---
title: "Extract structured data from an attachment"
method: POST
path: "/v1/messages/{id}/attachments/{attachmentId}/extract"
tags: ["Messages"]
---

# Extract structured data from an attachment

`POST /v1/messages/{id}/attachments/{attachmentId}/extract`

## Request

- Base URL: `https://api.agentboxd.com`
- URL: `https://api.agentboxd.com/v1/messages/{id}/attachments/{attachmentId}/extract`
- Auth: HTTP bearer

`{ schema: "invoice" | "receipt" | "tax_form" | {JSON Schema}, instructions? }` → `{ schema, data, model, repaired, truncated, untrusted: true }`, validated against the schema. Needs `attachments:extract` and AI processing `full`; counts toward `structured_extractions_per_month`.

Permission: `attachments:extract`.

## Path parameters

- `id` string, uuid, required
- `attachmentId` string, uuid, required

## Query parameters

- `include_unscreened` 'true' | 'false'
- `include_held` 'true' | 'false'

## Request body

- object
  - `schema` union, required
    - 'invoice' | 'receipt' | 'tax_form'
    - object
  - `instructions` string

## Response `200`

OK

- object

## Other responses

- `4XX`: Error
- `5XX`: Error

---

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