{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-index.sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Anesya API Reference for Coding Agents","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"span","attributes":{"style":{"color":"#cdcefb","fontSize":"14px","fontWeight":"700","textTransform":"uppercase","letterSpacing":"0.05em","display":"block","marginBottom":"-30px"}},"children":["Get Started"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"anesya-api-reference-for-coding-agents","__idx":0},"children":["Anesya API Reference for Coding Agents"]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Complete, structured reference for coding agents integrating the Anesya document processing API."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This page is designed for AI coding agents and advanced automation systems that need one dense reference instead of navigating multiple pages."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["It focuses on the public Anesya API currently documented in the public schema:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Documents"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Parsings"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Extracts"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"product-summary","__idx":1},"children":["Product summary"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Anesya processes business documents and exposes a simple resource-based workflow:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["upload or reference a document"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["create a parsing"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["create an extract from a schema"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["poll until the final JSON result is available"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"core-api-facts","__idx":2},"children":["Core API facts"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Base URL:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.anesya.app"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Auth header:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-API-Key: YOUR_API_KEY"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Primary integration surface:"]}," REST API"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Public entities:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["parsing"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["extract"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Input types:"]}," document ID, public URL, pre-signed URL, multipart file, and URL list for parsing only"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"important-agent-note","__idx":3},"children":["Important agent note"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The public API schema currently documents document, parsing, and extract endpoints."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["It does ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["not"]}," document a public schema-management endpoint in this spec, even though extract creation requires a schema ID."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An agent should therefore assume:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["a valid schema ID must already exist in the workspace"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["schema creation or discovery may happen outside this public API flow"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If the user asks how to create a schema, refer to ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/tutorials/schemas/create_schema"},"children":["Create schema"]},"."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"authentication","__idx":4},"children":["Authentication"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create an API key in the dashboard, then pass it on every request:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"X-API-Key: YOUR_API_KEY\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"environment-variables","__idx":5},"children":["Environment variables"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"macos--linux","__idx":6},"children":["macOS / Linux"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"export ANESYA_API_KEY=\"YOUR_API_KEY\"\nexport ANESYA_SCHEMA_ID=\"YOUR_SCHEMA_ID\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"windows-powershell","__idx":7},"children":["Windows PowerShell"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"powershell","header":{"controls":{"copy":{}}},"source":"$env:ANESYA_API_KEY=\"YOUR_API_KEY\"\n$env:ANESYA_SCHEMA_ID=\"YOUR_SCHEMA_ID\"\n","lang":"powershell"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"minimal-authenticated-request","__idx":8},"children":["Minimal authenticated request"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X GET \"https://api.anesya.app/v0/documents\" \\\n  -H \"X-API-Key: $ANESYA_API_KEY\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"resource-model","__idx":9},"children":["Resource model"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Resource"},"children":["Resource"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Purpose"},"children":["Purpose"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"How it is created"},"children":["How it is created"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"When to use it"},"children":["When to use it"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Document"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Stored source file"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /v0/documents"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["When the source file should be reusable"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Parsing"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["OCR, markdown, page-level processing result"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /v0/parsing"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["When you need parsing output or status visibility"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Extract"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Structured JSON generated from a schema"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /v0/extract"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["When you need structured output"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"relationship-between-resources","__idx":10},"children":["Relationship between resources"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["parsing"]}," is created from a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]},", a public URL, a pre-signed URL, a multipart file, or a list of URLs"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["An ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["extract"]}," is created either:",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["from an existing ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["parsing"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["or directly from a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]},", in which case a new parsing is created first"]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"which-endpoint-should-the-agent-use","__idx":11},"children":["Which endpoint should the agent use?"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Goal"},"children":["Goal"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Endpoint"},"children":["Endpoint"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Method"},"children":["Method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Input shape"},"children":["Input shape"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Upload and store a reusable file"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/documents"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["multipart file"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Returns a document ID"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Browse stored documents"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/documents"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["query params"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Paginated response"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Retrieve one document"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/documents/{id}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["path ID"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Returns one document"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Download one document"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/documents/{id}/download"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["path ID"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Redirects to file URL"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Get OCR, markdown, pictures, and page-level processing data"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/parsing"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["document ID, URL, file, or URL list"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["URL list returns multiple parsings"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Browse parsings"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/parsing"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["query params"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Paginated response"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Retrieve one parsing"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/parsing/{id}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["path ID"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Use for polling and inspection"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Generate structured JSON from a parsing or document"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/extract"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["parsing ID or document + schema ID"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Requires ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["schema"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Retrieve one extract"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/extract/{id}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["path ID"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Use for polling and final result retrieval"]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"canonical-workflow-for-agents","__idx":12},"children":["Canonical workflow for agents"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The safest default workflow is:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["upload the file with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/documents"]}," if a reusable document reference is useful"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["create a parsing with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/parsing"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["poll ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/parsing/{id}"]}," until the parsing is final"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["create an extract with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/extract"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["poll ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/extract/{id}"]}," until the extract is final"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["consume ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["extract.result"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This is the preferred workflow when:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["the user needs OCR or markdown separately"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["the user needs observability and easy debugging"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["the input shape is complex"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["the agent should avoid hidden intermediate work"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"documents-endpoint-reference","__idx":13},"children":["Documents endpoint reference"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"get-v0documents","__idx":14},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /v0/documents"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["List stored documents."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"query-parameters","__idx":15},"children":["Query parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Page number"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["size"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Page size"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["search"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Search in filename and metadata values"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["created_at_after"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["date-time"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Filter lower bound"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["created_at_before"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["date-time"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Filter upper bound"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-shape","__idx":16},"children":["Response shape"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"count\": 1,\n  \"next\": null,\n  \"previous\": null,\n  \"results\": [\n    {\n      \"id\": \"uuid\",\n      \"filename\": \"invoice.pdf\",\n      \"file_url\": \"/v0/documents/uuid/download\",\n      \"metadata\": {\"source\": \"api\"},\n      \"page_count\": 3,\n      \"created_at\": \"2025-06-12T14:56:10.682461Z\",\n      \"updated_at\": \"2025-06-12T14:56:10.682461Z\"\n    }\n  ]\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"post-v0documents","__idx":17},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /v0/documents"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Upload one document."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"multipart-fields","__idx":18},"children":["Multipart fields"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Required"},"children":["Required"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["file"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["binary"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["yes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Source document file"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["filename"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["no"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional filename override"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["metadata"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["object"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["no"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional metadata object"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example","__idx":19},"children":["Example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST \"https://api.anesya.app/v0/documents\" \\\n  -H \"X-API-Key: $ANESYA_API_KEY\" \\\n  -F \"file=@invoice.pdf;type=application/pdf\" \\\n  -F \"filename=invoice.pdf\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"get-v0documentsid","__idx":20},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /v0/documents/{id}"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Retrieve one document by ID."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"get-v0documentsiddownload","__idx":21},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /v0/documents/{id}/download"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get the download URL for the stored file."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Important behavior:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["response status is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["302"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["agent should follow redirects if it needs the actual file"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"parsing-endpoint-reference","__idx":22},"children":["Parsing endpoint reference"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"post-v0parsing","__idx":23},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /v0/parsing"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create one or more parsings."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"supported-document-shapes","__idx":24},"children":["Supported ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]}," shapes"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Shape"},"children":["Shape"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Example"},"children":["Example"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Allowed"},"children":["Allowed"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["existing document ID"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"300f339f-da71-4f9f-80f6-c25a63baae75\""]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["yes"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["public or pre-signed URL"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"https://example.com/invoice.pdf\""]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["yes"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["multipart file"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["binary upload"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["yes"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["list of public or pre-signed URLs"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[\"https://a.pdf\", \"https://b.pdf\"]"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["yes"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"parameters","__idx":25},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Required"},"children":["Required"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Default"},"children":["Default"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["union"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["yes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["-"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Document ID, URL, binary file, or URL list"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["picture_description_enabled"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["boolean"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["no"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Enable image descriptions"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["table_verification_enabled"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["boolean"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["no"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Stronger table verification"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["model"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["enum"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["no"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PIGALLE"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PIGALLE"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PIGALLE_LITE"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["metadata"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["object"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["no"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional metadata"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"response-handling-rule","__idx":26},"children":["Response handling rule"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /v0/parsing"]}," is the most important shape-switching endpoint."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The response can be:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["one parsing object"]}," when the input is a document ID, one URL, or one file"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["an array of parsing objects"]}," when the input is a list of URLs"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An agent must not assume this endpoint always returns one object."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"canonical-json-example","__idx":27},"children":["Canonical JSON example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"document\": \"YOUR_DOCUMENT_ID\",\n  \"picture_description_enabled\": false,\n  \"table_verification_enabled\": false,\n  \"model\": \"PIGALLE\",\n  \"metadata\": {\n    \"source\": \"agent\"\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"canonical-url-list-example","__idx":28},"children":["Canonical URL-list example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"document\": [\n    \"https://example.com/doc-1.pdf\",\n    \"https://example.com/doc-2.pdf\"\n  ],\n  \"model\": \"PIGALLE_LITE\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"get-v0parsing","__idx":29},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /v0/parsing"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["List parsings."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"query-parameters-1","__idx":30},"children":["Query parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Page number"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["size"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Page size"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["search"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Search in filename and metadata values"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["One of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IN_QUEUE"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IN_PROGRESS"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FINISHED"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PARTIAL_FINISHED"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ERROR"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["created_at_after"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["date-time"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Filter lower bound"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["created_at_before"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["date-time"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Filter upper bound"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"get-v0parsingid","__idx":31},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /v0/parsing/{id}"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Retrieve one parsing."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"important-response-fields","__idx":32},"children":["Important response fields"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Meaning"},"children":["Meaning"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Current parsing state"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["markdown_content"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Extracted markdown text"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ocr_content"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["OCR payload"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pictures"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Image-level entries"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pages_total"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Total pages"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pages_success"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Successfully processed pages"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pages_failed"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Failed pages"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Error message if parsing failed"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"parsing-status-model","__idx":33},"children":["Parsing status model"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Status"},"children":["Status"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Meaning"},"children":["Meaning"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Agent action"},"children":["Agent action"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IN_QUEUE"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Waiting to start"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["keep polling"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IN_PROGRESS"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Running"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["keep polling"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FINISHED"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Completed successfully"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["safe to continue"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PARTIAL_FINISHED"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Completed with partial page failure"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["usually safe to continue"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ERROR"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Failed"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["stop and inspect ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"extract-endpoint-reference","__idx":34},"children":["Extract endpoint reference"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"post-v0extract","__idx":35},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /v0/extract"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create one extract from either:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["an existing parsing"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["or one document input plus a schema"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"required-rules","__idx":36},"children":["Required rules"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The request must include:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["schema"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The request must include exactly one of:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["parsing"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]}," is used, a new parsing is created first."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"supported-document-shapes-on-extract","__idx":37},"children":["Supported ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]}," shapes on extract"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Shape"},"children":["Shape"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Allowed"},"children":["Allowed"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["existing document ID"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["yes"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["public or pre-signed URL"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["yes"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["multipart file"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["yes"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["URL list"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["no documented support"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"parameters-1","__idx":38},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Required"},"children":["Required"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Default"},"children":["Default"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["union"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["conditional"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["-"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Existing document ID, URL, or multipart file"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["parsing"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string UUID"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["conditional"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["-"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Existing parsing ID"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["schema"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string UUID"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["yes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["-"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Existing schema ID"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["picture_description_enabled"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["boolean"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["no"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Applied only when a new parsing is created from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["table_verification_enabled"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["boolean"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["no"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Applied only when a new parsing is created from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["model"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["enum"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["no"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PIGALLE"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Applied only when a new parsing is created from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["metadata"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["object"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["no"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Applied only when a new parsing is created from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"canonical-extract-from-parsing-payload","__idx":39},"children":["Canonical extract-from-parsing payload"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"parsing\": \"YOUR_PARSING_ID\",\n  \"schema\": \"YOUR_SCHEMA_ID\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"canonical-direct-extract-payload","__idx":40},"children":["Canonical direct-extract payload"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"document\": \"YOUR_DOCUMENT_ID\",\n  \"schema\": \"YOUR_SCHEMA_ID\",\n  \"model\": \"PIGALLE\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"response-handling-rule-1","__idx":41},"children":["Response handling rule"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The extract response is one extract object."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result"]}," field can be:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," while processing"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["an object"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["an array of objects"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This is because the public schema models ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result"]}," as a generic JSON payload."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An agent must therefore treat ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["extract.result"]}," as ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["arbitrary JSON"]},", not as a fixed object shape."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"get-v0extractid","__idx":42},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /v0/extract/{id}"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Retrieve one extract."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"important-response-fields-1","__idx":43},"children":["Important response fields"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Meaning"},"children":["Meaning"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Current extract state"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Final structured JSON when finished"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Error message if extraction failed"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["schema"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Schema metadata"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["parsing"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Related parsing object"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"extract-status-model","__idx":44},"children":["Extract status model"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Status"},"children":["Status"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Meaning"},"children":["Meaning"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Agent action"},"children":["Agent action"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IN_QUEUE"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Waiting to start"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["keep polling"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IN_PROGRESS"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Running"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["keep polling"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FINISHED"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Completed successfully"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["consume ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ERROR"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Failed"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["stop and inspect ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"polling-rules-for-agents","__idx":45},"children":["Polling rules for agents"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After any successful ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/parsing"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/extract"]},":"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["store the returned resource ID"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["wait a short interval"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["call the corresponding retrieve endpoint"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["inspect ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["stop only when the resource is in a final state"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"recommended-final-states","__idx":46},"children":["Recommended final states"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parsing","__idx":47},"children":["Parsing"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FINISHED"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PARTIAL_FINISHED"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ERROR"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"extract","__idx":48},"children":["Extract"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FINISHED"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ERROR"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"canonical-pseudo-code","__idx":49},"children":["Canonical pseudo-code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"repeat\n  resource = GET by ID\n  status = resource.status\n\n  if status is final:\n    stop\n\n  wait 2 to 5 seconds\nend\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"deterministic-agent-decision-rules","__idx":50},"children":["Deterministic agent decision rules"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use these rules in order:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If the task requires OCR output, markdown content, pictures, or page-level processing visibility, use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/parsing"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If a completed parsing already exists and the task requires structured data, use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/extract"]}," with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["parsing"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If the task only needs one final structured result from one raw document, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/extract"]}," with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]}," is acceptable."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If the input is a list of URLs, use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/parsing"]}," first, then create one extract per parsing."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If reuse matters, create a stored ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]}," first with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v0/documents"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"safe-default-when-the-request-is-ambiguous","__idx":51},"children":["Safe default when the request is ambiguous"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Prefer:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["document upload"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["parsing creation"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["parsing polling"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["extract creation"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["extract polling"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This minimizes hidden behavior and improves debuggability."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"canonical-curl-workflow","__idx":52},"children":["Canonical cURL workflow"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"1-upload-a-file","__idx":53},"children":["1. Upload a file"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST \"https://api.anesya.app/v0/documents\" \\\n  -H \"X-API-Key: $ANESYA_API_KEY\" \\\n  -F \"file=@invoice.pdf;type=application/pdf\" \\\n  -F \"filename=invoice.pdf\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"2-create-a-parsing","__idx":54},"children":["2. Create a parsing"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST \"https://api.anesya.app/v0/parsing\" \\\n  -H \"X-API-Key: $ANESYA_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"document\": \"YOUR_DOCUMENT_ID\",\n    \"model\": \"PIGALLE\"\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"3-poll-the-parsing","__idx":55},"children":["3. Poll the parsing"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X GET \"https://api.anesya.app/v0/parsing/YOUR_PARSING_ID\" \\\n  -H \"X-API-Key: $ANESYA_API_KEY\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"4-create-an-extract","__idx":56},"children":["4. Create an extract"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST \"https://api.anesya.app/v0/extract\" \\\n  -H \"X-API-Key: $ANESYA_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"parsing\": \"YOUR_PARSING_ID\",\n    \"schema\": \"YOUR_SCHEMA_ID\"\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"5-poll-the-extract","__idx":57},"children":["5. Poll the extract"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X GET \"https://api.anesya.app/v0/extract/YOUR_EXTRACT_ID\" \\\n  -H \"X-API-Key: $ANESYA_API_KEY\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"common-agent-failure-modes","__idx":58},"children":["Common agent failure modes"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An agent should explicitly avoid these mistakes:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["sending both ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["parsing"]}," in the extract payload"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["omitting ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["schema"]}," when creating an extract"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["treating parsing URL-list responses as one object"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["assuming a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST"]}," response means processing is complete"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["treating ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PARTIAL_FINISHED"]}," as a hard failure without checking whether partial output is acceptable"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["trying to send a list of URLs directly to the extract endpoint"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["assuming ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["extract.result"]}," is always an object rather than generic JSON"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"error-model","__idx":59},"children":["Error model"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The public schema currently documents these common HTTP outcomes:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"HTTP status"},"children":["HTTP status"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Meaning"},"children":["Meaning"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["200"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Resource retrieved successfully"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["201"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Resource created and processing started"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["302"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Document download redirects to the file URL"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["400"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Missing or invalid request fields"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["401"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Missing or invalid API key"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["404"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Resource not found"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"common-error-shapes","__idx":60},"children":["Common error shapes"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"authentication-error","__idx":61},"children":["Authentication error"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"detail\": \"Invalid API key\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"not-found","__idx":62},"children":["Not found"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"detail\": \"Parsing not found.\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"validation-error","__idx":63},"children":["Validation error"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"detail\": \"Missing or invalid fields\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Validation errors may also be keyed by field name."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"recommended-companion-pages","__idx":64},"children":["Recommended companion pages"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/tutorials/quickstart"},"children":["API quickstart"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/tutorials/parsing"},"children":["Parsing guide"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/tutorials/extract"},"children":["Extract guide"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/tutorials/quickstart"},"children":["Quickstart polling flow"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/tutorials/n8n/n8n-parsing"},"children":["n8n parsing workflow"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/tutorials/schemas/create_schema"},"children":["Create schema"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/api/schema"},"children":["API reference"]}]}]}]},"headings":[{"value":"Anesya API Reference for Coding Agents","id":"anesya-api-reference-for-coding-agents","depth":1},{"value":"Product summary","id":"product-summary","depth":2},{"value":"Core API facts","id":"core-api-facts","depth":3},{"value":"Important agent note","id":"important-agent-note","depth":3},{"value":"Authentication","id":"authentication","depth":2},{"value":"Environment variables","id":"environment-variables","depth":3},{"value":"macOS / Linux","id":"macos--linux","depth":4},{"value":"Windows PowerShell","id":"windows-powershell","depth":4},{"value":"Minimal authenticated request","id":"minimal-authenticated-request","depth":3},{"value":"Resource model","id":"resource-model","depth":2},{"value":"Relationship between resources","id":"relationship-between-resources","depth":3},{"value":"Which endpoint should the agent use?","id":"which-endpoint-should-the-agent-use","depth":2},{"value":"Canonical workflow for agents","id":"canonical-workflow-for-agents","depth":2},{"value":"Documents endpoint reference","id":"documents-endpoint-reference","depth":2},{"value":"GET /v0/documents","id":"get-v0documents","depth":3},{"value":"Query parameters","id":"query-parameters","depth":4},{"value":"Response shape","id":"response-shape","depth":4},{"value":"POST /v0/documents","id":"post-v0documents","depth":3},{"value":"Multipart fields","id":"multipart-fields","depth":4},{"value":"Example","id":"example","depth":4},{"value":"GET /v0/documents/{id}","id":"get-v0documentsid","depth":3},{"value":"GET /v0/documents/{id}/download","id":"get-v0documentsiddownload","depth":3},{"value":"Parsing endpoint reference","id":"parsing-endpoint-reference","depth":2},{"value":"POST /v0/parsing","id":"post-v0parsing","depth":3},{"value":"Supported document shapes","id":"supported-document-shapes","depth":3},{"value":"Parameters","id":"parameters","depth":3},{"value":"Response handling rule","id":"response-handling-rule","depth":3},{"value":"Canonical JSON example","id":"canonical-json-example","depth":3},{"value":"Canonical URL-list example","id":"canonical-url-list-example","depth":3},{"value":"GET /v0/parsing","id":"get-v0parsing","depth":3},{"value":"Query parameters","id":"query-parameters-1","depth":4},{"value":"GET /v0/parsing/{id}","id":"get-v0parsingid","depth":3},{"value":"Important response fields","id":"important-response-fields","depth":4},{"value":"Parsing status model","id":"parsing-status-model","depth":3},{"value":"Extract endpoint reference","id":"extract-endpoint-reference","depth":2},{"value":"POST /v0/extract","id":"post-v0extract","depth":3},{"value":"Required rules","id":"required-rules","depth":3},{"value":"Supported document shapes on extract","id":"supported-document-shapes-on-extract","depth":3},{"value":"Parameters","id":"parameters-1","depth":3},{"value":"Canonical extract-from-parsing payload","id":"canonical-extract-from-parsing-payload","depth":3},{"value":"Canonical direct-extract payload","id":"canonical-direct-extract-payload","depth":3},{"value":"Response handling rule","id":"response-handling-rule-1","depth":3},{"value":"GET /v0/extract/{id}","id":"get-v0extractid","depth":3},{"value":"Important response fields","id":"important-response-fields-1","depth":4},{"value":"Extract status model","id":"extract-status-model","depth":3},{"value":"Polling rules for agents","id":"polling-rules-for-agents","depth":2},{"value":"Recommended final states","id":"recommended-final-states","depth":3},{"value":"Parsing","id":"parsing","depth":4},{"value":"Extract","id":"extract","depth":4},{"value":"Canonical pseudo-code","id":"canonical-pseudo-code","depth":3},{"value":"Deterministic agent decision rules","id":"deterministic-agent-decision-rules","depth":2},{"value":"Safe default when the request is ambiguous","id":"safe-default-when-the-request-is-ambiguous","depth":3},{"value":"Canonical cURL workflow","id":"canonical-curl-workflow","depth":2},{"value":"1. Upload a file","id":"1-upload-a-file","depth":3},{"value":"2. Create a parsing","id":"2-create-a-parsing","depth":3},{"value":"3. Poll the parsing","id":"3-poll-the-parsing","depth":3},{"value":"4. Create an extract","id":"4-create-an-extract","depth":3},{"value":"5. Poll the extract","id":"5-poll-the-extract","depth":3},{"value":"Common agent failure modes","id":"common-agent-failure-modes","depth":2},{"value":"Error model","id":"error-model","depth":2},{"value":"Common error shapes","id":"common-error-shapes","depth":3},{"value":"Authentication error","id":"authentication-error","depth":4},{"value":"Not found","id":"not-found","depth":4},{"value":"Validation error","id":"validation-error","depth":4},{"value":"Recommended companion pages","id":"recommended-companion-pages","depth":2}],"frontmatter":{"seo":{"title":"Anesya API Reference for Coding Agents"}},"lastModified":"2026-04-22T15:07:29.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/tutorials/agent-guide","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}