API Keys
Create and manage API keys for programmatic access.
GET
/api/v1/workspaces/{workspace_id}/api-keysList API Keys
Get all API keys for the workspace. Key values are masked (only prefix shown).
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| workspace_id | uuid | Required | Workspace ID |
Code Examples
bash
curl https://api.sentrasa.com/api/v1/workspaces/{workspace_id}/api-keys \
-H "X-API-Key: rp_your_api_key"Response
200List of API keysjson
[
{
"id": "key_550e8400-e29b-41d4-a716-446655440000",
"name": "Production Key",
"key_prefix": "rp_prod_",
"scopes": [
"read"
],
"is_active": true,
"last_used_at": "2026-03-20T10:00:00Z",
"created_at": "2026-02-15T09:00:00Z"
}
]POST
/api/v1/workspaces/{workspace_id}/api-keysCreate API Key
Create a new API key. The full key value is only returned once on creation.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| workspace_id | uuid | Required | Workspace ID |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Required | Key name (1-255 chars) |
| scopes | string[] | Default: ["read"] | Permission scopes |
json
{
"name": "Production Key",
"scopes": [
"read"
]
}Code Examples
bash
curl -X POST https://api.sentrasa.com/api/v1/workspaces/{workspace_id}/api-keys \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Production Key", "scopes": ["read"]}'Response
201API key created (includes full key value)json
{
"id": "key_661e9400-f39c-52e5-b827-557766551111",
"name": "Production Key",
"key_prefix": "rp_prod_",
"key": "rp_prod_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
"scopes": [
"read"
],
"is_active": true,
"last_used_at": null,
"created_at": "2026-03-20T14:00:00Z"
}DELETE
/api/v1/workspaces/{workspace_id}/api-keys/{key_id}Revoke API Key
Permanently revoke an API key. This action cannot be undone.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| workspace_id | uuid | Required | Workspace ID |
| key_id | uuid | Required | API key ID |
Code Examples
bash
curl -X DELETE https://api.sentrasa.com/api/v1/workspaces/{workspace_id}/api-keys/{key_id} \
-H "X-API-Key: rp_your_api_key"Response
200Key revokedjson
{
"message": "API key revoked successfully"
}