Retrieve an API Key API

On this page

This API is used to retrieve a single API Key by unique Id. To retrieve a key, an API key with equal or greater permissions must be used.

Request#

Send the unique Id of the API Key to retrieve.

API Key Authentication
Retrieve an API Key by unique Id
GET/api/api-key/{apiKeyId}
OpenAPI Spec

Path Parameters#

apiKeyId
  • Type: UUID
  • Required

The unique Id of the API Key to retrieve.

Response#

The response for this API contains a single API Key. The response is defined below along with an example JSON response.

Response Codes
CodeDescription
200The request succeeded. The response contains a JSON body.
400The request was invalid or malformed. The response contains an Errors JSON object with the specific errors. FusionAuth also returns a 400 when the request needs a paid FusionAuth license and no license is present.
401FusionAuth didn't authorize the request. The Authorization header is missing, the API key isn't valid, or the API key doesn't have permission for this endpoint and method. The response is empty. For more information, see Unauthorized Responses.
404The object you requested doesn't exist. The response is empty.
500FusionAuth had an internal error and logged a stack trace in the FusionAuth log files. The response is empty.

Response Body#

apiKey.expirationInstant
  • Type: Long
  • Available since 1.55.0

The expiration instant of this API key. Using an expired API key for API Authentication will result in a 401 response code.

apiKey.id
  • Type: UUID

The Id of the API key.

apiKey.insertInstant
  • Type: Long

The instant when the API key was added to the FusionAuth database.

apiKey.ipAccessControlListId
  • Type: UUID
  • Available since 1.30.0

The Id of the IP Access Control List limiting access to this API key.

apiKey.key
  • Type: String

The API key value, this is the string value you will use in the Authorization header to authenticate API requests.

If the apiKey.retrievable value is false then this field will not be returned in the response.

apiKey.keyManager
  • Type: Boolean

Indicates whether this key is a key manager. Setting this flag to true allows this key to be used to call these APIs. An attempt to call these APIs with a non-manager key (keyManager set to false) will always return a HTTP response status code 401.

apiKey.lastUpdateInstant
  • Type: Long

The instant when the API key was last updated in the FusionAuth database.

apiKey.metaData.attributes.description
  • Type: String

Description of the key.

apiKey.name
  • Type: String
  • Available since 1.56.0

The name of the API key.

apiKey.permissions.endpoints
  • Type: Object

Endpoint permissions for this key. Each key of the object is an endpoint, with the value being an array of the HTTP methods which can be used against the endpoint. An empty permissions object means that this is a super key that authorizes this key for all the endpoints.

apiKey.retrievable
  • Type: Boolean
  • Available since 1.56.0

Indicates whether this key is retrievable. If this value is false, the key will not be returned in the API response.

apiKey.tenantId
  • Type: String

The unique Id of the Tenant. This value is present if the key is tenant scoped. Tenant scoped keys can only be used to access users and other tenant scoped objects for the specified tenant. This value is read-only once the key is created.

Example API Key response JSON
{
  "apiKey": {
    "expirationInstant": 872812800000,
    "id": "b016fa93-e8bc-4b79-b39f-5d37966c0178",
    "insertInstant": 1619119404194,
    "ipAccessControlListId": "eae37b0e-950b-4e92-abcc-d0b310326f66",
    "key": "WHYugARKzum-jHvzCk5-C558EKPaYEECz5k8fDZayIaFiZHRKqy9kaQn",
    "keyManager": false,
    "lastUpdateInstant": 1619120513500,
    "metaData": {
      "attributes": {
        "description": "non-manager key"
      }
    },
    "name": "Awesome API Key",
    "permissions": {
      "endpoints": {
        "/api/application": [
          "DELETE",
          "POST",
          "GET",
          "PUT",
          "PATCH"
        ],
        "/api/application/oauth-configuration": [
          "DELETE",
          "POST",
          "GET",
          "PUT",
          "PATCH"
        ],
        "/api/application/role": [
          "DELETE",
          "POST",
          "GET",
          "PUT",
          "PATCH"
        ]
      }
    },
    "retrievable": true,
    "tenantId": "94f751c5-4883-4684-a817-6b106778edec"
  }
}