{
    "info": {
        "name": "exdata API",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "variable": [
        {
            "key": "base_url",
            "value": "https://www.exdata.app/api/v1"
        },
        {
            "key": "api_token",
            "value": "your-test-token"
        },
        {
            "key": "document_id",
            "value": "123"
        },
        {
            "key": "extraction_run_id",
            "value": "456"
        },
        {
            "key": "physical_page",
            "value": "1"
        },
        {
            "key": "projection",
            "value": "invoice-lines.csv"
        },
        {
            "key": "preview_id",
            "value": "987"
        },
        {
            "key": "extraction_result_etag",
            "value": "\"extraction-result-789-v0\""
        }
    ],
    "auth": {
        "type": "bearer",
        "bearer": [
            {
                "key": "token",
                "value": "{{api_token}}",
                "type": "string"
            }
        ]
    },
    "item": [
        {
            "name": "Check API authentication",
            "request": {
                "method": "GET",
                "url": "{{base_url}}/ping"
            }
        },
        {
            "name": "List documents",
            "request": {
                "method": "GET",
                "url": "{{base_url}}/documents?sort=-created_at&per_page=25"
            }
        },
        {
            "name": "Upload a document",
            "request": {
                "method": "POST",
                "url": "{{base_url}}/documents",
                "header": [
                    {
                        "key": "Idempotency-Key",
                        "value": "invoice-{{$timestamp}}"
                    }
                ],
                "body": {
                    "mode": "formdata",
                    "formdata": [
                        {
                            "key": "file",
                            "type": "file",
                            "src": []
                        },
                        {
                            "key": "locale",
                            "value": "en",
                            "type": "text"
                        },
                        {
                            "key": "custom_types[]",
                            "value": "invoice",
                            "type": "text"
                        },
                        {
                            "key": "requester",
                            "value": "accounts-payable",
                            "type": "text"
                        },
                        {
                            "key": "processing_mode",
                            "value": "extraction",
                            "type": "text"
                        },
                        {
                            "key": "processing_lane",
                            "value": "standard",
                            "type": "text"
                        },
                        {
                            "key": "extraction_profile",
                            "value": "generic",
                            "type": "text"
                        }
                    ]
                }
            }
        },
        {
            "name": "Upload a document with x402 payment",
            "request": {
                "method": "POST",
                "url": "{{base_url}}/x402/extractions"
            }
        },
        {
            "name": "Retrieve an anonymous x402 extraction",
            "request": {
                "method": "GET",
                "url": "{{base_url}}/x402/extractions/{{document_id}}"
            }
        },
        {
            "name": "Retrieve a document",
            "request": {
                "method": "GET",
                "url": "{{base_url}}/documents/{{document_id}}"
            }
        },
        {
            "name": "Delete a document",
            "request": {
                "method": "DELETE",
                "url": "{{base_url}}/documents/{{document_id}}"
            }
        },
        {
            "name": "Download document thumbnail",
            "request": {
                "method": "GET",
                "url": "{{base_url}}/documents/{{document_id}}/thumbnail"
            }
        },
        {
            "name": "List document previews",
            "request": {
                "method": "GET",
                "url": "{{base_url}}/documents/{{document_id}}/previews"
            }
        },
        {
            "name": "List document extractions",
            "request": {
                "method": "GET",
                "url": "{{base_url}}/documents/{{document_id}}/extractions?include=evidence"
            }
        },
        {
            "name": "Download an extraction evidence page preview",
            "request": {
                "method": "GET",
                "url": "{{base_url}}/documents/{{document_id}}/extraction-runs/{{extraction_run_id}}/pages/{{physical_page}}/preview"
            }
        },
        {
            "name": "Download a document profile export",
            "request": {
                "method": "GET",
                "url": "{{base_url}}/documents/{{document_id}}/exports/{{projection}}"
            }
        },
        {
            "name": "Download a deterministic batch profile export",
            "request": {
                "method": "GET",
                "url": "{{base_url}}/documents/exports/{{projection}}?document_ids[]=123&document_ids[]=456"
            }
        },
        {
            "name": "Review a profile result",
            "request": {
                "method": "POST",
                "url": "{{base_url}}/documents/{{document_id}}/extractions/reviews",
                "header": [
                    {
                        "key": "Content-Type",
                        "value": "application/json"
                    },
                    {
                        "key": "Idempotency-Key",
                        "value": "extraction-review-{{$timestamp}}"
                    },
                    {
                        "key": "If-Match",
                        "value": "{{extraction_result_etag}}"
                    }
                ],
                "body": {
                    "mode": "raw",
                    "raw": "{\n    \"action\": \"correct\",\n    \"invoice_ref\": \"invoice_5f2db86e322d058b2bfd\",\n    \"entity_ref\": \"relationship_1\",\n    \"field\": \"customer_number\",\n    \"corrected_value\": \"KUNDE-10\",\n    \"reason\": \"Confirmed against the printed account block.\",\n    \"evidence_reference\": {\n        \"component_ref\": \"component_8a1f74f0f1d8c2ab\",\n        \"physical_page\": 1,\n        \"label\": \"Kundennummer\",\n        \"text\": \"Kundennummer KUNDE-10\",\n        \"source\": \"native_text\",\n        \"match\": \"manual\"\n    }\n}\n",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                }
            }
        },
        {
            "name": "Download a preview file",
            "request": {
                "method": "GET",
                "url": "{{base_url}}/previews/{{preview_id}}"
            }
        }
    ]
}
