> For the complete documentation index, see [llms.txt](https://rawctx.gitbook.io/rawctx-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rawctx.gitbook.io/rawctx-docs/api-reference/rawctx-http-api/authentication-and-errors.md).

# Authentication and errors

## Credential types

| Credential      | Intended use                                                               |
| --------------- | -------------------------------------------------------------------------- |
| User API token  | CLI, manager review, lifecycle events, settings, export, policy            |
| Application JWT | Runtime create/read/evidence/reconciliation/proof work for one application |
| Browser session | Hub BFF calls from the rawctx web application                              |

Application scopes include `answer_audit:create`, `answer_audit:read`, `answer_audit:evidence:read`, `answer_audit:evidence:write`, `answer_audit:reconcile`, and `answer_audit:proof:write`.

## Status handling

| Status | Meaning and action                                                |
| ------ | ----------------------------------------------------------------- |
| 400    | Malformed or unsupported request; fix the client                  |
| 401    | Missing, expired, or invalid credentials; reauthenticate          |
| 403    | Wrong token type, role, scope, tenant, or application key         |
| 404    | Resource does not exist in the current tenant boundary            |
| 409    | Idempotency, lifecycle, reconciliation, or receipt-claim conflict |
| 410    | Requested evidence or token is no longer retrievable              |
| 422    | Schema, hash mode, or workspace-policy mismatch                   |
| 429    | Rate or budget limit; honor the response and back off             |
| 5xx    | Service failure; retry only safe idempotent work with a bound     |

Do not parse human-readable error strings when using the Python SDK. A missing local credential can raise `AuthRequiredError`; HTTP responses are represented by `RegistryError` with `status_code`, `detail`, and optional `payload`.

## Safe retries

Preserve the original idempotency key across a bounded retry. Never generate a fresh key merely because the first response timed out. Do not retry 403, 409, or 422 unchanged.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://rawctx.gitbook.io/rawctx-docs/api-reference/rawctx-http-api/authentication-and-errors.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
