---
title: "[Beta] Get AI Metadata for a Document"
method: GET
path: "/public/beta/documents/{document_id}/ai-metadata"
tags: ["Documents"]
---

# \[Beta\] Get AI Metadata for a Document

`GET /public/beta/documents/{document_id}/ai-metadata`

## Request

- Base URL: `https://api.pandadoc.com`
- URL: `https://api.pandadoc.com/public/beta/documents/{document_id}/ai-metadata`
- Auth: one of:
  - API key in header `Authorization`
  - OAuth 2
    - Authorization code: `https://app.pandadoc.com/oauth2/authorize`
    - Token URL: `https://api.pandadoc.com/oauth2/access_token`
- TypeScript: <https://skmtc.dev/pandadoc/apis/pandadoc-public-api/docs/public/beta/documents/:document_id/ai-metadata/get.ts> (a function with typed inputs; its response is checked against the schema)

Returns the AI metadata fields populated for the document. Each result combines the field definition (`id`, `key`, `field_type`, `settings`) with the extracted value (`value`, `acceptance_status`).

Only fields that have an extracted value for the document are returned.

The endpoint signals AI extraction state via the HTTP status code:

- `202 extraction_pending` — extraction is in progress. Clients
  should retry after the number of seconds indicated in the
  `Retry-After` header.

- `204 No Content` — extraction has terminally failed for this
  document. No body is returned; retrying will not help — contact
  support.

- `409 not_started` — extraction has not been triggered for this
  document (typically because the document is not yet completed).

## Path parameters

- `document_id` string, required

## Query parameters

- `limit` integer
- `offset` integer

## Response `200`

AI metadata is available. Returns the fields populated for the document. `results` is empty when nothing has been extracted yet.

- AIMetadataResponse: Page of AI metadata fields populated for a document.
  - `count` integer, required: Total number of AI metadata fields available for the document across all pages. The current page slice is in `results` and is bounded by `limit` and `offset`.
  - `results` AIMetadataField[], required: AI metadata fields populated for the document. Each entry combines the field definition with the extracted value. Empty when nothing has been extracted yet.
    - `id` string, required: Stable identifier of the metadata field definition. The same identifier appears for the same field across every document.
    - `key` string, required: Human-readable field key (e.g. `Contract value`, `Counterparty name`, `Expiration date`).
    - `field_type` 'single_line' | 'multi_line' | 'date' | 'number' | 'dropdown' | 'checkbox' | 'url' | 'duration' | 'percent' | 'currency' | 'signature_info', required: Data type of an AI metadata field.
    - `settings` object, required: Field-type-specific configuration (e.g. available `period` units for `duration`, allowed `items` for `dropdown`). Empty object when the field has no configuration.
    - `value` AIMetadataValue: Extracted value for an AI metadata field on a document.
      - `value` string, required: The extracted or entered value, serialised as a string. Interpretation depends on the parent field's `field_type` (e.g. an ISO-8601 date for `date`, an amount with currency for `currency`, a boolean literal for `checkbox`).
      - `acceptance_status` 'pending' | 'accepted', required: Acceptance state of an AI metadata value.

## Other responses

- `202`: AI extraction has not yet finished for this document. Retry after the number of seconds indicated in the `Retry-After` header.
- `204`: AI extraction has terminally failed for this document. No body is returned; retrying will not help — contact support.
- `401`: Authentication error
- `403`: Permission error
- `404`: Not found error
- `409`: Document is in an incorrect state to process the request.
- `429`: Too many requests error

---

[API](https://skmtc.dev/pandadoc/apis/pandadoc-public-api.md) - [All operations](https://skmtc.dev/pandadoc/apis/pandadoc-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/pandadoc/apis/pandadoc-public-api/revisions/b9a306b1a421?raw)
