# Capturing API

Human URL: https://dochorizon.klippa.com/docs/prompt-builder/capturing-api
Source: https://dochorizon.klippa.com/docs/llms/prompt-builder/capturing-api.md

> Use the capturing API to use your created prompt and retrieve data from documents

---

The Prompt Builder Capturing API offers a variety of endpoints to support your document capturing requirements. In this section, we will focus on the three synchronous endpoints, providing detailed information on their functionality and usage. The first endpoint is used to **List Available Prompt Configurations**. Using any of these configurations you can use the second endpoint to **Capture a Document**, and the third endpoint to **Obtain the JSON schema** of that given prompt configuration. Please note that we also provide asynchronous endpoints, for more information on those refer to [this page](https://dochorizon.klippa.com/docs/llms/capturing/async.md). For issues with the API requests, a list of common error codes is provided [here](https://dochorizon.klippa.com/docs/llms/api/error-codes.md).

## List Available Prompt Configurations

**GET** `document_capturing/v1/prompt_builder/configurations`

Use this endpoint to receive in JSON format all Prompt Builder configurations available in a project. This endpoint requires you to send a GET request to the endpoint url.

## Capture a Document

**POST** `document_capturing/v1/prompt_builder/configurations/{slug}`

Use this endpoint to send a document for data capturing and retrieve found data in JSON format. This endpoint requires you to send a POST request to the endpoint url and the request should contain a payload. Follow the steps below to make sure the payload is optimized for your specific use case.

### Have a Prompt Configuration Ready

- [The Prompt Builder](https://dochorizon.klippa.com/docs/llms/prompt-builder.md): Before you can call the Prompt Builder API, you need to have created a prompt on the Doxis AI.dp platform. You can read more about this process here. The Prompt Builder grants you the ability to create your own capturing prompt, utilizing machine learning models to capture the data you need from your documents.

### Ready Your Document

- [Sending a Document for Capturing](https://dochorizon.klippa.com/docs/llms/api/sending-documents.md): Ready your document and provide it to the endpoint as a list of document objects called `documents`. This step also provides you with customization options such as including which range of pages to capture of the document.

### Request & Response

- [API Reference](https://dochorizon.klippa.com/docs/llms/prompt-builder/reference/capture.md): Once the JSON is ready, send it as a payload in a **POST** message to the endpoint url and obtain data exactly how you configured your prompt. Make sure you use the slug of your prompt configuration as a path parameter in the url, instead of the `{slug}` placeholder.

## Get JSON Schema

**GET** `document_capturing/v1/prompt_builder/configurations/{slug}/schema`

The output of this endpoint is the full JSON schema of a prompt configuration. To obtain it, simply send a **GET** request to the endpoint url, and make sure to replace the `{slug}` placeholder with the slug of the configuration you want to receive the JSON schema of. You will find the whole JSON schema returned as a response.

- [API Reference](https://dochorizon.klippa.com/docs/llms/prompt-builder/reference/schema.md): View this endpoint's API reference to gain insight on what resulting JSON you can expect from our capturing service.

### List Prompt Builder Configurations

**GET** `document_capturing/v1/prompt_builder/configurations`

### Capture with Prompt Builder Configuration

**POST** `document_capturing/v1/prompt_builder/configurations/{slug}`

```json
{
  "documents": [
    {
      "data": "{base64-string-of-your-document}"
    }
  ]
}
```

### Capture Async with Prompt Builder Configuration

**POST** `document_capturing/v1/prompt_builder/configurations/{slug}/async`

```json
{
  "documents": [
    {
      "data": "{base64-string-of-your-document}"
    }
  ]
}
```

### Capture Async with Prompt Builder Configuration (with Webhook Config)

**POST** `document_capturing/v1/prompt_builder/configurations/{slug}/async`

```json
{
  "documents": [
    {
      "data": "{base64-string-of-your-document}"
    }
  ],
  "webhook": {
    "types": [
        "on_status_update", "on_finish"
    ],
    "url": "{your-url}"
  }  
}
```

### Get status of async job

**GET** `document_capturing/v1/prompt_builder/configurations/{slug}/async/{job_id}`

### Remove or Cancel async job

**DEL** `document_capturing/v1/prompt_builder/configurations/{slug}/async/{job_id}`

### Get logs of async job

**GET** `document_capturing/v1/prompt_builder/configurations/{slug}/async/{job_id}/logs`

### Get result of async job

**GET** `document_capturing/v1/prompt_builder/configurations/{slug}/async/{job_id}/result`

### Get list of async jobs

**GET** `document_capturing/v1/prompt_builder/configurations/{slug}/async`

### Get JSON schema of configuration

**GET** `document_capturing/v1/prompt_builder/configurations/{slug}/schema`