Skip to main content

getApiKey

ApiKeyResponseWrapper getApiKey()

GET /api/2.0/keys/@self

Get the current API key

Returns the API key that authenticated this very request, letting the holder of a key find out what it is allowed to do without knowing its ID. The key is identified by the Authorization header of the call itself, so the request has to be sent as Bearer sk-...; a session authenticated in any other way has no key to report and this operation is not usable for it. The call is read-only and returns one entry, with the same fields as GET api/2.0/keys and without the secret - read permissions for the granted scopes, expiresAt for the expiry and isActive for the state. To look at a key other than the one in use, call GET api/2.0/keys instead.

Parameters​

This endpoint does not need any parameter.

Responses​

Status codeDescriptionTypeResponse headers
200The API key that authenticated this requestApiKeyResponseWrapperX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
400The request has no Authorization header, as with a session authenticated by a cookie--
500The Authorization header carries a token that is not an API key of this portal--
401UnauthorizedErrorApiResponse-
429Too Many Requests.ErrorApiResponseRetry-After
502Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON.--
503Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON.--

Return type​

ApiKeyResponseWrapper

Authorization​

Basic, OAuth2 (scopes: read, write), ApiKeyBearer, asc_auth_key, Bearer, OpenId

HTTP request headers​

  • Content-Type: Not defined
  • Accept: application/json