My API calls return 401

Auth failures and the four things that cause them.

A 401 means the request was not authenticated. It is a credential problem, never a credit problem.

  1. Is the key revoked? Revocation is immediate, so a key deleted under Profile then API keys fails on the very next request. Create a new one.
  2. Is the header right? It must be Authorization: Bearer <key>. A missing Bearer prefix is the single most common cause.
  3. Is the key complete? Keys begin with ag_live_. Copy and paste often clips characters or adds a trailing newline, especially from a terminal or a shell variable.
  4. Are you hitting the right host? REST calls go to https://argorant.com under /api/mcp/.... The MCP endpoint is https://mcp.argorant.com/mcp and uses OAuth rather than a bearer key.

A quick way to isolate it: call GET /api/mcp/account. If that returns your identity and quota, the key and header are fine and the problem is in the specific call. If it also returns 401, the credential itself is the problem.

From the CLI, run argorant login <key> again. Exit code 2 signals an auth failure, which makes it easy to branch on in a script.

Keys are shown once at creation. If you cannot find yours, do not hunt for it, revoke and create a new one.

Still stuck? support@argorant.com