Authentication

Learn how to authenticate your API requests using API keys.

Overview

Generation and account APIs require authentication. Public discovery includes health, capabilities, and OpenAPI; bot registration bootstraps credentials without an existing key. Vydra uses Bearer API keys for application requests.

API Key Format

API keys follow the format: vydra_live_[prefix]_[randomString]

Creating API Keys

You can create API keys from your dashboard or via the API itself (session authentication required).

Via Dashboard

  1. Sign in to your Vydra account
  2. Navigate to Settings → API Keys
  3. Click Create New Key
  4. Give your key a name and optional expiration
  5. Copy and securely store your key - it will not be shown again!

Via API

Create API Keybash
curl -X POST https://vydra.ai/api/v1/api-keys \
  -H "Content-Type: application/json" \
  -H "Cookie: __session=YOUR_SESSION_COOKIE" \
  -d '{
    "name": "My Production Key",
    "expiresInDays": 90
  }'

Important

The full API key is only returned once when created. Store it securely immediately. If you lose it, you will need to create a new key.

Agent onboarding and company workspaces

curl -X POST https://vydra.ai/api/v1/auth/bot-register \
  -H "Content-Type: application/json" \
  -d '{"agent_name":"my-agent","billing_email":"ops@example.com","account_type":"company","company_name":"Example Company"}'

Ask whether the account is personal or for a company before registering. account_type accepts personal (default) or company; company_name is required for company accounts. The owner opens dashboard_url, chooses Connect workspace, and signs in with the verified billing email. This connects the existing credits, generations, and API keys to a regular login. Workspace & team lets administrators invite colleagues with their own logins. No new payment is required to claim.

Save api_key and dashboard_token when returned; they are shown once. dashboard_url and billing_url let a human manage the bot account and fund it. Use the API key for generation, not the dashboard token. If billing is unavailable on the deployment, billing_url can fall back to the dashboard. Returning a checkout link is not a successful payment.

Creator catalog, Studio, and library reads require jobs:read; writes require jobs:write. jobs:* or * also match. These resources belong to the key’s organization and share its credit balance. Human sign-in remains available through Clerk; existing bot accounts can use agent sign in.

Using API Keys

Include your API key in the Authorization header as a Bearer token:

Authentication Examples

curl https://vydra.ai/api/v1/models \
  -H "Authorization: Bearer vydra_live_user_abc_X7kM9pQ..."

API Key Response Format

When you create an API key, you will receive a response like this:

Create Key Responsejson
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "key": "vydra_live_user_abc_X7kM9pQ...",
  "keyPrefix": "vydra_live_use...",
  "message": "Store this key securely. It will not be shown again."
}

Response Fields

NameTypeDescription
idstringUnique identifier for the API key (UUID)
keystringThe full API key - only shown once!
keyPrefixstringTruncated prefix for identification
messagestringReminder to store the key securely

API Key Scopes

API keys can be restricted to specific operations using scopes. By default, keys are created with full access.

ScopeDescription
*Full access (default)
models:*All model operations
models:readList models only
models:writeGenerate/edit with models
jobs:*All job operations
upload:*Upload files
account:readRead account info

Managing API Keys

List Your Keys

curl https://vydra.ai/api/v1/api-keys \
  -H "Authorization: Bearer YOUR_API_KEY"

Revoke a Key

curl -X DELETE https://vydra.ai/api/v1/api-keys/KEY_ID \
  -H "Authorization: Bearer YOUR_API_KEY"

Warning

Revoking an API key is permanent and cannot be undone. Any applications using the revoked key will immediately lose access.

Authentication Errors

These errors may occur during authentication:

StatusCodeDescription
401MISSING_AUTHNo Authorization header provided
401INVALID_FORMATInvalid API key format
401KEY_NOT_FOUNDAPI key does not exist
401KEY_REVOKEDAPI key was revoked
401KEY_EXPIREDAPI key has expired
403INSUFFICIENT_SCOPEKey lacks required permission

Best Practices

🔐 Keep Keys Secret

Never expose API keys in client-side code, public repositories, or logs. Use environment variables to store keys securely.

🔄 Rotate Regularly

Periodically create new API keys and revoke old ones, especially if you suspect a key may have been compromised.

🎯 Use Minimal Scopes

Create keys with only the permissions they need. A key used only for listing models does not need write access.

📅 Set Expiration

For temporary integrations or testing, set an expiration date on your API keys to ensure they are automatically disabled.