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 login

Check that the key is saved and valid:

npx ctx212 auth status
npx ctx212 auth whoami

Making 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

StatusMeaning
401Missing or invalid API key
403Key exists but lacks permission for this resource
429Rate limit exceeded

On this page