Skip to content
E-invoicing

einvoice.generate

Generate a KoSIT-validated XRechnung UBL or CII invoice, or a ZUGFeRD PDF/A-3.

POSThttps://api.kanagu.dev/v1/einvoice/generate
Price
$0.02 per successful call
Without a key
10 free calls per IP per UTC day, shared by REST and MCP.
MCP tool
einvoice.generate at https://api.kanagu.dev/mcp
curl https://api.kanagu.dev/v1/einvoice/generate \
  -H "Content-Type: application/json" \
  -d '{"format":"ubl","invoiceNumber":"2026-0417","issueDate":"2026-11-23","deliveryDate":"2026-11-20","dueDate":"2026-12-23","buyerReference":"90000000-03083-72","seller":{"name":"Linden Consulting GmbH","vatId":"DE123456789","email":"billing@example.com","street":"Lindenstraße 12","city":"Berlin","postalCode":"10117","country":"DE","contact":{"name":"Kai Weber","phone":"+49 30 5550100","email":"kai@example.com"}},"buyer":{"name":"Nordhafen Verwaltungs GmbH","email":"invoices@example.org","street":"Hafenstraße 8","city":"Hamburg","postalCode":"20457","country":"DE"},"iban":"DE79000000001234567890","lines":[{"description":"Software integration workshop","quantity":"2","unitPrice":"475.00","vatRate":"19"}]}'
curl https://api.kanagu.dev/v1/einvoice/generate \
  -H "Authorization: Bearer $KANAGU_KEY" \
  -H "Content-Type: application/json" \
  -d '{"format":"ubl","invoiceNumber":"2026-0417","issueDate":"2026-11-23","deliveryDate":"2026-11-20","dueDate":"2026-12-23","buyerReference":"90000000-03083-72","seller":{"name":"Linden Consulting GmbH","vatId":"DE123456789","email":"billing@example.com","street":"Lindenstraße 12","city":"Berlin","postalCode":"10117","country":"DE","contact":{"name":"Kai Weber","phone":"+49 30 5550100","email":"kai@example.com"}},"buyer":{"name":"Nordhafen Verwaltungs GmbH","email":"invoices@example.org","street":"Hafenstraße 8","city":"Hamburg","postalCode":"20457","country":"DE"},"iban":"DE79000000001234567890","lines":[{"description":"Software integration workshop","quantity":"2","unitPrice":"475.00","vatRate":"19"}]}'
const res = await fetch("https://api.kanagu.dev/v1/einvoice/generate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KANAGU_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "format": "ubl",
    "invoiceNumber": "2026-0417",
    "issueDate": "2026-11-23",
    "deliveryDate": "2026-11-20",
    "dueDate": "2026-12-23",
    "buyerReference": "90000000-03083-72",
    "seller": {
      "name": "Linden Consulting GmbH",
      "vatId": "DE123456789",
      "email": "billing@example.com",
      "street": "Lindenstraße 12",
      "city": "Berlin",
      "postalCode": "10117",
      "country": "DE",
      "contact": {
        "name": "Kai Weber",
        "phone": "+49 30 5550100",
        "email": "kai@example.com"
      }
    },
    "buyer": {
      "name": "Nordhafen Verwaltungs GmbH",
      "email": "invoices@example.org",
      "street": "Hafenstraße 8",
      "city": "Hamburg",
      "postalCode": "20457",
      "country": "DE"
    },
    "iban": "DE79000000001234567890",
    "lines": [
      {
        "description": "Software integration workshop",
        "quantity": "2",
        "unitPrice": "475.00",
        "vatRate": "19"
      }
    ]
  }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const result = await res.json();
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "einvoice.generate",
    "arguments": {
      "format": "ubl",
      "invoiceNumber": "2026-0417",
      "issueDate": "2026-11-23",
      "deliveryDate": "2026-11-20",
      "dueDate": "2026-12-23",
      "buyerReference": "90000000-03083-72",
      "seller": {
        "name": "Linden Consulting GmbH",
        "vatId": "DE123456789",
        "email": "billing@example.com",
        "street": "Lindenstraße 12",
        "city": "Berlin",
        "postalCode": "10117",
        "country": "DE",
        "contact": {
          "name": "Kai Weber",
          "phone": "+49 30 5550100",
          "email": "kai@example.com"
        }
      },
      "buyer": {
        "name": "Nordhafen Verwaltungs GmbH",
        "email": "invoices@example.org",
        "street": "Hafenstraße 8",
        "city": "Hamburg",
        "postalCode": "20457",
        "country": "DE"
      },
      "iban": "DE79000000001234567890",
      "lines": [
        {
          "description": "Software integration workshop",
          "quantity": "2",
          "unitPrice": "475.00",
          "vatRate": "19"
        }
      ]
    }
  }
}
Request body
{
  "format": "ubl",
  "invoiceNumber": "2026-0417",
  "issueDate": "2026-11-23",
  "deliveryDate": "2026-11-20",
  "dueDate": "2026-12-23",
  "buyerReference": "90000000-03083-72",
  "seller": {
    "name": "Linden Consulting GmbH",
    "vatId": "DE123456789",
    "email": "billing@example.com",
    "street": "Lindenstraße 12",
    "city": "Berlin",
    "postalCode": "10117",
    "country": "DE",
    "contact": {
      "name": "Kai Weber",
      "phone": "+49 30 5550100",
      "email": "kai@example.com"
    }
  },
  "buyer": {
    "name": "Nordhafen Verwaltungs GmbH",
    "email": "invoices@example.org",
    "street": "Hafenstraße 8",
    "city": "Hamburg",
    "postalCode": "20457",
    "country": "DE"
  },
  "iban": "DE79000000001234567890",
  "lines": [
    {
      "description": "Software integration workshop",
      "quantity": "2",
      "unitPrice": "475.00",
      "vatRate": "19"
    }
  ]
}

