Ory.Api.APIKeys (ory_client v1.22.40)

Copy Markdown

API calls for all endpoints tagged APIKeys.

Summary

Functions

Batch Import API Keys Imports up to 1000 external API keys in one request. Returns per-item results. If at least one item succeeds, response is 200 OK. If all items fail, the endpoint returns a non-200 error. http POST /v2alpha1/admin/importedApiKeys:batchImport { "requests": [ {"raw_key": "sk_live_abc", "name": "Stripe key", "actor_id": "user_1"}, {"raw_key": "ghp_xyz", "name": "GitHub PAT", "actor_id": "user_2"} ] }

Batch Verify API Keys Verifies multiple credentials in a single request. Efficiently verifies up to 100 credentials in parallel. Each credential is verified independently; partial failures are returned. Admin access only. Cache Control (HTTP Headers): - Cache-Control: no-cache - Bypasses cache read, forces fresh DB lookup - Cache-Control: no-store - Bypasses cache read AND write (never cached) - Pragma: no-cache - Same as Cache-Control: no-cache (HTTP/1.0) The cache directive applies to every credential in the batch. http POST /v2alpha1/admin/apiKeys:batchVerify { "requests": [ {"credential": "sk_live_abc123..."}, {"credential": "eyJhbGciOiJFZERTQSI..."} ] }

Delete Imported API Key Permanently deletes an imported key (hard delete). The key is removed from the database. Use RevokeAPIKey for soft deletion (recommended). http DELETE /v2alpha1/admin/importedApiKeys/{key_id}

Derive Token Mints a short-lived JWT or Macaroon token from an API key. Works with both issued and imported keys. The derived token inherits the permissions of the parent API key. http POST /v2alpha1/admin/apiKeys:derive { "credential": "eyJhbGciOiJFZERTQSI...", "ttl": "1h" }

Get Imported API Key Retrieves details about a specific imported key. Returns metadata about the imported key. The original raw key is never returned. http GET /v2alpha1/admin/importedApiKeys/{key_id}

Get Issued API Key Retrieves details about a specific issued API key including its status, scopes, expiration, and usage statistics. The secret is never returned. http GET /v2alpha1/admin/issuedApiKeys/01HQZX9VYQKJB8XQZQXQZQXQXQ

