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

# Introduction

> Introduction to our API.

export const PostBadgeLink = ({label, href}) => {
  return <div className={"flex row gap-2"}>
      <span className="w-8 flex items-center">
        <span className="px-1 py-0.5 rounded-md text-[0.55rem] leading-tight font-bold bg-blue-400/20 text-blue-700 dark:bg-blue-400/20 dark:text-blue-400">POST</span>
      </span>

      <div><a href={href}>{label}</a></div>
    </div>;
};

Doczilla offers three endpoint types: `direct`, `sync` and `async`.

* `direct`: your document is generated and returned directly in the response to your request,
  providing simplicity and efficiency. For requests with responses exceeding 32 MiB,
  refer to the [Content type](#content-type) section.

* `sync`: your document is created and directly returns a URL instead of the raw document.
  Optionally, write the document directly into your bucket by using the [storage option][storage-options], bypassing the need for our temporary storage.

* `async`: you provide a [webhook][webhook-options] where the [result](/api-reference/webhook-event) is sent to after the document is created.

## Endpoints

| Endpoint                                                                                       |   Type   | Body                                                                                                                               |
| :--------------------------------------------------------------------------------------------- | :------: | :--------------------------------------------------------------------------------------------------------------------------------- |
| <PostBadgeLink label="/v1/pdf" href="/api-reference/endpoint/pdf" />                           | `direct` | [page][page-options], [pdf][pdf-options]                                                                                           |
| <PostBadgeLink label="/v1/pdf/sync" href="/api-reference/endpoint/sync-pdf" />                 |  `sync`  | [page][page-options], [pdf][pdf-options], [storage][storage-options]                                                               |
| <PostBadgeLink label="/v1/pdf/async" href="/api-reference/endpoint/async-pdf" />               |  `async` | [page][page-options], [pdf][pdf-options], [storage][storage-options], [webhook][webhook-options]                                   |
|                                                                                                |          |                                                                                                                                    |
| <PostBadgeLink label="/v1/screenshot" href="/api-reference/endpoint/screenshot" />             | `direct` | [page][page-options], [screenshot][screenshot-options]                                                                             |
| <PostBadgeLink label="/v1/screenshot/sync" href="/api-reference/endpoint/sync-screenshot" />   |  `sync`  | [page][page-options], [screenshot][screenshot-options], [storage][storage-options]                                                 |
| <PostBadgeLink label="/v1/screenshot/async" href="/api-reference/endpoint/async-screenshot" /> |  `async` | [page][page-options], [screenshot][screenshot-options], [storage][storage-options], [webhook][webhook-options]                     |
|                                                                                                |          |                                                                                                                                    |
| <PostBadgeLink label="/v1/template/:id" href="/api-reference/endpoint/template" />             | `direct` | [page][page-options], [pdf][pdf-options], [screenshot][screenshot-options], [storage][storage-options], [webhook][webhook-options] |
| <PostBadgeLink label="/v1/template/:id/sync" href="/api-reference/endpoint/sync-template" />   |  `sync`  | [page][page-options], [pdf][pdf-options], [screenshot][screenshot-options], [storage][storage-options], [webhook][webhook-options] |
| <PostBadgeLink label="/v1/template/:id/async" href="/api-reference/endpoint/async-template" /> |  `async` | [page][page-options], [pdf][pdf-options], [screenshot][screenshot-options], [storage][storage-options], [webhook][webhook-options] |

## Content type

By default, when doing a `direct` request Doczilla will return with the `Content-Type` header associated with the endpoint, this will be:

* `/v1/pdf` -> `application/pdf`
* `/v1/screenshot` with `screenshot.type` set to `png` -> `image/png` (default)
* `/v1/screenshot` with `screenshot.type` set to `jpeg` -> `image/jpeg`
* `/v1/screenshot` with `screenshot.type` set to `webp` -> `image/webp`

If the size of the final document or screenshot exceeds 32 MiB, the `Transfer-Encoding` header will be set
to `chunked`, and the `Content-Type` header will be changed to `application/octet-stream`.

[page-options]: /api-reference/page-options

[pdf-options]: /api-reference/pdf-options

[screenshot-options]: /api-reference/screenshot-options

[storage-options]: /api-reference/storage-options

[webhook-options]: /api-reference/webhook-options
