{
  "openapi": "3.1.0",
  "info": {
    "title": "Rahunok Free Invoice, Act & Delivery Note PDF API",
    "version": "1.1.0",
    "description": "100% free, stateless API for creating printable Ukrainian A4 Payment Invoices (Рахунок на оплату), Service Acceptance Acts (Акт наданих послуг) and Delivery Notes (Видаткова накладна) in PDF via doc_type=invoice|act|waybill with Cyrillic support, VAT modes, amount in words, bilateral signatures and vector NBU IBAN QR code. No API key or registration required.",
    "contact": {
      "name": "Rahunok",
      "url": "https://rahunok.com/instrumenty/rahunok-proforma/",
      "email": "rahunok@rahunok.com"
    }
  },
  "servers": [
    {
      "url": "https://rahunok.com"
    }
  ],
  "paths": {
    "/api/invoice.pdf": {
      "get": {
        "operationId": "createInvoicePdfGet",
        "summary": "Generate a free A4 invoice PDF from query parameters",
        "parameters": [
          {
            "name": "seller",
            "in": "query",
            "required": true,
            "description": "Seller FOP or company legal name (max 160 chars).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "iban",
            "in": "query",
            "required": true,
            "description": "Ukrainian IBAN (UA + 27 digits for UAH) or international IBAN for EUR/USD/PLN.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "items",
            "in": "query",
            "required": false,
            "description": "Line items as \"Title|qty|unit|price;Title2|qty|unit|price\" or JSON array [{title,quantity,unit,price,discount_percent}].",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tax_id",
            "in": "query",
            "required": false,
            "description": "Seller EDRPOU (8 digits) or RNOKPP (10 digits). Required for NBU QR code on UAH invoices.",
            "schema": {
              "type": "string",
              "pattern": "^(\\d{8}|\\d{10})$"
            }
          },
          {
            "name": "subject",
            "in": "query",
            "required": false,
            "description": "Single-line service/product description if items omitted.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "amount",
            "in": "query",
            "required": false,
            "description": "Single-line total amount if items omitted.",
            "schema": {
              "type": "number",
              "exclusiveMinimum": 0
            }
          },
          {
            "name": "customer",
            "in": "query",
            "required": false,
            "description": "Optional buyer name, company or @instagram handle.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer_phone",
            "in": "query",
            "required": false,
            "description": "Optional buyer phone or messenger handle.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer_tax_id",
            "in": "query",
            "required": false,
            "description": "Optional buyer EDRPOU / RNOKPP.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "query",
            "required": false,
            "description": "Invoice number (e.g. RH-2026-105). Auto-generated if omitted.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "date",
            "in": "query",
            "required": false,
            "description": "Issue date in YYYY-MM-DD format (defaults to today).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "due_days",
            "in": "query",
            "required": false,
            "description": "Payment term in days from issue date (default 3).",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 365
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "description": "Invoice currency: UAH (default), EUR, USD or PLN.",
            "schema": {
              "type": "string",
              "enum": [
                "UAH",
                "EUR",
                "USD",
                "PLN"
              ],
              "default": "UAH"
            }
          },
          {
            "name": "tax_mode",
            "in": "query",
            "required": false,
            "description": "VAT calculation mode.",
            "schema": {
              "type": "string",
              "enum": [
                "no-vat",
                "vat-on-top",
                "vat-included",
                "vat-exempt"
              ],
              "default": "no-vat"
            }
          },
          {
            "name": "vat_rate",
            "in": "query",
            "required": false,
            "description": "VAT percentage when tax_mode uses VAT (default 20).",
            "schema": {
              "type": "number",
              "default": 20
            }
          },
          {
            "name": "basis",
            "in": "query",
            "required": false,
            "description": "Optional contract / order basis (omitted if empty).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "purpose",
            "in": "query",
            "required": false,
            "description": "Optional bank payment purpose (max 140 chars; auto-generated if omitted).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "doc_type",
            "in": "query",
            "required": false,
            "description": "Document type: invoice (default), act (Акт виконаних робіт / наданих послуг), or waybill (Видаткова накладна).",
            "schema": {
              "type": "string",
              "enum": [
                "invoice",
                "act",
                "waybill"
              ],
              "default": "invoice"
            }
          },
          {
            "name": "doc_title",
            "in": "query",
            "required": false,
            "description": "Optional custom document title override.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "signer",
            "in": "query",
            "required": false,
            "description": "Optional name of supplier signatory.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer_signer",
            "in": "query",
            "required": false,
            "description": "Optional name of buyer/client signatory for bilateral Acts and Waybills.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Document UI language: uk (default), en, pl, ru.",
            "schema": {
              "type": "string",
              "enum": [
                "uk",
                "en",
                "pl",
                "ru"
              ],
              "default": "uk"
            }
          },
          {
            "name": "download",
            "in": "query",
            "required": false,
            "description": "Pass 1 to force Content-Disposition: attachment instead of inline.",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Printable A4 invoice PDF with Cyrillic support and embedded NBU QR code",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "parameter": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "example": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createInvoicePdfPost",
        "summary": "Generate a free A4 invoice PDF from JSON payload (seller, items[], prices, optional customer)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "seller",
                  "iban",
                  "items"
                ],
                "properties": {
                  "lang": {
                    "type": "string",
                    "enum": [
                      "uk",
                      "en",
                      "pl",
                      "ru"
                    ],
                    "default": "uk"
                  },
                  "currency": {
                    "type": "string",
                    "enum": [
                      "UAH",
                      "EUR",
                      "USD",
                      "PLN"
                    ],
                    "default": "UAH"
                  },
                  "doc_type": {
                    "type": "string",
                    "enum": [
                      "invoice",
                      "act",
                      "waybill"
                    ],
                    "default": "invoice",
                    "description": "Primary document kind: invoice, service acceptance act, or delivery note (waybill)."
                  },
                  "doc_title": {
                    "type": "string",
                    "description": "Optional heading override."
                  },
                  "number": {
                    "type": "string",
                    "description": "Invoice number (defaults to RH-YYYY-MMDD)."
                  },
                  "issue_date": {
                    "type": "string",
                    "description": "YYYY-MM-DD"
                  },
                  "due_date": {
                    "type": "string",
                    "description": "YYYY-MM-DD"
                  },
                  "due_days": {
                    "type": "integer",
                    "default": 3
                  },
                  "basis": {
                    "type": "string",
                    "description": "Optional contract reference; omitted when empty."
                  },
                  "tax_mode": {
                    "type": "string",
                    "enum": [
                      "no-vat",
                      "vat-on-top",
                      "vat-included",
                      "vat-exempt"
                    ],
                    "default": "no-vat"
                  },
                  "vat_rate": {
                    "type": "number",
                    "default": 20
                  },
                  "purpose": {
                    "type": "string",
                    "maxLength": 140
                  },
                  "notes": {
                    "type": "string"
                  },
                  "signer": {
                    "type": "string"
                  },
                  "buyer_signer": {
                    "type": "string",
                    "description": "Buyer signatory name for Acts and Delivery Notes."
                  },
                  "adjustment": {
                    "type": "number",
                    "default": 0
                  },
                  "download": {
                    "type": "boolean",
                    "default": false
                  },
                  "seller": {
                    "oneOf": [
                      {
                        "type": "string",
                        "description": "Seller FOP or company legal name"
                      },
                      {
                        "type": "object",
                        "required": [
                          "name"
                        ],
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "tax_id": {
                            "type": "string",
                            "description": "8-digit EDRPOU or 10-digit RNOKPP (for NBU QR)"
                          },
                          "iban": {
                            "type": "string"
                          },
                          "bank_name": {
                            "type": "string"
                          },
                          "vat_number": {
                            "type": "string"
                          },
                          "address": {
                            "type": "string"
                          },
                          "phone": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          }
                        }
                      }
                    ]
                  },
                  "tax_id": {
                    "type": "string",
                    "description": "Seller tax ID (if seller passed as string)"
                  },
                  "iban": {
                    "type": "string",
                    "description": "Seller IBAN (if seller passed as string)"
                  },
                  "customer": {
                    "oneOf": [
                      {
                        "type": "string",
                        "description": "Buyer name or @instagram handle"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "tax_id": {
                            "type": "string"
                          },
                          "phone": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "address": {
                            "type": "string"
                          }
                        }
                      }
                    ]
                  },
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 40,
                    "items": {
                      "type": "object",
                      "required": [
                        "title",
                        "price"
                      ],
                      "properties": {
                        "title": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "number",
                          "default": 1
                        },
                        "unit": {
                          "type": "string",
                          "default": "посл."
                        },
                        "price": {
                          "type": "number"
                        },
                        "discount_percent": {
                          "type": "number",
                          "default": 0
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Printable A4 invoice PDF with Cyrillic support and embedded NBU QR code",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "parameter": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "example": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/invoice": {
      "get": {
        "operationId": "getInvoicePdfLinks",
        "summary": "Get clickable PDF download link, QR image URL and totals as JSON (?output=json), or API guide if no query params",
        "parameters": [
          {
            "name": "seller",
            "in": "query",
            "required": true,
            "description": "Seller FOP or company legal name (max 160 chars).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "iban",
            "in": "query",
            "required": true,
            "description": "Ukrainian IBAN (UA + 27 digits for UAH) or international IBAN for EUR/USD/PLN.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "items",
            "in": "query",
            "required": false,
            "description": "Line items as \"Title|qty|unit|price;Title2|qty|unit|price\" or JSON array [{title,quantity,unit,price,discount_percent}].",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tax_id",
            "in": "query",
            "required": false,
            "description": "Seller EDRPOU (8 digits) or RNOKPP (10 digits). Required for NBU QR code on UAH invoices.",
            "schema": {
              "type": "string",
              "pattern": "^(\\d{8}|\\d{10})$"
            }
          },
          {
            "name": "subject",
            "in": "query",
            "required": false,
            "description": "Single-line service/product description if items omitted.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "amount",
            "in": "query",
            "required": false,
            "description": "Single-line total amount if items omitted.",
            "schema": {
              "type": "number",
              "exclusiveMinimum": 0
            }
          },
          {
            "name": "customer",
            "in": "query",
            "required": false,
            "description": "Optional buyer name, company or @instagram handle.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer_phone",
            "in": "query",
            "required": false,
            "description": "Optional buyer phone or messenger handle.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer_tax_id",
            "in": "query",
            "required": false,
            "description": "Optional buyer EDRPOU / RNOKPP.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "query",
            "required": false,
            "description": "Invoice number (e.g. RH-2026-105). Auto-generated if omitted.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "date",
            "in": "query",
            "required": false,
            "description": "Issue date in YYYY-MM-DD format (defaults to today).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "due_days",
            "in": "query",
            "required": false,
            "description": "Payment term in days from issue date (default 3).",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 365
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "description": "Invoice currency: UAH (default), EUR, USD or PLN.",
            "schema": {
              "type": "string",
              "enum": [
                "UAH",
                "EUR",
                "USD",
                "PLN"
              ],
              "default": "UAH"
            }
          },
          {
            "name": "tax_mode",
            "in": "query",
            "required": false,
            "description": "VAT calculation mode.",
            "schema": {
              "type": "string",
              "enum": [
                "no-vat",
                "vat-on-top",
                "vat-included",
                "vat-exempt"
              ],
              "default": "no-vat"
            }
          },
          {
            "name": "vat_rate",
            "in": "query",
            "required": false,
            "description": "VAT percentage when tax_mode uses VAT (default 20).",
            "schema": {
              "type": "number",
              "default": 20
            }
          },
          {
            "name": "basis",
            "in": "query",
            "required": false,
            "description": "Optional contract / order basis (omitted if empty).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "purpose",
            "in": "query",
            "required": false,
            "description": "Optional bank payment purpose (max 140 chars; auto-generated if omitted).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "doc_type",
            "in": "query",
            "required": false,
            "description": "Document type: invoice (default), act (Акт виконаних робіт / наданих послуг), or waybill (Видаткова накладна).",
            "schema": {
              "type": "string",
              "enum": [
                "invoice",
                "act",
                "waybill"
              ],
              "default": "invoice"
            }
          },
          {
            "name": "doc_title",
            "in": "query",
            "required": false,
            "description": "Optional custom document title override.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "signer",
            "in": "query",
            "required": false,
            "description": "Optional name of supplier signatory.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer_signer",
            "in": "query",
            "required": false,
            "description": "Optional name of buyer/client signatory for bilateral Acts and Waybills.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Document UI language: uk (default), en, pl, ru.",
            "schema": {
              "type": "string",
              "enum": [
                "uk",
                "en",
                "pl",
                "ru"
              ],
              "default": "uk"
            }
          },
          {
            "name": "download",
            "in": "query",
            "required": false,
            "description": "Pass 1 to force Content-Disposition: attachment instead of inline.",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            }
          },
          {
            "name": "output",
            "in": "query",
            "required": false,
            "description": "Pass json to receive clickable pdf_url & qr_png links for chat rendering.",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "pdf"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON metadata containing clickable PDF URL, NBU QR PNG URL and totals for AI chats",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "is_free": {
                      "type": "boolean"
                    },
                    "invoice_number": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "total": {
                      "type": "number"
                    },
                    "amount_words_uk": {
                      "type": "string"
                    },
                    "pdf_url": {
                      "type": "string"
                    },
                    "pdf_download_url": {
                      "type": "string"
                    },
                    "qr_png": {
                      "type": "string",
                      "nullable": true
                    },
                    "nbu_payment_link": {
                      "type": "string",
                      "nullable": true
                    },
                    "markdown": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createInvoiceLinksPost",
        "summary": "Compute invoice totals and return direct clickable PDF link + NBU QR PNG URL for ChatGPT/Gemini/Claude/Grok responses",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "seller",
                  "iban",
                  "items"
                ],
                "properties": {
                  "lang": {
                    "type": "string",
                    "enum": [
                      "uk",
                      "en",
                      "pl",
                      "ru"
                    ],
                    "default": "uk"
                  },
                  "currency": {
                    "type": "string",
                    "enum": [
                      "UAH",
                      "EUR",
                      "USD",
                      "PLN"
                    ],
                    "default": "UAH"
                  },
                  "doc_type": {
                    "type": "string",
                    "enum": [
                      "invoice",
                      "act",
                      "waybill"
                    ],
                    "default": "invoice",
                    "description": "Primary document kind: invoice, service acceptance act, or delivery note (waybill)."
                  },
                  "doc_title": {
                    "type": "string",
                    "description": "Optional heading override."
                  },
                  "number": {
                    "type": "string",
                    "description": "Invoice number (defaults to RH-YYYY-MMDD)."
                  },
                  "issue_date": {
                    "type": "string",
                    "description": "YYYY-MM-DD"
                  },
                  "due_date": {
                    "type": "string",
                    "description": "YYYY-MM-DD"
                  },
                  "due_days": {
                    "type": "integer",
                    "default": 3
                  },
                  "basis": {
                    "type": "string",
                    "description": "Optional contract reference; omitted when empty."
                  },
                  "tax_mode": {
                    "type": "string",
                    "enum": [
                      "no-vat",
                      "vat-on-top",
                      "vat-included",
                      "vat-exempt"
                    ],
                    "default": "no-vat"
                  },
                  "vat_rate": {
                    "type": "number",
                    "default": 20
                  },
                  "purpose": {
                    "type": "string",
                    "maxLength": 140
                  },
                  "notes": {
                    "type": "string"
                  },
                  "signer": {
                    "type": "string"
                  },
                  "buyer_signer": {
                    "type": "string",
                    "description": "Buyer signatory name for Acts and Delivery Notes."
                  },
                  "adjustment": {
                    "type": "number",
                    "default": 0
                  },
                  "download": {
                    "type": "boolean",
                    "default": false
                  },
                  "seller": {
                    "oneOf": [
                      {
                        "type": "string",
                        "description": "Seller FOP or company legal name"
                      },
                      {
                        "type": "object",
                        "required": [
                          "name"
                        ],
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "tax_id": {
                            "type": "string",
                            "description": "8-digit EDRPOU or 10-digit RNOKPP (for NBU QR)"
                          },
                          "iban": {
                            "type": "string"
                          },
                          "bank_name": {
                            "type": "string"
                          },
                          "vat_number": {
                            "type": "string"
                          },
                          "address": {
                            "type": "string"
                          },
                          "phone": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          }
                        }
                      }
                    ]
                  },
                  "tax_id": {
                    "type": "string",
                    "description": "Seller tax ID (if seller passed as string)"
                  },
                  "iban": {
                    "type": "string",
                    "description": "Seller IBAN (if seller passed as string)"
                  },
                  "customer": {
                    "oneOf": [
                      {
                        "type": "string",
                        "description": "Buyer name or @instagram handle"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "tax_id": {
                            "type": "string"
                          },
                          "phone": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "address": {
                            "type": "string"
                          }
                        }
                      }
                    ]
                  },
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 40,
                    "items": {
                      "type": "object",
                      "required": [
                        "title",
                        "price"
                      ],
                      "properties": {
                        "title": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "number",
                          "default": 1
                        },
                        "unit": {
                          "type": "string",
                          "default": "посл."
                        },
                        "price": {
                          "type": "number"
                        },
                        "discount_percent": {
                          "type": "number",
                          "default": 0
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON metadata containing clickable PDF URL, NBU QR PNG URL and totals for AI chats",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "is_free": {
                      "type": "boolean"
                    },
                    "invoice_number": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "total": {
                      "type": "number"
                    },
                    "amount_words_uk": {
                      "type": "string"
                    },
                    "pdf_url": {
                      "type": "string"
                    },
                    "pdf_download_url": {
                      "type": "string"
                    },
                    "qr_png": {
                      "type": "string",
                      "nullable": true
                    },
                    "nbu_payment_link": {
                      "type": "string",
                      "nullable": true
                    },
                    "markdown": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}