> This page is for version v2025-04-21.
> For other versions, use one of these documentation indexes:
> - v2026-02-09 (default): https://docs.extend.ai/2026-02-09/llms.txt
> - v2025-04-21: https://docs.extend.ai/2025-04-21/llms.txt
> - v2024-12-23: https://docs.extend.ai/2024-12-23/llms.txt

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.extend.ai/llms.txt
> Use this file to discover all available pages before exploring further.
>
> ## API version
> The current API version is `2026-02-09`, served at the site root (no version prefix in URLs).
> If this page URL contains `/2025-04-21/` or `/2024-12-23/`, you are reading an older API version.
> Prefer the current docs at https://docs.extend.ai/llms.txt unless the user explicitly needs that older version.
> Do not treat older-version pages as the source of truth for new integrations.

Citations are a way for you to get bounding box references and citation text for every field in your extraction.

You can enable citations in Studio in the Build tab for an extractor config under "Advanced options". Or via API by setting the `citationsEnabled` option to `true` in the extraction config.

![](/_fern-files/_img/70b44d62cb9e5566a9717afc9b98896a3639f0414bff5e6de740df5488af67a0.webp)

> **Note**
>
> To generate robust and accurate citations, we use an additional citation focused model. As a result, using citations will add a moderate increase in latency on your use case.

## Example

![](/_fern-files/_img/d0573237680f7e10161966aa1cf18ec6d4b1f5da56613a080e5ef9b965ccd8a7.webp)

```json
{
  "value": {
    "line_items": [
      {
        "unit_price": 100,
        "description": "Front and rear brake cables",
        "final_price": 100
      },
      {
        "unit_price": 15,
        "description": "New set of pedal arms",
        "final_price": 30
      },
      {
        "unit_price": 5,
        "description": "Labor 3hrs",
        "final_price": 15
      }
    ],
    "invoice_number": "US-001"
  },
  "metadata": {
    "invoice_number": {
      "citations": [
        {
          "page": 1,
          "polygon": [
            {
              "x": 612,
              "y": 231
            },
            {
              "x": 706,
              "y": 231
            },
            {
              "x": 706,
              "y": 259
            },
            {
              "x": 612,
              "y": 259
            }
          ],
          "referenceText": "US-001"
        }
      ],
      "ocrConfidence": 0.988,
      "logprobsConfidence": 1
    },
    "line_items[0]": {
      "citations": [
        {
          "page": 1,
          "polygon": [
            {
              "x": 54,
              "y": 410
            },
            {
              "x": 694,
              "y": 410
            },
            {
              "x": 694,
              "y": 442
            },
            {
              "x": 54,
              "y": 442
            }
          ],
          "referenceText": "| 1   | Front and rear brake cables | 100.00     | 100.00 |"
        }
      ],
      "ocrConfidence": 0.991,
      "logprobsConfidence": 0.562
    },
    "line_items[1]": {
      "citations": [
        {
          "page": 1,
          "polygon": [
            {
              "x": 54,
              "y": 442
            },
            {
              "x": 694,
              "y": 442
            },
            {
              "x": 694,
              "y": 476
            },
            {
              "x": 54,
              "y": 476
            }
          ],
          "referenceText": "| 2   | New set of pedal arms       | 15.00      | 30.00  |"
        }
      ],
      "ocrConfidence": 0.989,
      "logprobsConfidence": 1
    },
    "line_items[2]": {
      "citations": [
        {
          "page": 1,
          "polygon": [
            {
              "x": 54,
              "y": 475
            },
            {
              "x": 694,
              "y": 475
            },
            {
              "x": 694,
              "y": 508
            },
            {
              "x": 54,
              "y": 508
            }
          ],
          "referenceText": "| 3   | Labor 3hrs                  | 5.00       | 15.00  |"
        }
      ],
      "ocrConfidence": 0.988,
      "logprobsConfidence": 1
    },
  }
}
```

Citations are returned in the `metadata` object for each field. Learn more about [Metadata here](/2025-04-21/product/extraction/output-types#accessing-metadata).

## Citation Schema

The `polygon` and `referenceText` fields are only returned if the `citationsEnabled` option is enabled in the processor config. This can be enabled through the Studio in the Build tab under "Advanced options".

For Excel and CSV, `extraction_light` 3.8.0+ and `extraction_performance` 4.11.0+ return an optional `cellRange` in A1 notation instead of a polygon. `page` is the 1-based worksheet index for Excel and is always `1` for CSV; CSV columns start at `A` and rows at `1`.

The shape of the polygon is as follows:

```typescript
export type Citation = {
  page?: number;
  referenceText?: string | null;
  polygon?: Point[];
  cellRange?: string;
};

type Point = {
  x: number;
  y: number;
};
```

### How to use citations in pdf viewers

How to use the bounding values in order to place a bounding box on a file, depends heavily on the file type. In general though, you will need to take
the bounding box values we return and convert them to whatever coordinate system your rendering library uses or what you define if you are using a native Canvas
element approach to drawing them over an image for instance.

The values we return in the `polygon` field represent the coordinates of the bounding box on the image or page.
They indicate the points of the polygon that form the bounding box. You may need to convert these values into a format suitable for your rendering library.
If your rendering library uses a coordinate system based on percentages of the total image or page size, you would need to perform an additional conversion step.

For PDFs, here is an example of how to apply a transform to the value in order to be rendered using `react-pdf-viewer` or a similar library:

```typescript
export type HighlightArea = {
  left: number;
  top: number;
  width: number;
  height: number;
  pageIndex: number;
};

function convertPolygonToHighlightArea({
  polygon,
  pageIndex,
  pageHeight,
  pageWidth,
}: {
  polygon: Point[];
  pageIndex: number;
  pageHeight: number;
  pageWidth: number;
}): HighlightArea {
  const boundingBox = polygon.reduce(
    (acc, curr) => {
      return {
        left: Math.min(acc.left, curr.x),
        top: Math.min(acc.top, curr.y),
        right: Math.max(acc.right, curr.x),
        bottom: Math.max(acc.bottom, curr.y),
      };
    },
    { left: 0, top: 0, right: 0, bottom: 0 }
  );

  // If you are able to access the page height and width of the document, use them to calculate the highlight area
  if (pageHeight && pageWidth) {
    const highlightArea: HighlightArea = {
      height: ((boundingBox.bottom - boundingBox.top) / pageHeight) * 100 + 2,
      width: ((boundingBox.right - boundingBox.left) / pageWidth) * 100 + 2,
      top: (boundingBox.top / pageHeight) * 100 - 1,
      left: (boundingBox.left / pageWidth) * 100 - 1,
      pageIndex,
    };
    return highlightArea;
  }

  const DPI = 72; // Default DPI - calibrate this based on your product

  // Otherwise you can default to a conversion based on the zoom level of the document
  const highlightArea: HighlightArea = {
    left: boundingBox.left * 9,
    top: boundingBox.top * 9,
    width: ((boundingBox.right - boundingBox.left) * DPI) / 8,
    height: ((boundingBox.bottom - boundingBox.top) * DPI) / 8,
    pageIndex,
  };
  return highlightArea;
}
```