Authentication

Authentication

All API requests require authentication via an API key in the request header.

API Key

Include your API key in the X-API-Key header with every request.

Header
X-API-Key: your-api-key-here

Demo API Key

For testing and development, use our demo API key:

demo-key-123451,000 requests/day

Demo Key Limits

  • 1,000 requests per day
  • Rate limited to 10 requests per second
  • For production use, contact us for a dedicated key

Example Request

cURL

curl -X GET "https://german-language.onrender.com/stats" \
  -H "X-API-Key: demo-key-12345"

Python

import requests

response = requests.get(
    "https://german-language.onrender.com/stats",
    headers={"X-API-Key": "demo-key-12345"}
)

print(response.json())

JavaScript

const response = await fetch(
  "https://german-language.onrender.com/stats",
  {
    headers: {
      "X-API-Key": "demo-key-12345"
    }
  }
);

const data = await response.json();
console.log(data);

Authentication Errors

If authentication fails, you'll receive a 401 Unauthorized response:

Response 401 Unauthorized
{
  "detail": "Invalid API key. Get a key at /register (coming soon)"
}

Common Issues

  • Missing header: Make sure to include X-API-Key in your request headers
  • Invalid key: Double-check your API key for typos
  • Expired key: Demo keys don't expire, but production keys may