API Keys
Create and manage API keys for programmatic access.
API Keys
API keys provide programmatic access to the Weavz API. Keys are scoped to an organization and prefixed with wvz_.
List API Keys
/api/v1/api-keysList all API keys for your organization. Key values are masked — only the keyPrefix (first 8 characters) is shown.
Response
{
"apiKeys": [
{
"id": "k1a2b3c4-d5e6-7890-abcd-ef1234567890",
"orgId": "550e8400-e29b-41d4-a716-446655440000",
"name": "Production Key",
"keyPrefix": "wvz_ab12",
"permissions": null,
"lastUsedAt": "2025-01-16T08:00:00.000Z",
"expiresAt": null,
"createdAt": "2025-01-15T10:30:00.000Z"
}
],
"total": 1
}Example
curl https://api.weavz.io/api/v1/api-keys \
-H "Authorization: Bearer wvz_your_api_key"Create API Key
/api/v1/api-keysCreate a new API key. The full key value is returned only once in the plainKey field — store it securely.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Descriptive name for the key |
expiresAt | string (date-time) | No | Expiration timestamp (no expiry if omitted) |
permissions | object | No | Permission scope (unrestricted if omitted). See below. |
Permissions Object
| Field | Type | Required | Description |
|---|---|---|---|
scope | string | Yes | "org" for full access, "workspace" for workspace-scoped |
workspaceIds | string[] | When scope is "workspace" | UUIDs of the workspaces this key can access |
Response (201)
{
"apiKey": {
"id": "k1a2b3c4-d5e6-7890-abcd-ef1234567890",
"orgId": "550e8400-e29b-41d4-a716-446655440000",
"name": "Production Key",
"keyPrefix": "wvz_ab12",
"permissions": null,
"lastUsedAt": null,
"expiresAt": null,
"createdAt": "2025-01-15T10:30:00.000Z"
},
"plainKey": "wvz_ab12cd34ef56gh78ij90kl12mn34op56"
}Example
curl -X POST https://api.weavz.io/api/v1/api-keys \
-H "Authorization: Bearer wvz_your_api_key" \
-H "Content-Type: application/json" \
-d '{"name": "Production Key"}'Create a workspace-scoped key:
curl -X POST https://api.weavz.io/api/v1/api-keys \
-H "Authorization: Bearer wvz_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Workspace-Only Key",
"permissions": {
"scope": "workspace",
"workspaceIds": ["PROJECT_UUID_1", "PROJECT_UUID_2"]
}
}'Workspace-scoped keys can only access resources within the specified workspaces. Requests to resources outside the allowed workspaces return 403 SCOPE_DENIED.
Errors
| Status | Code | Description |
|---|---|---|
400 | VALIDATION_ERROR | Missing key name |
403 | QUOTA_EXCEEDED | API key limit reached for your plan |
403 | SCOPE_DENIED | Workspace-scoped key cannot access this resource |
Revoke API Key
/api/v1/api-keys/:idRevoke an API key. The key is immediately invalidated and can no longer be used for authentication.
Path Parameters
| Field | Type | Description |
|---|---|---|
id | string (uuid) | API key ID |
Response
{
"deleted": true,
"id": "k1a2b3c4-d5e6-7890-abcd-ef1234567890"
}Example
curl -X DELETE https://api.weavz.io/api/v1/api-keys/k1a2b3c4-d5e6-7890-abcd-ef1234567890 \
-H "Authorization: Bearer wvz_your_api_key"Errors
| Status | Code | Description |
|---|---|---|
404 | NOT_FOUND | API key not found |