Get JWKS Returns the JSON Web Key Set for token verification. Provides the public keys needed to verify JWT tokens issued by this service. Keys are loaded from configuration (file://, https://, or base64:// URIs). Follows the JWKS standard (RFC 7517). http GET /v2alpha1/admin/derivedKeys/jwks.json

Import API Key Imports an external API key into the system. Allows importing keys from legacy systems or external providers. The raw key is hashed and stored securely (HMAC). Imported keys support token derivation (JWT/Macaroon) like issued keys. http POST /v2alpha1/admin/importedApiKeys { "raw_key": "sk_live_abc123xyz", "name": "Imported Stripe Key", "actor_id": "user_123" }

Issue API Key Creates a new API key for a given actor. The secret is returned only once in the response and cannot be retrieved later. Keys can be scoped with specific permissions and have optional expiration. http POST /v2alpha1/admin/issuedApiKeys { "name": "production-service", "actor_id": "user_123", "scopes": ["read", "write"], "ttl": "8760h" }

List Imported API Keys Lists all imported keys with filtering. Returns imported keys only (not issued keys). Supports pagination and AIP-160 filter expressions. http GET /v2alpha1/admin/importedApiKeys?page_size=50&filter=status%3DKEY_STATUS_ACTIVE

List Issued API Keys Lists issued API keys with optional filtering. Supports cursor-based pagination and AIP-160 filter expressions. Returns only issued (generated) API keys; use ListImportedAPIKeys for imported keys. http GET /v2alpha1/admin/issuedApiKeys?page_size=50&filter=actor_id%3D%22user_123%22

Revoke API Key Immediately revokes an API key (issued or imported). Once revoked, the key can no longer be used for authentication. This operation is irreversible. Revoked keys are retained for audit purposes. http POST /v2alpha1/admin/apiKeys/01HQZX9VYQKJB8XQZQXQZQXQXQ:revoke { "reason": "REVOCATION_REASON_KEY_COMPROMISE" }

Rotate Issued API Key Generates a new secret for an issued API key. Creates a new API key with a new key_id and secret, and immediately revokes the old key. This is the recommended way to update scopes, metadata, or rotate credentials. For zero-downtime rotation, use this workflow instead: 1. IssueAPIKey with new credentials 2. Deploy new secret to all services 3. Verify new secret works everywhere 4. RevokeAPIKey to remove the old key http POST /v2alpha1/admin/issuedApiKeys/01HQZX9VYQKJB8XQZQXQZQXQXQ:rotate { "scopes": ["read"] }

Update Imported API Key Updates metadata, scopes, or rate limits of an imported key. Supports partial updates via the update_mask query parameter (AIP-134). Omitting update_mask is equivalent to a mask of every populated field in the body. To clear a field to its zero value, list it explicitly in update_mask and leave it unset (or empty) in the body. http PATCH /v2alpha1/admin/importedApiKeys/{key_id}?update_mask=name { "imported_api_key": { "key_id": "{key_id}", "name": "New name" } }

Update Issued API Key Updates metadata, scopes, or rate limits of an issued key without rotating the secret. Use RotateIssuedAPIKey to change the secret. Follows AIP-134: the request body is the IssuedAPIKey resource itself, and the update_mask query parameter names the subset of fields to apply. Omitting update_mask is equivalent to a mask of every populated field in the body. To clear a field to its zero value, list it explicitly in update_mask and leave it unset (or empty) in the body. http PATCH /v2alpha1/admin/issuedApiKeys/01HQZX9VYQKJB8XQZQXQZQXQXQ?update_mask=scopes { "issued_api_key": { "key_id": "01HQZX9VYQKJB8XQZQXQZQXQXQ", "scopes": ["read"] } }

Verify API Key Verifies a single API key or derived token. Validates the credential's signature, expiration, and revocation status. Works with any credential type (issued keys, imported keys, JWT, macaroon). The verification result includes decoded claims and metadata — admin access only. Cache Control (HTTP Headers): - Cache-Control: no-cache - Bypasses cache read, forces fresh DB lookup - Cache-Control: no-store - Bypasses cache read AND write (never cached) - Pragma: no-cache - Same as Cache-Control: no-cache (HTTP/1.0) http POST /v2alpha1/admin/apiKeys:verify { "credential": "sk_live_abc123..." }

Revoke API Key (self-service) Proof-of-possession variant of revocation. Lives alongside AdminRevokeAPIKey in this service; the Self* prefix on the request/response messages disambiguates from the admin variant's RevokeAPIKeyRequest. Allows an API key holder to revoke their own key. The caller must provide the full API key secret as proof of possession. Supports issued API keys and imported keys. JWT and macaroon tokens cannot be self-revoked (they are stateless). The PRIVILEGE_WITHDRAWN reason is not allowed for self-revocation (admin-only). http POST /v2alpha1/apiKeys:selfRevoke { "credential": "sk_live_abc123...", "reason": "REVOCATION_REASON_KEY_COMPROMISE" }

Functions

admin_batch_import_api_keys(connection, batch_import_api_keys_request, opts \\ [])

@spec admin_batch_import_api_keys(
  Tesla.Env.client(),
  Ory.Model.BatchImportApiKeysRequest.t(),
  keyword()
) ::
  {:ok, Ory.Model.BatchImportApiKeysResponse.t()}
  | {:ok, Ory.Model.Status.t()}
  | {:error, Tesla.Env.t()}

Batch Import API Keys Imports up to 1000 external API keys in one request. Returns per-item results. If at least one item succeeds, response is 200 OK. If all items fail, the endpoint returns a non-200 error. http POST /v2alpha1/admin/importedApiKeys:batchImport { "requests": [ {"raw_key": "sk_live_abc", "name": "Stripe key", "actor_id": "user_1"}, {"raw_key": "ghp_xyz", "name": "GitHub PAT", "actor_id": "user_2"} ] }

Parameters

  • connection (Ory.Connection): Connection to server
  • batch_import_api_keys_request (BatchImportApiKeysRequest): BatchImportAPIKeysRequest imports multiple external API keys in one request. The maximum batch size is 1000 keys.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Ory.Model.BatchImportApiKeysResponse.t} on success
  • {:error, Tesla.Env.t} on failure

