Skip to main content

API Keys

All requests to the MarketDataset API require an API key passed via the X-API-KEY header.
curl "https://api.marketdataset.ai/forex/prices?pair=EURUSD" \
  -H "X-API-KEY: sk_your_key_here"

Getting an API key

  1. Sign in at marketdataset.ai/dashboard
  2. In the Overview section, click Create API Key
  3. Give your key a descriptive name (e.g., “production”, “backtesting”)
  4. Copy the key immediately — it’s only shown once

Key format

API keys use the prefix sk_ followed by a 32-character random string:
sk_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6

Security best practices

API keys should only be used in server-side code or secure environments. Never embed them in frontend JavaScript, mobile apps, or public repositories.
Store keys in environment variables, not hardcoded in source code.
export MARKETDATASET_API_KEY=sk_your_key_here
Create a new key and delete the old one from the Dashboard. Old keys are invalidated immediately upon deletion.
Create distinct keys for development, staging, and production to limit blast radius if a key is compromised.

Error responses

StatusErrorCause
401Missing API keyX-API-KEY header not provided
401Invalid API keyKey not found or deleted
402Insufficient creditsAccount balance is $0.00
429Rate limit exceededToo many requests per minute