{
  "info": {
    "name": "External API V1",
    "description": "External API V1 collection (v1.30.0, updated 2026-11-18). Field reference: https://www.invoice-converter.com/developer-api/v1/openapi.json. Guide: https://www.invoice-converter.com/en/developer-api.\n\nSet the collection variables base_url, api_key (a live icp_... key), and idempotency_key. Run the Happy Path folder in order: convert, poll status, download result, download validation report.\n\nRate limits per API key and endpoint (fixed calendar-minute and calendar-hour windows): POST /invoices:convert 30/min, 500/h; POST /invoices:convert-structured 30/min, 500/h; GET /tasks/{task_id} 60/min, 1500/h; GET /tasks/{task_id}/result 60/min, 1000/h; GET /tasks/{task_id}/validation-report 30/min, 500/h; POST, GET, DELETE /webhook-endpoint 30/min, 300/h; POST /webhook-endpoint:test 5/min, 50/h; on 429, wait Retry-After and retry with the same Idempotency-Key.\n\nBursts: start with about 2–4 conversions in flight. API uploads collectively use at most half the processing queue per backend process, rounded down. A full queue or API share returns 503 SERVER_BUSY with Retry-After: 15 before conversion rate or unit reservation; wait and retry with the same Idempotency-Key. V1 has no batch or task-list endpoints: poll each task, or register a completion webhook (Webhooks folder).\n\nPolling: first status call about 20 s after the 202, then 20, 30, 45, 60 s, then every 60 s; stop on completed or failed; give up after about 16 minutes.\n\nUploads bypass the Vercel Function. Source/carrier file ≤ 20 MB; structured data parts ≤ 2 MB total. Multipart body ≤ 21 MB (document) or 23 MB (structured), including 1 MB overhead. Over-limit requests return JSON 413 PAYLOAD_TOO_LARGE with details.limit_bytes.\n\nErrors: branch on the JSON code, and for 500 TASK_FAILED on details.code and details.retryable, never on the HTTP status alone. The full code catalog with retry guidance is ErrorEnvelope.code in the OpenAPI document.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://www.invoice-converter.com"
    },
    {
      "key": "api_key",
      "value": ""
    },
    {
      "key": "correlation_id",
      "value": "11111111-1111-4111-8111-111111111111"
    },
    {
      "key": "idempotency_key",
      "value": "idem-convert-001"
    },
    {
      "key": "task_id",
      "value": ""
    },
    {
      "key": "client_reference",
      "value": "ERP-2026-0001"
    },
    {
      "key": "source_system",
      "value": "acme-erp"
    },
    {
      "key": "bad_api_key",
      "value": "icp_invalid_key"
    },
    {
      "key": "webhook_url",
      "value": "https://erp.example.com/hooks/invoice-converter"
    }
  ],
  "item": [
    {
      "name": "Happy Path",
      "item": [
        {
          "name": "1) Convert Invoice (202)",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('convert accepted', function () {",
                  "  pm.expect(pm.response.code).to.eql(202);",
                  "});",
                  "var body = pm.response.json();",
                  "pm.test('task_id returned', function () {",
                  "  pm.expect(body.task_id).to.be.a('string').and.not.empty;",
                  "});",
                  "if (body.task_id) { pm.collectionVariables.set('task_id', body.task_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotency_key}}"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": ""
                },
                {
                  "key": "format",
                  "type": "text",
                  "value": "XRECHNUNG"
                },
                {
                  "key": "profile",
                  "type": "text",
                  "value": "XRECHNUNG",
                  "disabled": true,
                  "description": "Optional. format=XRECHNUNG accepts only profile XRECHNUNG (its default). See the format x profile table in the OpenAPI operation description."
                },
                {
                  "key": "jurisdiction",
                  "type": "text",
                  "value": "DE",
                  "disabled": true
                },
                {
                  "key": "transaction_scope",
                  "type": "text",
                  "value": "B2G",
                  "disabled": true
                },
                {
                  "key": "delivery_channel",
                  "type": "text",
                  "value": "DIRECT_XML",
                  "disabled": true
                },
                {
                  "key": "client_reference",
                  "type": "text",
                  "value": "{{client_reference}}"
                },
                {
                  "key": "source_system",
                  "type": "text",
                  "value": "{{source_system}}"
                },
                {
                  "key": "email_input",
                  "type": "text",
                  "value": "Bitte die Bestellnummer PO-42 uebernehmen.",
                  "description": "Optional raw free-text customer instructions in any language, PDF sources only, max 10000 characters, sent without email block markers. All AI extraction and correction steps receive the text separately from the invoice source text. Cannot be combined with use_embedded_xml=true and is not accepted by invoices:convert-structured. The normalized text is part of the idempotency request identity. Invalid input returns 400 INVALID_EMAIL_INPUT before any unit is reserved. Standard invoice validation still applies.",
                  "disabled": true
                },
                {
                  "key": "use_embedded_xml",
                  "type": "text",
                  "value": "true",
                  "description": "Optional, default false. Embedded Factur-X, ZUGFeRD, or XRechnung XML inside a PDF is ignored unless this field is explicitly true. Invalid values return 400 INVALID_EMBEDDED_XML_POLICY.",
                  "disabled": true
                },
                {
                  "key": "use_seller_master_data",
                  "type": "text",
                  "value": "true",
                  "description": "Optional. When omitted, the tenant profile default applies; false ignores saved seller defaults for this request. Invalid values return 400 INVALID_SELLER_MASTER_DATA.",
                  "disabled": true
                },
                {
                  "key": "seller_master_data",
                  "type": "text",
                  "value": "{\"business_name\":\"ACME GmbH\",\"street\":\"Musterstr. 1\",\"postal_code\":\"10115\",\"city\":\"Berlin\",\"country\":\"DE\",\"vat_id\":\"DE123456789\"}",
                  "description": "Optional JSON object string with request-scoped seller defaults; used only when use_seller_master_data=true. electronic_address and electronic_address_scheme must be supplied together or both omitted; an incomplete pair returns 400 INVALID_SELLER_MASTER_DATA. Every supplied profile value replaces the corresponding extracted seller or payment value; differences create non-blocking warnings. Invalid JSON or unsupported fields return 400 INVALID_SELLER_MASTER_DATA.",
                  "disabled": true
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/api/v1/invoices:convert",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "invoices:convert"
              ]
            },
            "description": "Uploads one PDF, DOCX, or TXT invoice and starts a strict async conversion. format is required; profile is optional. Embedded XML in a PDF is ignored unless use_embedded_xml=true. email_input carries optional free-text instructions (PDF source only, max 10000 characters, not with use_embedded_xml=true). The Idempotency-Key must match ^[A-Za-z0-9][A-Za-z0-9._:-]{0,199}$. Branch on status (pending or processing), not on message. Rate limit: 30/min and 500/h."
          }
        },
        {
          "name": "1b) Convert Structured Invoice (202)",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('structured convert accepted', function () {",
                  "  pm.expect(pm.response.code).to.eql(202);",
                  "});",
                  "var body = pm.response.json();",
                  "pm.test('structured task_id returned', function () {",
                  "  pm.expect(body.task_id).to.be.a('string').and.not.empty;",
                  "});",
                  "if (body.task_id) { pm.collectionVariables.set('task_id', body.task_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotency_key}}-structured"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "pdf_file",
                  "type": "file",
                  "src": ""
                },
                {
                  "key": "data_file",
                  "type": "file",
                  "src": "",
                  "description": "Invoice data: `.json`, `.csv`, `.xml`, `.xlsx`, or `.txt` (≤ 2 MB total). Canonical JSON (top level or wrapped in `invoice_data`), consistent canonical JSON parts, and one UBL 2.1 Invoice / CII D16B XML file map without AI; other formats use AI mapping. Unknown canonical fields and conflicting bundle facts return `400 INVALID_UPLOAD`. Repeat the part for one invoice split across files; all parts need the same invoice number, and canonical lines need unique explicit IDs. Schema: https://www.invoice-converter.com/developer-api/v1/invoice-data.schema.json. The field names `data_files` and `data_files[]` are accepted as aliases."
                },
                {
                  "key": "format",
                  "type": "text",
                  "value": "ZUGFERD"
                },
                {
                  "key": "external_invoice_id",
                  "type": "text",
                  "value": "{{client_reference}}"
                },
                {
                  "key": "source_system",
                  "type": "text",
                  "value": "{{source_system}}"
                },
                {
                  "key": "use_seller_master_data",
                  "type": "text",
                  "value": "true",
                  "description": "Optional. When omitted, the tenant profile default applies; false ignores saved seller defaults for this request. Invalid values return 400 INVALID_SELLER_MASTER_DATA.",
                  "disabled": true
                },
                {
                  "key": "seller_master_data",
                  "type": "text",
                  "value": "{\"business_name\":\"ACME GmbH\",\"street\":\"Musterstr. 1\",\"postal_code\":\"10115\",\"city\":\"Berlin\",\"country\":\"DE\",\"vat_id\":\"DE123456789\"}",
                  "description": "Optional JSON object string with request-scoped seller defaults; used only when use_seller_master_data=true. electronic_address and electronic_address_scheme must be supplied together or both omitted; an incomplete pair returns 400 INVALID_SELLER_MASTER_DATA. Every supplied profile value replaces the corresponding extracted seller or payment value; differences create non-blocking warnings. Invalid JSON or unsupported fields return 400 INVALID_SELLER_MASTER_DATA.",
                  "disabled": true
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/api/v1/invoices:convert-structured",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "invoices:convert-structured"
              ]
            },
            "description": "Uploads a carrier PDF plus invoice data. Canonical JSON, consistent canonical JSON parts, and one UBL 2.1 Invoice / CII D16B XML file map without AI. Other source shapes and mixed-format parts use AI mapping. All split parts need the same invoice number; invoiceNumber and Invoice_Number__c columns are recognized. Unknown canonical JSON fields or conflicting bundle facts return 400 INVALID_UPLOAD before task creation; inspect details.unknown_paths or details.path. Lines in each canonical part require unique explicit IDs; identical repeated lines across parts are deduplicated. The pdf_file never supplies invoice data. data_file parts are limited to 2 MB total. Rate limit: 30/min and 500/h. Schema: https://www.invoice-converter.com/developer-api/v1/invoice-data.schema.json. Example: https://www.invoice-converter.com/developer-api/v1/invoice-data.example.json. Carrier PDF ≤ 20 MB; whole multipart body ≤ 23 MB. Over-limit requests return JSON 413 PAYLOAD_TOO_LARGE with details.limit_bytes."
          }
        },
        {
          "name": "2) Poll Task Status (200)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v1/tasks/{{task_id}}",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "tasks",
                "{{task_id}}"
              ],
              "query": [
                {
                  "key": "include_validation_report_html",
                  "value": "true",
                  "description": "Optional. Enable only when the polling response should inline sanitized validation report HTML. Values other than true/false return 400 INVALID_QUERY_PARAMETER.",
                  "disabled": true
                }
              ]
            },
            "description": "Polls task state: pending, processing, completed, or failed. First call about 20 s after the 202, then back off (20, 30, 45, 60 s, then every 60 s) and stop on completed or failed. Rate limit: 60/min and 1500/h. After completion the task is kept for 24 hours; an unknown or expired task returns 404 TASK_NOT_FOUND on every task endpoint."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const body = pm.response.json();",
                  "pm.test('completed status includes result_artifacts diagnostics', function () {",
                  "  if (body.status === 'completed') {",
                  "    pm.expect(body.result_artifacts).to.be.an('object');",
                  "  }",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "3) Fetch Result XML (200 | 202 | 422)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v1/tasks/{{task_id}}/result?download=xml",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "tasks",
                "{{task_id}}",
                "result"
              ],
              "query": [
                {
                  "key": "download",
                  "value": "xml"
                }
              ]
            },
            "description": "Downloads the validated XML artifact. Pure retrieval: nothing is generated or validated on this call. 202 TASK_NOT_READY (error envelope, not a file) while processing. For XML formats download=xml is the primary artifact; a 500 INTERNAL_ARTIFACT_INVARIANT_FAILED here is not normal, so escalate it with the correlation ID. Successful downloads carry X-Correlation-ID, X-Artifact-Sha256, X-Validation-Proof-Id, and further proof headers. Rate limit: 60/min and 1000/h."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "if (pm.response.code === 200) {",
                  "  pm.test('successful XML result returned a file payload', function () {",
                  "    pm.expect(pm.response.headers.get('Content-Type')).to.match(/application\\/(xml|pdf)|text\\/xml/);",
                  "  });",
                  "  pm.test('artifact proof headers present', function () {",
                  "    pm.expect(pm.response.headers.get('X-Artifact-Sha256')).to.be.a('string').and.not.empty;",
                  "    pm.expect(pm.response.headers.get('X-Validation-Proof-Id')).to.be.a('string').and.not.empty;",
                  "  });",
                  "} else {",
                  "  const body = pm.response.json();",
                  "  pm.test('non-ready or failed result uses documented error code', function () {",
                  "    pm.expect([",
                  "      'TASK_NOT_READY',",
                  "      'VALIDATION_FAILED',",
                  "      'DOCUMENT_NOT_CONVERTIBLE',",
                  "      'TASK_FAILED',",
                  "      'INTERNAL_ARTIFACT_INVARIANT_FAILED',",
                  "      'ARTIFACT_GENERATION_RERUN_REQUIRED',",
                  "      'EXTRACTION_INCOMPLETE_GROUP_FAILURE',",
                  "      'TASK_NOT_FOUND'",
                  "    ]).to.include(body.code);",
                  "  });",
                  "  pm.test('500 TASK_FAILED is terminal unless details.retryable says otherwise', function () {",
                  "    if (body.code === 'TASK_FAILED') {",
                  "      pm.expect(body.details).to.be.an('object');",
                  "      pm.expect(body.details.code).to.be.a('string');",
                  "    }",
                  "  });",
                  "}"
                ]
              }
            }
          ]
        },
        {
          "name": "4) Fetch Result PDF (200 | 202 | 422)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v1/tasks/{{task_id}}/result?download=pdf",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "tasks",
                "{{task_id}}",
                "result"
              ],
              "query": [
                {
                  "key": "download",
                  "value": "pdf"
                }
              ]
            },
            "description": "download=pdf returns the hybrid ZUGFeRD/Factur-X PDF for format=ZUGFERD and a best-effort rendering for the XML formats (it can be unavailable while download=xml succeeds). Rate limit: 60/min and 1000/h."
          }
        },
        {
          "name": "5) Fetch Validation Report (200 | 202 | 404)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v1/tasks/{{task_id}}/validation-report?download=html",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "tasks",
                "{{task_id}}",
                "validation-report"
              ],
              "query": [
                {
                  "key": "download",
                  "value": "html"
                }
              ]
            },
            "description": "Downloads the validation report bound to the delivered artifact. download is required: html for people, xml for the KoSIT report or Factur-X validation-evidence XML (source=facturx_php). X-Artifact-Sha256 on this endpoint is the hash of the validated result artifact, not of the report bytes. Rate limit: 30/min and 500/h."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('validation report response is expected status', function () {",
                  "  pm.expect([200, 202, 404, 409, 422]).to.include(pm.response.code);",
                  "});",
                  "if (pm.response.code === 200) {",
                  "  pm.test('report proof headers present', function () {",
                  "    pm.expect(pm.response.headers.get('X-Artifact-Sha256')).to.be.a('string').and.not.empty;",
                  "    pm.expect(pm.response.headers.get('X-Validation-Proof-Id')).to.be.a('string').and.not.empty;",
                  "    pm.expect(pm.response.headers.get('X-Validation-Report-Content-Type')).to.be.a('string').and.not.empty;",
                  "  });",
                  "}"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Error Scenarios",
      "description": "Error-path probes. Branch on the JSON code; the full catalog with HTTP status and retry guidance is ErrorEnvelope.code in the OpenAPI document.\n\nRetry with the same Idempotency-Key: 429 RATE_LIMITED and 503 SERVER_BUSY (full processing queue) after Retry-After, 409 IDEMPOTENCY_IN_PROGRESS, 502/504 PROXY_ERROR, and 503 AUTH_SERVICE_UNAVAILABLE, PLAN_TIER_CHECK_FAILED, RATE_LIMIT_SERVICE_UNAVAILABLE, API_CREDIT_SERVICE_UNAVAILABLE, UPLOAD_FAILED (other acceptance failure).\nStart a new conversion with a new key: 409 ARTIFACT_GENERATION_RERUN_REQUIRED (for example details.code AUTHORITATIVE_VALIDATION_UNAVAILABLE), 409 EXTRACTION_INCOMPLETE_GROUP_FAILURE, and 500 TASK_FAILED when details.retryable is true.\nDo not retry: other 4xx (fix the request, the data in details.items, or the source document for 422 DOCUMENT_NOT_CONVERTIBLE; buy credits or activate API access at details.action_url for 402/403), 500 TASK_FAILED with details.retryable false or absent, 500 INTERNAL_ARTIFACT_INVARIANT_FAILED (escalate).",
      "item": [
        {
          "name": "400 Missing Idempotency-Key",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('missing key is rejected', function () {",
                  "  pm.expect(pm.response.code).to.eql(400);",
                  "});",
                  "var body = pm.response.json();",
                  "pm.test('error code is IDEMPOTENCY_KEY_REQUIRED', function () {",
                  "  pm.expect(body.code).to.eql('IDEMPOTENCY_KEY_REQUIRED');",
                  "});"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": ""
                },
                {
                  "key": "format",
                  "type": "text",
                  "value": "XRECHNUNG"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/api/v1/invoices:convert",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "invoices:convert"
              ]
            }
          }
        },
        {
          "name": "400 Invalid Idempotency-Key Format",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('invalid key format is rejected', function () {",
                  "  pm.expect(pm.response.code).to.eql(400);",
                  "});",
                  "var body = pm.response.json();",
                  "pm.test('error code is INVALID_IDEMPOTENCY_KEY', function () {",
                  "  pm.expect(body.code).to.eql('INVALID_IDEMPOTENCY_KEY');",
                  "});"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              },
              {
                "key": "Idempotency-Key",
                "value": "invalid key with spaces"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": ""
                },
                {
                  "key": "format",
                  "type": "text",
                  "value": "XRECHNUNG"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/api/v1/invoices:convert",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "invoices:convert"
              ]
            }
          }
        },
        {
          "name": "401 Invalid API Key",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('invalid api key returns 401', function () {",
                  "  pm.expect(pm.response.code).to.eql(401);",
                  "});",
                  "var body = pm.response.json();",
                  "pm.test('error code is INVALID_API_KEY or AUTHENTICATION_REQUIRED', function () {",
                  "  pm.expect(['INVALID_API_KEY', 'AUTHENTICATION_REQUIRED']).to.include(body.code);",
                  "});"
                ]
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{bad_api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v1/tasks/11111111-1111-4111-8111-111111111111",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "tasks",
                "11111111-1111-4111-8111-111111111111"
              ]
            }
          }
        },
        {
          "name": "409 Idempotency Conflict (Seed)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              },
              {
                "key": "Idempotency-Key",
                "value": "idem-conflict-001"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": ""
                },
                {
                  "key": "format",
                  "type": "text",
                  "value": "XRECHNUNG"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/api/v1/invoices:convert",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "invoices:convert"
              ]
            }
          }
        },
        {
          "name": "409 Idempotency Conflict (Different Payload)",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('conflict or in-progress response', function () {",
                  "  pm.expect(pm.response.code).to.eql(409);",
                  "});",
                  "var body = pm.response.json();",
                  "pm.test('idempotency error code', function () {",
                  "  pm.expect(['IDEMPOTENCY_CONFLICT', 'IDEMPOTENCY_IN_PROGRESS']).to.include(body.code);",
                  "});"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              },
              {
                "key": "Idempotency-Key",
                "value": "idem-conflict-001"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": ""
                },
                {
                  "key": "format",
                  "type": "text",
                  "value": "ZUGFERD"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/api/v1/invoices:convert",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "invoices:convert"
              ]
            },
            "description": "Reuses the seeded Idempotency-Key with a different payload. IDEMPOTENCY_CONFLICT is NOT retryable - use a new key for a new payload. If the seed request is still being processed you get IDEMPOTENCY_IN_PROGRESS instead, which IS retryable with the same key after a short delay (an in-progress claim is reclaimed after 15 minutes). Once the original task is past its 24-hour retention, a replay returns the non-retryable IDEMPOTENCY_REPLAY_EXPIRED and the conversion must be restarted with a new key."
          }
        },
        {
          "name": "400 Invalid download query",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('invalid download query rejected', function () {",
                  "  pm.expect(pm.response.code).to.eql(400);",
                  "});",
                  "var body = pm.response.json();",
                  "pm.test('INVALID_DOWNLOAD_FORMAT code', function () {",
                  "  pm.expect(body.code).to.eql('INVALID_DOWNLOAD_FORMAT');",
                  "});"
                ]
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v1/tasks/{{task_id}}/result?download=zip",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "tasks",
                "{{task_id}}",
                "result"
              ],
              "query": [
                {
                  "key": "download",
                  "value": "zip"
                }
              ]
            }
          }
        },
        {
          "name": "422 Invalid format",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('invalid format is rejected', function () {",
                  "  pm.expect(pm.response.code).to.eql(422);",
                  "});",
                  "var body = pm.response.json();",
                  "pm.test('error code is INVALID_FORMAT', function () {",
                  "  pm.expect(body.code).to.eql('INVALID_FORMAT');",
                  "});"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              },
              {
                "key": "Idempotency-Key",
                "value": "idem-invalid-format-001"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": ""
                },
                {
                  "key": "format",
                  "type": "text",
                  "value": "PEPPOL"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/api/v1/invoices:convert",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "invoices:convert"
              ]
            }
          }
        },
        {
          "name": "413 Payload too large (attach a file over 20 MB)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              },
              {
                "key": "Idempotency-Key",
                "value": "idem-large-001"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": ""
                },
                {
                  "key": "format",
                  "type": "text",
                  "value": "XRECHNUNG"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/api/v1/invoices:convert",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "invoices:convert"
              ]
            },
            "description": "Uploads bypass the Vercel Function. Source/carrier file ≤ 20 MB; structured data parts ≤ 2 MB total. Multipart body ≤ 21 MB (document) or 23 MB (structured), including 1 MB overhead. Over-limit requests return JSON 413 PAYLOAD_TOO_LARGE with details.limit_bytes."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('oversized request returns the JSON size envelope', function () {",
                  "  pm.expect(pm.response.code).to.eql(413);",
                  "  const body = pm.response.json();",
                  "  pm.expect(body.code).to.eql('PAYLOAD_TOO_LARGE');",
                  "  pm.expect(body.details.limit_bytes).to.be.a('number');",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "429/503 Probe (status endpoint)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v1/tasks/{{task_id}}",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "tasks",
                "{{task_id}}"
              ]
            },
            "description": "Repeat quickly to observe 429 RATE_LIMITED (status bucket: 60/min, 1500/h). 429 responses carry Retry-After, X-RateLimit-Limit-Minute, X-RateLimit-Limit-Hour, and details.minute_count, hour_count, limit_minute, limit_hour. A dependency outage can return a retryable 503 such as AUTH_SERVICE_UNAVAILABLE or RATE_LIMIT_SERVICE_UNAVAILABLE."
          }
        },
        {
          "name": "500/502/504 Probe (result endpoint)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v1/tasks/{{task_id}}/result?download=xml",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "tasks",
                "{{task_id}}",
                "result"
              ],
              "query": [
                {
                  "key": "download",
                  "value": "xml"
                }
              ]
            },
            "description": "Depending on task state this endpoint returns 202, 409, 422, 500, 502, 503, or 504. Retry 502/504 PROXY_ERROR and retryable 503 codes. On 409 start a new conversion with a new key. Do not retry 500 TASK_FAILED unless details.retryable is true (then start a new conversion), and never retry 500 INTERNAL_ARTIFACT_INVARIANT_FAILED."
          }
        }
      ]
    },
    {
      "name": "Webhooks",
      "description": "Optional completion webhooks. Register one HTTPS endpoint for the key's company; the 201 or 200 response returns the signing secret once. Each event request carries X-Invoice-Converter-Signature: t=<unix seconds>,v1=<hex> (HMAC-SHA256 over \"<t>.<raw body>\" with the whole secret) and X-Invoice-Converter-Event-Id for deduplication; reject a t more than 5 minutes from your clock. Answer 2xx within 10 seconds; failed attempts are retried up to 8 times over about 23 hours. The event names the task; fetch the result with the task endpoints.",
      "item": [
        {
          "name": "Register or replace the webhook endpoint",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('endpoint is saved', function () {",
                  "  pm.expect(pm.response.code).to.be.oneOf([200, 201]);",
                  "});",
                  "var body = pm.response.json();",
                  "pm.test('the secret is returned once', function () {",
                  "  pm.expect(body.secret).to.match(/^whsec_/);",
                  "});"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v1/webhook-endpoint",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "webhook-endpoint"
              ]
            },
            "description": "Store the returned secret on your server; GET never returns it. Sending this request again rotates the secret.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"url\": \"{{webhook_url}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Get the webhook endpoint",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('endpoint is registered', function () {",
                  "  pm.expect(pm.response.code).to.eql(200);",
                  "});",
                  "pm.test('the secret is never returned', function () {",
                  "  pm.expect(pm.response.json()).to.not.have.property('secret');",
                  "});"
                ]
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v1/webhook-endpoint",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "webhook-endpoint"
              ]
            }
          }
        },
        {
          "name": "Send a test event",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('test event is queued', function () {",
                  "  pm.expect(pm.response.code).to.eql(202);",
                  "});",
                  "pm.test('event type is webhook.test', function () {",
                  "  pm.expect(pm.response.json().type).to.eql('webhook.test');",
                  "});"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v1/webhook-endpoint:test",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "webhook-endpoint:test"
              ]
            }
          }
        },
        {
          "name": "Delete the webhook endpoint",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('endpoint is deleted', function () {",
                  "  pm.expect(pm.response.code).to.eql(204);",
                  "});"
                ]
              }
            }
          ],
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "X-Correlation-ID",
                "value": "{{correlation_id}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v1/webhook-endpoint",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "v1",
                "webhook-endpoint"
              ]
            }
          }
        }
      ]
    }
  ]
}
