Unify V2 (Recommended)
Unify V2 is the recommended contract for converting and validating business documents with Complyance. It supports both direct single-document requests and bulk requests. For each document, it applies the source mapping configured for your workspace, converts the payload into a canonical GETS document, and validates the result.
Recommended for all new integrations. If you currently use the Unify V1 bulk envelope, you can continue using it while you migrate. See Migrate from Unify V1 for a step-by-step guide.
Why use Unify V2?
- Flexible requests — send one document directly or submit one or more documents in an
invoicesarray. - Explicit controls — country, environment, source, and document type are provided for every document, whether at the request root or inside each
invoices[]item. - Direct outcomes — successful documents return HTTP
200; document validation failures return HTTP422. - Actionable validation findings — errors can identify both the canonical GETS field and the corresponding path in your source payload.
- Optional diagnostics — request timing and mapping diagnostics with
debug: truewhen troubleshooting. - Minimal migration effort — your mapped source payload normally remains unchanged.
Choose the correct contract
Both contracts use the same endpoint. The new-api HTTP header selects the contract.
| Contract | new-api header | Request style | Recommended use |
|---|---|---|---|
| Unify V2 (Recommended) | true | Direct single document or self-contained documents in invoices | All new integrations and migrations |
| Unify V1 | Omitted, false, or any other value | defaults and invoices envelope | Existing integrations that still use the V1 contract |
The selector must be sent as an HTTP header. Do not put new-api in the JSON body.
Before you begin
You need:
- A Complyance API key for your workspace and target environment.
- A source mapping configured for your workspace.
- The source alias and version supplied for your integration, such as
AES:1. - A country and document type supported by that source mapping.
- The API base URL supplied for your environment.
Endpoint and authentication
POST /api/v3/unify
Authorization: Bearer <YOUR_API_KEY>
Content-Type: application/json
Accept: application/json
new-api: trueExamples in this guide use:
https://prod.gets.complyance.io/api/v3/unifyUse the base URL provided by Complyance for your environment.
Your API key must match the requested environment:
environment | Required key |
|---|---|
sandbox | Sandbox/mock API key |
production | Production API key |
An environment mismatch returns HTTP 403.
Quick start
{
"country": "AE",
"environment": "sandbox",
"purpose": "mapping",
"source": "AES:1",
"documentType": {
"base": "tax_invoice",
"modifiers": []
},
"payload": {
"invoice_data": {
"document_number": "INV-AE-1001",
"invoice_date": "2026-07-10",
"currency_code": "AED",
"tax_exclusive_amount": 2250,
"total_tax_amount": 112.5,
"total_amount": 2362.5,
"amount_due": 2362.5
},
"seller_info": {
"seller_name": "Acme LLC",
"country_code": "AE",
"vat_number": "100000000000003"
},
"buyer_info": {
"buyer_name": "Buyer LLC",
"buyer_country": "AE"
},
"line_items": [
{
"line_id": "1",
"item_name": "Electronic equipment",
"quantity": 1,
"net_price": 2250,
"line_total": 2250,
"tax_category": "S",
"tax_rate": 5,
"line_vat": 112.5
}
]
}
}The fields required inside payload depend on your configured source mapping and the applicable country rules. Use the mapping specification supplied for your integration; the payload above is representative.
Choose the purpose
Set purpose according to what the request should do:
| Value | Use when |
|---|---|
mapping | Processing the document through the Integration Engine. |
invoicing | Sending the document through the invoicing workflow. |
The examples use mapping. Change it to invoicing when you want to send an invoice. In a bulk request, set purpose separately for each invoices[] item.
Request formats
Unify V2 supports two request formats:
- Single: put one document's controls and
payloadat the request root. - Bulk: put an
invoicesarray at the request root. Everyinvoices[]item is a complete document request containing its own controls andpayload.
Do not combine the formats in one request. A bulk request has invoices at the root; fields such as country, environment, source, documentType, and payload belong inside each array item.
| Field | Required | Description |
|---|---|---|
invoices | Bulk only | Array of self-contained document requests. Omit it for a single request. |
country | Yes, per document | Country code used to resolve the mapping and validation rules, for example AE. |
environment | Yes, per document | sandbox or production. The API key must match this environment. |
purpose | Yes, per document | mapping for the Integration Engine or invoicing for sending invoices. |
source | Yes, per document | Configured source alias in name:version format, for example AES:1. |
documentType | Yes, per document | Logical document classification. |
documentType.base | Yes, per document | Base type such as tax_invoice or credit_note. |
documentType.modifiers | Yes, per document | Array of scenario modifiers. Send [] when none apply. |
documentType.variant | No | Optional subtype when required by the selected document type. |
payload | Yes, per document | Your original source-system JSON object. Do not manually convert it to GETS. |
debug | No | Set to true on a document request to request supported diagnostics during testing or troubleshooting. |
collection | No | Target collection when required: documents, receipts, or purchases. |
ingestionMethod | No | Direct API requests default to api. Most clients should omit this field unless instructed otherwise. |
documentId | No | Existing identifier for workflows that explicitly require one. Omit it for a standard new document. |
How source mapping works
Your payload can use any JSON structure supported by your configured source mapping:
{
"invoice_data": {
"document_number": "INV-1001"
},
"seller_info": {
"seller_name": "Acme LLC"
}
}The source value tells Complyance which mapping to apply. For example, the mapping may convert invoice_data.document_number into the canonical GETS field header.documentId.
The source mapping must be available to your authenticated workspace and support the requested country and document type. You do not need to rename your source fields or construct a GETS document yourself.
See the Field Mapping Reference for country-specific guidance.
Processing flow
For a standard mapping or invoicing request, Complyance:
- Authenticates the caller and checks the requested environment.
- Resolves the source mapping for the authenticated workspace.
- Maps the source payload to a canonical GETS document.
- Validates the GETS document against applicable rules.
- Generates and validates the invoice XML.
- Returns the document result or structured validation findings.
Successful single-document response
A successfully converted and validated single request returns HTTP 200:
{
"documentId": "6a7eab425227e2981a38f486",
"message": "Your invoice was validated and is ready for submission.",
"Base64XML": "PEludm9pY2U+PC9JbnZvaWNlPg=="
}| Field | Description |
|---|---|
documentId | Complyance identifier for the persisted document. Store it with your internal invoice record. |
message | Human-readable processing outcome. Use the HTTP status, not this text, for programmatic decisions. |
Base64XML | Generated invoice XML encoded as Base64. Decode it before reading or saving it as XML. |
debug | Optional diagnostics returned when debug: true is requested. |
Validation and processing errors
If mapping succeeds but GETS or XML validation fails, the API returns HTTP 422 and an errors array. Request, authentication, and source-resolution errors use other HTTP statuses and a smaller response body.
See Responses and Errors for response fields, status codes, and client-handling guidance.
Single-document and bulk workflows
Use the single format when you need to process one document directly. Use the bulk format to submit one or more documents through an invoices array:
{
"invoices": [
{
"country": "AE",
"environment": "sandbox",
"purpose": "mapping",
"source": "AES:1",
"documentType": {
"base": "tax_invoice",
"modifiers": []
},
"payload": {
"invoice_data": {
"document_number": "INV-AE-1001"
}
}
}
]
}Unlike the Unify V1 envelope, the Unify V2 bulk format does not use shared defaults. Repeat the effective country, environment, source, document type, and payload in every invoices[] item. See Examples for complete single and bulk request bodies.
Next steps
- Examples — request, debug, and XML-decoding examples.
- Responses and Errors — status codes and structured validation findings.
- Migrate from Unify V1 — field mapping, before-and-after requests, and rollout checklist.
- Field Mapping Reference — country-specific payload guidance.
- Unify V1 Integration Guide — retained for existing integrations.