Authentication and API keys

How the X-API-Key header works, where keys come from, how to rotate one, and what your account limits are.

Written By Carmine Cella

Last updated About 3 hours ago

Every request to https://scraping-api.datafuel.ai/api/v1 needs your API key in the X-API-Key header. There is no OAuth flow and no session cookie.

curl https://scraping-api.datafuel.ai/api/v1/users/@me \  --header "X-API-Key: df_key_your_key_here"

Keys start with df_key_ followed by 32 random characters.

Where keys come from

Your key is shown in the DataFuel dashboard under your account settings.

Rotate a key

If a key leaks, rotate it from the dashboard or with the API:

curl https://scraping-api.datafuel.ai/api/v1/users/@me/api-key/reset \  --request POST \  --header "X-API-Key: df_key_old_key"

{ "api_key": "df_key_3kQpZ8vNw2LxR7yTfB1jHdC4mS6aG0eU" }

The old key stops working immediately. The new key is returned only in this response and cannot be retrieved again, so store it before the connection closes.

Keep keys server-side

Requests from browsers and mobile apps expose the key to anyone who opens the developer tools. Put DataFuel calls behind your own backend and let your backend hold the key.

Account limits

GET /users/@me returns your plan, concurrency limit and monthly quota. GET /users/@me/balance returns the credits left. The Pricing and credits article explains what each call costs.

Two endpoints need no key

  • GET /api/v1/healthz and GET /api/v1/healthz?deep=1 report whether the API and its dependencies are up.
  • GET /api/v1/capabilities lists which task types and AI engines are switched on right now.

Errors

HTTPMeaning
401 UNAUTHORIZEDHeader missing, key malformed, or key rotated.
402 INSUFFICIENT_CREDITSKey is fine, balance is not. Top up in the dashboard.