Manage Codat API keys programmatically.
You can have up to 10 active keys. The last remaining key cannot be deleted. Keys are only shown in full at creation time — store them immediately.
Summary
Functions
Creates a new API key. The full key value is only visible in the response.
Deletes an API key by its ID.
Lists all API keys for the authenticated account.
Functions
@spec create(Codat.Client.t() | map(), map() | keyword()) :: {:ok, map()} | {:error, Codat.Error.t()}
Creates a new API key. The full key value is only visible in the response.
Example
{:ok, key} = Codat.Platform.APIKeys.create(client, %{name: "Production"})
key["apiKey"] # store this immediately!
@spec delete(Codat.Client.t() | String.t(), String.t() | keyword()) :: {:ok, nil} | {:error, Codat.Error.t()}
Deletes an API key by its ID.
Example
{:ok, nil} = Codat.Platform.APIKeys.delete(client, "key-id")
@spec list( Codat.Client.t() | keyword(), keyword() ) :: {:ok, Codat.Pagination.t()} | {:error, Codat.Error.t()}
Lists all API keys for the authenticated account.
Example
{:ok, page} = Codat.Platform.APIKeys.list(client)