Getting Started

Authentication

Learn how to authenticate your requests to the VidRouter API using API keys.

API Keys

VidRouter uses API keys to authenticate requests. Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

Getting Your API Key

You can create and manage your API keys from your account settings:

  1. Go to your API Keys settings
  2. Click "Create New API Key"
  3. Give your key a descriptive name
  4. Copy the key and store it securely

Using API Keys

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

API Key Usage Examples
curl -X GET "https://api.vidrouter.com/v1/models" \
  -H "Authorization: Bearer vr_1234567890abcdef" \
  -H "Content-Type: application/json"

Security Best Practices

Do
  • Store API keys in environment variables
  • Use different keys for different environments
  • Rotate keys regularly
  • Use descriptive names for your keys
  • Delete unused keys
  • Monitor your API usage
Don't
  • Hard-code keys in your source code
  • Commit keys to version control
  • Share keys in public forums
  • Use the same key across all environments
  • Store keys in client-side code
  • Ignore unusual API activity

Environment Variables

The recommended way to use API keys is through environment variables:

Environment Variables Setup
# .env file
VIDROUTER_API_KEY=vr_1234567890abcdef

Error Responses

If authentication fails, you'll receive an error response:

401
Unauthorized
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid API key provided",
    "type": "authentication_error"
  }
}