TechnoMindsSaudi digital infrastructure

Developer documentation

Fatoorah API with Node.js and TypeScript

Use the built-in fetch client or a generated OpenAPI client from server runtime. Bound timeouts, preserve request IDs, and never create a new logical operation after an uncertain transport result.

Implementation guide

What the integration should preserve.

  1. 01

    Read credentials only in server runtime.

  2. 02

    Use a stable idempotency key across network and worker retries.

  3. 03

    Validate response state before applying a downstream side effect.

  4. 04

    Log request IDs and error codes, never bearer tokens or invoice secrets.

  5. 05

    Verify webhook HMAC with the unparsed request bytes.

Relevant paths

POST /v1/zatca/invoices/generate/simplifiedGET /v1/request-logsGET /v1/usage

Example

const payload = {
  "organization_id": process.env.TECHNOMINDS_ORGANIZATION_ID!,
  "egs_unit_id": null,
  "taxpayer_profile_id": null,
  "tax_calculation_mode": "TECHNOMINDS_CALCULATES",
  "requested_invoice_type": "SIMPLIFIED_TAX_INVOICE",
  "seller": {
    "legal_name": "Synthetic Najd Retail",
    "vat_number": "310000000000003",
    "commercial_registration": null,
    "address": null,
    "branch": "Riyadh",
    "additional_identifiers": []
  },
  "buyer": {
    "legal_name": null,
    "vat_number": null,
    "commercial_registration": null,
    "address": null,
    "additional_identifiers": [],
    "buyer_type": "individual"
  },
  "supply": {
    "supply_date": "2026-08-10",
    "end_date": null,
    "purchase_order_reference": null,
    "contract_reference": null,
    "delivery_reference": null,
    "payment_terms": null,
    "payment_method": "card"
  },
  "line_items": [
    {
      "line_id": "line-1",
      "name_ar": "عنصر تجريبي",
      "name_en": "Synthetic sandbox item",
      "description": "Fictional developer fixture",
      "quantity": 1,
      "unit_code": "PCE",
      "unit_price": 10000,
      "discounts": [],
      "charges": [],
      "tax_category": "standard_rated",
      "tax_rate": 15,
      "tax_exemption_reason": null
    }
  ],
  "notes": {}
} as const;

const response = await fetch(
  `${process.env.TECHNOMINDS_API_URL}/v1/zatca/invoices/generate/simplified`,
  {
    method: "POST",
    headers: {
      authorization: `Bearer ${process.env.TECHNOMINDS_API_KEY}`,
      "idempotency-key": "invoice-demo-001",
      "content-type": "application/json",
    },
    body: JSON.stringify(payload),
  },
);
const result = await response.json();

Continue reading