Getting StartedAuthentication
Getting Started

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);
{
  "error": {
    "code": "invalid_token",
    "message": "Invalid or expired API key"
  }
}

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

header
X-API-KEYfm_80672c4f6fd****61faa39c5f78
Required

API Key for authentication. Format: X-API-KEY fm_YourKeyHere.

query
keyfm_80672c4f6fd****61faa39c5f78
Required

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.

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