Request body

application/json

format"ubl" | "cii" | "zugferd"required
invoiceNumberstring (max 50 chars)required
issueDatestring (date)required
dueDatestring (date)required
deliveryDatestring (date)
currencystring
buyerReferencestring (max 120 chars)required
sellerobjectrequired
seller.namestring (max 160 chars)required
seller.emailstring (email, max 160 chars)required
seller.streetstring (max 160 chars)required
seller.citystring (max 100 chars)required
seller.postalCodestring (max 20 chars)required
seller.countrystringrequired
seller.vatIdstringrequired
seller.contactobjectrequired
seller.contact.namestring (max 120 chars)required
seller.contact.phonestring (max 60 chars)required
seller.contact.emailstring (email, max 160 chars)required
buyerobjectrequired
buyer.namestring (max 160 chars)required
buyer.emailstring (email, max 160 chars)required
buyer.streetstring (max 160 chars)required
buyer.citystring (max 100 chars)required
buyer.postalCodestring (max 20 chars)required
buyer.countrystringrequired
buyer.vatIdstring
ibanstringrequired
linesarray of objectrequired
lines[].descriptionstring (max 300 chars)required
lines[].quantitystringrequired
lines[].unitPricestringrequired
Net item price per base quantity.
lines[].baseQuantitystring
Quantity covered by the item price. Defaults to one.
lines[].baseQuantityUnitstring
Unit of the base quantity. Defaults to the line unit.
lines[].grossUnitPricestring
Item price before the item price discount.
lines[].unitPriceDiscountstring
Discount on the item price per base quantity.
lines[].unitstring
lines[].vatRatestringrequired

Response

200 · application/json

format"ubl" | "cii" | "zugferd"required
xmlstringrequired
validationobjectrequired
validation.validbooleanrequired
validation.validator"KoSIT 1.6.3 / XRechnung 3.0.2 (2026-08-31)"required
validation.issuesarray of objectrequired
validation.issues[].ruleIdstringrequired
validation.issues[].severitystringrequired
validation.issues[].xpathstringrequired
validation.issues[].fieldstringrequired
validation.issues[].messagestringrequired
validation.issues[].fixHintstringrequired
pdfBase64string (base64)
PDF/A-3 for format zugferd

Try it

einvoice.generate

$0.02/call

No key needed · 10 free calls per IP per day

Response

Run the request to see the live response here.

Errors

Errors are JSON {"error":{"code","message"}}. An operation may add its own 400 codes; the message says what to fix.

StatusCode and meaning
400invalid_input

The body does not match the request schema. The message names each field.

400invalid_json

The body is missing or is not valid JSON.

400invalid_idempotency_key

Idempotency-Key must be 1–128 visible ASCII characters.

401invalid_api_key

The Bearer key is missing, malformed, invalid or inactive.

402free_allowance_exhausted

This month's free usage is used up and the account has no subscription. Subscribe from the dashboard, or wait for the next UTC month; Retry-After gives the seconds left.

404not_found

No operation at this path.

409idempotency_conflict

The Idempotency-Key was already used with a different body.

413payload_too_large

JSON bodies may be at most 64 KiB.

429trial_limit

The anonymous trial allows 10 calls per IP per UTC day, shared by REST and MCP. Retry-After gives the seconds left.

500internal_error

The call failed on our side. It is not billed; retry with the same Idempotency-Key.

JSON Schema

