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, by a cookie or by a user token, has no key to report and is rejected with 400. 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 code | Description | Type | Response headers |
|---|---|---|---|
| 200 | The API key that authenticated this request | ApiKeyResponseWrapper | X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset |
| 400 | The request is not authenticated by an API key, as with a session authenticated by a cookie or by a user token | - | - |
| 401 | Unauthorized | ErrorApiResponse | - |
| 429 | Too Many Requests. | ErrorApiResponse | Retry-After |
| 500 | Internal Server Error. | ErrorApiResponse | - |
| 502 | Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON. | - | - |
| 503 | Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON. | - | - |
Return type
Authorization
Basic, OAuth2 (scopes: read, write), ApiKeyBearer, asc_auth_key, Bearer, OpenId
HTTP request headers
- Content-Type: Not defined
- Accept: application/json