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

# Response Format

> This page describes the **Extract** response format.

The Extract response returns top-level request metadata and a `result` object. The `result` object contains the extracted data in `extracted_schema` and can also include citations, page-level fields, stamp results, and usage metadata.

## Top-level response

The `entity_extraction` endpoint returns the following top-level structure:

```json theme={null}
{
  "code": 200,
  "message": "Success",
  "status": "finished",
  "version": "v3.x.x",
  "duration": 28450,
  "part_durations": {
    "parse_duration": 0,
    "doc_cvt_duration": 48,
    "retrieve_duration": 0,
    "prompt_duration": 0,
    "llm_duration": 26950,
    "format_duration": 12
  },
  "result": {
    "extracted_schema": {},
    "pages": [
      {
        "height": 1584,
        "width": 1224,
        "angle": 0,
        "status": "Success",
        "durations": 0,
        "page_number": 1,
        "image_id": ""
      }
    ],
    "stamps": [],
    "success_count": 1,
    "usage": {
      "acgpt_request_number": 3,
      "prompt_tokens": 0,
      "completion_tokens": 0,
      "total_tokens": 0,
      "request_number": 0,
      "acgpt_prompt_tokens": 4200,
      "acgpt_completion_tokens": 120,
      "acgpt_total_tokens": 4320
    }
  },
  "x_request_id": "req_example_id"
}
```

### Top-level fields

| Field            | Type    | Description                                                    |
| ---------------- | ------- | -------------------------------------------------------------- |
| `code`           | integer | Business-level response code returned by the service           |
| `message`        | string  | Response message                                               |
| `status`         | string  | Request status, such as `finished`                             |
| `version`        | string  | Extract service version                                        |
| `duration`       | integer | Total processing time reported by the service, in milliseconds |
| `part_durations` | object  | Timing breakdown for internal processing stages                |
| `result`         | object  | Extraction result object                                       |
| `x_request_id`   | string  | Request identifier returned with every response                |

### part\_durations fields

Observed fields in `part_durations` include:

| Field               | Type    | Description                  |
| ------------------- | ------- | ---------------------------- |
| `parse_duration`    | integer | Parse stage duration         |
| `doc_cvt_duration`  | integer | Document conversion duration |
| `retrieve_duration` | integer | Retrieval stage duration     |
| `prompt_duration`   | integer | Prompt preparation duration  |
| `llm_duration`      | integer | LLM inference duration       |
| `format_duration`   | integer | Output formatting duration   |

All duration values are reported in milliseconds.

## The result object

The result object can include the following fields:

| Field              | Type    | Description                                                            |
| ------------------ | ------- | ---------------------------------------------------------------------- |
| `extracted_schema` | object  | Structured data returned according to your schema                      |
| `citations`        | object  | Field-level source citations, returned when citation output is enabled |
| `pages`            | array   | Page-level processing metadata                                         |
| `stamps`           | array   | Stamp results, returned when stamp output is enabled                   |
| `success_count`    | integer | Number of pages processed successfully                                 |
| `usage`            | object  | Usage metadata returned by the service                                 |

## The extracted\_schema object

The `result.extracted_schema` object contains the extracted data in the structure defined by your schema.

### Field behavior

* String fields that cannot be extracted may be returned as empty strings.
* Array fields that cannot be extracted may be returned as empty arrays.
* The current response format does not force missing fields to return `null`.
* Number and integer fields are returned according to the schema type when a value is extracted successfully.
* Enum fields return one of the predefined values defined in the schema when a value is extracted successfully.

### Example: full response with extracted\_schema

```json theme={null}
{
  "code": 200,
  "message": "Success",
  "status": "finished",
  "version": "v3.x.x",
  "duration": 28450,
  "part_durations": {
    "parse_duration": 0,
    "doc_cvt_duration": 48,
    "retrieve_duration": 0,
    "prompt_duration": 0,
    "llm_duration": 26950,
    "format_duration": 12
  },
  "result": {
    "extracted_schema": {
      "purchase_order": "PO-100045",
      "purchase_date": "2026-02-10",
      "total": "$1,250.00",
      "vendor_name": "Example Supplier Inc.",
      "ship_to_name": "Example Distribution Center"
    },
    "pages": [
      {
        "height": 1584,
        "width": 1224,
        "angle": 0,
        "status": "Success",
        "durations": 0,
        "page_number": 1,
        "image_id": ""
      }
    ],
    "stamps": [],
    "success_count": 1,
    "usage": {
      "acgpt_request_number": 3,
      "prompt_tokens": 0,
      "completion_tokens": 0,
      "total_tokens": 0,
      "request_number": 0,
      "acgpt_prompt_tokens": 4200,
      "acgpt_completion_tokens": 120,
      "acgpt_total_tokens": 4320
    }
  },
  "x_request_id": "req_example_id"
}
```

## Citations

The `result.citations` object identifies the source location of extracted values.

When citation output is enabled, the response can include a `citations` object keyed by field name.

### Example: full response with citations