Request schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "format": {
      "type": "string",
      "enum": [
        "ubl",
        "cii",
        "zugferd"
      ]
    },
    "invoiceNumber": {
      "type": "string",
      "minLength": 1,
      "maxLength": 50
    },
    "issueDate": {
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "dueDate": {
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "deliveryDate": {
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "currency": {
      "default": "EUR",
      "type": "string",
      "pattern": "^[A-Z]{3}$"
    },
    "buyerReference": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "seller": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 160
        },
        "email": {
          "type": "string",
          "maxLength": 160,
          "format": "email",
          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        },
        "street": {
          "type": "string",
          "minLength": 1,
          "maxLength": 160
        },
        "city": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "postalCode": {
          "type": "string",
          "minLength": 1,
          "maxLength": 20
        },
        "country": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        },
        "vatId": {
          "type": "string",
          "pattern": "^[A-Z]{2}[A-Z0-9]{3,16}$"
        },
        "contact": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            },
            "phone": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            },
            "email": {
              "type": "string",
              "maxLength": 160,
              "format": "email",
              "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
            }
          },
          "required": [
            "name",
            "phone",
            "email"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "name",
        "email",
        "street",
        "city",
        "postalCode",
        "country",
        "vatId",
        "contact"
      ],
      "additionalProperties": false
    },
    "buyer": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 160
        },
        "email": {
          "type": "string",
          "maxLength": 160,
          "format": "email",
          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        },
        "street": {
          "type": "string",
          "minLength": 1,
          "maxLength": 160
        },
        "city": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "postalCode": {
          "type": "string",
          "minLength": 1,
          "maxLength": 20
        },
        "country": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        },
        "vatId": {
          "type": "string",
          "pattern": "^[A-Z]{2}[A-Z0-9]{3,16}$"
        }
      },
      "required": [
        "name",
        "email",
        "street",
        "city",
        "postalCode",
        "country"
      ],
      "additionalProperties": false
    },
    "iban": {
      "type": "string",
      "pattern": "^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$"
    },
    "lines": {
      "minItems": 1,
      "maxItems": 500,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "quantity": {
            "type": "string",
            "pattern": "^\\d{1,8}(?:\\.\\d{1,4})?$"
          },
          "unitPrice": {
            "type": "string",
            "pattern": "^\\d{1,8}(?:\\.\\d{1,18})?$",
            "description": "Net item price per base quantity."
          },
          "baseQuantity": {
            "description": "Quantity covered by the item price. Defaults to one.",
            "type": "string",
            "pattern": "^\\d{1,8}(?:\\.\\d{1,4})?$"
          },
          "baseQuantityUnit": {
            "description": "Unit of the base quantity. Defaults to the line unit.",
            "type": "string",
            "pattern": "^[A-Z0-9]{2,3}$"
          },
          "grossUnitPrice": {
            "description": "Item price before the item price discount.",
            "type": "string",
            "pattern": "^\\d{1,8}(?:\\.\\d{1,18})?$"
          },
          "unitPriceDiscount": {
            "description": "Discount on the item price per base quantity.",
            "type": "string",
            "pattern": "^\\d{1,8}(?:\\.\\d{1,18})?$"
          },
          "unit": {
            "default": "C62",
            "type": "string",
            "pattern": "^[A-Z0-9]{2,3}$"
          },
          "vatRate": {
            "type": "string",
            "pattern": "^\\d{1,3}(?:\\.\\d{1,2})?$"
          }
        },
        "required": [
          "description",
          "quantity",
          "unitPrice",
          "vatRate"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "format",
    "invoiceNumber",
    "issueDate",
    "dueDate",
    "buyerReference",
    "seller",
    "buyer",
    "iban",
    "lines"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "format": "ubl",
      "invoiceNumber": "2026-0417",
      "issueDate": "2026-11-23",
      "deliveryDate": "2026-11-20",
      "dueDate": "2026-12-23",
      "buyerReference": "90000000-03083-72",
      "seller": {
        "name": "Linden Consulting GmbH",
        "vatId": "DE123456789",
        "email": "billing@example.com",
        "street": "Lindenstraße 12",
        "city": "Berlin",
        "postalCode": "10117",
        "country": "DE",
        "contact": {
          "name": "Kai Weber",
          "phone": "+49 30 5550100",
          "email": "kai@example.com"
        }
      },
      "buyer": {
        "name": "Nordhafen Verwaltungs GmbH",
        "email": "invoices@example.org",
        "street": "Hafenstraße 8",
        "city": "Hamburg",
        "postalCode": "20457",
        "country": "DE"
      },
      "iban": "DE79000000001234567890",
      "lines": [
        {
          "description": "Software integration workshop",
          "quantity": "2",
          "unitPrice": "475.00",
          "vatRate": "19"
        }
      ]
    }
  ]
}
Response schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "format": {
      "type": "string",
      "enum": [
        "ubl",
        "cii",
        "zugferd"
      ]
    },
    "xml": {
      "type": "string"
    },
    "validation": {
      "type": "object",
      "properties": {
        "valid": {
          "type": "boolean"
        },
        "validator": {
          "type": "string",
          "const": "KoSIT 1.6.3 / XRechnung 3.0.2 (2026-08-31)"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "ruleId": {
                "type": "string"
              },
              "severity": {
                "type": "string"
              },
              "xpath": {
                "type": "string"
              },
              "field": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "fixHint": {
                "type": "string"
              }
            },
            "required": [
              "ruleId",
              "severity",
              "xpath",
              "field",
              "message",
              "fixHint"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "valid",
        "validator",
        "issues"
      ],
      "additionalProperties": false
    },
    "pdfBase64": {
      "description": "PDF/A-3 for format zugferd",
      "type": "string",
      "format": "base64",
      "contentEncoding": "base64",
      "pattern": "^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$"
    }
  },
  "required": [
    "format",
    "xml",
    "validation"
  ],
  "additionalProperties": false
}