Authentication Guide
All API Codex APIs authenticate with a single API key. One key works across all 40 APIs, comes with free monthly credits, and takes less than a minute to create.
Getting Your Key
- Sign up at dash.apicodex.io with just your email, no credit card required
- Create an API key from the API Keys page
- That's it: the key (
acx_live_...) works across all 40 APIs and includes 1,000 free credits every month
Making Requests
Call any API at https://api.apicodex.io and pass the key either as an apikey query parameter or an X-Api-Key header:
Code
Code
Implementation Examples
cURL
Code
JavaScript/Node.js
Code
Python
Code
PHP
Code
Credits and Quotas
Every request costs a fixed number of credits depending on the API: bundled-data APIs cost 1 credit, live network lookups 5, and AI or scraping APIs 25. Your plan's monthly credit quota, per-key usage, and billing all live in the dashboard. Only successful (2xx) responses consume credits.
Security Best Practices
1. Never Expose Keys in Client-Side Code
❌ Bad Practice:
Code
✅ Good Practice:
Code
2. Use Environment Variables
.env file:
Code
Load it with dotenv (Node.js), python-dotenv (Python), or your framework's config layer, and add .env to .gitignore.
3. Rotate Keys When Needed
You can keep up to 5 active keys in the dashboard: create a new key, switch your deployment over, then revoke the old one. Revocation takes effect within about a minute.
4. Secure Storage in Production
- AWS: AWS Secrets Manager or Parameter Store
- Azure: Azure Key Vault
- Google Cloud: Secret Manager
- Heroku: Config Vars
- Vercel / Cloudflare: Environment Variables
- Docker: Docker Secrets
Authentication Errors
| Error Code | Description | Solution |
|---|---|---|
| 401 | Invalid, missing, or revoked API key | Check the key in the dashboard |
| 429 | Monthly credit quota reached | Upgrade your plan or wait for renewal |
| 503 | Service temporarily unavailable | Retry with exponential backoff |
Error Handling Example
Code
Testing Authentication
Code
A JSON payload means you're authenticated; a 401 means the key is missing, mistyped, or revoked.
Troubleshooting
- ✓ Verify the API key is correct (no extra spaces or characters)
- ✓ Check key status and remaining credits in the dashboard
- ✓ Ensure the header (
X-Api-Key) or query param (apikey) is properly formatted - ✓ Verify the API endpoint URL is correct
- ✓ Ensure you're not exceeding your plan's rate limit
- ✓ Verify network connectivity and firewall settings
Next Steps
- Review Rate Limiting to understand usage limits
- Learn about Error Handling for robust applications
- Check Best Practices for production deployments
- Explore our API Catalog to start building
Need Help?
- Dashboard: Manage keys, usage, and billing at dash.apicodex.io
- API Codex Support: Contact us for API-specific questions
- Documentation: Browse our comprehensive guides