Manage Arize API keys programmatically. Create, list, delete, and regenerate user or service keys.
The api_keys client methods are currently in ALPHA. The API may change without notice. A one-time warning is emitted on first use.
Key Capabilities
- List API keys with optional filtering by type or status
- Create user keys (account-scoped) or service keys (space-scoped)
- Delete keys immediately and permanently
- Refresh (rotate) a key while preserving its name and scope
List API Keys
List API keys for the authenticated user. Optionally filter by key_type ("user" or "service") and status ("active" or "deleted"). When status is omitted, only active keys are returned.
resp = client.api_keys.list(
key_type="service", # optional: "user" or "service"
status="active", # optional: "active" or "deleted"
limit=50,
)
for key in resp.api_keys:
print(key.id, key.name, key.key_type)
For details on pagination, field introspection, and data conversion (to dict/JSON/DataFrame), see Response Objects.
Create an API Key
Two key types are supported:
"user" — authenticates as the creating user with their full permissions. space_id must not be set.
"service" — scoped to a specific space, backed by a bot user with limited roles. space_id is required.
The raw key value is returned only once in the key field of the response. Store it securely — it cannot be retrieved again.
User Key
result = client.api_keys.create(
name="my-user-key",
description="Used for CI pipeline", # optional
key_type="user",
)
print(result.key) # store this securely — shown only once
print(result.id)
Service Key
from datetime import datetime, timezone
result = client.api_keys.create(
name="my-service-key",
key_type="service",
space_id="your-space-id", # required for service keys
expires_at=datetime(2027, 1, 1, tzinfo=timezone.utc), # optional
)
print(result.key) # store this securely — shown only once
print(result.id)
Delete an API Key
Delete a key by ID. The key is deactivated immediately and permanently.
client.api_keys.delete(api_key_id="your-api-key-id")
print("API key deleted")
Refresh an API Key
Revoke an existing key and issue a replacement with the same name, description, type, and scope. A new raw key value is returned.
The new raw key value is returned only once in the key field of the response. Store it securely.
from datetime import datetime, timezone
result = client.api_keys.refresh(
api_key_id="your-api-key-id",
expires_at=datetime(2027, 1, 1, tzinfo=timezone.utc), # optional
)
print(result.key) # store this securely — shown only once