User-based API Keys
This Public Stable API allows you to manage API keys and make API calls to the PCE.
Working with User-based API Keys
Functionality | HTTP | URI |
---|---|---|
Get a collection of API keys |
| [api_version][user_href]/api_keys |
Get an individual API key |
| [api_version][api_key_href] |
Create an API key |
| [api_version][user_href]/api_keys |
Update an API key |
| [api_version][api_key_href] |
Delete an API key |
| [api_version][api_key_href] |
List User-based API Keys
When you GET an individual API key or a collection of API keys, the response only returns those created by the user who authenticated with the PCE for the session.
This API gets one API key or a collection of API keys created by a specific user. To get a single API key, you need to know the API key’s URI, which is returned in the form of an HREF path when you create an API key and the HREF of the user who created the key.
You can query the user API keys as follows:
GET /api/v2/orgs/:xorg_id/api_keys?type=user
You can also query the user-based API keys based on their expiration:
GET /api/v2/orgs/:xorg_id/api_keys?type=user&state=active
GET /api/v2/orgs/:xorg_id/api_keys?type=user&state=expired
GET [api_version][user_href]/api_keys
Create User-based API Keys
This API creates a unique API key and returns an API key ID and secret. You can use these to obtain, update, or delete the key and make other API calls.
To create an API key, you must authenticate using a session token or another API key. To obtain a session token, use the Users API and authenticate with the PCE. You will receive your user ID, user HREF, and a session token that you can use when you call this API to create an API key.
Important
If you use an API key, safely store the key and the secret. Anyone with access to both will have access to the API for your organization.
Important
Due to security concerns, external users cannot create an API Key even if their roles allow it.
Update User-based API Keys
This API allows you to update an API key name or description.
To make this call, you need the API key URI, which is returned as an HREF path when you create a User-Based API Key.
PUT [api_version][api_key_href
Delete User-based API Keys
To delete an API key, you need the unique API key ID, which is returned as an HREF path property when you create a new API key or get a single or a collection of API keys.
DELETE [api_version][api_key_href]