admin_batch_verify_api_keys(connection, batch_verify_api_keys_request, opts \\ [])

@spec admin_batch_verify_api_keys(
  Tesla.Env.client(),
  Ory.Model.BatchVerifyApiKeysRequest.t(),
  keyword()
) ::
  {:ok, Ory.Model.BatchVerifyApiKeysResponse.t()}
  | {:ok, Ory.Model.Status.t()}
  | {:error, Tesla.Env.t()}

Batch Verify API Keys Verifies multiple credentials in a single request. Efficiently verifies up to 100 credentials in parallel. Each credential is verified independently; partial failures are returned. Admin access only. Cache Control (HTTP Headers): - Cache-Control: no-cache - Bypasses cache read, forces fresh DB lookup - Cache-Control: no-store - Bypasses cache read AND write (never cached) - Pragma: no-cache - Same as Cache-Control: no-cache (HTTP/1.0) The cache directive applies to every credential in the batch. http POST /v2alpha1/admin/apiKeys:batchVerify { "requests": [ {"credential": "sk_live_abc123..."}, {"credential": "eyJhbGciOiJFZERTQSI..."} ] }

Parameters

  • connection (Ory.Connection): Connection to server
  • batch_verify_api_keys_request (BatchVerifyApiKeysRequest):
  • opts (keyword): Optional parameters
    • :"Cache-Control" (String.t): Cache-directive controlling the verifier cache. no-cache forces a fresh database lookup (cache read is bypassed). no-store additionally prevents the result from being written to the cache. Any other value is ignored.
    • :Pragma (String.t): HTTP/1.0 alias for Cache-Control: no-cache. Behaves identically when set to no-cache; ignored otherwise.

Returns

  • {:ok, Ory.Model.BatchVerifyApiKeysResponse.t} on success
  • {:error, Tesla.Env.t} on failure

admin_delete_imported_api_key(connection, key_id, opts \\ [])

@spec admin_delete_imported_api_key(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, any()} | {:ok, Ory.Model.Status.t()} | {:error, Tesla.Env.t()}

Delete Imported API Key Permanently deletes an imported key (hard delete). The key is removed from the database. Use RevokeAPIKey for soft deletion (recommended). http DELETE /v2alpha1/admin/importedApiKeys/{key_id}

Parameters

  • connection (Ory.Connection): Connection to server
  • key_id (String.t): SHA512/256 hash of the imported key (REQUIRED)
  • opts (keyword): Optional parameters

Returns

  • {:ok, any()} on success
  • {:error, Tesla.Env.t} on failure

admin_derive_token(connection, derive_token_request, opts \\ [])

@spec admin_derive_token(
  Tesla.Env.client(),
  Ory.Model.DeriveTokenRequest.t(),
  keyword()
) ::
  {:ok, Ory.Model.DeriveTokenResponse.t()}
  | {:ok, Ory.Model.Status.t()}
  | {:error, Tesla.Env.t()}

Derive Token Mints a short-lived JWT or Macaroon token from an API key. Works with both issued and imported keys. The derived token inherits the permissions of the parent API key. http POST /v2alpha1/admin/apiKeys:derive { "credential": "eyJhbGciOiJFZERTQSI...", "ttl": "1h" }

