{
  "openapi": "3.1.0",
  "info": {
    "title": "Konty External API",
    "version": "1.0.0",
    "description": "Issue, read and void fiscal documents of a Konty account from a webshop, ERP or PMS: Montenegrin fiscal receipts (EFI), Serbian fiscal receipts (VSDC) and Serbian e-invoices (SEF). A request Konty can tell will fail is refused and stores nothing; one the tax authority fails is kept (202, fiscalized false) and followed up by Konty support. The guide: https://docs.konty.com/en/api/index.html."
  },
  "servers": [
    {
      "url": "https://api.ariapos.rs/api/v1/external",
      "description": "Serbia, production (aria_live_ keys)"
    },
    {
      "url": "https://staging.api.ariapos.rs/api/v1/external",
      "description": "Serbia, sandbox (aria_test_ keys)"
    },
    {
      "url": "https://api.ariapos.me/api/v1/external",
      "description": "Montenegro, production (aria_live_ keys)"
    },
    {
      "url": "https://staging.api.ariapos.me/api/v1/external",
      "description": "Montenegro, sandbox (aria_test_ keys)"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Status"
    },
    {
      "name": "Catalogue"
    },
    {
      "name": "Orders"
    },
    {
      "name": "Room service",
      "description": "Porudžbine a room-service app sends to the venue: the venue accepts or refuses them on the POS and closes them as a room charge or a receipt. Nothing is fiscalized when a porudžbina arrives."
    },
    {
      "name": "Export",
      "description": "Every document of the venue, for analysis tools (scope orders:export)."
    }
  ],
  "paths": {
    "/status": {
      "get": {
        "tags": [
          "Status"
        ],
        "operationId": "getStatus",
        "summary": "Key, account, cash register and certificate state",
        "description": "Needs no scope and never refuses an inactive register or user: it reports them.",
        "responses": {
          "200": {
            "description": "The key's binding and readiness.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Status"
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                },
                "examples": {
                  "rsStaging": {
                    "summary": "RS account on staging: receipts signed by the development ESDC",
                    "value": {
                      "data": {
                        "key": {
                          "name": "Webshop",
                          "prefix": "aria_test_4ZDsLG",
                          "source": "woocommerce",
                          "scopes": [
                            "orders:create",
                            "orders:read",
                            "orders:void",
                            "catalog:read",
                            "clients:read"
                          ],
                          "expires_at": null
                        },
                        "account": {
                          "name": "Aria Test doo",
                          "country": "RS"
                        },
                        "cash_register": {
                          "id": 12,
                          "name": "Webshop",
                          "shared": true,
                          "active": true,
                          "shift_open": true
                        },
                        "user": {
                          "id": 34,
                          "name": "API – Webshop",
                          "active": true
                        },
                        "vsdc_certificate": {
                          "present": false,
                          "expires_at": null,
                          "signer": "development_esdc"
                        }
                      },
                      "request_id": "7c9e6679-7425-40de-944b-e07fc1f90010"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed. Codes: API_KEY_MISSING, API_KEY_INVALID, API_KEY_DISABLED, API_KEY_EXPIRED.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Account inactive. Codes: SUBSCRIPTION_INACTIVE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Access refused. Codes: IP_NOT_ALLOWED, MODULE_NOT_ACTIVE, MARKET_NOT_SUPPORTED, INSUFFICIENT_SCOPE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Codes: RATE_LIMITED.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure. Codes: INTERNAL_ERROR.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/products": {
      "get": {
        "tags": [
          "Catalogue"
        ],
        "operationId": "listProducts",
        "summary": "Sellable products",
        "x-scope": "catalog:read",
        "description": "Prices are informational: an order is issued at the prices you send.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Out-of-range values are clamped to 1..100, not refused."
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Name contains, or an exact code / barcode / GTIN (products) or id / tax / registration number (clients)."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of products.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Product"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/PageMeta"
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed. Codes: API_KEY_MISSING, API_KEY_INVALID, API_KEY_DISABLED, API_KEY_EXPIRED.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Account inactive. Codes: SUBSCRIPTION_INACTIVE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Access refused. Codes: IP_NOT_ALLOWED, MODULE_NOT_ACTIVE, MARKET_NOT_SUPPORTED, INSUFFICIENT_SCOPE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Codes: RATE_LIMITED.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure. Codes: INTERNAL_ERROR.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The key's register or user is unavailable. Codes: REGISTER_UNAVAILABLE, USER_UNAVAILABLE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/tax-rates": {
      "get": {
        "tags": [
          "Catalogue"
        ],
        "operationId": "listTaxRates",
        "summary": "Tax rates",
        "x-scope": "catalog:read",
        "responses": {
          "200": {
            "description": "Every tax rate.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TaxRate"
                      }
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed. Codes: API_KEY_MISSING, API_KEY_INVALID, API_KEY_DISABLED, API_KEY_EXPIRED.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Account inactive. Codes: SUBSCRIPTION_INACTIVE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Access refused. Codes: IP_NOT_ALLOWED, MODULE_NOT_ACTIVE, MARKET_NOT_SUPPORTED, INSUFFICIENT_SCOPE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Codes: RATE_LIMITED.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure. Codes: INTERNAL_ERROR.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The key's register or user is unavailable. Codes: REGISTER_UNAVAILABLE, USER_UNAVAILABLE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/clients": {
      "get": {
        "tags": [
          "Catalogue"
        ],
        "operationId": "listClients",
        "summary": "Clients",
        "x-scope": "clients:read",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Out-of-range values are clamped to 1..100, not refused."
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Name contains, or an exact code / barcode / GTIN (products) or id / tax / registration number (clients)."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of clients.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Client"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/PageMeta"
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed. Codes: API_KEY_MISSING, API_KEY_INVALID, API_KEY_DISABLED, API_KEY_EXPIRED.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Account inactive. Codes: SUBSCRIPTION_INACTIVE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Access refused. Codes: IP_NOT_ALLOWED, MODULE_NOT_ACTIVE, MARKET_NOT_SUPPORTED, INSUFFICIENT_SCOPE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Codes: RATE_LIMITED.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure. Codes: INTERNAL_ERROR.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The key's register or user is unavailable. Codes: REGISTER_UNAVAILABLE, USER_UNAVAILABLE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/orders": {
      "get": {
        "tags": [
          "Export"
        ],
        "operationId": "exportOrders",
        "summary": "Every document of the venue in a period (for analysis tools)",
        "description": "All documents the venue issued — POS, delivery, QR and API alike — that reached Konty in the given local days (created_at), at most one month, oldest id first. Page with `after` = meta.next_cursor until it is null. A document issued offline belongs to the period it reached Konty in, so pulling every period once gets every document once; pull a period a few minutes after it ends. Proformas, training documents (POS training mode too), copies and incoming documents are not listed. A table's rounds are listed only where each is a fiscal document (Montenegro: an unpaid invoice, settled later by a summary); in Serbia they are not documents, and the table's receipt carries their items. A refund or storno is a new document in the period it arrives; the original's canceled_at and updated_at change, so re-pull a period to see them.",
        "x-scope": "orders:export",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First local day (Y-m-d)."
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last local day (Y-m-d), at most one month after `from`."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 1000
            }
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            },
            "description": "meta.next_cursor of the previous page of the same period."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of documents.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExportedOrder"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "from",
                        "to",
                        "limit",
                        "count",
                        "next_cursor"
                      ],
                      "properties": {
                        "from": {
                          "type": "string",
                          "format": "date"
                        },
                        "to": {
                          "type": "string",
                          "format": "date"
                        },
                        "limit": {
                          "type": "integer"
                        },
                        "count": {
                          "type": "integer"
                        },
                        "next_cursor": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        }
                      }
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                },
                "examples": {
                  "page": {
                    "summary": "One document, more to follow",
                    "value": {
                      "data": [
                        {
                          "id": 48211,
                          "hash": "q7k2m9x0a1b2c",
                          "number": 123,
                          "full_number": "ab123cd456/123/2026/tcr123",
                          "status": "paid",
                          "einvoice": false,
                          "source": "pos",
                          "external_reference": null,
                          "issuing_date": "2026-10-14T17:22:05+00:00",
                          "created_at": "2026-10-14T17:22:06+00:00",
                          "updated_at": "2026-10-14T17:22:06+00:00",
                          "registered_at": "2026-10-14T17:22:06+00:00",
                          "canceled_at": null,
                          "cash_register": {
                            "id": 1,
                            "name": "Kasa 1"
                          },
                          "cashier": {
                            "id": 4,
                            "name": "Vesna Ilić"
                          },
                          "shift": {
                            "id": 311,
                            "name": "Jutarnja",
                            "started_at": "2026-10-14T06:01:12+00:00",
                            "closed_at": "2026-10-14T22:14:40+00:00"
                          },
                          "table": {
                            "id": 12,
                            "name": "B4",
                            "sector": {
                              "id": 2,
                              "name": "Bašta"
                            }
                          },
                          "total": "1050.00",
                          "tax_total": "135.71",
                          "tip": "0.00",
                          "payments": [
                            {
                              "method": "card",
                              "amount": "1050.00"
                            }
                          ],
                          "change": "0.00",
                          "fiscal": {
                            "fiscalized": true,
                            "register_type": "fiscal",
                            "register_status": "success",
                            "invoice_number": "9WM3LAJT-9WM3LAJT-5882"
                          },
                          "settled_by": null,
                          "refers_to": [],
                          "referred_by": [],
                          "client": {
                            "id": 42,
                            "name": "Kupac doo",
                            "id_type": "tax_id_number",
                            "id_number": "101010101",
                            "tax_id_number": "101010101"
                          },
                          "items": [
                            {
                              "product_id": 16,
                              "code": "SKU-4471",
                              "name": "Club sendvič",
                              "quantity": "1.000",
                              "unit": "pcs",
                              "unit_price": "850.00",
                              "discount_percent": "0.00",
                              "tax_label": "Ђ",
                              "tax_rate": "20.00",
                              "exempt_from_tax": null,
                              "tax": "141.67",
                              "total": "850.00"
                            },
                            {
                              "product_id": 17,
                              "code": "SKU-0001",
                              "name": "Dostava",
                              "quantity": "1.000",
                              "unit": "pcs",
                              "unit_price": "200.00",
                              "discount_percent": "0.00",
                              "tax_label": "Г",
                              "tax_rate": "0.00",
                              "exempt_from_tax": null,
                              "tax": "0.00",
                              "total": "200.00"
                            }
                          ]
                        }
                      ],
                      "meta": {
                        "from": "2026-10-01",
                        "to": "2026-10-31",
                        "limit": 1000,
                        "count": 1,
                        "next_cursor": 48211
                      },
                      "request_id": "7c9e6679-7425-40de-944b-e07fc1f90007"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed. Codes: API_KEY_MISSING, API_KEY_INVALID, API_KEY_DISABLED, API_KEY_EXPIRED.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Account inactive. Codes: SUBSCRIPTION_INACTIVE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Access refused. Codes: IP_NOT_ALLOWED, MODULE_NOT_ACTIVE, MARKET_NOT_SUPPORTED, INSUFFICIENT_SCOPE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid period. Codes: VALIDATION_ERROR, PERIOD_TOO_LONG (details.max_to).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "periodTooLong": {
                    "summary": "More than one month",
                    "value": {
                      "error": {
                        "code": "PERIOD_TOO_LONG",
                        "message": "A period is at most one month.",
                        "details": {
                          "max_to": "2026-11-15"
                        }
                      },
                      "request_id": "7c9e6679-7425-40de-944b-e07fc1f90008"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Codes: RATE_LIMITED.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure. Codes: INTERNAL_ERROR.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Orders"
        ],
        "operationId": "createOrder",
        "summary": "Issue a fiscal receipt or an e-invoice",
        "x-scope": "orders:create",
        "description": "One document per (your integration, external_reference): a reference already used — whatever the body — is refused with 409 DUPLICATE_REFERENCE, and error.details.order is the document it names (the same payload GET /orders/{reference} answers). After a lost response, resend or GET the same reference; never retry under a new reference.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderRequest"
              },
              "examples": {
                "meReceipt": {
                  "summary": "Receipt, one item, card (ME or RS)",
                  "value": {
                    "external_reference": "WC-10045",
                    "type": "receipt",
                    "items": [
                      {
                        "code": "SKU-1",
                        "quantity": 2,
                        "unit_price": 12.5
                      }
                    ],
                    "payments": [
                      {
                        "method": "card",
                        "amount": 25.0
                      }
                    ]
                  }
                },
                "rsEinvoice": {
                  "summary": "E-invoice (RS)",
                  "value": {
                    "external_reference": "ERP-2026/77",
                    "type": "einvoice",
                    "client": {
                      "id_type": "tax_id_number_local",
                      "id_number": "101010101",
                      "registration_number": "20202020",
                      "name": "Kupac doo"
                    },
                    "items": [
                      {
                        "product_id": 15,
                        "quantity": 10,
                        "unit_price": 120,
                        "discount_percent": 5
                      }
                    ],
                    "payments": [
                      {
                        "method": "invoice",
                        "amount": 1140
                      }
                    ],
                    "einvoice": {
                      "due_date": "2026-11-15"
                    }
                  }
                },
                "receiptWithBuyer": {
                  "summary": "ME receipt with a domestic buyer, card + cash",
                  "value": {
                    "external_reference": "WC-10045",
                    "type": "receipt",
                    "client": {
                      "id_type": "tax_id_number",
                      "id_number": "02000001",
                      "name": "Kupac d.o.o.",
                      "address": "Bulevar 1",
                      "city": "Podgorica"
                    },
                    "items": [
                      {
                        "product_id": 15,
                        "quantity": 2,
                        "unit_price": 121
                      }
                    ],
                    "payments": [
                      {
                        "method": "card",
                        "amount": 200
                      },
                      {
                        "method": "cash",
                        "amount": 42
                      }
                    ]
                  }
                },
                "foreignBuyer": {
                  "summary": "Receipt with a foreign buyer (needs address, city, country, id_type)",
                  "value": {
                    "external_reference": "WC-10046",
                    "type": "receipt",
                    "client": {
                      "id_type": "passport_number",
                      "id_number": "P1234567",
                      "name": "John Smith",
                      "address": "Hauptstr. 1",
                      "city": "Berlin",
                      "country": "DEU"
                    },
                    "items": [
                      {
                        "code": "SKU-1",
                        "quantity": 1,
                        "unit_price": 121
                      }
                    ],
                    "payments": [
                      {
                        "method": "card",
                        "amount": 121
                      }
                    ]
                  }
                },
                "rsReceipt": {
                  "summary": "RS receipt by barcode, with a discount and a note",
                  "value": {
                    "external_reference": "SHOP-881",
                    "type": "receipt",
                    "expect_country": "RS",
                    "items": [
                      {
                        "barcode": "8600000000017",
                        "quantity": 2,
                        "unit_price": 125,
                        "discount_percent": 4,
                        "note": "gift wrap"
                      }
                    ],
                    "payments": [
                      {
                        "method": "cash",
                        "amount": 240
                      }
                    ]
                  }
                },
                "onAccount": {
                  "summary": "Receipt paid on account (non-cash invoice; ME needs no day deposit)",
                  "value": {
                    "external_reference": "B2B-501",
                    "type": "receipt",
                    "client": {
                      "id": 42
                    },
                    "items": [
                      {
                        "gtin": "08600000000017",
                        "quantity": 10,
                        "unit_price": 12.1
                      }
                    ],
                    "payments": [
                      {
                        "method": "invoice",
                        "amount": 121
                      }
                    ]
                  }
                },
                "rsEinvoiceOptions": {
                  "summary": "RS e-invoice with VAT obligation by delivery date",
                  "value": {
                    "external_reference": "ERP-2026/78",
                    "type": "einvoice",
                    "client": {
                      "id_type": "tax_id_number",
                      "id_number": "101010101",
                      "registration_number": "20202020",
                      "name": "Kupac doo",
                      "address": "Bulevar 5",
                      "city": "Beograd",
                      "postal_number": "11000"
                    },
                    "items": [
                      {
                        "product_id": 15,
                        "quantity": 3,
                        "unit_price": 120
                      }
                    ],
                    "payments": [
                      {
                        "method": "invoice",
                        "amount": 360
                      }
                    ],
                    "einvoice": {
                      "due_date": "2026-11-30",
                      "vat_obligation": "by_delivery_date",
                      "delivery_date": "2026-10-24"
                    }
                  }
                },
                "describedItems": {
                  "summary": "Items described by the integrator's own code (created with catalog:write when unknown)",
                  "value": {
                    "external_reference": "WC-10050",
                    "type": "receipt",
                    "items": [
                      {
                        "code": "SKU-4471",
                        "name": "Club sendvič",
                        "tax_rate": 20,
                        "quantity": 1,
                        "unit_price": 850
                      },
                      {
                        "code": "SKU-0001",
                        "name": "Dostava",
                        "tax_rate": 0,
                        "tax_rate_label": "Г",
                        "quantity": 1,
                        "unit_price": 200
                      }
                    ],
                    "payments": [
                      {
                        "method": "card",
                        "amount": 1050
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Issued and fiscalized.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                },
                "examples": {
                  "meReceipt": {
                    "summary": "ME receipt, fiscalized",
                    "value": {
                      "data": {
                        "external_reference": "WC-10045",
                        "country": "ME",
                        "type": "receipt",
                        "register_status": "success",
                        "number": 1,
                        "total": "242.00",
                        "tax_total": "42.00",
                        "issued_at": "2026-10-25T09:41:12+00:00",
                        "fiscalized": true,
                        "iic": "970E13F90E07ACDAC7CA61700BF01B83",
                        "fiscal_code": "0f3b2a8e-6c1d-4f6a-9b7e-2d5c8a1e4f90",
                        "verification_url": "https://efitest.tax.gov.me/ic/#/verify?iic=970E13F90E07ACDAC7CA61700BF01B83&tin=02356666&crtd=2026-10-25T10:41:12+01:00&ord=1&bu=ab123cd456&cr=xy987zz321&sw=cx878wj457&prc=242.00",
                        "voided": false,
                        "corrected": false
                      },
                      "request_id": "7c9e6679-7425-40de-944b-e07fc1f90001"
                    }
                  },
                  "rsReceipt": {
                    "summary": "RS receipt, fiscalized (journal: the receipt text for the buyer)",
                    "value": {
                      "data": {
                        "external_reference": "SHOP-881",
                        "country": "RS",
                        "type": "receipt",
                        "register_status": "success",
                        "number": 1,
                        "total": "240.00",
                        "tax_total": "40.00",
                        "issued_at": "2026-10-25T09:41:12+00:00",
                        "fiscalized": true,
                        "invoice_number": "9WM3LAJT-9WM3LAJT-5700",
                        "invoice_counter": "4508/5700ПП",
                        "verification_url": "https://suf.purs.gov.rs/v/?vl=A1JXTTNMQUpUOVdNM0xBSlQ...",
                        "sdc_date_time": "2026-10-25T11:41:12.511+02:00",
                        "journal": "============ ФИСКАЛНИ РАЧУН ============\n            100000001\n          Aria Test doo\n         Knez Mihailova 1\n             Beograd\nКасир:                    API – Webshop\nЕСИР број:                       1442/8\n-------------ПРОМЕТ ПРОДАЈА-------------\nАртикли\n========================================\nНазив   Цена         Кол.         Укупно\nKafa (Ђ)\n       120,00          2          240,00\n----------------------------------------\nУкупан износ:                     240,00\nГотовина:                        240,00\n========================================\nОзнака       Име      Стопа        Порез\nЂ             ПДВ   20,00%         40,00\n----------------------------------------\nУкупан износ пореза:               40,00\n========================================\nПФР време:          25.10.2026. 11:41:12\nПФР број рачуна: 9WM3LAJT-9WM3LAJT-5700\nБројач рачуна:               4508/5700ПП\n========================================\n======== КРАЈ ФИСКАЛНОГ РАЧУНА =========",
                        "voided": false,
                        "corrected": false
                      },
                      "request_id": "7c9e6679-7425-40de-944b-e07fc1f90006"
                    }
                  },
                  "rsEinvoice": {
                    "summary": "RS e-invoice, sent to SEF",
                    "value": {
                      "data": {
                        "external_reference": "ERP-2026/77",
                        "country": "RS",
                        "type": "einvoice",
                        "register_status": "einvoice-sending",
                        "number": 1,
                        "total": "1140.00",
                        "tax_total": "190.00",
                        "issued_at": "2026-10-25T09:41:12+00:00",
                        "fiscalized": true,
                        "sales_invoice_id": 4242,
                        "einvoice_status": "einvoice-sending",
                        "voided": false,
                        "corrected": false
                      },
                      "request_id": "7c9e6679-7425-40de-944b-e07fc1f90008"
                    }
                  }
                }
              }
            }
          },
          "202": {
            "description": "Stored but not fiscalized: the tax authority failed (data.fiscal_error says how). The document is kept, register_status `failed`; Konty support follows it up. Do not resend a modified order under this reference.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                },
                "examples": {
                  "kept": {
                    "summary": "Kept, not fiscalized (EFI did not answer); Konty support follows it up",
                    "value": {
                      "data": {
                        "external_reference": "WC-10046",
                        "country": "ME",
                        "type": "receipt",
                        "register_status": "failed",
                        "number": 2,
                        "total": "242.00",
                        "tax_total": "42.00",
                        "issued_at": "2026-10-25T09:41:12+00:00",
                        "fiscalized": false,
                        "fiscal_error": {
                          "code": "FISCAL_STATUS_UNKNOWN",
                          "message": "The tax authority's answer was lost. The document is kept as not fiscalized; Konty support follows it up.",
                          "details": {
                            "efi_request_uuid": "bd2ab1cf-6b2b-4f61-a6dd-54f10d25c84e"
                          }
                        },
                        "iic": null,
                        "fiscal_code": null,
                        "verification_url": null,
                        "voided": false,
                        "corrected": false
                      },
                      "request_id": "7c9e6679-7425-40de-944b-e07fc1f90003"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed. Codes: API_KEY_MISSING, API_KEY_INVALID, API_KEY_DISABLED, API_KEY_EXPIRED.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Account inactive. Codes: SUBSCRIPTION_INACTIVE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Access refused. Codes: IP_NOT_ALLOWED, MODULE_NOT_ACTIVE, MARKET_NOT_SUPPORTED, INSUFFICIENT_SCOPE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Codes: RATE_LIMITED.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure. Codes: INTERNAL_ERROR.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict. Codes: DUPLICATE_REFERENCE (error.details.external_reference, error.details.order: the document already issued under it), FISCAL_SETUP_INCOMPLETE, SHIFT_CLOSED, VSDC_CERTIFICATE_MISSING, REGISTER_UNAVAILABLE, USER_UNAVAILABLE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "duplicateReference": {
                    "summary": "A used external_reference, with the document it names",
                    "value": {
                      "error": {
                        "code": "DUPLICATE_REFERENCE",
                        "message": "This external_reference was already used. The document it names is in details.order; never resend it under a new reference.",
                        "details": {
                          "external_reference": "WC-10045",
                          "order": {
                            "external_reference": "WC-10045",
                            "country": "ME",
                            "type": "receipt",
                            "register_status": "success",
                            "number": 1,
                            "total": "242.00",
                            "tax_total": "42.00",
                            "issued_at": "2026-10-25T09:41:12+00:00",
                            "fiscalized": true,
                            "iic": "970E13F90E07ACDAC7CA61700BF01B83",
                            "fiscal_code": "0f3b2a8e-6c1d-4f6a-9b7e-2d5c8a1e4f90",
                            "verification_url": "https://efitest.tax.gov.me/ic/#/verify?iic=970E13F90E07ACDAC7CA61700BF01B83&tin=02356666&crtd=2026-10-25T10:41:12+01:00&ord=1&bu=ab123cd456&cr=xy987zz321&sw=cx878wj457&prc=242.00",
                            "voided": false,
                            "corrected": false
                          }
                        }
                      },
                      "request_id": "7c9e6679-7425-40de-944b-e07fc1f90004"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Invalid order. Codes: VALIDATION_ERROR, PRODUCT_NOT_FOUND, PRODUCT_TAX_MISMATCH, PRODUCT_IDENTIFIER_TAKEN, TAX_RATE_NOT_FOUND, TAX_RATE_AMBIGUOUS, CLIENT_NOT_FOUND, COUNTRY_MISMATCH, PAYMENT_TOTAL_MISMATCH, ORDER_REJECTED.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "paymentTotalMismatch": {
                    "summary": "Payments do not add up to the total",
                    "value": {
                      "error": {
                        "code": "PAYMENT_TOTAL_MISMATCH",
                        "message": "The payments do not add up to the order total.",
                        "details": {
                          "order_total": "242.00",
                          "payments_total": "1.00"
                        }
                      },
                      "request_id": "7c9e6679-7425-40de-944b-e07fc1f90005"
                    }
                  },
                  "taxRateAmbiguous": {
                    "summary": "A described item's tax rate matches several labels",
                    "value": {
                      "error": {
                        "code": "TAX_RATE_AMBIGUOUS",
                        "message": "Several tax rates have this value; send tax_rate_label.",
                        "details": {
                          "item_index": 0,
                          "tax_rate": 0,
                          "labels": [
                            "Г",
                            "А"
                          ]
                        }
                      },
                      "request_id": "7c9e6679-7425-40de-944b-e07fc1f90006"
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "Nothing was stored: the day's opening cash deposit (ME shared register) could not be registered. Code: FISCAL_SERVICE_UNAVAILABLE; resending is safe.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "The cash register is issuing other documents. No document was stored: send the same request again after Retry-After. Codes: REGISTER_BUSY.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait."
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/orders/{reference}": {
      "get": {
        "tags": [
          "Orders"
        ],
        "operationId": "getOrder",
        "summary": "Read a document by your reference",
        "x-scope": "orders:read",
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            },
            "description": "Your external_reference. May contain '/' (e.g. 2026/ERP-7) — send it unencoded."
          }
        ],
        "responses": {
          "200": {
            "description": "The same payload as the create response.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                },
                "examples": {
                  "meReceipt": {
                    "summary": "The document, as issued",
                    "value": {
                      "data": {
                        "external_reference": "WC-10045",
                        "country": "ME",
                        "type": "receipt",
                        "register_status": "success",
                        "number": 1,
                        "total": "242.00",
                        "tax_total": "42.00",
                        "issued_at": "2026-10-25T09:41:12+00:00",
                        "fiscalized": true,
                        "iic": "970E13F90E07ACDAC7CA61700BF01B83",
                        "fiscal_code": "0f3b2a8e-6c1d-4f6a-9b7e-2d5c8a1e4f90",
                        "verification_url": "https://efitest.tax.gov.me/ic/#/verify?iic=970E13F90E07ACDAC7CA61700BF01B83&tin=02356666&crtd=2026-10-25T10:41:12+01:00&ord=1&bu=ab123cd456&cr=xy987zz321&sw=cx878wj457&prc=242.00",
                        "voided": false,
                        "corrected": false
                      },
                      "request_id": "7c9e6679-7425-40de-944b-e07fc1f90001"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed. Codes: API_KEY_MISSING, API_KEY_INVALID, API_KEY_DISABLED, API_KEY_EXPIRED.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Account inactive. Codes: SUBSCRIPTION_INACTIVE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Access refused. Codes: IP_NOT_ALLOWED, MODULE_NOT_ACTIVE, MARKET_NOT_SUPPORTED, INSUFFICIENT_SCOPE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Codes: RATE_LIMITED.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure. Codes: INTERNAL_ERROR.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The key's register or user is unavailable. Codes: REGISTER_UNAVAILABLE, USER_UNAVAILABLE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not issued. Codes: NOT_FOUND.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/orders/{reference}/void": {
      "post": {
        "tags": [
          "Orders"
        ],
        "operationId": "voidOrder",
        "summary": "Void a document issued by mistake",
        "x-scope": "orders:void",
        "description": "ME receipt: a full-cancel corrective receipt. RS receipt: a refund receipt (reason: error). RS e-invoice: storno in SEF. A repeated void is refused: 409 VOID_NOT_ALLOWED with details.reason already_voided and details.order (the document with its void).",
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            },
            "description": "Your external_reference. May contain '/' (e.g. 2026/ERP-7) — send it unencoded."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoidRequest"
              },
              "examples": {
                "void": {
                  "summary": "Void in full",
                  "value": {
                    "reason": "Customer cancelled"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Voided.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                },
                "examples": {
                  "meVoid": {
                    "summary": "ME receipt voided by a full-cancel corrective",
                    "value": {
                      "data": {
                        "external_reference": "WC-10045",
                        "country": "ME",
                        "type": "receipt",
                        "register_status": "success",
                        "number": 1,
                        "total": "242.00",
                        "tax_total": "42.00",
                        "issued_at": "2026-10-25T09:41:12+00:00",
                        "fiscalized": true,
                        "iic": "970E13F90E07ACDAC7CA61700BF01B83",
                        "fiscal_code": "0f3b2a8e-6c1d-4f6a-9b7e-2d5c8a1e4f90",
                        "verification_url": "https://efitest.tax.gov.me/ic/#/verify?iic=970E13F90E07ACDAC7CA61700BF01B83&tin=02356666&crtd=2026-10-25T10:41:12+01:00&ord=1&bu=ab123cd456&cr=xy987zz321&sw=cx878wj457&prc=242.00",
                        "voided": true,
                        "corrected": true,
                        "void": {
                          "fiscalized": true,
                          "number": 2,
                          "total": "-242.00",
                          "issued_at": "2026-10-25T09:41:12+00:00",
                          "register_status": "success",
                          "iic": "CEE88C4CA31100B4ACD2E35F4AAD9F2E",
                          "fiscal_code": "c7d1e9a2-3b4f-4e8a-a6d5-1f2e3c4b5a60"
                        }
                      },
                      "request_id": "7c9e6679-7425-40de-944b-e07fc1f90002"
                    }
                  },
                  "rsVoid": {
                    "summary": "RS receipt voided by a refund",
                    "value": {
                      "data": {
                        "external_reference": "SHOP-881",
                        "country": "RS",
                        "type": "receipt",
                        "register_status": "success",
                        "number": 1,
                        "total": "240.00",
                        "tax_total": "40.00",
                        "issued_at": "2026-10-25T09:41:12+00:00",
                        "fiscalized": true,
                        "invoice_number": "9WM3LAJT-9WM3LAJT-5700",
                        "invoice_counter": "4508/5700ПП",
                        "verification_url": "https://suf.purs.gov.rs/v/?vl=A1JXTTNMQUpUOVdNM0xBSlQ...",
                        "sdc_date_time": "2026-10-25T11:41:12.511+02:00",
                        "journal": "============ ФИСКАЛНИ РАЧУН ============\n            100000001\n          Aria Test doo\n         Knez Mihailova 1\n             Beograd\nКасир:                    API – Webshop\nЕСИР број:                       1442/8\n-------------ПРОМЕТ ПРОДАЈА-------------\nАртикли\n========================================\nНазив   Цена         Кол.         Укупно\nKafa (Ђ)\n       120,00          2          240,00\n----------------------------------------\nУкупан износ:                     240,00\nГотовина:                        240,00\n========================================\nОзнака       Име      Стопа        Порез\nЂ             ПДВ   20,00%         40,00\n----------------------------------------\nУкупан износ пореза:               40,00\n========================================\nПФР време:          25.10.2026. 11:41:12\nПФР број рачуна: 9WM3LAJT-9WM3LAJT-5700\nБројач рачуна:               4508/5700ПП\n========================================\n======== КРАЈ ФИСКАЛНОГ РАЧУНА =========",
                        "voided": true,
                        "corrected": true,
                        "void": {
                          "fiscalized": true,
                          "number": 2,
                          "total": "-240.00",
                          "issued_at": "2026-10-25T09:41:12+00:00",
                          "register_status": "success",
                          "invoice_number": "9WM3LAJT-9WM3LAJT-5701",
                          "verification_url": "https://suf.purs.gov.rs/v/?vl=A1JXTTNMQUpUOVdNM0xBSlR...",
                          "journal": "============ ФИСКАЛНИ РАЧУН ============\n            100000001\n          Aria Test doo\n         Knez Mihailova 1\n             Beograd\nКасир:                    API – Webshop\nЕСИР број:                       1442/8\n-------------ПРОМЕТ РЕФУНДАЦИЈА-------------\nАртикли\n========================================\nНазив   Цена         Кол.         Укупно\nKafa (Ђ)\n       120,00          2          240,00\n----------------------------------------\nУкупан износ:                     240,00\nГотовина:                        240,00\n========================================\nОзнака       Име      Стопа        Порез\nЂ             ПДВ   20,00%         40,00\n----------------------------------------\nУкупан износ пореза:               40,00\n========================================\nПФР време:          25.10.2026. 11:41:12\nПФР број рачуна: 9WM3LAJT-9WM3LAJT-5701\nБројач рачуна:               4508/5701ПР\n========================================\n======== КРАЈ ФИСКАЛНОГ РАЧУНА ========="
                        }
                      },
                      "request_id": "7c9e6679-7425-40de-944b-e07fc1f90007"
                    }
                  },
                  "einvoiceStorno": {
                    "summary": "RS e-invoice storno in SEF",
                    "value": {
                      "data": {
                        "external_reference": "ERP-2026/77",
                        "country": "RS",
                        "type": "einvoice",
                        "register_status": "einvoice-storno",
                        "number": 1,
                        "total": "1140.00",
                        "tax_total": "190.00",
                        "issued_at": "2026-10-25T09:41:12+00:00",
                        "fiscalized": true,
                        "sales_invoice_id": 4242,
                        "einvoice_status": "einvoice-storno",
                        "voided": true,
                        "corrected": false
                      },
                      "request_id": "7c9e6679-7425-40de-944b-e07fc1f90009"
                    }
                  }
                }
              }
            }
          },
          "202": {
            "description": "The corrective / refund was stored but not fiscalized (data.fiscal_error); Konty support follows it up.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed. Codes: API_KEY_MISSING, API_KEY_INVALID, API_KEY_DISABLED, API_KEY_EXPIRED.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Account inactive. Codes: SUBSCRIPTION_INACTIVE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Access refused. Codes: IP_NOT_ALLOWED, MODULE_NOT_ACTIVE, MARKET_NOT_SUPPORTED, INSUFFICIENT_SCOPE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Codes: RATE_LIMITED.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure. Codes: INTERNAL_ERROR.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not issued. Codes: NOT_FOUND.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Cannot be voided now. Codes: VOID_NOT_ALLOWED (details.reason already_voided carries details.order), FISCAL_SETUP_INCOMPLETE, SHIFT_CLOSED, VSDC_CERTIFICATE_MISSING, REGISTER_UNAVAILABLE, USER_UNAVAILABLE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid request. Codes: VALIDATION_ERROR.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Nothing was stored here. The day's opening cash deposit (ME shared register) could not be registered (FISCAL_SERVICE_UNAVAILABLE; resending is safe), or an e-invoice storno failed in SEF: FISCAL_REJECTED / FISCAL_SERVICE_UNAVAILABLE leave the e-invoice unchanged; after FISCAL_STATUS_UNKNOWN SEF may have taken the storno — check einvoice_status with GET before resending.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "The cash register is issuing other documents. No document was stored: send the same request again after Retry-After. Codes: REGISTER_BUSY.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait."
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/tickets": {
      "post": {
        "tags": [
          "Room service"
        ],
        "operationId": "createTicket",
        "summary": "Send a room-service porudžbina",
        "x-scope": "tickets:create",
        "description": "Creates a porudžbina the venue sees in Nalozi. Nothing is issued: the venue accepts or refuses it, prepares it, and closes it as Pošalji na sobu (charged to the room through the hotel system) or Naplati (a receipt, cash or card). Prices are the venue's catalogue prices. One porudžbina per (your integration, external_reference): a used reference is refused with 409 DUPLICATE_REFERENCE and error.details.ticket. Follow it with GET /tickets/{reference}.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TicketRequest"
              },
              "examples": {
                "roomService": {
                  "summary": "Two items for room 214",
                  "value": {
                    "external_reference": "RS-2026-0042",
                    "room": "214",
                    "guest": "Marko Petrović",
                    "note": "bez luka",
                    "items": [
                      {
                        "product_id": 12,
                        "quantity": 2,
                        "note": "dobro pečeno"
                      },
                      {
                        "code": "102",
                        "quantity": 1
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The porudžbina, waiting for the venue.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Ticket"
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                },
                "examples": {
                  "received": {
                    "summary": "Received",
                    "value": {
                      "data": {
                        "external_reference": "RS-2026-0042",
                        "status": "received",
                        "room": "214",
                        "guest": "Marko Petrović",
                        "note": "bez luka",
                        "items": [
                          {
                            "product_id": 12,
                            "name": "Pljeskavica",
                            "quantity": 2,
                            "unit_price": "650.00",
                            "total": "1300.00",
                            "note": "dobro pečeno"
                          },
                          {
                            "product_id": 31,
                            "name": "Mineralna voda",
                            "quantity": 1,
                            "unit_price": "200.00",
                            "total": "200.00",
                            "note": null
                          }
                        ],
                        "total": "1500.00",
                        "reject_reason": null,
                        "document": null,
                        "created_at": "2026-10-27T19:02:11+00:00",
                        "updated_at": "2026-10-27T19:02:11+00:00"
                      },
                      "request_id": "5b2f1c7e-8d3a-4f1b-9c2e-7a6d5e4f3b21"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed. Codes: API_KEY_MISSING, API_KEY_INVALID, API_KEY_DISABLED, API_KEY_EXPIRED.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Account inactive. Codes: SUBSCRIPTION_INACTIVE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Access refused. Codes: IP_NOT_ALLOWED, MODULE_NOT_ACTIVE, MARKET_NOT_SUPPORTED, INSUFFICIENT_SCOPE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Codes: RATE_LIMITED.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure. Codes: INTERNAL_ERROR.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict. DUPLICATE_REFERENCE (error.details.external_reference, error.details.ticket: the porudžbina already sent under it).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "duplicateTicket": {
                    "summary": "A used external_reference, with the porudžbina it names",
                    "value": {
                      "error": {
                        "code": "DUPLICATE_REFERENCE",
                        "message": "This external_reference was already used. The porudžbina it names is in details.ticket; never resend it under a new reference.",
                        "details": {
                          "external_reference": "RS-2026-0042",
                          "ticket": {
                            "external_reference": "RS-2026-0042",
                            "status": "received",
                            "room": "214",
                            "guest": "Marko Petrović",
                            "note": "bez luka",
                            "items": [
                              {
                                "product_id": 12,
                                "name": "Pljeskavica",
                                "quantity": 2,
                                "unit_price": "650.00",
                                "total": "1300.00",
                                "note": "dobro pečeno"
                              },
                              {
                                "product_id": 31,
                                "name": "Mineralna voda",
                                "quantity": 1,
                                "unit_price": "200.00",
                                "total": "200.00",
                                "note": null
                              }
                            ],
                            "total": "1500.00",
                            "reject_reason": null,
                            "document": null,
                            "created_at": "2026-10-27T19:02:11+00:00",
                            "updated_at": "2026-10-27T19:02:11+00:00"
                          }
                        }
                      },
                      "request_id": "5b2f1c7e-8d3a-4f1b-9c2e-7a6d5e4f3b21"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Refused, nothing stored. Codes: VALIDATION_ERROR (error.details.errors), PRODUCT_NOT_FOUND (error.details.item_index).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "productNotFound": {
                    "summary": "An item matches no sellable product",
                    "value": {
                      "error": {
                        "code": "PRODUCT_NOT_FOUND",
                        "message": "No sellable product with this code.",
                        "details": {
                          "item_index": 1,
                          "code": "102"
                        }
                      },
                      "request_id": "5b2f1c7e-8d3a-4f1b-9c2e-7a6d5e4f3b21"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/tickets/{reference}": {
      "get": {
        "tags": [
          "Room service"
        ],
        "operationId": "getTicket",
        "summary": "Read a porudžbina by your reference",
        "x-scope": "tickets:read",
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            },
            "description": "Your external_reference. May contain '/' (e.g. 2026/ERP-7) — send it unencoded."
          }
        ],
        "responses": {
          "200": {
            "description": "The porudžbina and where it stands.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Ticket"
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                },
                "examples": {
                  "sentToRoom": {
                    "summary": "Closed, charged to the room",
                    "value": {
                      "data": {
                        "external_reference": "RS-2026-0042",
                        "status": "sent_to_room",
                        "room": "214",
                        "guest": "Marko Petrović",
                        "note": "bez luka",
                        "items": [
                          {
                            "product_id": 12,
                            "name": "Pljeskavica",
                            "quantity": 2,
                            "unit_price": "650.00",
                            "total": "1300.00",
                            "note": "dobro pečeno"
                          },
                          {
                            "product_id": 31,
                            "name": "Mineralna voda",
                            "quantity": 1,
                            "unit_price": "200.00",
                            "total": "200.00",
                            "note": null
                          }
                        ],
                        "total": "1500.00",
                        "reject_reason": null,
                        "document": {
                          "type": "room_charge",
                          "room": "214",
                          "number": null,
                          "fiscal_number": null,
                          "issued_at": "2026-10-27T19:40:03+00:00"
                        },
                        "created_at": "2026-10-27T19:02:11+00:00",
                        "updated_at": "2026-10-27T19:40:03+00:00"
                      },
                      "request_id": "5b2f1c7e-8d3a-4f1b-9c2e-7a6d5e4f3b21"
                    }
                  },
                  "paid": {
                    "summary": "Closed with a receipt",
                    "value": {
                      "data": {
                        "external_reference": "RS-2026-0042",
                        "status": "paid",
                        "room": "214",
                        "guest": "Marko Petrović",
                        "note": "bez luka",
                        "items": [
                          {
                            "product_id": 12,
                            "name": "Pljeskavica",
                            "quantity": 2,
                            "unit_price": "650.00",
                            "total": "1300.00",
                            "note": "dobro pečeno"
                          },
                          {
                            "product_id": 31,
                            "name": "Mineralna voda",
                            "quantity": 1,
                            "unit_price": "200.00",
                            "total": "200.00",
                            "note": null
                          }
                        ],
                        "total": "1500.00",
                        "reject_reason": null,
                        "document": {
                          "type": "receipt",
                          "room": null,
                          "number": 118,
                          "fiscal_number": "9WM3LAJT-9WM3LAJT-5710",
                          "issued_at": "2026-10-27T19:38:44+00:00"
                        },
                        "created_at": "2026-10-27T19:02:11+00:00",
                        "updated_at": "2026-10-27T19:38:44+00:00"
                      },
                      "request_id": "5b2f1c7e-8d3a-4f1b-9c2e-7a6d5e4f3b21"
                    }
                  },
                  "rejected": {
                    "summary": "Refused by the venue",
                    "value": {
                      "data": {
                        "external_reference": "RS-2026-0042",
                        "status": "rejected",
                        "room": "214",
                        "guest": "Marko Petrović",
                        "note": "bez luka",
                        "items": [
                          {
                            "product_id": 12,
                            "name": "Pljeskavica",
                            "quantity": 2,
                            "unit_price": "650.00",
                            "total": "1300.00",
                            "note": "dobro pečeno"
                          },
                          {
                            "product_id": 31,
                            "name": "Mineralna voda",
                            "quantity": 1,
                            "unit_price": "200.00",
                            "total": "200.00",
                            "note": null
                          }
                        ],
                        "total": "1500.00",
                        "reject_reason": "Kuhinja je zatvorena.",
                        "document": null,
                        "created_at": "2026-10-27T19:02:11+00:00",
                        "updated_at": "2026-10-27T19:05:30+00:00"
                      },
                      "request_id": "5b2f1c7e-8d3a-4f1b-9c2e-7a6d5e4f3b21"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed. Codes: API_KEY_MISSING, API_KEY_INVALID, API_KEY_DISABLED, API_KEY_EXPIRED.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Account inactive. Codes: SUBSCRIPTION_INACTIVE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Access refused. Codes: IP_NOT_ALLOWED, MODULE_NOT_ACTIVE, MARKET_NOT_SUPPORTED, INSUFFICIENT_SCOPE.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Codes: RATE_LIMITED.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure. Codes: INTERNAL_ERROR.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "TICKET_NOT_FOUND — no porudžbina of your integration with this reference.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "ticketNotFound": {
                    "summary": "Unknown reference",
                    "value": {
                      "error": {
                        "code": "TICKET_NOT_FOUND",
                        "message": "No porudžbina with this external_reference."
                      },
                      "request_id": "5b2f1c7e-8d3a-4f1b-9c2e-7a6d5e4f3b21"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authorization: Bearer aria_live_… (aria_test_… on the sandbox)."
      }
    },
    "headers": {
      "X-Request-Id": {
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Equal to the body's request_id; quote it to support."
      }
    },
    "schemas": {
      "ErrorEnvelope": {
        "type": "object",
        "required": [
          "error",
          "request_id"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "$ref": "#/components/schemas/ErrorCode"
              },
              "message": {
                "type": "string"
              },
              "details": {
                "type": "object",
                "additionalProperties": true
              }
            }
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "ErrorCode": {
        "type": "string",
        "enum": [
          "API_KEY_MISSING",
          "API_KEY_INVALID",
          "API_KEY_DISABLED",
          "API_KEY_EXPIRED",
          "SUBSCRIPTION_INACTIVE",
          "IP_NOT_ALLOWED",
          "MODULE_NOT_ACTIVE",
          "MARKET_NOT_SUPPORTED",
          "INSUFFICIENT_SCOPE",
          "NOT_FOUND",
          "TICKET_NOT_FOUND",
          "METHOD_NOT_ALLOWED",
          "REGISTER_UNAVAILABLE",
          "USER_UNAVAILABLE",
          "SHIFT_CLOSED",
          "VSDC_CERTIFICATE_MISSING",
          "FISCAL_SETUP_INCOMPLETE",
          "DUPLICATE_REFERENCE",
          "VOID_NOT_ALLOWED",
          "VALIDATION_ERROR",
          "PRODUCT_NOT_FOUND",
          "PRODUCT_TAX_MISMATCH",
          "PRODUCT_IDENTIFIER_TAKEN",
          "TAX_RATE_NOT_FOUND",
          "TAX_RATE_AMBIGUOUS",
          "CLIENT_NOT_FOUND",
          "COUNTRY_MISMATCH",
          "PAYMENT_TOTAL_MISMATCH",
          "PERIOD_TOO_LONG",
          "ORDER_REJECTED",
          "RATE_LIMITED",
          "HTTP_ERROR",
          "INTERNAL_ERROR",
          "FISCAL_REJECTED",
          "FISCAL_SERVICE_UNAVAILABLE",
          "FISCAL_STATUS_UNKNOWN",
          "REGISTER_BUSY"
        ],
        "description": "- API_KEY_MISSING: 401 — no Authorization: Bearer header.\n- API_KEY_INVALID: 401 — unknown key, or a key of the other environment (aria_live_ vs aria_test_).\n- API_KEY_DISABLED: 401 — the key was disabled in Konty Admin.\n- API_KEY_EXPIRED: 401 — the key is past its expiry date.\n- SUBSCRIPTION_INACTIVE: 402 — the Konty account is not active.\n- IP_NOT_ALLOWED: 403 — the caller's IP is not on the key's whitelist.\n- MODULE_NOT_ACTIVE: 403 — the account has no active External API module.\n- MARKET_NOT_SUPPORTED: 403 — the account's market is not served (BA).\n- INSUFFICIENT_SCOPE: 403 — the key lacks the route's scope (details.required_scope).\n- NOT_FOUND: 404 — no document with this external_reference, or no such endpoint (a request without a key is answered API_KEY_MISSING first).\n- TICKET_NOT_FOUND: 404 — no porudžbina of your integration with this external_reference.\n- METHOD_NOT_ALLOWED: 405 — reserved.\n- REGISTER_UNAVAILABLE: 409 — the key's cash register is inactive; bind another in Konty Admin.\n- USER_UNAVAILABLE: 409 — the key's user is inactive; bind another in Konty Admin.\n- SHIFT_CLOSED: 409 — the key's regular cash register has no open shift.\n- VSDC_CERTIFICATE_MISSING: 409 — RS: no valid VSDC certificate stored (details.certificate: missing | expired).\n- FISCAL_SETUP_INCOMPLETE: 409 — the account's fiscal setup would make the tax authority refuse the document; nothing was stored. details.reason: fiscalization_disabled | certificate_missing | certificate_expired | venue_identity_missing | tcr_missing | operator_code_missing | operator_code_refused (ME: the tax authority refused the operator code of the key's user) | day_deposit_missing (ME, cash or card payment on a regular register) | einvoice_api_key_missing (RS e-invoice). Fixed in Konty Admin, then resend.\n- DUPLICATE_REFERENCE: 409 — this external_reference was already used (details.order: the document it names; never resend under a new reference).\n- VOID_NOT_ALLOWED: 409 — the document cannot be voided (details.register_status; details.reason: already_voided (details.order: the document with its void) | already_corrected | not_registered | is_a_correction | einvoice_status | already_storno, or the business rule that refused the corrective).\n- VALIDATION_ERROR: 422 — the request is not valid (details.errors: field → messages).\n- PRODUCT_NOT_FOUND: 422 — no sellable product for an item (details.item_index).\n- PRODUCT_TAX_MISMATCH: 422 — a described item's code belongs to a product with another tax rate (details.product_tax_rate, details.product_tax_rate_label).\n- PRODUCT_IDENTIFIER_TAKEN: 422 — a described item's gtin or barcode belongs to another product, or its code is held by a product deleted before codes were freed or (with scales) differs from another product's only by leading zeros (details.field, details.product_id).\n- TAX_RATE_NOT_FOUND: 422 — no tax rate of the venue has a described item's tax_rate (and tax_rate_label).\n- TAX_RATE_AMBIGUOUS: 422 — several of the venue's tax rates have a described item's tax_rate; send tax_rate_label (details.labels).\n- CLIENT_NOT_FOUND: 422 — client.id does not exist.\n- COUNTRY_MISMATCH: 422 — expect_country differs from the account's country (details.country).\n- PAYMENT_TOTAL_MISMATCH: 422 — payments do not add up to the order total (details.order_total, details.payments_total).\n- PERIOD_TOO_LONG: 422 — GET /orders: `to` is more than one month after `from` (details.max_to).\n- ORDER_REJECTED: 422 — the order was refused by a business rule (details.reason).\n- RATE_LIMITED: 429 — too many requests for the key (its rate limit) or from one IP (3000 a minute across the API); see the Retry-After header.\n- HTTP_ERROR: 4xx/5xx — another HTTP-level refusal. A 503 is maintenance: the service is temporarily unavailable and nothing was stored; send the same request again later (after the Retry-After header, when present).\n- INTERNAL_ERROR: 500 — unexpected failure; quote the request_id to support.\n- FISCAL_REJECTED: the tax authority rejected the document. As fiscal_error of a 202 (the document is kept as not fiscalized; Konty support follows it up), or a 502 for an e-invoice storno.\n- FISCAL_SERVICE_UNAVAILABLE: the tax authority could not be reached. As fiscal_error of a 202 (kept, followed up by support), or a 502 when nothing was stored (the day's opening deposit, an e-invoice storno); resending is safe then.\n- FISCAL_STATUS_UNKNOWN: the tax authority's answer was lost. As fiscal_error of a 202 (kept, followed up by support), or a 502 for an e-invoice storno.\n- REGISTER_BUSY: 503 — POST /orders and POST /orders/{reference}/void: the key's cash register is issuing other documents and this request got no turn within 10 seconds. No document was stored; send the same request, with the same external_reference, after the Retry-After header."
      },
      "PageMeta": {
        "type": "object",
        "properties": {
          "page": {
            "type": "integer"
          },
          "per_page": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "last_page": {
            "type": "integer"
          }
        }
      },
      "Status": {
        "type": "object",
        "properties": {
          "key": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "prefix": {
                "type": "string"
              },
              "source": {
                "type": "string"
              },
              "scopes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Scope"
                }
              },
              "expires_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          },
          "account": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "country": {
                "$ref": "#/components/schemas/Country"
              }
            }
          },
          "cash_register": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "shared": {
                "type": "boolean"
              },
              "active": {
                "type": "boolean"
              },
              "shift_open": {
                "type": "boolean"
              }
            }
          },
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "active": {
                "type": "boolean"
              }
            }
          },
          "vsdc_certificate": {
            "type": "object",
            "description": "RS only. Outside production (the staging sandbox) receipts are signed by the tax sandbox's development ESDC and need no certificate; an uploaded valid certificate is used instead.",
            "properties": {
              "present": {
                "type": "boolean"
              },
              "expires_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "signer": {
                "type": "string",
                "enum": [
                  "vsdc",
                  "development_esdc"
                ],
                "description": "Who signs RS receipts now: `vsdc` with this certificate, or `development_esdc` (sandbox only, no certificate needed)."
              }
            }
          }
        }
      },
      "Scope": {
        "type": "string",
        "enum": [
          "orders:create",
          "orders:read",
          "orders:void",
          "orders:export",
          "catalog:read",
          "catalog:write",
          "clients:read",
          "tickets:create",
          "tickets:read"
        ]
      },
      "Country": {
        "type": "string",
        "enum": [
          "ME",
          "RS"
        ]
      },
      "Product": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "barcode": {
            "type": [
              "string",
              "null"
            ]
          },
          "gtin": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "price": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "242.00"
            ],
            "description": "Catalogue price, tax-inclusive (informational)."
          },
          "unit": {
            "type": "string"
          },
          "quantity": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?\\d+\\.\\d{3}$",
            "examples": [
              "12.500"
            ],
            "description": "The venue's stock of the product, three decimals: the total over all its warehouses. Null for a product made from ingredients (it keeps no stock of its own). Negative when more was sold than was recorded as received."
          },
          "tax_rate": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TaxRateRef"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "TaxRateRef": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "label": {
            "type": "string"
          },
          "rate": {
            "type": "string"
          }
        }
      },
      "TaxRate": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "label": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "rate": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        }
      },
      "Client": {
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "id_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "id_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_id_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "registration_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "postal_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "integer"
          }
        }
      },
      "ClientInput": {
        "type": "object",
        "description": "By id, or by identity: the most recent client with the same id_type + id_number (else the same tax ID, in tax_id_number or as the id_number of a tax-ID id_type) is used and never updated; otherwise a new client is created from these fields.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "id_type": {
            "type": "string",
            "enum": [
              "tax_id_number",
              "personal_id_number",
              "passport_number",
              "vat_number",
              "tax_number",
              "social_security_number",
              "tax_id_number_local",
              "personal_id_number_local",
              "tax_id_number_local_jbkjs",
              "retiree_card_number",
              "agricultural_holding_tax_id_number",
              "agricultural_holding_personal_id_number",
              "agricultural_holding_id_number",
              "personal_id_card_number",
              "personal_id_card_number_mkd",
              "personal_id_card_number_mne",
              "personal_id_card_number_alb",
              "personal_id_card_number_bih",
              "personal_id_card_number_eur",
              "resident_number_refugee",
              "resident_number_foreign",
              "resident_number_diplomat",
              "passport_number_local",
              "passport_number_foreign",
              "tax_id_number_foreign"
            ],
            "description": "Required together with id_number. On a receipt, Montenegro takes tax_id_number, personal_id_number, passport_number, vat_number, tax_number and social_security_number; Serbia takes tax_id_number (a domestic buyer's PIB, with country SRB) and the types from tax_id_number_local on. Another type is refused with 422 VALIDATION_ERROR (client.id_type). RS PIB: tax_id_number_local; RS public sector: tax_id_number_local_jbkjs."
          },
          "id_number": {
            "type": "string",
            "maxLength": 64,
            "description": "Required together with id_type."
          },
          "tax_id_number": {
            "type": "string",
            "maxLength": 64,
            "description": "The buyer's tax ID. Sent without id_type, it names the buyer on fiscal documents: Serbia a PIB (tax_id_number_local), or a foreign tax ID (tax_id_number_foreign) when country is not SRB; Montenegro a TIN (tax_id_number), or a TAX number (tax_number) when country is not MNE. A new client is saved with that id_type."
          },
          "registration_number": {
            "type": "string",
            "maxLength": 64
          },
          "vat_number": {
            "type": "string",
            "maxLength": 64
          },
          "name": {
            "type": "string",
            "description": "Required when Konty does not know the client yet (a new client is created). Names are unique among a venue's clients: when another client already has this name, it is used if it has the same tax ID or id number (tax_id_number or id_number); otherwise the request is refused with 422 VALIDATION_ERROR (client.name).",
            "maxLength": 255
          },
          "address": {
            "type": "string",
            "maxLength": 255
          },
          "city": {
            "type": "string",
            "maxLength": 255
          },
          "postal_number": {
            "type": "string",
            "maxLength": 32
          },
          "country": {
            "type": "string",
            "maxLength": 3,
            "description": "ISO 3166-1 alpha-3 (MNE, SRB, DEU, …), stored upper case. RS, ME, BA, MK and AL are also read as their alpha-3 code; any other value that is not three letters is refused with 422 VALIDATION_ERROR (client.country)."
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 255
          }
        },
        "anyOf": [
          {
            "required": [
              "id"
            ]
          },
          {
            "required": [
              "id_type",
              "id_number"
            ]
          },
          {
            "required": [
              "tax_id_number"
            ]
          }
        ]
      },
      "OrderItem": {
        "type": "object",
        "required": [
          "quantity",
          "unit_price"
        ],
        "description": "Exactly one of product_id, code, barcode, gtin — or a described item: code, name and tax_rate, and no product_id. A described item is found by its code (also a product not sold on the POS; codes compare ignoring letter case and accents); a key with catalog:write creates the product when the code is unknown, with the sent name, tax rate and unit, and gtin/barcode when sent. An existing product is never changed, and its tax rate must match the item's (PRODUCT_TAX_MISMATCH). On any other item, name, tax_rate, tax_rate_label and unit are ignored.",
        "properties": {
          "product_id": {
            "type": "integer"
          },
          "code": {
            "type": "string",
            "maxLength": 255
          },
          "barcode": {
            "type": "string",
            "maxLength": 255
          },
          "gtin": {
            "type": "string",
            "maxLength": 255,
            "description": "A lookup key, or on a described item the new product's GTIN: 8 to 14 characters."
          },
          "name": {
            "type": "string",
            "maxLength": 200,
            "description": "With code and tax_rate (and no product_id), makes this a described item: the product's name when it is created."
          },
          "tax_rate": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Described item: the tax rate in percent, e.g. 20. Must match exactly one of the venue's rates (GET /tax-rates), or send tax_rate_label too (TAX_RATE_AMBIGUOUS lists the labels)."
          },
          "tax_rate_label": {
            "type": "string",
            "maxLength": 10,
            "description": "Described item, optional: the rate's label as GET /tax-rates returns it (e.g. Ђ). With it, both value and label must match."
          },
          "unit": {
            "type": "string",
            "enum": [
              "pcs",
              "t",
              "kg",
              "g",
              "l",
              "m",
              "m2",
              "m3",
              "h",
              "day"
            ],
            "default": "pcs",
            "description": "Described item: the unit of a created product."
          },
          "quantity": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 500000
          },
          "unit_price": {
            "type": "number",
            "minimum": 0,
            "maximum": 99999999,
            "description": "Tax-inclusive price per unit, issued exactly as sent (ME: greater than 0) — except for a diplomat client, who pays it without the product's VAT (the API strips it, as the POS does). The tax rate always comes from the product (a described item's tax_rate only finds or creates it)."
          },
          "discount_percent": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "default": 0
          },
          "note": {
            "type": "string",
            "maxLength": 255
          }
        }
      },
      "Payment": {
        "type": "object",
        "required": [
          "method",
          "amount"
        ],
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "cash",
              "card",
              "card_business",
              "invoice",
              "check",
              "voucher",
              "mobile_money",
              "other"
            ],
            "description": "Receipts accept per market — ME: cash, card, card_business, invoice, other; RS: cash, card, invoice, check, voucher, mobile_money, other. Any other method on a receipt is 422 VALIDATION_ERROR (payments.N.method: payment_method_not_supported; card_business on an RS receipt names itself). RS: a card payment on a register whose settings take no cards is 422 (payments.N.method: register_takes_no_cards)."
          },
          "amount": {
            "type": "number",
            "exclusiveMinimum": 0
          }
        }
      },
      "OrderRequest": {
        "type": "object",
        "required": [
          "external_reference",
          "type",
          "items",
          "payments"
        ],
        "properties": {
          "external_reference": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9._-]+(/[A-Za-z0-9._-]+)*$",
            "description": "Your own id of the order; letter case is ignored (ABC and abc are one reference); '/' between segments only, no '.' or '..' segment."
          },
          "type": {
            "type": "string",
            "enum": [
              "receipt",
              "einvoice"
            ],
            "description": "einvoice: RS only."
          },
          "expect_country": {
            "$ref": "#/components/schemas/Country"
          },
          "client": {
            "$ref": "#/components/schemas/ClientInput"
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 500,
            "items": {
              "$ref": "#/components/schemas/OrderItem"
            }
          },
          "payments": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/Payment"
            },
            "description": "Must add up to the order total (2 decimals)."
          },
          "note": {
            "type": "string",
            "maxLength": 255
          },
          "einvoice": {
            "type": "object",
            "description": "RS e-invoice options.",
            "properties": {
              "due_date": {
                "type": "string",
                "format": "date",
                "description": "Required when vat_obligation is by_due_date."
              },
              "vat_obligation": {
                "type": "string",
                "enum": [
                  "by_issue_date",
                  "by_delivery_date",
                  "by_due_date",
                  "no_obligation"
                ],
                "default": "by_delivery_date"
              },
              "delivery_date": {
                "type": "string",
                "format": "date"
              }
            }
          }
        }
      },
      "VoidRequest": {
        "type": "object",
        "required": [
          "reason"
        ],
        "properties": {
          "reason": {
            "type": "string",
            "maxLength": 255
          }
        }
      },
      "Void": {
        "type": "object",
        "properties": {
          "fiscalized": {
            "type": "boolean",
            "description": "Registered with the tax authority (false: kept, followed up by support)."
          },
          "number": {
            "type": [
              "integer",
              "null"
            ]
          },
          "total": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "242.00"
            ]
          },
          "issued_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "register_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "iic": {
            "type": [
              "string",
              "null"
            ],
            "description": "ME"
          },
          "fiscal_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "ME"
          },
          "invoice_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "RS"
          },
          "verification_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "RS"
          },
          "journal": {
            "type": [
              "string",
              "null"
            ],
            "description": "RS receipt: the legal receipt text VSDC signed, to hand to the buyer."
          }
        }
      },
      "Order": {
        "type": "object",
        "properties": {
          "external_reference": {
            "type": "string"
          },
          "country": {
            "$ref": "#/components/schemas/Country"
          },
          "type": {
            "type": "string",
            "enum": [
              "receipt",
              "einvoice"
            ]
          },
          "register_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "number": {
            "type": [
              "integer",
              "null"
            ]
          },
          "total": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "242.00"
            ]
          },
          "tax_total": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "examples": [
              "242.00"
            ]
          },
          "issued_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "fiscalized": {
            "type": "boolean",
            "description": "Registered with the tax authority. false: kept as not fiscalized (register_status `failed`); Konty support follows it up."
          },
          "fiscal_error": {
            "$ref": "#/components/schemas/FiscalError"
          },
          "voided": {
            "type": "boolean",
            "description": "Cancelled in full (the API's void, a full cancel on the POS, or an e-invoice storno)."
          },
          "corrected": {
            "type": "boolean",
            "description": "Some correction exists (a partial one on the POS included)."
          },
          "void": {
            "$ref": "#/components/schemas/Void",
            "description": "Receipts: the corrective / refund that cancelled the document in full. Absent for an e-invoice (its storno is einvoice_status)."
          },
          "iic": {
            "type": [
              "string",
              "null"
            ],
            "description": "ME receipt"
          },
          "fiscal_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "ME receipt"
          },
          "verification_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "ME / RS receipt"
          },
          "invoice_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "RS receipt"
          },
          "invoice_counter": {
            "type": [
              "string",
              "null"
            ],
            "description": "RS receipt"
          },
          "sdc_date_time": {
            "type": [
              "string",
              "null"
            ],
            "description": "RS receipt"
          },
          "journal": {
            "type": [
              "string",
              "null"
            ],
            "description": "RS receipt: the legal receipt text VSDC signed, to hand to the buyer."
          },
          "sales_invoice_id": {
            "type": [
              "integer",
              "string",
              "null"
            ],
            "description": "RS e-invoice"
          },
          "einvoice_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "RS e-invoice"
          }
        }
      },
      "FiscalError": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "description": "Why a kept document is not fiscalized (202 only; GET does not repeat it). Konty support follows it up; the document's register_status stays `failed` until then.",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "FISCAL_REJECTED",
              "FISCAL_SERVICE_UNAVAILABLE",
              "FISCAL_STATUS_UNKNOWN"
            ]
          },
          "message": {
            "type": "string"
          },
          "details": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "TicketItemInput": {
        "type": "object",
        "required": [
          "quantity"
        ],
        "description": "Exactly one of product_id, code, barcode or gtin. No price: the venue's catalogue prices every item.",
        "properties": {
          "product_id": {
            "type": "integer"
          },
          "code": {
            "type": "string",
            "maxLength": 255
          },
          "barcode": {
            "type": "string",
            "maxLength": 255
          },
          "gtin": {
            "type": "string",
            "maxLength": 255
          },
          "quantity": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 500000
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 255,
            "description": "For the kitchen, e.g. 'dobro pečeno'."
          }
        }
      },
      "TicketRequest": {
        "type": "object",
        "required": [
          "external_reference",
          "room",
          "items"
        ],
        "properties": {
          "external_reference": {
            "type": "string",
            "maxLength": 64,
            "description": "Your own id of the porudžbina; letter case is ignored (ABC and abc are one reference); '/' between segments only, no '.' or '..' segment."
          },
          "room": {
            "type": "string",
            "maxLength": 20,
            "description": "The guest's room number; no '·' or '—'."
          },
          "guest": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 120
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500,
            "description": "The guest's note for the whole porudžbina."
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/TicketItemInput"
            }
          }
        }
      },
      "TicketItem": {
        "type": "object",
        "required": [
          "product_id",
          "name",
          "quantity",
          "unit_price",
          "total"
        ],
        "properties": {
          "product_id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "quantity": {
            "type": "number"
          },
          "unit_price": {
            "type": "string",
            "description": "The catalogue price, tax included."
          },
          "total": {
            "type": "string"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "TicketDocument": {
        "type": "object",
        "required": [
          "type",
          "number",
          "fiscal_number",
          "issued_at"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "receipt",
              "room_charge"
            ]
          },
          "room": {
            "type": [
              "string",
              "null"
            ],
            "description": "The room charged (room_charge only)."
          },
          "number": {
            "type": [
              "integer",
              "null"
            ]
          },
          "fiscal_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "RS: the VSDC invoice number; ME: the fiscal code (FIC). Null for an RS room charge, which the hotel reception fiscalizes."
          },
          "issued_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Ticket": {
        "type": "object",
        "required": [
          "external_reference",
          "status",
          "room",
          "items",
          "total",
          "document"
        ],
        "properties": {
          "external_reference": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "received",
              "accepted",
              "ready",
              "sent_to_room",
              "paid",
              "rejected"
            ],
            "description": "received: waiting for the venue · accepted: being prepared · ready: prepared · sent_to_room: closed, charged to the room · paid: closed with a receipt · rejected: refused by the venue (reject_reason)."
          },
          "room": {
            "type": "string"
          },
          "guest": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TicketItem"
            }
          },
          "total": {
            "type": "string"
          },
          "reject_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "The venue's reason, with status rejected only."
          },
          "document": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TicketDocument"
              },
              {
                "type": "null"
              }
            ],
            "description": "What closed the porudžbina; null until then."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "OrderReference": {
        "type": "object",
        "required": [
          "id",
          "number",
          "type"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "number": {
            "type": [
              "integer",
              "null"
            ]
          },
          "type": {
            "type": [
              "string",
              "null"
            ],
            "description": "As stored: corrective (a refund / storno and what it corrects), summary (a summary and the unpaid invoices it settles), advance …"
          }
        }
      },
      "ExportedOrderItem": {
        "type": "object",
        "required": [
          "product_id",
          "code",
          "name",
          "quantity",
          "unit",
          "unit_price",
          "discount_percent",
          "tax_label",
          "tax_rate",
          "exempt_from_tax",
          "tax",
          "total"
        ],
        "properties": {
          "product_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string",
            "description": "As printed on the document, not the catalogue's current name."
          },
          "quantity": {
            "type": "string",
            "description": "Three decimals; negative on a refund. A credit note's item: the quantity it adds or removes."
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "unit_price": {
            "type": "string",
            "description": "Tax-inclusive price per unit, before the discount."
          },
          "discount_percent": {
            "type": "string"
          },
          "tax_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_rate": {
            "type": "string"
          },
          "exempt_from_tax": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax": {
            "type": "string",
            "description": "Two decimals; 0 for an item exempt from tax, as the document's tax_total counts it."
          },
          "total": {
            "type": "string",
            "description": "Tax-inclusive line total after the discount."
          }
        }
      },
      "ExportedOrder": {
        "type": "object",
        "description": "A document as an analysis tool needs it. Aggregate items from receipts, invoices and refunds; payments from the documents that carry them: a summary settles unpaid invoices already listed (refers_to type summary), so its items are not counted again.",
        "required": [
          "id",
          "hash",
          "number",
          "full_number",
          "status",
          "einvoice",
          "source",
          "external_reference",
          "issuing_date",
          "created_at",
          "updated_at",
          "registered_at",
          "canceled_at",
          "cash_register",
          "cashier",
          "shift",
          "total",
          "tax_total",
          "tip",
          "payments",
          "change",
          "fiscal",
          "settled_by",
          "refers_to",
          "referred_by",
          "client",
          "items"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "hash": {
            "type": "string"
          },
          "number": {
            "type": [
              "integer",
              "null"
            ]
          },
          "full_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "paid",
              "unpaid",
              "summary",
              "advance",
              "credit_note"
            ]
          },
          "einvoice": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "description": "pos, api:<integration>, a delivery platform (glovo, wolt …), qr."
          },
          "external_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "issuing_date": {
            "type": "string",
            "format": "date-time",
            "description": "When it was issued (on an offline terminal: before it reached Konty)."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it reached Konty — the period filters on it."
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "registered_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "canceled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "cash_register": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "cashier": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "shift": {
            "type": [
              "object",
              "null"
            ],
            "description": "The shift the document was issued in (every document has one; null only if the shift's record no longer exists).",
            "required": [
              "id",
              "name",
              "started_at",
              "closed_at"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The name the cashier gave the shift when opening it; null for an unnamed shift."
              },
              "started_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "closed_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Null while the shift is open."
              }
            }
          },
          "table": {
            "type": [
              "object",
              "null"
            ],
            "description": "Hospitality venues only: the table the document was issued on, or null when it was not issued on a table (or the table was deleted since). Retail venues have no tables, and their documents do not carry this field.",
            "required": [
              "id",
              "name",
              "sector"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sector": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "The area of the venue the table belongs to (table names repeat across sectors).",
                "properties": {
                  "id": {
                    "type": "integer"
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            }
          },
          "total": {
            "type": "string",
            "description": "Two decimals."
          },
          "tax_total": {
            "type": "string",
            "description": "Two decimals."
          },
          "tip": {
            "type": "string",
            "description": "Two decimals."
          },
          "payments": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "method",
                "amount"
              ],
              "properties": {
                "method": {
                  "type": "string",
                  "enum": [
                    "cash",
                    "card",
                    "card_business",
                    "invoice",
                    "advance",
                    "check",
                    "voucher",
                    "mobile_money",
                    "other"
                  ]
                },
                "amount": {
                  "type": "string",
                  "description": "Two decimals."
                }
              }
            }
          },
          "change": {
            "type": "string",
            "description": "Two decimals."
          },
          "fiscal": {
            "type": "object",
            "properties": {
              "fiscalized": {
                "type": "boolean"
              },
              "register_type": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "register_status": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "iic": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "fiscal_code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "invoice_number": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sales_invoice_id": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "description": "ME: iic, fiscal_code. RS receipt: invoice_number. E-invoice: sales_invoice_id."
          },
          "settled_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "ota_sync: charged to a hotel room."
          },
          "refers_to": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderReference"
            }
          },
          "referred_by": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderReference"
            }
          },
          "client": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id_type": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id_number": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "tax_id_number": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "description": "As stored: a company's PIB, a person's JMBG (or a foreigner's passport number)."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExportedOrderItem"
            }
          }
        }
      }
    }
  }
}
