Sign in to try it

API documentation

Everything a developer needs to connect a system to AZDAN: a short guide first, then every operation with examples you can try.

Public copy, for reading

Anyone can read this page. It holds no account data and nothing can be sent from it. Calling the API always needs an API key of your own account.
Base URL
https://<your AZDAN address>

Every address on this page starts with it. It is the address of this environment only; another environment has its own address and its own API keys.

Download OpenAPI (JSON)

Getting started

  1. Before you start

    The AZDAN Integration API is plain HTTPS with JSON. Your system calls https://<your AZDAN address>/api/v1/integrations/peppol/... and AZDAN validates the document, sends it to the buyer on the Peppol network and reports it to the tax authority for you.

    You need two things: an API key (next step), and a company in this account that is linked with EmaraTax and live on Peppol. The sender of every document must be one of your own Peppol participants.

    Development and Production are separate environments, each with its own address, accounts and keys. A key from one never works on the other.

  2. Get an API key

    Sign in to the Tenant Console, open Developers › API keys and choose Create key. An Admin of the account creates keys; a Developer can see them. The key is shown once only: copy it straight into your system's secret store.

    To replace a key, create a new one, switch your system to it, then revoke the old one. If a key may have leaked, revoke it at once: requests with it are refused from that moment.

    Keep a key on your server only, never in a browser, a mobile app or source code, and use one key per system so you can revoke one without stopping the others.

    Open API keys
  3. Authenticate

    Send the key on every request in the header Authorization: Bearer <your key>. Nothing else is needed: no sign-in, no session, no cookie.

    401 means the key is missing, wrong or revoked. 403 means the key is valid but may not do this operation. A new key can validate, send and read transactions.

    A first request: your latest transaction
    curl "https://<your AZDAN address>/api/v1/integrations/peppol/transactions?limit=1" \
      -H "Authorization: Bearer $AZDAN_API_KEY"
  4. Validate, then send

    POST /validate checks an invoice or credit note against the UAE rules and sends nothing. It answers valid: true, or the list of rules that failed with the field each one is about.

    POST /invoices sends the document. It answers 202 with a transactionId as soon as the document is accepted; delivery to the buyer continues in the background, so keep the transactionId.

    Complete example bodies for an invoice and a credit note are in the reference below, under “2. Send a document”.

    Validate and send (invoice.json is the request body)
    # 1. Check the document. Nothing is sent.
    curl -X POST "https://<your AZDAN address>/api/v1/integrations/peppol/validate" \
      -H "Authorization: Bearer $AZDAN_API_KEY" \
      -H "Content-Type: application/json" \
      -d @invoice.json
    
    # 2. Send it. One Idempotency-Key per document.
    curl -X POST "https://<your AZDAN address>/api/v1/integrations/peppol/invoices" \
      -H "Authorization: Bearer $AZDAN_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: INV-2026-000123" \
      -d @invoice.json
    
    # 202 Accepted
    # { "transactionId": "txn_1789562400000_9f3a1c2b", "status": "queued", "idempotent": false, ... }
  5. Retry safely

    Send a header Idempotency-Key with every document: one value per document, 1 to 120 characters, for example your own invoice number. If the same key arrives again AZDAN returns the first transaction with idempotent: true and does not send twice; only a first attempt that failed before it left AZDAN is sent again.

    So after a timeout or a 5xx answer, send the same request again with the same key. Use a new key only for a new document. GET /transactions/by-idempotency/{key} finds the transaction of a key.

  6. Check the status and get the documents

    GET /transactions/{transactionId} returns the transaction. Its status moves from queued to sending to delivered, or ends in failed with the reason. A document you receive from a supplier has the status received.

    GET /transactions lists your transactions with filters. For a regular sync, read it page after page with limit and the cursor of the previous answer.

    The files of a transaction are under /transactions/{transactionId}/files/: invoice-xml, invoice-pdf, sbd-xml, tdd-xml and mls-xml. The documents part of the transaction says which exist.

    Read a transaction and download its PDF
    curl "https://<your AZDAN address>/api/v1/integrations/peppol/transactions/txn_1789562400000_9f3a1c2b" \
      -H "Authorization: Bearer $AZDAN_API_KEY"
    
    # The invoice as a PDF
    curl -L -o invoice.pdf "https://<your AZDAN address>/api/v1/integrations/peppol/transactions/txn_1789562400000_9f3a1c2b/files/invoice-pdf" \
      -H "Authorization: Bearer $AZDAN_API_KEY"
  7. Get notified with webhooks

    Instead of asking for the status again and again, register an HTTPS address of your system under Developers › Webhooks and choose the events you want. AZDAN then sends a JSON message to it when a transaction changes.

    Check every message before you use it. The header X-Azdan-Signature is t=<time>,v1=<signature>: compute HMAC-SHA256 of <t>.<body as received> with the signing secret of your webhook and compare. Refuse a message whose time is more than 5 minutes away from yours.

    Answer with any 2xx status within 10 seconds, then do your work. Otherwise AZDAN tries again, up to 8 times in about an hour. A repeat carries the same X-Azdan-Event-Id: ignore one you have already processed.

    Every message is signed, so the check above always works. If your endpoint also asks callers to identify themselves, choose a method under Authentication when you add the webhook: Basic (a user name and a password), API key (one secret value in a header you name), OAuth 2.0 (a Client ID and a Client Secret that AZDAN exchanges at your token URL for an access token), or custom headers (for example a Client ID and a Client Secret in two headers). What you save is stored encrypted and is never shown again; to change it, save new values.

    Every message carries X-Azdan-Event-Id (the same value is in Idempotency-Key), X-Azdan-Webhook-Id, X-Azdan-Payload-Version, X-Azdan-Timestamp and X-Azdan-Signature, and the header of your method: Authorization: Basic …, the header you named, or Authorization: Bearer …. AZDAN calls only https addresses on the public internet and does not follow redirects; the same holds for an OAuth 2.0 token URL.

    On the Webhooks page, Send test event shows exactly what AZDAN sent and what your endpoint answered. Deliveries lists every attempt with its result. Dead letters keeps the events that failed all 8 attempts, so you can send them again once your endpoint is fixed; the account's administrators get an e-mail when that happens. While a webhook is paused its events are kept for up to 7 days and sent when you resume it.

    Check a webhook message: signature, authentication, repeats
    // Node.js (Express): check a delivery before using it.
    const crypto = require("node:crypto");
    
    // 1. The signature: every message has one, whichever authentication you chose.
    //    rawBody is the body exactly as received (not parsed and written again).
    function isFromAzdan(rawBody, signatureHeader, signingSecret) {
      const parts = signatureHeader.split(",").map((p) => p.trim().split("="));
      const t = (parts.find(([k]) => k === "t") || [])[1];
      const sent = parts.filter(([k]) => k === "v1").map(([, v]) => v);
      if (!t || Math.abs(Date.now() / 1000 - Number(t)) > 300) return false; // older than 5 minutes
      const expected = crypto.createHmac("sha256", signingSecret).update(t + "." + rawBody).digest("hex");
      return sent.some((v) => v.length === expected.length &&
        crypto.timingSafeEqual(Buffer.from(v), Buffer.from(expected)));
    }
    
    // 2. The authentication you chose for the webhook. Keep only the one you use.
    const same = (a, b) => a.length === b.length && crypto.timingSafeEqual(Buffer.from(a), Buffer.from(b));
    function callerIsAllowed(req) {
      const auth = req.headers["authorization"] || "";
      // Basic: the user name and password you saved
      if (auth.startsWith("Basic ")) {
        const expected = Buffer.from(process.env.HOOK_USER + ":" + process.env.HOOK_PASSWORD).toString("base64");
        return same(auth.slice(6), expected);
      }
      // API key: the header you named, here X-API-Key
      if (req.headers["x-api-key"]) return same(String(req.headers["x-api-key"]), process.env.HOOK_API_KEY);
      // OAuth 2.0: an access token your own token URL issued. Verify it as for any caller
      // of your API: signature, expiry, audience and scope.
      if (auth.startsWith("Bearer ")) return verifyAccessToken(auth.slice(7));
      return false;
    }
    
    // 3. The endpoint: check, answer within 10 seconds, then do the work.
    app.post("/hooks/azdan", express.raw({ type: "application/json" }), (req, res) => {
      const rawBody = req.body.toString("utf8");
      if (!callerIsAllowed(req)) return res.sendStatus(401);
      if (!isFromAzdan(rawBody, req.headers["x-azdan-signature"] || "", process.env.AZDAN_WEBHOOK_SECRET)) {
        return res.sendStatus(400);
      }
      const eventId = req.headers["x-azdan-event-id"];
      if (alreadyProcessed(eventId)) return res.sendStatus(200); // a retry of an event you have
      res.sendStatus(200);
      handle(JSON.parse(rawBody));
    });
    Open Webhooks
  8. Errors

    An error is JSON with the same shape in every operation. Let your program decide on code, show message to a person, and read details (or issues when the request itself is malformed) for the rule and the field.

    What each status asks of you:

    400
    The request or the document is not valid. Correct it and send again; sending the same thing again will fail the same way.
    401
    The API key is missing, wrong or revoked.
    403
    The key may not do this operation, the sender is not one of your participants, or your subscription does not allow another production document. code says which.
    404
    No such transaction or file in your account.
    409
    This sender already sent a document of this type with this number. Nothing was sent; details names the earlier transaction.
    422
    The document is valid but could not be sent, for example because the receiver is not registered on Peppol. details gives the reason.
    429
    Too many requests. The answer is the same JSON error, with the code RATE_LIMITED and the seconds to wait in retryAfterSeconds and in the Retry-After header. Wait that long, then continue.
    5xx
    A temporary problem on the AZDAN side or on the network. Try again later with the same Idempotency-Key.
    The shape of an error
    {
      "error": {
        "code": "UNAUTHORIZED",
        "message": "Invalid API key"
      }
    }
  9. Rate limits

    Requests are counted for your account, whatever the number of its API keys, in windows of one minute and in three budgets that do not draw on each other: sending, validation and reading. Every answer says where you stand in the budget it used, in the RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset headers.

    Above a budget the answer is 429 with the code RATE_LIMITED: the same JSON error as every other. budget names the one that ran out, and retryAfterSeconds in the body and the Retry-After header both give the seconds until you may continue. The other two budgets are not affected.

    To back off: stop sending, wait those seconds, then repeat the same request. Repeat a send with the same Idempotency-Key, so the document cannot be sent twice. Do not retry without waiting: refused requests count too. Spread a large batch over time, and let webhooks tell you when a status changes instead of asking again and again.

    The budgets in this environment, in requests a minute:

    BudgetOperationsFree planPaid
    SendingPOST /invoices1060
    ValidationPOST /validate2060
    ReadingGET requests: status, lists, events and downloads60300

    From one network address, each in a minute:

    600
    requests without a valid API key. A request made with a valid key is not counted here: its account's budgets apply.
    20
    requests with the same key refused for a missing or invalid API key. After that, requests with that key from that address are answered 429 with the code TOO_MANY_AUTH_FAILURES until the minute ends: correct the key and wait. Other keys from the same address are not affected.
    200
    such refusals in all, whatever the keys. After that, every request from that address is answered the same way until the minute ends.
    What a rate-limited answer looks like
    HTTP/1.1 429 Too Many Requests
    Retry-After: 37
    RateLimit-Limit: 60
    RateLimit-Remaining: 0
    RateLimit-Reset: 37
    
    {
      "error": {
        "code": "RATE_LIMITED",
        "message": "Too many sending requests for this account. Try again in 37 seconds.",
        "retryAfterSeconds": 37,
        "budget": "send",
        "limitPerMinute": 60
      }
    }
  10. Versions and changes

    The API has a version, and it is the number in the address: this is version 1, /api/v1/integrations/peppol/.... Every answer names the version that served it in the X-Azdan-Api-Version header. The older address without a number, /api/integrations/peppol/..., is version 1 as well and keeps working; use the address with v1 in anything new.

    Inside a version nothing you rely on is removed, renamed or given another meaning. New things do arrive: operations, optional request fields, fields in answers, and values in lists such as error codes and events. So ignore a field you do not know, and give a value you do not know a default path. A change that would break a working integration gets a new number, /api/v2/...; version 1 then keeps working for at least 12 months, and its answers carry the Deprecation and Sunset headers with the date it stops.

    The UAE document rules (PINT-AE) have their own number, apart from the API's. When the authorities change them, validation follows on their date inside the same API version, and you are told ahead.

  11. Test, then go live

    Every request names the Peppol network it is for: "environment": "test" (used when you leave it out) or "environment": "production". Build and test with test; your company must be registered in the network you name.

    Before you go live: the company is live on Peppol, your system sends "environment": "production" with a key of the Production account, it retries with the same Idempotency-Key, and it checks the signature of every webhook message.

API reference

Every operation, grouped by task, with its parameters, answers and examples. This copy is for reading. To try a request with your own API key, sign in to the Tenant Console and open Developers › API documentation.

The reference is in English, the language of the API itself.

Loading the API reference…