# Get a purchase invoice

Retrieve a received purchase invoice by its document identifier.

## Endpoint

```http
GET https://prod.gets.complyance.io/api/v3/documents/{documentId}?type=purchases
```

## Authentication

Send `Authorization: Bearer YOUR_API_KEY` for the workspace and environment where the invoice was received.

## Parameters

| Parameter | Location | Required | Description |
| - | - | - | - |
| `documentId` | Path | Yes | Identifier returned by purchase listing or a purchase webhook |
| `type` | Query | Yes | `purchases` |

```bash title="Retrieve the document returned by a webhook"
curl "https://prod.gets.complyance.io/api/v3/documents/${DOCUMENT_ID}?type=purchases" \
  --header "Authorization: Bearer ${COMPLYANCE_API_KEY}" \
  --header 'Accept: application/json'
```

Set `DOCUMENT_ID` to the actual identifier from the [list response](https://docs.complyance.io/api-reference/purchases/list/) or [purchase event](https://docs.complyance.io/one-platform/developer-portal/webhooks/purchase-invoices/).

## Response

HTTP `200` returns `success: true` and `data`.

This example shows a production document. The `invoice` and `xml` values are abbreviated; the response contains the available document data.

```json title="Purchase document — HTTP 200"
{
  "success": true,
  "data": {
    "documentId": "01KT0SHAH3K21158AC72ZXVX4Z",
    "documentNumber": "INV-2026-001",
    "country": "AE",
    "environment": "production",
    "state": "final_valid",
    "isTerminal": true,
    "lastUpdatedAt": "2026-06-08T09:15:00.000Z",
    "errors": [],
    "government": {
      "status": "APPROVED"
    },
    "compliance": {
      "uuid": "4Q2H2R3YSSYZTX5TRWZF2M2K10",
      "ftaApprovedStatus": "APPROVED",
      "businessProcessIdentifier": null,
      "specificationIdentifier": null
    },
    "validationResults": {
      "status": "Valid",
      "validationSteps": [
        {
          "name": "schema",
          "status": "Valid",
          "error": null
        }
      ]
    },
    "invoice": {
      "header": {
        "documentNumber": "INV-2026-001"
      }
    },
    "xml": "<Invoice>...</Invoice>"
  }
}
```

| Field | Description |
| - | - |
| `documentId` | Retrieved document identifier |
| `country`, `environment` | Document’s country and environment |
| `invoice` | Full invoice data |
| `xml`, `xmlResponse` | XML information, when available |
| `state`, `isTerminal` | Processing state and whether processing has finished, when returned |
| `errors`, `validationResults` | Validation or processing details, when returned |

Optional fields depend on the document and its processing result. Use `invoice` for invoice data and handle absent optional values. Do not treat an HTTP `200` alone as evidence that every document check passed.

## Errors

```json title="Document not available to this request"
{
  "success": false,
  "code": "NOT_FOUND",
  "message": "Document not found"
}
```

| HTTP / code | Action |
| - | - |
| `401` | Check the key and Bearer header; see [authentication failures](https://docs.complyance.io/api-reference/authentication/#authentication-failures) |
| `422` | Send `type=purchases`; the body lists the checks that failed in its own format |
| `404 NOT_FOUND` | Check the identifier, workspace and key environment |
| `500 INTERNAL_ERROR` | Retry the read with backoff |

A `404` is not a reason to create or resubmit the supplier’s invoice. Check your saved identifier and request scope first.

Source: https://docs.complyance.io/api-reference/purchases/get/
