API Key Authentication
Context.dev uses API key authentication to secure all API requests. Every request to the Context.dev API must include a valid API key in the request headers.Getting Your API Key
Sign Up
Create an account at context.dev if you haven’t
already.
Access Dashboard
Log in to your Context.dev dashboard.
Using Your API Key
HTTP Header Authentication
Include your API key in theAuthorization header with the Bearer prefix:
SDK Authentication
All official SDKs handle authentication automatically when you provide your API key:JavaScript/TypeScript
JavaScript/TypeScript
Python
Python
Ruby
Ruby
Storing API Keys Securely
Environment Variables (Recommended)
Store your API key in environment variables, never hardcode it in your source code:.env file (for development):
Production Deployment
For production environments, set environment variables using your platform’s configuration: Vercel:Rate Limiting
Rate limits are applied per API key and vary by plan tier. Below are the current limits. See the pricing page for the latest details on credits and overage rates.| Plan | Credits per Month | Requests per Second | Overage |
|---|---|---|---|
| Trial | 500 one-time trial credits | — | — |
| Starter | 30,000 / month | 2 calls/sec | $19 per 1K credits |
| Pro | 200,000 / month | 5 calls/sec | $9 per 1K credits |
| Scale | 2,500,000 / month | 20 calls/sec | $6 per 1K credits |
| Enterprise | Custom | Custom | Contact sales |
Context.dev uses a credit-based pricing system. Different API endpoints consume different amounts of credits. For example, web scraping endpoints cost 1 credit each (1/10th the cost of a standard brand API call). See the pricing page for full details.
429 Too Many Requests response with a Retry-After header.
Handling Rate Limits
Implement exponential backoff when you receive rate limit errors:If you consistently hit your limits, consider upgrading your plan on the pricing page or contact support for a custom plan.
Prefetch endpoint is rate-limit free! The Prefetch by
Email endpoint doesn’t
count against your rate limits or credit usage.
Security Best Practices
1. Never Expose Keys in Client-Side Code
Bad: Hardcoding API keys in frontend JavaScript2. Use HTTPS Only
Always make API requests over HTTPS to encrypt your API key in transit. The Context.dev API only accepts HTTPS requests.3. Don’t Log API Keys
Avoid logging API keys in application logs or error tracking services:Testing & Development
Local Development
For local development, use a.env.local file that’s not committed to version control:
CI/CD Pipelines
Store API keys as secrets in your CI/CD platform:- GitHub Actions: Repository Secrets
- GitLab CI: CI/CD Variables
- CircleCI: Project Environment Variables
Authentication Errors
401 Unauthorized
You’ll receive a401 error if:
- Your API key is missing from the request
- Your API key is invalid or expired
- Your API key has been deleted
403 Forbidden
You’ll receive a403 error if:
- Your API key doesn’t have permission for the requested endpoint
- Your account has been suspended
Related Resources
Quickstart
Get started with your first API call
Core Concepts
Understand Context.dev fundamentals
Troubleshooting
Common authentication issues
API Reference
Explore all endpoints