Issue a simplified invoice (ticket)

Issue a simplified invoice (ticket)

A simplified invoice (ticket) is a lightweight sales document typically delivered as a PDF. There is no universal XML standard for tickets, so for integrations the recommended approach is to work with JSON and let B2Brouter generate the PDF.

Use "type": "IssuedSimplifiedInvoice" to create a simplified invoice.

Create the simplified invoice

Example request

curl --location 'https://api-staging.b2brouter.net/accounts/{ACCOUNT_ID}/invoices' \
  --header 'X-B2B-API-Key: {YOUR_API_KEY}' \
  --header 'X-B2B-API-Version: {YOUR_API_VERSION}' \
  --header 'Content-Type: application/json' \
  --data '{
    "send_after_import": false,
    "invoice": {
      "type": "IssuedSimplifiedInvoice",
      "number": "T-2026-0001",
      "date": "2026-01-21",
      "currency": "EUR",
      "file_reference": "POS-ORDER-12345",
      "contact": {
        "name": "Final consumer",
        "country": "es"
      },
      "invoice_lines_attributes": [
        {
          "quantity": 1,
          "price": 10,
          "description": "Coffee",
          "taxes_attributes": [
            {
              "name": "VAT",
              "percent": 21,
              "category": "S"
            }
          ]
        }
      ]
    }
  }'

Sample response (excerpt)

{
  "invoice": {
    "id": 123456,
    "type": "IssuedSimplifiedInvoice",
    "number": "T-2026-0001",
    "state": "new",
    "file_reference": "POS-ORDER-12345",
    "document_type_code": "pdf.invoice"
  }
}

Send the simplified invoice (generate the PDF)

curl --location \
  --request POST 'https://api-staging.b2brouter.net/invoices/send_invoice/{INVOICE_ID}' \
  --header 'X-B2B-API-Key: {YOUR_API_KEY}' \
  --header 'X-B2B-API-Version: {YOUR_API_VERSION}'

Download the PDF

curl --request GET \
  --url 'https://api-staging.b2brouter.net/invoices/{INVOICE_ID}/as/pdf.invoice?download=true' \
  --header 'X-B2B-API-Key: {YOUR_API_KEY}' \
  --header 'X-B2B-API-Version: {YOUR_API_VERSION}' \
  --output simplified_invoice.pdf

Notes

  • Use file_reference to store your own internal reference (order ID, ticket ID, POS transaction ID, etc.) and make reconciliation easier.
  • If you want B2Brouter to send the PDF by email, set contact_email_override on the invoice before creating the invoice or calling POST /invoices/send_invoice/{INVOICE_ID}.
  • To list simplified invoices: GET /accounts/{ACCOUNT_ID}/invoices?type=IssuedSimplifiedInvoice