Authentication
img-src uses API keys for authentication. This guide covers how to create, use, and manage your API keys.Getting an API Key
- Sign in to img-src.io
- Navigate to Settings
- Click Create API Key
- Enter a name for your key
- Choose the scopes (permissions)
- Optionally set an expiration
- Copy the key immediately
API Key Format
API keys have the format:- Prefix:
imgsrc_(always) - Length: 56 characters total
- Characters: alphanumeric
Using Your API Key
Include the API key in theAuthorization header:
Scopes
API keys can have different permission scopes:| Scope | Permissions |
|---|---|
read | List images, get metadata, view settings |
write | Upload images, delete images, update settings |
read and write scopes.
Creating a Read-Only Key
For applications that only need to list or display images:Key Expiration
Set an expiration for temporary access:Revoking Keys
Delete a key to immediately revoke access:Security Best Practices
Never expose keys in client-side code
Never expose keys in client-side code
API keys should only be used in server-side code. For client-side applications, use a backend proxy.
Use environment variables
Use environment variables
Store API keys in environment variables, not in code.Recommended environment variable name:
IMGSRC_API_KEYRotate keys regularly
Rotate keys regularly
Create new keys periodically and delete old ones. This limits the impact if a key is compromised.
Use minimal scopes
Use minimal scopes
Only grant the permissions each key needs. A key for displaying images only needs
read scope.Set expiration for temporary access
Set expiration for temporary access
For CI/CD, contractors, or temporary integrations, always set an expiration date.
Monitor key usage
Monitor key usage
Check
last_used_at and total_requests to detect unauthorized usage:CDN Authentication
Images served via CDN URLs don’t require authentication:Private Images (Pro)
Pro users can create private images that require signed URLs:Error Responses
401 Unauthorized
- Missing
Authorizationheader - Invalid API key format
- Expired API key
- Deleted API key
403 Forbidden
- Key doesn’t have required scope
- Attempting to access another user’s resources
Rate Limiting
API keys are rate limited based on your plan:| Plan | Requests/Minute |
|---|---|
| Free | 100 |
| Pro | 500 |