Parameters

  • connection (Ory.Connection): Connection to server
  • derive_token_request (DeriveTokenRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Ory.Model.DeriveTokenResponse.t} on success
  • {:error, Tesla.Env.t} on failure

admin_get_imported_api_key(connection, key_id, opts \\ [])

@spec admin_get_imported_api_key(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Ory.Model.ImportedApiKey.t()}
  | {:ok, Ory.Model.Status.t()}
  | {:error, Tesla.Env.t()}

Get Imported API Key Retrieves details about a specific imported key. Returns metadata about the imported key. The original raw key is never returned. http GET /v2alpha1/admin/importedApiKeys/{key_id}

Parameters

  • connection (Ory.Connection): Connection to server
  • key_id (String.t): SHA512/256 hash of the imported key (REQUIRED)
  • opts (keyword): Optional parameters

Returns

  • {:ok, Ory.Model.ImportedApiKey.t} on success
  • {:error, Tesla.Env.t} on failure

admin_get_issued_api_key(connection, key_id, opts \\ [])

@spec admin_get_issued_api_key(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Ory.Model.IssuedApiKey.t()}
  | {:ok, Ory.Model.Status.t()}
  | {:error, Tesla.Env.t()}

Get Issued API Key Retrieves details about a specific issued API key including its status, scopes, expiration, and usage statistics. The secret is never returned. http GET /v2alpha1/admin/issuedApiKeys/01HQZX9VYQKJB8XQZQXQZQXQXQ

Parameters

  • connection (Ory.Connection): Connection to server
  • key_id (String.t): Identifier of the API key resource.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Ory.Model.IssuedApiKey.t} on success
  • {:error, Tesla.Env.t} on failure

admin_get_jwks(connection, opts \\ [])

@spec admin_get_jwks(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Ory.Model.Status.t()}
  | {:ok, Ory.Model.GetJwksResponse.t()}
  | {:error, Tesla.Env.t()}

