WorkOS.ApiKeys (WorkOS SDK for Elixir v3.0.1)

Copy Markdown View Source

Operations for the ApiKeys API.

Summary

Functions

create_api_key_expire(client, id, params \\ %{}, opts \\ [])

@spec create_api_key_expire(WorkOS.Client.t(), String.t(), map(), keyword()) ::
  {:ok, WorkOS.ApiKey.t()} | {:error, WorkOS.Error.error()}

Expire an API key

Expire an API key immediately, schedule a future expiration, or clear a scheduled future expiration.

Parameters

  • id — The unique ID of the API key.
  • params — request body map
  • opts — per-request options (see WorkOS.Client.request/5)

create_organization_api_key(client, organization_id, params \\ %{}, opts \\ [])

@spec create_organization_api_key(WorkOS.Client.t(), String.t(), map(), keyword()) ::
  {:ok, WorkOS.OrganizationApiKeyWithValue.t()} | {:error, WorkOS.Error.error()}

Create an API key for an organization

Create a new API key for an organization.

Parameters

  • organization_id — Unique identifier of the Organization.
  • params — request body map
  • opts — per-request options (see WorkOS.Client.request/5)

create_validation(client, params \\ %{}, opts \\ [])

@spec create_validation(WorkOS.Client.t(), map(), keyword()) ::
  {:ok, WorkOS.ApiKeyValidationResponse.t()} | {:error, WorkOS.Error.error()}

Validate API key

Validate an API key value and return the API key object if valid.

Parameters

delete_api_key(client, id, opts \\ [])

@spec delete_api_key(WorkOS.Client.t(), String.t(), keyword()) ::
  {:ok, term()} | {:error, WorkOS.Error.error()}

Delete an API key

Permanently deletes an API key. This action cannot be undone. Once deleted, any requests using this API key will fail authentication.

Parameters

list_organization_api_keys(client, organization_id, params \\ %{}, opts \\ [])

@spec list_organization_api_keys(WorkOS.Client.t(), String.t(), map(), keyword()) ::
  {:ok, WorkOS.Page.t(WorkOS.OrganizationApiKey.t())}
  | {:error, WorkOS.Error.error()}

List API keys for an organization

Get a list of all API keys for an organization.

Parameters

  • organization_id — Unique identifier of the Organization.
  • params — query parameters: :before, :after_, :limit, :order
  • opts — per-request options (see WorkOS.Client.request/5)