Skip to main content
Create an API key that authenticates the Clay Public API (api.clay.com/public/v0). The secret is returned only at creation — store it immediately, because it cannot be retrieved later. List existing keys with clay api-keys list.
clay api-keys create --name <name>

Flags

FlagDescription
--name <name>Human-readable name for the API key.

Output

{
  "id": "ak_abc123",
  "name": "CI key",
  "scopes": ["cli:all"],
  "workspaceId": 12345,
  "createdAt": "2026-01-01T00:00:00.000Z",
  "updatedAt": "2026-01-01T00:00:00.000Z",
  "apiKey": "clay_sk_..."
}
FieldTypeDescription
idstringAPI key id. Pass it to update or delete.
namestringThe name you supplied.
scopesstring[]Scopes granted to the key.
workspaceIdnumber | undefinedWorkspace the key is scoped to, when set.
createdAtstringISO 8601 creation timestamp.
updatedAtstringISO 8601 last-updated timestamp.
apiKeystringThe secret. Returned only once, at creation — store it now; it cannot be fetched again.
The apiKey secret is shown only in this response. If you lose it, delete the key with clay api-keys delete and create a new one.

Errors

CodeExitNotes
validation_error2--name is missing or empty.
auth_forbidden3The key lacks permission to create API keys.

Examples

clay api-keys create --name "CI key"
clay api-keys create --name "CI key" | jq -r '.apiKey'