> For the complete documentation index, see [llms.txt](https://docs.shadowcipher.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shadowcipher.in/reference/errors.md).

# Errors

Error format and codes.

Errors return a JSON body with an `error` code and a readable `error_description`. When a specific request field caused the error, `field` names it.

```json
{
  "error": "invalid_request",
  "error_description": "document must be a base64-encoded PDF",
  "field": "document"
}
```

## Token endpoint errors

| HTTP | `error`                  | When                                                 |
| ---- | ------------------------ | ---------------------------------------------------- |
| 400  | `invalid_request`        | `client_id` or `client_secret` is missing.           |
| 400  | `unsupported_grant_type` | `grant_type` is sent and isn't `client_credentials`. |
| 401  | `invalid_client`         | Unknown client, wrong secret, or inactive client.    |

## API errors

| HTTP | `error`               | When                                                                                                                               |
| ---- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| 400  | `invalid_request`     | A field is missing or invalid, the body isn't JSON, or the template is unknown or inactive.                                        |
| 401  | `invalid_token`       | The access token is missing, invalid or expired. Get a new token.                                                                  |
| 403  | `forbidden`           | The token lacks the `txn:initiate` scope, the client is inactive, or the signature type or template isn't assigned to your client. |
| 404  | —                     | No such transaction for this client (`fetchDoc`).                                                                                  |
| 413  | `payload_too_large`   | The document is larger than 10 MB.                                                                                                 |
| 429  | `rate_limit_exceeded` | Too many requests. See [Rate limits](https://docs.shadowcipher.in/reference/rate-limits.md).                                       |
| 500  | `server_error`        | Something went wrong on our side. Retry later.                                                                                     |


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.shadowcipher.in/reference/errors.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
