Chuyển đến nội dung chính

API Authentication

ECODATA API uses Bearer token authentication.

Getting Your API Key

  1. Log in to ECODATA Dashboard
  2. Navigate to Settings → API Keys
  3. Click Generate New Key
  4. Copy and store your key securely

Using the API Key

curl -H "Authorization: Bearer YOUR_API_KEY" \
https://ecodata.khoviet.com/api/v1/indicators

Query Parameter (Alternative)

curl "https://ecodata.khoviet.com/api/v1/indicators?api_key=YOUR_API_KEY"

Security Best Practices

  • ✅ Store API keys in environment variables
  • ✅ Use HTTPS for all requests
  • ✅ Rotate keys periodically
  • ❌ Never commit keys to version control
  • ❌ Never share keys publicly

Error Responses

CodeMessageSolution
401Invalid API keyCheck your API key
403Rate limit exceededWait or upgrade plan
403Insufficient permissionsCheck your subscription

Keep Keys Secret

Never expose your API key in client-side code.