Endpoints for managing API Keys
Create an API Key
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.api_keys.create_api_key(name="<value>", subject="<value>", type_="api_key", description="um solace recklessly", claims="<value>", scopes=[
"<value 1>",
"<value 2>",
"<value 3>",
], created_by="<value>", seconds_until_expiration=9695.91)
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
name |
str |
✔️ |
N/A |
subject |
str |
✔️ |
N/A |
type |
Optional[str] |
➖ |
N/A |
description |
OptionalNullable[str] |
➖ |
N/A |
claims |
OptionalNullable[Any] |
➖ |
N/A |
scopes |
List[str] |
➖ |
N/A |
created_by |
OptionalNullable[str] |
➖ |
N/A |
seconds_until_expiration |
OptionalNullable[float] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.CreateAPIKeyResponseBody
| Error Type |
Status Code |
Content Type |
| models.CreateAPIKeyAPIKeysResponseBody |
400 |
application/json |
| models.CreateAPIKeyAPIKeysResponseResponseBody |
409 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
Get API Keys
import clerk_backend_api
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.api_keys.get_api_keys(subject="<value>", type_="api_key", include_invalid=clerk_backend_api.IncludeInvalid.FALSE, limit=10, offset=0, query="<value>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
subject |
str |
✔️ |
N/A |
type |
Optional[str] |
➖ |
N/A |
include_invalid |
Optional[models.IncludeInvalid] |
➖ |
N/A |
limit |
Optional[float] |
➖ |
N/A |
offset |
OptionalNullable[float] |
➖ |
N/A |
query |
Optional[str] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GetAPIKeysResponseBody
| Error Type |
Status Code |
Content Type |
| models.GetAPIKeysAPIKeysResponseBody |
400 |
application/json |
| models.GetAPIKeysAPIKeysResponseResponseBody |
404 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
Get an API Key by ID
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.api_keys.get_api_key(api_key_id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
api_key_id |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GetAPIKeyResponseBody
| Error Type |
Status Code |
Content Type |
| models.GetAPIKeyAPIKeysResponseBody |
400 |
application/json |
| models.GetAPIKeyAPIKeysResponseResponseBody |
404 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
Update an API Key
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.api_keys.update_api_key(api_key_id="<id>", claims="<value>", scopes=[
"<value 1>",
"<value 2>",
], description=None, subject="<value>", seconds_until_expiration=7782.19)
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
api_key_id |
str |
✔️ |
N/A |
claims |
OptionalNullable[Any] |
➖ |
N/A |
scopes |
List[str] |
➖ |
N/A |
description |
OptionalNullable[str] |
➖ |
N/A |
subject |
Optional[str] |
➖ |
N/A |
seconds_until_expiration |
OptionalNullable[float] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.UpdateAPIKeyResponseBody
| Error Type |
Status Code |
Content Type |
| models.UpdateAPIKeyAPIKeysResponseBody |
400 |
application/json |
| models.UpdateAPIKeyAPIKeysResponseResponseBody |
404 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
Delete an API Key
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.api_keys.delete_api_key(api_key_id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
api_key_id |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.DeleteAPIKeyResponseBody
| Error Type |
Status Code |
Content Type |
| models.DeleteAPIKeyAPIKeysResponseBody |
400 |
application/json |
| models.DeleteAPIKeyAPIKeysResponseResponseBody |
404 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
Get an API Key Secret
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.api_keys.get_api_key_secret(api_key_id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
api_key_id |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GetAPIKeySecretResponseBody
| Error Type |
Status Code |
Content Type |
| models.GetAPIKeySecretAPIKeysResponseBody |
400 |
application/json |
| models.GetAPIKeySecretAPIKeysResponseResponseBody |
404 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
Revoke an API Key
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.api_keys.revoke_api_key(api_key_id="<id>", revocation_reason="<value>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
api_key_id |
str |
✔️ |
N/A |
revocation_reason |
OptionalNullable[str] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.RevokeAPIKeyResponseBody
| Error Type |
Status Code |
Content Type |
| models.RevokeAPIKeyAPIKeysResponseBody |
400 |
application/json |
| models.RevokeAPIKeyAPIKeysResponseResponseBody |
404 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
Verify an API Key
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.api_keys.verify_api_key(secret="<value>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
secret |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.VerifyAPIKeyResponseBody
| Error Type |
Status Code |
Content Type |
| models.VerifyAPIKeyAPIKeysResponseBody |
400 |
application/json |
| models.VerifyAPIKeyAPIKeysResponseResponseBody |
404 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |