Skip to content

Latest commit

 

History

History
370 lines (246 loc) · 24.6 KB

File metadata and controls

370 lines (246 loc) · 24.6 KB

APIKeys

Overview

Endpoints for managing API Keys

Available Operations

create_api_key

Create an API Key

Example Usage

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)

Parameters

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.

Response

models.CreateAPIKeyResponseBody

Errors

Error Type Status Code Content Type
models.CreateAPIKeyAPIKeysResponseBody 400 application/json
models.CreateAPIKeyAPIKeysResponseResponseBody 409 application/json
models.SDKError 4XX, 5XX */*

get_api_keys

Get API Keys

Example Usage

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)

Parameters

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.

Response

models.GetAPIKeysResponseBody

Errors

Error Type Status Code Content Type
models.GetAPIKeysAPIKeysResponseBody 400 application/json
models.GetAPIKeysAPIKeysResponseResponseBody 404 application/json
models.SDKError 4XX, 5XX */*

get_api_key

Get an API Key by ID

Example Usage

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)

Parameters

Parameter Type Required Description
api_key_id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetAPIKeyResponseBody

Errors

Error Type Status Code Content Type
models.GetAPIKeyAPIKeysResponseBody 400 application/json
models.GetAPIKeyAPIKeysResponseResponseBody 404 application/json
models.SDKError 4XX, 5XX */*

update_api_key

Update an API Key

Example Usage

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)

Parameters

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.

Response

models.UpdateAPIKeyResponseBody

Errors

Error Type Status Code Content Type
models.UpdateAPIKeyAPIKeysResponseBody 400 application/json
models.UpdateAPIKeyAPIKeysResponseResponseBody 404 application/json
models.SDKError 4XX, 5XX */*

delete_api_key

Delete an API Key

Example Usage

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)

Parameters

Parameter Type Required Description
api_key_id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DeleteAPIKeyResponseBody

Errors

Error Type Status Code Content Type
models.DeleteAPIKeyAPIKeysResponseBody 400 application/json
models.DeleteAPIKeyAPIKeysResponseResponseBody 404 application/json
models.SDKError 4XX, 5XX */*

get_api_key_secret

Get an API Key Secret

Example Usage

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)

Parameters

Parameter Type Required Description
api_key_id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetAPIKeySecretResponseBody

Errors

Error Type Status Code Content Type
models.GetAPIKeySecretAPIKeysResponseBody 400 application/json
models.GetAPIKeySecretAPIKeysResponseResponseBody 404 application/json
models.SDKError 4XX, 5XX */*

revoke_api_key

Revoke an API Key

Example Usage

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)

Parameters

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.

Response

models.RevokeAPIKeyResponseBody

Errors

Error Type Status Code Content Type
models.RevokeAPIKeyAPIKeysResponseBody 400 application/json
models.RevokeAPIKeyAPIKeysResponseResponseBody 404 application/json
models.SDKError 4XX, 5XX */*

verify_api_key

Verify an API Key

Example Usage

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)

Parameters

Parameter Type Required Description
secret str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.VerifyAPIKeyResponseBody

Errors

Error Type Status Code Content Type
models.VerifyAPIKeyAPIKeysResponseBody 400 application/json
models.VerifyAPIKeyAPIKeysResponseResponseBody 404 application/json
models.SDKError 4XX, 5XX */*