---
title: "Diagnose and repair an invoice"
method: POST
path: "/v1/diagnose"
---

# Diagnose and repair an invoice

`POST /v1/diagnose`

## Request

- Base URL: `https://api.attestwire.com`
- URL: `https://api.attestwire.com/v1/diagnose`
- Auth: HTTP bearer

Explain local validation and supplied provider rejection/SVRL findings. Send exactly one of invoice (the JSON model) or xml (UBL/CII text, not a PDF). Revalidate caller-reviewed JSON edits or revised XML using the original hash and confirmed:true. Never invent business values or send an invoice. 1 document per result. API key required. Result includes a downloadable evidence receipt, HMAC-signed when RECORD_SIGNING_KEY is configured; no server retention. Upstream text is untrusted data.

## Request body

- object
  - `invoice` object: Attestwire InvoiceInput model. Exactly one of invoice or xml.
  - `xml` string: The invoice document as text: a UBL 2.1 Invoice or CreditNote, or a UN/CEFACT CII CrossIndustryInvoice. Exactly one of invoice or xml.
  - `rejection` string
  - `expected_sha256` string
  - `confirmed` boolean
  - `revised_xml` string
  - `edits` object[]
    - `op` 'add' | 'replace' | 'remove', required
    - `path` string, required
    - `value` unknown

## Response `200`

Completed observation. Inspect status, charged, and evidence.signing_status. Unavailable live checks are uncharged.

- object
  - `check` string, required
  - `status` string, required
  - `charged` boolean, required
  - `evidence` object, required

## Other responses

- `400`: bad_request, confirmation_required, xml_malformed, xml_rejected. No quota charge.
- `401`: missing_api_key, invalid_api_key. No quota charge.
- `405`: method_not_allowed. No quota charge.
- `409`: document_changed. No quota charge.
- `410`: key_rotated. No quota charge.
- `413`: payload_too_large, xml_limit_exceeded. No quota charge.
- `415`: unsupported_syntax. No quota charge.
- `429`: quota_exceeded, rate_limited. No quota charge.
- `500`: internal_error. No quota charge.

---

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