Authentication and API Keys
Learn how to securely authenticate with the FetchMedia API using API keys for file upload, fetching, and processing endpoints.
const response = await fetch('https://api.fetchmedia.io/v1/fetch', {
method: 'POST',
headers: {
'X-API-KEY': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://www.tiktok.com/@user/video/123456789'
})
});
const data = await response.json();
console.log(data.fetch_id);
curl -X POST https://api.fetchmedia.io/v1/fetch \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.tiktok.com/@user/video/123456789"
}'
import requests
response = requests.post(
'https://api.fetchmedia.io/v1/fetch',
headers={
'X-API-KEY': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'url': 'https://www.tiktok.com/@user/video/123456789'
}
)
print(response.json()['fetch_id'])
{
"error": {
"code": "invalid_token",
"message": "Invalid or expired API key"
}
}
{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests. Retry after 60 seconds",
"retry_after": 60
}
}
Overview
FetchMedia uses API key authentication to secure access to video fetching and processing endpoints. You generate an API key from your dashboard and include it in the X-API-KEY header of every request. This method grants permissions for actions like fetching TikTok videos, editing with FFmpeg, or repurposing Instagram Reels.
All requests to https://api.fetchmedia.io/v1/ require a valid key. Keys have built-in rate limits to protect your account.
New accounts include generous trial limits. Upgrade for production use.
Generating and Managing API Keys
Access your FetchMedia dashboard at https://app.fetchmedia.io to create and manage keys.
Log In
Visit https://app.fetchmedia.io and sign / sign-up in with your credentials.
Navigate to Keys
Click API Keys in the sidebar.
Generate / Copy Key
Click Generate New Key or Copy your first key.
Manage keys by viewing or revoking them. Revoke compromised keys immediately.
Including API Keys in Requests
Add your key to the Authorization header as Bearer YOUR_API_KEY or as a query parameter
API Key for authentication. Format: X-API-KEY fm_YourKeyHere.
API Key for authentication. Format: key=fm_YourKeyHere.
Use these examples to fetch a TikTok video:
Replace YOUR_API_KEY with your actual key.
Authentication Methods
Choose based on your setup:
Use header auth in tools like Postman or Insomnia.
Add Authorization header in HTTP nodes.
{
"headers": {
"X-API-KEY": "YOUR_API_KEY"
}
}
Best Practices and Security
Never commit API keys to Git. Use environment variables like process.env.FETCHMEDIA_API_KEY.
-
Store keys in secure vaults (e.g., Secrets Manager).
-
Rotate keys every 90 days.
-
Monitor usage in your dashboard.
Next Steps
Last updated Jan 23, 2026
Built with Documentation.AI