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:
- Go to your API Keys settings
- Click "Create New API Key"
- Give your key a descriptive name
- Copy the key and store it securely
Important: API keys are only shown once upon creation. Make sure to copy and store them securely immediately.
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_1234567890abcdefError Responses
If authentication fails, you'll receive an error response:
401
Unauthorized{
"error": {
"code": "unauthorized",
"message": "Invalid API key provided",
"type": "authentication_error"
}
}Rate Limiting: API keys are subject to rate limiting. Monitor your usage and implement proper error handling for rate limit responses.