```json theme={null}
{
  "code": 200,
  "message": "Success",
  "status": "finished",
  "version": "v3.x.x",
  "duration": 28450,
  "part_durations": {
    "parse_duration": 0,
    "doc_cvt_duration": 48,
    "retrieve_duration": 0,
    "prompt_duration": 0,
    "llm_duration": 26950,
    "format_duration": 12
  },
  "result": {
    "extracted_schema": {
      "purchase_order": "PO-100045"
    },
    "citations": {
      "purchase_order": {
        "value": "PO-100045",
        "bounding_regions": [
          {
            "page_number": 1,
            "position": [326, 478, 638, 478, 638, 521, 326, 521],
            "text": "PO-100045"
          }
        ],
        "llm_confidence": 0.97,
        "llm_confidence_level": "high"
      }
    },
    "pages": [
      {
        "height": 1584,
        "width": 1224,
        "angle": 0,
        "status": "Success",
        "durations": 0,
        "page_number": 1,
        "image_id": ""
      }
    ],
    "stamps": [],
    "success_count": 1,
    "usage": {
      "acgpt_request_number": 3,
      "prompt_tokens": 0,
      "completion_tokens": 0,
      "total_tokens": 0,
      "request_number": 0,
      "acgpt_prompt_tokens": 4200,
      "acgpt_completion_tokens": 120,
      "acgpt_total_tokens": 4320
    }
  },
  "x_request_id": "req_example_id"
}
```

### Citation fields

| Field                  | Type   | Description                                 |
| ---------------------- | ------ | ------------------------------------------- |
| `value`                | string | Extracted value for the field               |
| `llm_confidence`       | number | LLM confidence score, when available        |
| `llm_confidence_level` | string | Confidence label, when available            |
| `bounding_regions`     | array  | Source regions used for the extracted value |

### Bounding region fields

| Field         | Type    | Description                                  |
| ------------- | ------- | -------------------------------------------- |
| `page_number` | integer | Page number, starting at 1                   |
| `text`        | string  | Source text used for the citation            |
| `position`    | array   | Four-point bounding box in pixel coordinates |

### Coordinate format

Citation positions use four-point bounding boxes:

```text theme={null}
[x1, y1, x2, y2, x3, y3, x4, y4]
```

The four points are ordered as:

```text theme={null}
(x1,y1) -------- (x2,y2)
   |                |
   |  Field Area    |
   |                |
(x4,y4) -------- (x3,y3)
```

## Pages

The `result.pages` field contains page-level processing metadata.

Observed page fields include:

| Field         | Type    | Description                                                       |
| ------------- | ------- | ----------------------------------------------------------------- |
| `page_number` | integer | Page number, starting at 1                                        |
| `width`       | integer | Page width in pixels                                              |
| `height`      | integer | Page height in pixels                                             |
| `angle`       | integer | Page rotation angle reported by the service                       |
| `status`      | string  | Page processing status, such as `Success`                         |
| `image_id`    | string  | Internal page image identifier; may be an empty string            |
| `durations`   | number  | Page processing duration reported by the service, in milliseconds |

### Example: pages metadata

```json theme={null}
{
  "pages": [
    {
      "height": 1584,
      "width": 1224,
      "angle": 0,
      "status": "Success",
      "durations": 0,
      "page_number": 1,
      "image_id": ""
    }
  ]
}
```

## Stamps

The `result.stamps` field is returned as an array when stamp output is enabled.

If no stamps are detected, the field may be returned as an empty array:

```json theme={null}
{
  "stamps": []
}
```

When stamp results are returned, each item can include the following fields:

| Field         | Type   | Description                           |
| ------------- | ------ | ------------------------------------- |
| `color`       | string | Stamp color                           |
| `position`    | array  | Four-point bounding box for the stamp |
| `stamp_shape` | string | Stamp shape                           |
| `type`        | string | Stamp type                            |
| `value`       | string | Recognized stamp text                 |

## Usage

The `result.usage` field contains usage metadata returned by the service.

Observed fields include:

| Field                     | Type    | Description                                  |
| ------------------------- | ------- | -------------------------------------------- |
| `acgpt_request_number`    | integer | Number of internal ACGPT requests            |
| `prompt_tokens`           | integer | Prompt token count for the standard path     |
| `completion_tokens`       | integer | Completion token count for the standard path |
| `total_tokens`            | integer | Total token count for the standard path      |
| `request_number`          | integer | Number of requests for the standard path     |
| `acgpt_prompt_tokens`     | integer | Prompt token count for the ACGPT path        |
| `acgpt_completion_tokens` | integer | Completion token count for the ACGPT path    |
| `acgpt_total_tokens`      | integer | Total token count for the ACGPT path         |

### Example: usage metadata

```json theme={null}
{
  "usage": {
    "acgpt_request_number": 3,
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0,
    "request_number": 0,
    "acgpt_prompt_tokens": 4200,
    "acgpt_completion_tokens": 120,
    "acgpt_total_tokens": 4320
  }
}
```

## Extract-specific errors

Most authentication, file, and request validation errors are shared across Parse and Extract. See [Errors](/xparse/errors) for the full common error reference.

The following errors are specific to Extract:

| Code    | Description           | Solution                                                    |
| ------- | --------------------- | ----------------------------------------------------------- |
| `40306` | QPS limit exceeded    | Reduce request rate or request a higher limit.              |
| `50011` | LLM connection failed | Retry the request. Contact support if the problem persists. |
| `50012` | LLM engine failed     | Retry the request. Contact support if the problem persists. |

## Related resources

<CardGroup cols={3}>
  <Card title="Extract Quickstart" icon="rocket" href="/xparse/extract/quickstart">
    Extract your first document.
  </Card>

  <Card title="Schema Guide" icon="book" href="/xparse/extract/schema-guide">
    Create extraction schemas.
  </Card>

  <Card title="Best Practices" icon="lightbulb" href="/xparse/extract/best-practices">
    Improve extraction accuracy.
  </Card>

  <Card title="Errors" icon="triangle-exclamation" href="/xparse/errors">
    Review common error codes.
  </Card>

  <Card title="Supported Files & Limits" icon="file" href="/xparse/supported-files">
    Review supported formats and limits.
  </Card>
</CardGroup>
