Authentication
Authenticate API requests with a bearer token.
You can create an API key from the API Keys section of the console.
Save your API key locally with the Context212 CLI. The key is stored in ~/.ctx212/config.json and used by ctx212 commands and the MCP server.
npx ctx212 auth loginCheck that the key is saved and valid:
npx ctx212 auth status
npx ctx212 auth whoamiMaking requests
Pass the key on every request:
const headers = {
Authorization: `Bearer ${process.env.C212_API_KEY}`,
};
const response = await fetch("https://api.context212.com/api/v1/search", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({ query: "vacation policy", max_results: 3 }),
});Error responses
| Status | Meaning |
|---|---|
401 | Missing or invalid API key |
403 | Key exists but lacks permission for this resource |
429 | Rate limit exceeded |