Raw schema
{
"type": "object",
"properties": {
"type": {
"description": "dan = tax invoice (default), prof = proforma, deb = debit note, cred = credit note.",
"type": "string",
"enum": [
"dan",
"prof",
"deb",
"cred"
]
},
"draft": {
"description": "Save as a draft (default true). Pass false to issue the document and consume its number.",
"type": "boolean"
},
"client_id": {
"description": "Existing client id (invbg_list_clients). Then the to_* fields are ignored.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"to_name": {
"description": "Recipient name (when no client_id).",
"type": "string",
"minLength": 1,
"maxLength": 300
},
"is_to_person": {
"description": "true when the recipient is an individual (then to_egn is needed).",
"type": "boolean"
},
"to_bulstat": {
"description": "Recipient EIK/Bulstat (companies).",
"type": "string",
"minLength": 1,
"maxLength": 30
},
"to_egn": {
"description": "Recipient EGN, 10 digits (individuals), as text so leading zeros survive.",
"type": "string",
"pattern": "^\\d{10}$"
},
"to_is_reg_vat": {
"description": "Whether the recipient company is VAT-registered.",
"type": "boolean"
},
"to_vat_number": {
"description": "Recipient VAT number (needed when to_is_reg_vat is true).",
"type": "string",
"minLength": 1,
"maxLength": 30
},
"to_mol": {
"description": "Recipient accountable person (MOL); required for companies when no client_id.",
"type": "string",
"minLength": 1,
"maxLength": 150
},
"to_town": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"to_address": {
"description": "Recipient address (required when no client_id).",
"type": "string",
"minLength": 1,
"maxLength": 300
},
"to_country": {
"description": "Recipient country, ISO 3166-1 alpha-2.",
"type": "string",
"pattern": "^[A-Za-z]{2}$"
},
"items": {
"minItems": 1,
"maxItems": 200,
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 500,
"description": "Item name as printed on the invoice."
},
"price": {
"type": "number",
"description": "Price per unit (without VAT unless items_with_vat is true)."
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0,
"description": "Quantity."
},
"quantity_unit": {
"type": "string",
"minLength": 1,
"maxLength": 30,
"description": "Unit of measure, e.g. pcs, hours (see invbg_list_item_units)."
},
"vat_percent": {
"description": "VAT rate for this item in percent (20 is the standard Bulgarian rate). Needed on every item unless the invoice sets vat_percent.",
"type": "number",
"minimum": 0,
"maximum": 100
},
"reduction_percent": {
"description": "Discount on this item in percent.",
"type": "number",
"minimum": 0,
"maximum": 100
}
},
"required": [
"name",
"price",
"quantity",
"quantity_unit"
]
},
"description": "Line items."
},
"vat_percent": {
"description": "VAT rate for the whole document in percent; ignored where items carry their own vat_percent.",
"type": "number",
"minimum": 0,
"maximum": 100
},
"vat_exemption_reason": {
"description": "Why no VAT is charged (when VAT is 0); see invbg_list_vat_exemption_reasons.",
"type": "string",
"minLength": 1,
"maxLength": 500
},
"items_with_vat": {
"description": "true if item prices already include VAT (default false).",
"type": "boolean"
},
"currency": {
"description": "Document currency (default BGN).",
"type": "string",
"pattern": "^[A-Za-z]{3}$"
},
"currency_rate": {
"description": "Exchange rate to BGN (BGN/XXX). Required when currency is not BGN: take it from invbg_get_exchange_rate.",
"type": "number",
"exclusiveMinimum": 0
},
"payment_method": {
"description": "How the client pays.",
"type": "string",
"enum": [
"cash",
"bank",
"ondlv",
"card",
"order",
"cheque",
"barter",
"moneytransfer",
"epay",
"paypal",
"stripe",
"revolut",
"easypay",
"other"
]
},
"date_create": {
"description": "Issue date (default now).",
"type": "string"
},
"date_event": {
"description": "Tax event date (default: issue date).",
"type": "string"
},
"date_mature": {
"description": "Due date.",
"type": "string"
},
"notes": {
"description": "Notes printed on the document.",
"type": "string",
"minLength": 1,
"maxLength": 2000
},
"po_number": {
"description": "The buyer's purchase order number.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"number_set": {
"description": "Number set id to take the number from (invbg_list_number_sets); omit unless you use several series.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"reduction_percent": {
"description": "Discount on the whole document in percent.",
"type": "number",
"minimum": 0,
"maximum": 100
}
},
"required": [
"items"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}