> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pdfdyno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Error Handling

> Understand the HTTP status codes returned by PDFDyno.

PDFDyno uses standard HTTP response codes to indicate the success or failure of an API request.

In general:

* Codes in the `2xx` range indicate success.
* Codes in the `4xx` range indicate an error that failed given the information provided (e.g., a required parameter was omitted, JSON was invalid, or the Typst syntax was incorrect).
* Codes in the `5xx` range indicate an error with PDFDyno's servers.

## Error Response Format

When an error occurs, PDFDyno returns a JSON response containing an `error` object with a `message` explaining what went wrong.

```json theme={null}
{
  "error": "Invalid Typst syntax on line 4: expected block"
}
```

## HTTP Status Codes

Here is a comprehensive list of status codes you might encounter:

| Status Code | Description               | Meaning                                                                                                                                   |
| ----------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `200`       | **OK**                    | Everything worked as expected. The response body is your PDF buffer.                                                                      |
| `400`       | **Bad Request**           | The request was unacceptable. Usually caused by invalid JSON formatting, missing parameters, or a Typst compilation error (syntax error). |
| `401`       | **Unauthorized**          | No valid API key provided. Check your `Authorization: Bearer` header.                                                                     |
| `403`       | **Forbidden**             | Your account has been suspended, or your API key lacks permissions to perform this action.                                                |
| `413`       | **Payload Too Large**     | Your request exceeds the strict 10MB payload limit.                                                                                       |
| `429`       | **Too Many Requests**     | You have hit your rate limit (e.g. > 100 req/min). Check the dashboard to upgrade your plan.                                              |
| `500`       | **Internal Server Error** | Something went wrong on our end, such as a timeout or database failure.                                                                   |
| `503`       | **Service Unavailable**   | Service temporarily unavailable. Please try again later.                                                                                  |

<Note>
  If you encounter a `400 Bad Request` related to Typst syntax, ensure you test your template locally or in the [Typst Web App](https://typst.app) before sending it via the API.
</Note>
