eavz

API Keys

Create and manage API keys for authenticating with the Weavz API.

API keys are the primary way to authenticate with the Weavz API from your backend services. Each key is scoped to an organization and provides full access to that organization's resources.

Key Format

All Weavz API keys use the wvz_ prefix followed by a random string:

text
wvz_abc123def456...

This prefix makes it easy to identify Weavz keys in your codebase and allows secret scanners to detect leaked credentials.

Creating API Keys

1

Open Settings

Navigate to Settings → API Keys in the Weavz dashboard.

2

Create a new key

Click Create API Key and enter a descriptive name (e.g., production-backend, staging-server).

3

Set expiration (optional)

Optionally set an expiration date for automatic key rotation.

4

Copy the key

Click Create and copy the key immediately — it will only be shown once.

Using API Keys

Include your API key in the Authorization header of every request:

bash
curl https://api.weavz.io/api/v1/workspaces \
  -H "Authorization: Bearer wvz_your_key"

Listing Keys

bash
curl https://api.weavz.io/api/v1/api-keys \
  -H "Authorization: Bearer wvz_your_key"

Deleting Keys

bash
curl -X DELETE https://api.weavz.io/api/v1/api-keys/key_abc123 \
  -H "Authorization: Bearer wvz_your_key"

Key Rotation

To rotate an API key without downtime:

1

Create a new key

Generate a new API key via the dashboard or API.

2

Update your application

Deploy the new key to your environment variables.

3

Verify the new key

Confirm the new key works in production.

4

Delete the old key

Revoke the old key once the new one is verified.

typescript
// 1. Create new key
const { plainKey: newKey } = await client.apiKeys.create({
  name: 'production-backend-v2',
})
 
// 2. Update your environment variables with the new key
// 3. Verify the new key works
// 4. Delete the old key
await client.apiKeys.delete('old_key_id')

Scoping Keys to Workspaces

By default, API keys have org-wide access. For tighter security, you can scope a key to specific workspaces — the key will only be able to access resources (connections, MCP servers, triggers, actions) within those workspaces.

bash
curl -X POST https://api.weavz.io/api/v1/api-keys \
  -H "Authorization: Bearer wvz_your_existing_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "checkout-service",
    "permissions": {
      "scope": "workspace",
      "workspaceIds": ["WORKSPACE_UUID_1"]
    }
  }'

If a workspace-scoped key tries to access a resource outside its allowed workspaces, the API returns 403 with code SCOPE_DENIED. Org-level administration endpoints (API key management, org settings) also require org-wide keys.

When sending connectionExternalId/externalId for action execution or connection resolution, include the correct workspaceId (and endUserId when applicable). Explicit connection IDs are still validated against that context and are rejected on scope mismatch.

Best Practices

  • Use workspace-scoped keys for least-privilege access — each service should only access the workspaces it needs
  • Use environment variables — never hardcode API keys in source code
  • Separate keys per environment — use different keys for development, staging, and production
  • Set expiration dates — rotate keys periodically for better security
  • Never expose keys in client-side code — API keys should only be used in server-side applications
  • Monitor usage — check the Activity page to track API key usage
  • Revoke compromised keys immediately — if a key is leaked, delete it and create a new one