SDK ReferencePython SDK

Account

API functions for the Account resource.

Account

Functions for interacting with the account API resource. Each operation ships in four forms — sync / sync_detailed and their async counterparts.

Create API Key

Create API key

Returns the plaintext key exactly once. Max 50 active keys per account.

Parameters

  • body (CreateApiKeyBody | Unset)

Call styles

sync_detailed(client, body) -> Response[ApiKeyCreatedResponse | Error]
sync(client, body) -> ApiKeyCreatedResponse | Error | None
await asyncio_detailed(client, body) -> Response[ApiKeyCreatedResponse | Error]
await asyncio(client, body) -> ApiKeyCreatedResponse | Error | None

Get Account

Get account details

Returns account, plan, and current API key details. Accepts either auth scheme:

  • Bearer API key (bearerAuth): returns full account shape including api_key and subscription fields.
  • Clerk session JWT (ClerkSession): returns the minimal session account shape (id, name, email, plan, owner_user_id).

Call styles

sync_detailed(client) -> Response[GetAccountResponse200]
sync(client) -> GetAccountResponse200 | None
await asyncio_detailed(client) -> Response[GetAccountResponse200]
await asyncio(client) -> GetAccountResponse200 | None

Get API Key

Get API key

Parameters

  • id (str)

Call styles

sync_detailed(id, client) -> Response[ApiKeyResponse | Error]
sync(id, client) -> ApiKeyResponse | Error | None
await asyncio_detailed(id, client) -> Response[ApiKeyResponse | Error]
await asyncio(id, client) -> ApiKeyResponse | Error | None

List API Keys

List API keys

Parameters

  • include_revoked (bool | Unset): Default: False.

Call styles

sync_detailed(client, include_revoked) -> Response[ListApiKeysResponse200]
sync(client, include_revoked) -> ListApiKeysResponse200 | None
await asyncio_detailed(client, include_revoked) -> Response[ListApiKeysResponse200]
await asyncio(client, include_revoked) -> ListApiKeysResponse200 | None

Reveal API Key

Reveal API key

Decrypts and returns the plaintext API key. Only available when reveal_available is true.

Parameters

  • id (str)

Call styles

sync_detailed(id, client) -> Response[ApiKeyRevealResponse | Error]
sync(id, client) -> ApiKeyRevealResponse | Error | None
await asyncio_detailed(id, client) -> Response[ApiKeyRevealResponse | Error]
await asyncio(id, client) -> ApiKeyRevealResponse | Error | None

Revoke API Key

Revoke API key

Idempotent — returns 204 even if already revoked.

Parameters

  • id (str)

Call styles

sync_detailed(id, client) -> Response[Any | Error]
sync(id, client) -> Any | Error | None
await asyncio_detailed(id, client) -> Response[Any | Error]
await asyncio(id, client) -> Any | Error | None

Update API Key

Rename API key

Parameters

  • id (str)
  • body (UpdateApiKeyBody)

Call styles

sync_detailed(id, client, body) -> Response[ApiKeyResponse | Error]
sync(id, client, body) -> ApiKeyResponse | Error | None
await asyncio_detailed(id, client, body) -> Response[ApiKeyResponse | Error]
await asyncio(id, client, body) -> ApiKeyResponse | Error | None