Get JWKS Returns the JSON Web Key Set for token verification. Provides the public keys needed to verify JWT tokens issued by this service. Keys are loaded from configuration (file://, https://, or base64:// URIs). Follows the JWKS standard (RFC 7517). http GET /v2alpha1/admin/derivedKeys/jwks.json

Parameters

  • connection (Ory.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, Ory.Model.GetJwksResponse.t} on success
  • {:error, Tesla.Env.t} on failure

admin_import_api_key(connection, import_api_key_request, opts \\ [])

@spec admin_import_api_key(
  Tesla.Env.client(),
  Ory.Model.ImportApiKeyRequest.t(),
  keyword()
) ::
  {:ok, Ory.Model.ImportedApiKey.t()}
  | {:ok, Ory.Model.Status.t()}
  | {:error, Tesla.Env.t()}

Import API Key Imports an external API key into the system. Allows importing keys from legacy systems or external providers. The raw key is hashed and stored securely (HMAC). Imported keys support token derivation (JWT/Macaroon) like issued keys. http POST /v2alpha1/admin/importedApiKeys { "raw_key": "sk_live_abc123xyz", "name": "Imported Stripe Key", "actor_id": "user_123" }

Parameters

  • connection (Ory.Connection): Connection to server
  • import_api_key_request (ImportApiKeyRequest): Example: { "raw_key": "sk_live_abc123xyz789", "name": "Stripe Production Key", "actor_id": "payment-processor", "scopes": ["read", "write"], "ttl": "8760h", // 1 year (also accepts: 31536000s) "metadata": {"source": "stripe", "environment": "production"} }
  • opts (keyword): Optional parameters

Returns

  • {:ok, Ory.Model.ImportedApiKey.t} on success
  • {:error, Tesla.Env.t} on failure

admin_issue_api_key(connection, issue_api_key_request, opts \\ [])

@spec admin_issue_api_key(
  Tesla.Env.client(),
  Ory.Model.IssueApiKeyRequest.t(),
  keyword()
) ::
  {:ok, Ory.Model.IssueApiKeyResponse.t()}
  | {:ok, Ory.Model.Status.t()}
  | {:error, Tesla.Env.t()}

Issue API Key Creates a new API key for a given actor. The secret is returned only once in the response and cannot be retrieved later. Keys can be scoped with specific permissions and have optional expiration. http POST /v2alpha1/admin/issuedApiKeys { "name": "production-service", "actor_id": "user_123", "scopes": ["read", "write"], "ttl": "8760h" }

Parameters

  • connection (Ory.Connection): Connection to server
  • issue_api_key_request (IssueApiKeyRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Ory.Model.IssueApiKeyResponse.t} on success
  • {:error, Tesla.Env.t} on failure

admin_list_imported_api_keys(connection, opts \\ [])

@spec admin_list_imported_api_keys(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Ory.Model.ListImportedApiKeysResponse.t()}
  | {:ok, Ory.Model.Status.t()}
  | {:error, Tesla.Env.t()}

List Imported API Keys Lists all imported keys with filtering. Returns imported keys only (not issued keys). Supports pagination and AIP-160 filter expressions. http GET /v2alpha1/admin/importedApiKeys?page_size=50&filter=status%3DKEY_STATUS_ACTIVE

Parameters

  • connection (Ory.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :page_size (integer()): Number of items per page (default: 50, max: 1000)
    • :page_token (String.t): Cursor token for pagination (OPTIONAL)
    • :filter (String.t): filter is an AIP-160 expression. Indexed fields (efficient at any scale): actor_id, status. Other fields are not indexed and may be rejected. Examples: actor_id="user_123" status=KEY_STATUS_ACTIVE actor_id="user_123" AND status=KEY_STATUS_ACTIVE

Returns

  • {:ok, Ory.Model.ListImportedApiKeysResponse.t} on success
  • {:error, Tesla.Env.t} on failure

admin_list_issued_api_keys(connection, opts \\ [])

@spec admin_list_issued_api_keys(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Ory.Model.ListIssuedApiKeysResponse.t()}
  | {:ok, Ory.Model.Status.t()}
  | {:error, Tesla.Env.t()}

List Issued API Keys Lists issued API keys with optional filtering. Supports cursor-based pagination and AIP-160 filter expressions. Returns only issued (generated) API keys; use ListImportedAPIKeys for imported keys. http GET /v2alpha1/admin/issuedApiKeys?page_size=50&filter=actor_id%3D%22user_123%22

Parameters

  • connection (Ory.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :page_size (integer()): Number of items per page (default: 50, max: 1000)
    • :page_token (String.t): Cursor token for pagination
    • :filter (String.t): filter is an AIP-160 expression. Indexed fields (efficient at any scale): actor_id, status. Other fields are not indexed and may be rejected. Examples: actor_id="user_123" status=KEY_STATUS_ACTIVE actor_id="user_123" AND status=KEY_STATUS_ACTIVE

Returns

  • {:ok, Ory.Model.ListIssuedApiKeysResponse.t} on success
  • {:error, Tesla.Env.t} on failure

admin_revoke_api_key(connection, key_id, admin_revoke_api_key_body, opts \\ [])

@spec admin_revoke_api_key(
  Tesla.Env.client(),
  String.t(),
  Ory.Model.AdminRevokeApiKeyBody.t(),
  keyword()
) :: {:ok, any()} | {:ok, Ory.Model.Status.t()} | {:error, Tesla.Env.t()}

Revoke API Key Immediately revokes an API key (issued or imported). Once revoked, the key can no longer be used for authentication. This operation is irreversible. Revoked keys are retained for audit purposes. http POST /v2alpha1/admin/apiKeys/01HQZX9VYQKJB8XQZQXQZQXQXQ:revoke { "reason": "REVOCATION_REASON_KEY_COMPROMISE" }

Parameters

  • connection (Ory.Connection): Connection to server
  • key_id (String.t): Identifier of the API key resource.
  • admin_revoke_api_key_body (AdminRevokeApiKeyBody):
  • opts (keyword): Optional parameters

Returns

  • {:ok, any()} on success
  • {:error, Tesla.Env.t} on failure

admin_rotate_issued_api_key(connection, key_id, admin_rotate_issued_api_key_body, opts \\ [])

@spec admin_rotate_issued_api_key(
  Tesla.Env.client(),
  String.t(),
  Ory.Model.AdminRotateIssuedApiKeyBody.t(),
  keyword()
) ::
  {:ok, Ory.Model.RotateIssuedApiKeyResponse.t()}
  | {:ok, Ory.Model.Status.t()}
  | {:error, Tesla.Env.t()}

Rotate Issued API Key Generates a new secret for an issued API key. Creates a new API key with a new key_id and secret, and immediately revokes the old key. This is the recommended way to update scopes, metadata, or rotate credentials. For zero-downtime rotation, use this workflow instead: 1. IssueAPIKey with new credentials 2. Deploy new secret to all services 3. Verify new secret works everywhere 4. RevokeAPIKey to remove the old key http POST /v2alpha1/admin/issuedApiKeys/01HQZX9VYQKJB8XQZQXQZQXQXQ:rotate { "scopes": ["read"] }

Parameters

  • connection (Ory.Connection): Connection to server
  • key_id (String.t): key_id is the ID of the existing API key to rotate
  • admin_rotate_issued_api_key_body (AdminRotateIssuedApiKeyBody):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Ory.Model.RotateIssuedApiKeyResponse.t} on success
  • {:error, Tesla.Env.t} on failure

admin_update_imported_api_key(connection, key_id, admin_update_imported_api_key_request, opts \\ [])

@spec admin_update_imported_api_key(
  Tesla.Env.client(),
  String.t(),
  Ory.Model.AdminUpdateImportedApiKeyRequest.t(),
  keyword()
) ::
  {:ok, Ory.Model.ImportedApiKey.t()}
  | {:ok, Ory.Model.Status.t()}
  | {:error, Tesla.Env.t()}

Update Imported API Key Updates metadata, scopes, or rate limits of an imported key. Supports partial updates via the update_mask query parameter (AIP-134). Omitting update_mask is equivalent to a mask of every populated field in the body. To clear a field to its zero value, list it explicitly in update_mask and leave it unset (or empty) in the body. http PATCH /v2alpha1/admin/importedApiKeys/{key_id}?update_mask=name { "imported_api_key": { "key_id": "{key_id}", "name": "New name" } }

Parameters

  • connection (Ory.Connection): Connection to server
  • key_id (String.t): SHA-512/256 hash of credential
  • admin_update_imported_api_key_request (AdminUpdateImportedApiKeyRequest):
  • opts (keyword): Optional parameters
    • :update_mask (String.t): The list of fields to update. See AIP-134.

Returns

  • {:ok, Ory.Model.ImportedApiKey.t} on success
  • {:error, Tesla.Env.t} on failure

admin_update_issued_api_key(connection, key_id, admin_update_issued_api_key_request, opts \\ [])

@spec admin_update_issued_api_key(
  Tesla.Env.client(),
  String.t(),
  Ory.Model.AdminUpdateIssuedApiKeyRequest.t(),
  keyword()
) ::
  {:ok, Ory.Model.IssuedApiKey.t()}
  | {:ok, Ory.Model.Status.t()}
  | {:error, Tesla.Env.t()}

Update Issued API Key Updates metadata, scopes, or rate limits of an issued key without rotating the secret. Use RotateIssuedAPIKey to change the secret. Follows AIP-134: the request body is the IssuedAPIKey resource itself, and the update_mask query parameter names the subset of fields to apply. Omitting update_mask is equivalent to a mask of every populated field in the body. To clear a field to its zero value, list it explicitly in update_mask and leave it unset (or empty) in the body. http PATCH /v2alpha1/admin/issuedApiKeys/01HQZX9VYQKJB8XQZQXQZQXQXQ?update_mask=scopes { "issued_api_key": { "key_id": "01HQZX9VYQKJB8XQZQXQZQXQXQ", "scopes": ["read"] } }

Parameters

  • connection (Ory.Connection): Connection to server
  • key_id (String.t): Identifier of the API key resource.
  • admin_update_issued_api_key_request (AdminUpdateIssuedApiKeyRequest):
  • opts (keyword): Optional parameters
    • :update_mask (String.t): The list of fields to update. See AIP-134.

Returns

  • {:ok, Ory.Model.IssuedApiKey.t} on success
  • {:error, Tesla.Env.t} on failure

admin_verify_api_key(connection, verify_api_key_request, opts \\ [])

@spec admin_verify_api_key(
  Tesla.Env.client(),
  Ory.Model.VerifyApiKeyRequest.t(),
  keyword()
) ::
  {:ok, Ory.Model.VerifyApiKeyResponse.t()}
  | {:ok, Ory.Model.Status.t()}
  | {:error, Tesla.Env.t()}

Verify API Key Verifies a single API key or derived token. Validates the credential's signature, expiration, and revocation status. Works with any credential type (issued keys, imported keys, JWT, macaroon). The verification result includes decoded claims and metadata — admin access only. Cache Control (HTTP Headers): - Cache-Control: no-cache - Bypasses cache read, forces fresh DB lookup - Cache-Control: no-store - Bypasses cache read AND write (never cached) - Pragma: no-cache - Same as Cache-Control: no-cache (HTTP/1.0) http POST /v2alpha1/admin/apiKeys:verify { "credential": "sk_live_abc123..." }

Parameters

  • connection (Ory.Connection): Connection to server
  • verify_api_key_request (VerifyApiKeyRequest):
  • opts (keyword): Optional parameters
    • :"Cache-Control" (String.t): Cache-directive controlling the verifier cache. no-cache forces a fresh database lookup (cache read is bypassed). no-store additionally prevents the result from being written to the cache. Any other value is ignored.
    • :Pragma (String.t): HTTP/1.0 alias for Cache-Control: no-cache. Behaves identically when set to no-cache; ignored otherwise.

Returns

  • {:ok, Ory.Model.VerifyApiKeyResponse.t} on success
  • {:error, Tesla.Env.t} on failure

revoke_api_key(connection, self_revoke_api_key_request, opts \\ [])

@spec revoke_api_key(
  Tesla.Env.client(),
  Ory.Model.SelfRevokeApiKeyRequest.t(),
  keyword()
) ::
  {:ok, map()} | {:ok, Ory.Model.Status.t()} | {:error, Tesla.Env.t()}

Revoke API Key (self-service) Proof-of-possession variant of revocation. Lives alongside AdminRevokeAPIKey in this service; the Self* prefix on the request/response messages disambiguates from the admin variant's RevokeAPIKeyRequest. Allows an API key holder to revoke their own key. The caller must provide the full API key secret as proof of possession. Supports issued API keys and imported keys. JWT and macaroon tokens cannot be self-revoked (they are stateless). The PRIVILEGE_WITHDRAWN reason is not allowed for self-revocation (admin-only). http POST /v2alpha1/apiKeys:selfRevoke { "credential": "sk_live_abc123...", "reason": "REVOCATION_REASON_KEY_COMPROMISE" }

Parameters

  • connection (Ory.Connection): Connection to server
  • self_revoke_api_key_request (SelfRevokeApiKeyRequest): SelfRevokeAPIKeyRequest allows an API key holder to revoke their own key by providing the full key secret as proof of possession.
  • opts (keyword): Optional parameters

Returns

  • {:ok, map()} on success
  • {:error, Tesla.Env.t} on failure