openapi: 3.1.0
info:
  title: uplaceno.rs API – MVP (phase 1, Basic plan)
  version: 1.6.1-mvp
  x-status: locked
  description: >-
    Locked MVP contract. Changes only via versioning (additive → 1.x, breaking →
    2.0).


    **Environment** is determined solely from credentials: `upl_test_…` / token
    with `env=sandbox` → sandbox D1; `upl_live_…` / `env=live` → live D1. There
    is no `okruzenje` query parameter.


    **IDs** are UUID v7. **Amounts** are decimal strings (`"12000.00"`), always
    in RSD (MVP supports RSD only; no currency field).


    **VAT**: the organization has `u_sistemu_pdv`; when true, line VAT rate is
    10 or 20; when false, lines have no VAT and the proforma carries a note.


    **Pagination**: cursor (`limit`, `kursor` → `sledeci_kursor`, `ima_jos`),
    sorted by `id` descending (UUID v7 ≈ chronological).


    **Idempotency**: `Idempotency-Key` required on every POST (24 h).


    **Errors**: `application/problem+json` (RFC 9457) with a stable `kod` field.


    **Authorization**: effective = role permissions ∩ token scopes ∩ plan
    features; for API keys, key scopes replace the role.


    **Numbering**: 0001–9999 per org+env, always smallest free; payment
    reference model 97: KK + `sifra_organizacije`(5) + number(4) + cycle(2).


    **Dashboard sign-in**: email + password → HttpOnly cookie
    (`__Host-uplaceno_sesija` in production). CSRF: cookie mutations check
    `Origin`. Rate limit + Turnstile on login, registration and password reset.


    **Webhooks (Beta, target behaviour)**: body `{ id_dogadjaja, dogadjaj,
    kreirano, okruzenje, id_organizacije, podaci: { profaktura, uplata } }`;
    amounts as decimal strings; currency `RSD`. Headers: `X-Uplaceno-Dogadjaj`,
    `X-Uplaceno-Id-Dogadjaja`, `X-Uplaceno-Pokusaj`, `X-Uplaceno-Okruzenje`,
    `X-Uplaceno-Potpis` (`t=<unix>,v1=<hex>` or dual `v1` while rotating secret;
    HMAC-SHA256 over `"<t>.<raw body>"`). Delivery: 2xx success; otherwise wait
    10 s then retry after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h, 24 h (8
    attempts). `410` and 4xx except `408`/`429` are not retried. Live webhooks
    require Advanced plan (`api_webhook`); sandbox for testing.


    **Issuing rule**: invoice/fiscal document is issued ONLY after a matched
    payment. Before payment, only a proforma (`predracun` / payment request)
    exists — not a tax document, with note `Ovo nije poreska isprava`. Issuing
    method is derived (not sent by client) from `poreski_status`,
    `u_fiskalizaciji` and customer `tip_kupca`.


    **SEF (1.6.0)**: for `pdv_obveznik` + `pravno_lice`, default is
    `e_faktura_sef`; if buyer is not on SEF, `pdf_racun` is used. Scopes
    `sef:citanje` / `sef:pisanje`. Live SEF needs explicit PUT
    `/v1/podesavanja/sef` with `aktivno_okruzenje=live` and `potvrda_live=true`.


    **Rate limit** (IETF RateLimit headers): every response includes
    `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset` (seconds); 429
    also has `Retry-After`. Default: 600 req/min per credential and environment;
    `/v1/nalog/*` 10/min per IP; test webhook 10/min per endpoint.
  contact:
    name: uplaceno.rs
    url: https://uplaceno.rs
  license:
    name: Proprietary
    identifier: LicenseRef-Proprietary
servers:
  - url: https://api.uplaceno.rs/api
    description: Production (live and sandbox by API key)
  - url: https://api.staging.uplaceno.rs/api
    description: Staging
  - url: http://localhost:8788/api
    description: Local (wrangler dev)
security:
  - cookieAuth: []
  - oauth2: []
  - apiKey: []
tags:
  - name: Organizations
    description: Organizations the signed-in user belongs to.
    x-displayName: Organizations
  - name: Members
    description: Organization members and their roles.
    x-displayName: Members
  - name: Invitations
    description: Email invitations to join an organization.
    x-displayName: Invitations
  - name: Roles and permissions
    description: Built-in roles and the permission catalog.
    x-displayName: Roles and permissions
  - name: API keys
    description: Partner API keys (live and sandbox) and scopes.
    x-displayName: API keys
  - name: Plan and usage
    description: Subscription plan, seats and metered usage.
    x-displayName: Plan and usage
  - name: Bank accounts
    description: Payout / statement bank accounts.
    x-displayName: Bank accounts
  - name: Customers
    description: Customers (buyers) referenced on proformas and invoices.
    x-displayName: Customers
  - name: Products
    description: Product / service catalog.
    x-displayName: Products
  - name: Payment requests
    description: Payment requests (checkout-style links).
    x-displayName: Payment requests
  - name: Proforma invoices
    description: Proforma invoices (predračun) before fiscal documents.
    x-displayName: Proforma invoices
  - name: Proforma line items
    description: Line items on a proforma.
    x-displayName: Proforma line items
  - name: Numbering
    description: Invoice number pools and model-97 payment references.
    x-displayName: Numbering
  - name: Payments
    description: Recorded inbound payments.
    x-displayName: Payments
  - name: PDF payment proofs
    description: Customer-uploaded PDF payment proofs.
    x-displayName: PDF payment proofs
  - name: Reconciliation
    description: Automatic and manual payment-to-proforma matching.
    x-displayName: Reconciliation
  - name: Inbound email
    description: Inbound statement email addresses.
    x-displayName: Inbound email
  - name: Audit
    description: Immutable audit trail of org changes.
    x-displayName: Audit
  - name: Sandbox
    description: Test environment helpers (no live money).
    x-displayName: Sandbox
  - name: Webhooks
    description: Outbound HTTPS events to your endpoint. Field names stay Serbian
      ASCII; amounts are decimal strings; timestamps are RFC 3339 with offset.
    x-displayName: Webhooks
  - name: Invoices
    description: Fiscal invoices issued after a matched payment.
    x-privremeno: true
    x-displayName: Invoices
  - name: Document studio
    description: Document templates and PDF layout studio.
    x-privremeno: true
    x-displayName: Document studio
  - name: SEF (e-invoice)
    description: Serbian e-invoice (SEF) integration for B2B.
    x-displayName: SEF (e-invoice)
paths:
  /v1/organizacije:
    get:
      operationId: lista_organizacije
      summary: Organizations I belong to
      tags:
        - Organizations
      security:
        - cookieAuth: []
        - oauth2:
            - organizacije:citanje
        - apiKey: []
      x-required-scopes:
        - organizacije:citanje
      parameters:
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OrganizacijaLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: organizacija
                    sifra_organizacije: "00042"
                    naziv: Lizzard Solutions DOO
                    status: aktivan
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Organizations I belong to. Allowed roles: per role/scope;
        scope: organizacije:citanje."
    post:
      operationId: kreiraj_organizaciju
      summary: Create organization
      tags:
        - Organizations
      description: "Returns `402 dostignut_limit_organizacija` when the owner hits the
        plan limit (Basic: 1)."
      security:
        - cookieAuth: []
        - oauth2:
            - organizacije:pisanje
        - apiKey: []
      x-required-scopes:
        - organizacije:pisanje
      parameters:
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OrganizacijaKreiranje"
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Organizacija"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: organizacija
                sifra_organizacije: "00042"
                naziv: Lizzard Solutions DOO
                status: aktivan
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "402":
          $ref: "#/components/responses/PaymentRequired"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/organizacije/{id}:
    get:
      operationId: preuzmi_organizaciju
      summary: Get organization
      tags:
        - Organizations
      security:
        - cookieAuth: []
        - oauth2:
            - organizacije:citanje
        - apiKey: []
      x-required-scopes:
        - organizacije:citanje
      parameters:
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Organizacija"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: organizacija
                sifra_organizacije: "00042"
                naziv: Lizzard Solutions DOO
                status: aktivan
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Get organization. Allowed roles: per role/scope; scope:
        organizacije:citanje."
    patch:
      operationId: izmeni_organizaciju
      summary: Update organization
      tags:
        - Organizations
      security:
        - cookieAuth: []
        - oauth2:
            - organizacije:pisanje
        - apiKey: []
      x-required-scopes:
        - organizacije:pisanje
      parameters:
        - $ref: "#/components/parameters/Id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OrganizacijaIzmena"
            example:
              u_sistemu_pdv: true
              naziv: primer
              adresa:
                ulica: Bulevar oslobođenja 1
                grad: Novi Sad
              email: demo@uplaceno.rs
              logo_url: https://uplaceno.rs/primer
              tekuci_racun: "160000000012345678"
              poreski_status: pdv_obveznik
              u_fiskalizaciji: false
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Organizacija"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: organizacija
                sifra_organizacije: "00042"
                naziv: Lizzard Solutions DOO
                status: aktivan
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Partially updates: Update organization. Allowed roles: per
        role/scope; scope: organizacije:pisanje."
    delete:
      operationId: obrisi_organizaciju
      summary: Delete organization (owner only)
      tags:
        - Organizations
      description: Soft delete; 409 if open proformas exist.
      security:
        - cookieAuth: []
        - oauth2:
            - organizacije:pisanje
        - apiKey: []
      x-required-scopes:
        - organizacije:pisanje
      parameters:
        - $ref: "#/components/parameters/Id"
      responses:
        "204":
          description: Success, no content
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/organizacije/{organizacija_id}/clanovi:
    get:
      operationId: lista_clanove
      summary: List members
      tags:
        - Members
      security:
        - cookieAuth: []
        - oauth2:
            - clanovi:citanje
        - apiKey: []
      x-required-scopes:
        - clanovi:citanje
      parameters:
        - $ref: "#/components/parameters/OrgIdPath"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClanLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: clan
                    korisnik_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    uloga_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    status: aktivan
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: List members. Allowed roles: per role/scope; scope:
        clanovi:citanje."
  /v1/organizacije/{organizacija_id}/clanovi/{id}:
    get:
      operationId: preuzmi_clana
      summary: Get member
      tags:
        - Members
      security:
        - cookieAuth: []
        - oauth2:
            - clanovi:citanje
        - apiKey: []
      x-required-scopes:
        - clanovi:citanje
      parameters:
        - $ref: "#/components/parameters/OrgIdPath"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Clan"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: clan
                korisnik_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                uloga_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                status: aktivan
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Get member. Allowed roles: per role/scope; scope:
        clanovi:citanje."
    patch:
      operationId: izmeni_clana
      summary: Change member role/status
      tags:
        - Members
      security:
        - cookieAuth: []
        - oauth2:
            - clanovi:pisanje
        - apiKey: []
      x-required-scopes:
        - clanovi:pisanje
      parameters:
        - $ref: "#/components/parameters/OrgIdPath"
        - $ref: "#/components/parameters/Id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ClanIzmena"
            example:
              uloga_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
              status: aktivan
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Clan"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: clan
                korisnik_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                uloga_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                status: aktivan
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Partially updates: Change member role/status. Allowed roles: per
        role/scope; scope: clanovi:pisanje."
    delete:
      operationId: ukloni_clana
      summary: Remove member
      tags:
        - Members
      description: Owner cannot be removed (409).
      security:
        - cookieAuth: []
        - oauth2:
            - clanovi:pisanje
        - apiKey: []
      x-required-scopes:
        - clanovi:pisanje
      parameters:
        - $ref: "#/components/parameters/OrgIdPath"
        - $ref: "#/components/parameters/Id"
      responses:
        "204":
          description: Success, no content
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/organizacije/{organizacija_id}/pozivnice:
    get:
      operationId: lista_pozivnice
      summary: List invitations
      tags:
        - Invitations
      security:
        - cookieAuth: []
        - oauth2:
            - clanovi:citanje
        - apiKey: []
      x-required-scopes:
        - clanovi:citanje
      parameters:
        - $ref: "#/components/parameters/OrgIdPath"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PozivnicaLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: pozivnica
                    email: knjigovodja@primer.rs
                    uloga_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    status: na_cekanju
                    istice: 2026-11-01T08:00:00Z
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: List invitations. Allowed roles: per role/scope; scope:
        clanovi:citanje."
    post:
      operationId: kreiraj_pozivnicu
      summary: Send invitation
      tags:
        - Invitations
      description: "7-day expiry. `402 dostignut_limit_mesta` when all seats are taken
        (active + pending invitations). Basic plan: 1 seat = owner, so invites
        are effectively unavailable."
      security:
        - cookieAuth: []
        - oauth2:
            - clanovi:pisanje
        - apiKey: []
      x-required-scopes:
        - clanovi:pisanje
      parameters:
        - $ref: "#/components/parameters/OrgIdPath"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PozivnicaKreiranje"
            example:
              email: demo@uplaceno.rs
              uloga_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pozivnica"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: pozivnica
                email: knjigovodja@primer.rs
                uloga_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                status: na_cekanju
                istice: 2026-11-01T08:00:00Z
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "402":
          $ref: "#/components/responses/PaymentRequired"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/organizacije/{organizacija_id}/pozivnice/{id}:
    delete:
      operationId: opozovi_pozivnicu
      summary: Revoke invitation
      tags:
        - Invitations
      security:
        - cookieAuth: []
        - oauth2:
            - clanovi:pisanje
        - apiKey: []
      x-required-scopes:
        - clanovi:pisanje
      parameters:
        - $ref: "#/components/parameters/OrgIdPath"
        - $ref: "#/components/parameters/Id"
      responses:
        "204":
          description: Success, no content
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Deletes or revokes: Revoke invitation. Allowed roles: per
        role/scope; scope: clanovi:pisanje."
  /v1/organizacije/{organizacija_id}/uloge:
    get:
      operationId: lista_uloge
      summary: List roles
      tags:
        - Roles and permissions
      description: "MVP/Basic: built-in roles only (owner, admin, accountant, viewer).
        POST/PATCH/DELETE return `403 funkcija_nije_u_planu` and are outside the
        MVP contract."
      security:
        - cookieAuth: []
        - oauth2:
            - uloge:citanje
        - apiKey: []
      x-required-scopes:
        - uloge:citanje
      parameters:
        - $ref: "#/components/parameters/OrgIdPath"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UlogaLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: uloga
                    kljuc: knjigovodja
                    naziv: Knjigovođa
                    ugradjena: true
                    dozvole:
                      - profakture:citanje
                      - uplate:citanje
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/organizacije/{organizacija_id}/uloge/{id}:
    get:
      operationId: preuzmi_ulogu
      summary: Get role
      tags:
        - Roles and permissions
      security:
        - cookieAuth: []
        - oauth2:
            - uloge:citanje
        - apiKey: []
      x-required-scopes:
        - uloge:citanje
      parameters:
        - $ref: "#/components/parameters/OrgIdPath"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Uloga"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: uloga
                kljuc: knjigovodja
                naziv: Knjigovođa
                ugradjena: true
                dozvole:
                  - profakture:citanje
                  - uplate:citanje
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Get role. Allowed roles: per role/scope; scope: uloge:citanje."
  /v1/dozvole:
    get:
      operationId: lista_dozvole
      summary: Permission catalog
      tags:
        - Roles and permissions
      security:
        - cookieAuth: []
        - oauth2:
            - uloge:citanje
        - apiKey: []
      x-required-scopes:
        - uloge:citanje
      parameters:
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DozvolaLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: dozvola
                    kljuc: profakture:otkazivanje
                    minimalni_plan: osnovni
                    oauth_opsezi:
                      - primer
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Permission catalog. Allowed roles: per role/scope; scope:
        uloge:citanje."
  /v1/api-kljucevi:
    get:
      operationId: lista_api_kljuceve
      summary: List API keys
      tags:
        - API keys
      security:
        - cookieAuth: []
        - oauth2:
            - api_kljucevi:citanje
        - apiKey: []
      x-required-scopes:
        - api_kljucevi:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiKljucLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: api_kljuc
                    naziv: WooCommerce prodavnica
                    prefiks: upl_test_7Hk2
                    opsezi:
                      - organizacije:citanje
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: List API keys. Allowed roles: per role/scope; scope:
        api_kljucevi:citanje."
    post:
      operationId: kreiraj_api_kljuc
      summary: Create API key
      tags:
        - API keys
      security:
        - cookieAuth: []
        - oauth2:
            - api_kljucevi:pisanje
        - apiKey: []
      x-required-scopes:
        - api_kljucevi:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ApiKljucKreiranje"
            example:
              naziv: primer
              opsezi:
                - organizacije:citanje
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiKljucSaTajnom"
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Creates or triggers: Create API key. Allowed roles: per
        role/scope; scope: `api_kljucevi:pisanje`."
  /v1/api-kljucevi/{id}:
    get:
      operationId: preuzmi_api_kljuc
      summary: Get API key
      tags:
        - API keys
      security:
        - cookieAuth: []
        - oauth2:
            - api_kljucevi:citanje
        - apiKey: []
      x-required-scopes:
        - api_kljucevi:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiKljuc"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: api_kljuc
                naziv: WooCommerce prodavnica
                prefiks: upl_test_7Hk2
                opsezi:
                  - organizacije:citanje
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Get API key. Allowed roles: per role/scope; scope:
        api_kljucevi:citanje."
    delete:
      operationId: opozovi_api_kljuc
      summary: Revoke API key
      tags:
        - API keys
      security:
        - cookieAuth: []
        - oauth2:
            - api_kljucevi:pisanje
        - apiKey: []
      x-required-scopes:
        - api_kljucevi:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "204":
          description: Success, no content
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Deletes or revokes: Revoke API key. Allowed roles: per role/scope;
        scope: api_kljucevi:pisanje."
  /v1/api-kljucevi/{id}/rotiraj:
    post:
      operationId: rotiraj_api_kljuc
      summary: Rotate API key
      tags:
        - API keys
      description: Previous key remains valid for 24 h.
      security:
        - cookieAuth: []
        - oauth2:
            - api_kljucevi:pisanje
        - apiKey: []
      x-required-scopes:
        - api_kljucevi:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IdempotencyKey"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiKljucSaTajnom"
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/organizacije/{organizacija_id}/mesta:
    get:
      operationId: preuzmi_mesta
      summary: Organization seats
      tags:
        - Plan and usage
      security:
        - cookieAuth: []
        - oauth2:
            - naplata:citanje
        - apiKey: []
      x-required-scopes:
        - naplata:citanje
      parameters:
        - $ref: "#/components/parameters/OrgIdPath"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Mesta"
              example:
                limit: 1
                aktivni_clanovi: 1
                pozivnice_na_cekanju: 0
                slobodno: 0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Organization seats. Allowed roles: per role/scope; scope:
        naplata:citanje."
  /v1/naplata/potrosnja:
    get:
      operationId: preuzmi_potrosnju
      summary: Usage by period
      tags:
        - Plan and usage
      security:
        - cookieAuth: []
        - oauth2:
            - naplata:citanje
        - apiKey: []
      x-required-scopes:
        - naplata:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - name: period
          in: query
          schema:
            type: string
            pattern: ^\d{4}-\d{2}$
          example: 2026-11
          description: "Calendar month in Europe/Belgrade (`YYYY-MM`). Default: current
            month."
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Potrosnja"
              example:
                period: 2026-11
                izdato_profaktura: 37
                limit_profaktura: 50
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Usage by period. Allowed roles: per role/scope; scope:
        naplata:citanje."
  /v1/bankovni-racuni:
    get:
      operationId: lista_bankovne_racune
      summary: "List: bank accounts"
      tags:
        - Bank accounts
      security:
        - cookieAuth: []
        - oauth2:
            - banka:citanje
        - apiKey: []
      x-required-scopes:
        - banka:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankovniRacunLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: bankovni_racun
                    broj_racuna: "160000000012345678"
                    podrazumevani: true
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: List bank accounts. Allowed roles: per role/scope; scope:
        banka:citanje."
    post:
      operationId: kreiraj_bankovne_racune
      summary: "Create: bank accounts"
      tags:
        - Bank accounts
      security:
        - cookieAuth: []
        - oauth2:
            - banka:pisanje
        - apiKey: []
      x-required-scopes:
        - banka:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BankovniRacunKreiranje"
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankovniRacun"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: bankovni_racun
                broj_racuna: "160000000012345678"
                podrazumevani: true
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "402":
          $ref: "#/components/responses/PaymentRequired"
        "403":
          $ref: "#/components/responses/Forbidden"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Account number is validated (mod 97). Basic plan: at most one bank
        account per organization → `402 limit_paketa` (code
        `dostignut_limit_bankovnih_racuna`)."
  /v1/bankovni-racuni/{id}:
    get:
      operationId: preuzmi_bankovne_racune
      summary: "Get: bank accounts"
      tags:
        - Bank accounts
      security:
        - cookieAuth: []
        - oauth2:
            - banka:citanje
        - apiKey: []
      x-required-scopes:
        - banka:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankovniRacun"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: bankovni_racun
                broj_racuna: "160000000012345678"
                podrazumevani: true
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Get bank accounts. Allowed roles: per role/scope; scope:
        banka:citanje."
    patch:
      operationId: izmeni_bankovne_racune
      summary: "Update: bank accounts"
      tags:
        - Bank accounts
      security:
        - cookieAuth: []
        - oauth2:
            - banka:pisanje
        - apiKey: []
      x-required-scopes:
        - banka:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BankovniRacunIzmena"
            example:
              oznaka: primer
              podrazumevani: true
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankovniRacun"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: bankovni_racun
                broj_racuna: "160000000012345678"
                podrazumevani: true
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Partially updates: Update bank accounts. Allowed roles: per
        role/scope; scope: banka:pisanje."
    delete:
      operationId: obrisi_bankovne_racune
      summary: "Delete: bank accounts"
      tags:
        - Bank accounts
      security:
        - cookieAuth: []
        - oauth2:
            - banka:pisanje
        - apiKey: []
      x-required-scopes:
        - banka:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "204":
          description: Success, no content
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: Archive; 409 if the bank account is linked to open proformas.
  /v1/kupci:
    get:
      operationId: lista_kupce
      summary: "List: customers"
      tags:
        - Customers
      security:
        - cookieAuth: []
        - oauth2:
            - kupci:citanje
        - apiKey: []
      x-required-scopes:
        - kupci:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
        - name: pretraga
          in: query
          schema:
            type: string
          description: Pretraga po imenu/mejlu/PIB-u
        - name: eksterna_oznaka
          in: query
          schema:
            type: string
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KupacLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: kupac
                    naziv: Petar Petrović
                    kreirano: 2026-11-01T08:00:00Z
                    tip_kupca: fizicko_lice
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: List customers. Allowed roles: per role/scope; scope:
        kupci:citanje."
    post:
      operationId: kreiraj_kupce
      summary: "Create: customers"
      tags:
        - Customers
      security:
        - cookieAuth: []
        - oauth2:
            - kupci:pisanje
        - apiKey: []
      x-required-scopes:
        - kupci:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/KupacKreiranje"
            example:
              tip_kupca: pravno_lice
              naziv: Kupac DOO
              pib: "101234567"
              maticni_broj: "21876543"
              email: kupac@primer.rs
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Kupac"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: kupac
                naziv: Petar Petrović
                kreirano: 2026-11-01T08:00:00Z
                tip_kupca: fizicko_lice
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
      description: "Creates: ili pokrece: Kreiranje: Kupci. Allowed roles: per
        role/scope; scope: kupci:pisanje."
  /v1/kupci/{id}:
    get:
      operationId: preuzmi_kupce
      summary: "Get: customers"
      tags:
        - Customers
      security:
        - cookieAuth: []
        - oauth2:
            - kupci:citanje
        - apiKey: []
      x-required-scopes:
        - kupci:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Kupac"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: kupac
                naziv: Petar Petrović
                kreirano: 2026-11-01T08:00:00Z
                tip_kupca: fizicko_lice
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Get customers. Allowed roles: per role/scope; scope:
        kupci:citanje."
    patch:
      operationId: izmeni_kupce
      summary: "Update: customers"
      tags:
        - Customers
      security:
        - cookieAuth: []
        - oauth2:
            - kupci:pisanje
        - apiKey: []
      x-required-scopes:
        - kupci:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/KupacIzmena"
            example:
              tip: fizicko_lice
              naziv: Petar Petrović
              email: petar@primer.rs
              telefon: primer
              adresa:
                ulica: Bulevar oslobođenja 1
                grad: Novi Sad
              eksterna_oznaka: primer
              tip_kupca: fizicko_lice
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Kupac"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: kupac
                naziv: Petar Petrović
                kreirano: 2026-11-01T08:00:00Z
                tip_kupca: fizicko_lice
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
      description: "Partially updates: Update customers. Allowed roles: per
        role/scope; scope: kupci:pisanje."
    delete:
      operationId: obrisi_kupce
      summary: "Delete: customers"
      tags:
        - Customers
      security:
        - cookieAuth: []
        - oauth2:
            - kupci:pisanje
        - apiKey: []
      x-required-scopes:
        - kupci:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "204":
          description: Success, no content
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Deletes or revokes: Delete customers. Allowed roles: per
        role/scope; scope: kupci:pisanje."
  /v1/proizvodi:
    get:
      operationId: lista_proizvode
      summary: "List: products"
      tags:
        - Products
      security:
        - cookieAuth: []
        - oauth2:
            - proizvodi:citanje
        - apiKey: []
      x-required-scopes:
        - proizvodi:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
        - name: pretraga
          in: query
          schema:
            type: string
        - name: aktivan
          in: query
          schema:
            type: boolean
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProizvodLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: proizvod
                    naziv: Izrada sajta
                    jedinica_mere: kom
                    jedinicna_cena: "12000.00"
                    stopa_pdv: "10"
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: List products. Allowed roles: per role/scope; scope:
        proizvodi:citanje."
    post:
      operationId: kreiraj_proizvode
      summary: "Create: products"
      tags:
        - Products
      security:
        - cookieAuth: []
        - oauth2:
            - proizvodi:pisanje
        - apiKey: []
      x-required-scopes:
        - proizvodi:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProizvodKreiranje"
            example:
              naziv: Izrada sajta
              jedinicna_cena: "12000.00"
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Proizvod"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: proizvod
                naziv: Izrada sajta
                jedinica_mere: kom
                jedinicna_cena: "12000.00"
                stopa_pdv: "10"
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Creates: ili pokrece: Kreiranje: Proizvodi. Allowed roles: per
        role/scope; scope: proizvodi:pisanje."
  /v1/proizvodi/{id}:
    get:
      operationId: preuzmi_proizvode
      summary: "Get: products"
      tags:
        - Products
      security:
        - cookieAuth: []
        - oauth2:
            - proizvodi:citanje
        - apiKey: []
      x-required-scopes:
        - proizvodi:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Proizvod"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: proizvod
                naziv: Izrada sajta
                jedinica_mere: kom
                jedinicna_cena: "12000.00"
                stopa_pdv: "10"
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Get products. Allowed roles: per role/scope; scope:
        proizvodi:citanje."
    patch:
      operationId: izmeni_proizvode
      summary: "Update: products"
      tags:
        - Products
      security:
        - cookieAuth: []
        - oauth2:
            - proizvodi:pisanje
        - apiKey: []
      x-required-scopes:
        - proizvodi:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProizvodIzmena"
            example:
              naziv: Izrada sajta
              sifra_artikla: primer
              jedinica_mere: kom
              jedinicna_cena: "12000.00"
              stopa_pdv: "10"
              aktivan: true
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Proizvod"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: proizvod
                naziv: Izrada sajta
                jedinica_mere: kom
                jedinicna_cena: "12000.00"
                stopa_pdv: "10"
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Partially updates: Update products. Allowed roles: per role/scope;
        scope: proizvodi:pisanje."
    delete:
      operationId: obrisi_proizvode
      summary: "Delete: products"
      tags:
        - Products
      security:
        - cookieAuth: []
        - oauth2:
            - proizvodi:pisanje
        - apiKey: []
      x-required-scopes:
        - proizvodi:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "204":
          description: Success, no content
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Deletes or revokes: Delete products. Allowed roles: per
        role/scope; scope: proizvodi:pisanje."
  /v1/zahtevi-za-placanje:
    get:
      operationId: lista_zahteve_za_placanje
      summary: "List: payment requests"
      tags:
        - Payment requests
      security:
        - cookieAuth: []
        - oauth2:
            - zahtevi_za_placanje:citanje
        - apiKey: []
      x-required-scopes:
        - zahtevi_za_placanje:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
        - name: status
          in: query
          schema:
            type: string
            enum:
              - otvoren
              - delimicno_placeno
              - placeno
              - istekla
              - otkazan
        - name: eksterna_oznaka
          in: query
          schema:
            type: string
        - name: kupac_id
          in: query
          schema:
            type: string
            format: uuid
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ZahtevZaPlacanjeLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: zahtev_za_placanje
                    izvor: api
                    kupac_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    iznos: "12000.00"
                    status: otvoren
                    profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: List payment requests. Allowed roles: per role/scope;
        scope: zahtevi_za_placanje:citanje."
    post:
      operationId: kreiraj_zahteve_za_placanje
      summary: "Create: payment requests"
      tags:
        - Payment requests
      security:
        - cookieAuth: []
        - oauth2:
            - zahtevi_za_placanje:pisanje
        - apiKey: []
      x-required-scopes:
        - zahtevi_za_placanje:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ZahtevZaPlacanjeKreiranje"
            example:
              stavke:
                - kolicina: "1"
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ZahtevZaPlacanje"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: zahtev_za_placanje
                izvor: api
                kupac_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                iznos: "12000.00"
                status: otvoren
                profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "402":
          $ref: "#/components/responses/PaymentRequired"
        "403":
          $ref: "#/components/responses/Forbidden"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: >-
        Creates a payment request and ATOMICALLY issues a proforma: smallest
        free number 0001–9999 (Durable Object per org+env), model-97 payment
        reference, PDF + IPS QR asynchronously (queue), customer email when
        `posalji_mejl`.


        Errors: `402 limit_paketa` (monthly cap, Basic 50; sandbox does not
        consume quota), `409 opseg_brojeva_potrosen`, `403
        organizacija_samo_za_citanje`, `409 ponovljen_kljuc_idempotentnosti`.
  /v1/zahtevi-za-placanje/{id}:
    get:
      operationId: preuzmi_zahteve_za_placanje
      summary: "Get: payment requests"
      tags:
        - Payment requests
      security:
        - cookieAuth: []
        - oauth2:
            - zahtevi_za_placanje:citanje
        - apiKey: []
      x-required-scopes:
        - zahtevi_za_placanje:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ZahtevZaPlacanje"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: zahtev_za_placanje
                izvor: api
                kupac_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                iznos: "12000.00"
                status: otvoren
                profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Get payment requests. Allowed roles: per role/scope;
        scope: zahtevi_za_placanje:citanje."
    patch:
      operationId: izmeni_zahteve_za_placanje
      summary: "Update: payment requests"
      tags:
        - Payment requests
      security:
        - cookieAuth: []
        - oauth2:
            - zahtevi_za_placanje:pisanje
        - apiKey: []
      x-required-scopes:
        - zahtevi_za_placanje:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ZahtevZaPlacanjeIzmena"
            example:
              eksterna_oznaka: primer
              metapodaci:
                porudzbina_id: "1043"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ZahtevZaPlacanje"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: zahtev_za_placanje
                izvor: api
                kupac_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                iznos: "12000.00"
                status: otvoren
                profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Partially updates: Update payment requests. Allowed roles: per
        role/scope; scope: zahtevi_za_placanje:pisanje."
    delete:
      operationId: obrisi_zahteve_za_placanje
      summary: "Delete: payment requests"
      tags:
        - Payment requests
      security:
        - cookieAuth: []
        - oauth2:
            - zahtevi_za_placanje:pisanje
        - apiKey: []
      x-required-scopes:
        - zahtevi_za_placanje:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "204":
          description: Success, no content
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: Allowed only when the proforma has no payments; equivalent to
        proforma cancel (number returns to the pool).
  /v1/profakture:
    get:
      operationId: lista_profakture
      summary: "List: proformas"
      tags:
        - Proforma invoices
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:citanje
        - apiKey: []
      x-required-scopes:
        - profakture:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
        - name: status
          in: query
          schema:
            type: string
            enum:
              - nacrt
              - izdata
              - poslata
              - pregledana
              - privremeno_placena
              - delimicno_placeno
              - placeno
              - preplacena
              - konvertovana
              - istekla
              - otkazan
            description: converted se ne javlja u Osnovnom planu
        - name: kupac_id
          in: query
          schema:
            type: string
            format: uuid
        - name: broj
          in: query
          schema:
            type: string
            pattern: ^\d{4}$
        - name: poziv_na_broj
          in: query
          schema:
            type: string
        - name: izdato_od
          in: query
          schema:
            type: string
            format: date
        - name: izdato_do
          in: query
          schema:
            type: string
            format: date
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProfakturaLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: profaktura
                    broj: "0123"
                    verzija: 1
                    iznos: "12000.00"
                    placeno_iznos: "12000.00"
                    poziv_na_broj:
                      model: "97"
                      vrednost: "4800042012301"
                      kontrolni_broj: "48"
                    status: nacrt
                    url_placanja: https://pay.uplaceno.rs/pay/pt_Xk29aQ
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: List proformas. Allowed roles: per role/scope; scope:
        profakture:citanje."
    post:
      operationId: kreiraj_profakturu
      summary: Kreiranje predracuna (proformas)
      tags:
        - Proforma invoices
      description: >+
        Privremeno (1.4.2), ceka potvrdu. Creates i izdaje predracun (isto kao
        POST /v1/zahtevi-za-placanje, bez objekta zahteva). Dodeljuje najmanji
        slobodan broj i poziv na broj (model 97). **Pravilo izdavanja**:
        racun/faktura se izdaje TEK POSLE uparene uplate. Pre uplate postoji
        samo predracun (proforma, naslov `Predracun` ili `Zahtev za placanje`)
        koji NIJE poreska isprava i nosi napomenu `Ovo nije poreska isprava`.
        Nacin izdavanja se IZVODI (klijent ga ne salje) iz `poreski_status` i
        `u_fiskalizaciji` organization i `tip_kupca`:


        | organization | Kupac (`tip_kupca`) | `nacini_izdavanja` |

        |---|---|---|

        | pdv_obveznik | pravno_lice | e_faktura_sef |

        | pdv_obveznik | fizicko_lice | fiskalni_racun |

        | pausalac, `u_fiskalizaciji=false` | bilo koji | pdf_racun |

        | pausalac, `u_fiskalizaciji=true` | bilo koji | pdf_racun,
        fiskalni_racun |

      security:
        - cookieAuth: []
        - oauth2:
            - profakture:pisanje
        - apiKey: []
      x-required-scopes:
        - profakture:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProfakturaKreiranje"
            example:
              tip_kupca: pravno_lice
              kupac:
                tip_kupca: pravno_lice
                naziv: Kupac DOO
                pib: "101234567"
                maticni_broj: "21876543"
              stavke:
                - opis: Izrada sajta
                  kolicina: "1"
                  jedinicna_cena: "12000.00"
                  stopa_pdv: "20"
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Profaktura"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: profaktura
                broj: "0123"
                verzija: 1
                iznos: "12000.00"
                placeno_iznos: "12000.00"
                poziv_na_broj:
                  model: "97"
                  vrednost: "4800042012301"
                  kontrolni_broj: "48"
                status: nacrt
                url_placanja: https://pay.uplaceno.rs/pay/pt_Xk29aQ
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "402":
          $ref: "#/components/responses/PaymentRequired"
        "403":
          $ref: "#/components/responses/Forbidden"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
  /v1/profakture/{id}:
    get:
      operationId: preuzmi_profakture
      summary: "Get: proformas"
      tags:
        - Proforma invoices
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:citanje
        - apiKey: []
      x-required-scopes:
        - profakture:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Profaktura"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: profaktura
                broj: "0123"
                verzija: 1
                iznos: "12000.00"
                placeno_iznos: "12000.00"
                poziv_na_broj:
                  model: "97"
                  vrednost: "4800042012301"
                  kontrolni_broj: "48"
                status: nacrt
                url_placanja: https://pay.uplaceno.rs/pay/pt_Xk29aQ
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Get proformas. Allowed roles: per role/scope; scope:
        profakture:citanje."
    patch:
      operationId: izmeni_profakture
      summary: "Update: proformas"
      tags:
        - Proforma invoices
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:pisanje
        - apiKey: []
      x-required-scopes:
        - profakture:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IfMatch"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProfakturaIzmena"
            example:
              tip_kupca: fizicko_lice
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Profaktura"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: profaktura
                broj: "0123"
                verzija: 1
                iznos: "12000.00"
                placeno_iznos: "12000.00"
                poziv_na_broj:
                  model: "97"
                  vrednost: "4800042012301"
                  kontrolni_broj: "48"
                status: nacrt
                url_placanja: https://pay.uplaceno.rs/pay/pt_Xk29aQ
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
      description: "Partially updates: Update proformas. Allowed roles: per
        role/scope; scope: profakture:pisanje."
    delete:
      operationId: obrisi_profakture
      summary: "Delete: proformas"
      tags:
        - Proforma invoices
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:pisanje
        - apiKey: []
      x-required-scopes:
        - profakture:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "204":
          description: Success, no content
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: Only in `nacrt` status; otherwise use cancel (`409
        nedozvoljen_prelaz_statusa`).
  /v1/profakture/{id}/izdaj:
    post:
      operationId: izdaj_profakturu
      summary: Izdavanje (draft → issued)
      tags:
        - Proforma invoices
      description: In MVP proformas issue automatically; this endpoint is for drafts
        (e.g. when issue failed). Assigns a number.
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:pisanje
        - apiKey: []
      x-required-scopes:
        - profakture:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IdempotencyKey"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Profaktura"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: profaktura
                broj: "0123"
                verzija: 1
                iznos: "12000.00"
                placeno_iznos: "12000.00"
                poziv_na_broj:
                  model: "97"
                  vrednost: "4800042012301"
                  kontrolni_broj: "48"
                status: nacrt
                url_placanja: https://pay.uplaceno.rs/pay/pt_Xk29aQ
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "402":
          $ref: "#/components/responses/PaymentRequired"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/profakture/{id}/posalji:
    post:
      operationId: posalji_profakturu
      summary: Slanje mejlom kupcu
      tags:
        - Proforma invoices
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:pisanje
        - apiKey: []
      x-required-scopes:
        - profakture:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProfakturaSlanje"
            example:
              do: demo@uplaceno.rs
              kopija:
                - demo@uplaceno.rs
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Profaktura"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: profaktura
                broj: "0123"
                verzija: 1
                iznos: "12000.00"
                placeno_iznos: "12000.00"
                poziv_na_broj:
                  model: "97"
                  vrednost: "4800042012301"
                  kontrolni_broj: "48"
                status: nacrt
                url_placanja: https://pay.uplaceno.rs/pay/pt_Xk29aQ
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Creates: ili pokrece: Slanje mejlom kupcu. Allowed roles: per
        role/scope; scope: profakture:pisanje."
  /v1/profakture/{id}/otkazi:
    post:
      operationId: otkazi_profakturu
      summary: Otkazivanje
      tags:
        - Proforma invoices
      description: "Without payments: number returns to the pool (cycle+1). With a
        payment/approved proof: number is `locked` → `409
        nedozvoljen_prelaz_statusa`."
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:pisanje
        - apiKey: []
      x-required-scopes:
        - profakture:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProfakturaOtkazivanje"
            example:
              razlog: primer
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Profaktura"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: profaktura
                broj: "0123"
                verzija: 1
                iznos: "12000.00"
                placeno_iznos: "12000.00"
                poziv_na_broj:
                  model: "97"
                  vrednost: "4800042012301"
                  kontrolni_broj: "48"
                status: nacrt
                url_placanja: https://pay.uplaceno.rs/pay/pt_Xk29aQ
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/profakture/{id}/ponovo-izdaj:
    post:
      operationId: ponovo_izdaj_profakturu
      summary: Ponovno izdavanje
      tags:
        - Proforma invoices
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:pisanje
        - apiKey: []
      x-required-scopes:
        - profakture:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProfakturaPonovnoIzdavanje"
            example:
              vazi_do: 2026-11-15
              rok_placanja: 2026-11-15
              posalji_mejl: true
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Profaktura"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: profaktura
                broj: "0123"
                verzija: 1
                iznos: "12000.00"
                placeno_iznos: "12000.00"
                poziv_na_broj:
                  model: "97"
                  vrednost: "4800042012301"
                  kontrolni_broj: "48"
                status: nacrt
                url_placanja: https://pay.uplaceno.rs/pay/pt_Xk29aQ
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "402":
          $ref: "#/components/responses/PaymentRequired"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Creates: ili pokrece: Ponovno izdavanje. Allowed roles: per
        role/scope; scope: profakture:pisanje."
  /v1/profakture/{id}/pdf:
    get:
      operationId: preuzmi_pdf_profakture
      summary: Proforma PDF (current or `?version=`)
      tags:
        - Proforma invoices
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:citanje
        - apiKey: []
      x-required-scopes:
        - profakture:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - name: verzija
          in: query
          schema:
            type: integer
            minimum: 1
      responses:
        "200":
          description: Proforma PDF (current or `?version=`)
          content:
            application/pdf:
              schema:
                type: string
                format: binary
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "202":
          description: PDF still generating; retry after `Retry-After`
          headers:
            Retry-After:
              schema:
                type: integer
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: proforma PDF (current or `?version=`). Allowed roles: per
        role/scope; scope: `profakture:citanje`."
  /v1/profakture/{id}/qr.png:
    get:
      operationId: preuzmi_qr_profakture
      summary: IPS QR kod (NBS, tag RO:97…)
      tags:
        - Proforma invoices
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:citanje
        - apiKey: []
      x-required-scopes:
        - profakture:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - name: velicina
          in: query
          schema:
            type: integer
            minimum: 128
            maximum: 1024
            default: 300
      responses:
        "200":
          description: IPS QR kod (NBS, tag RO:97…)
          content:
            image/png:
              schema:
                type: string
                format: binary
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: IPS QR kod (NBS, tag RO:97…). Allowed roles: per
        role/scope; scope: profakture:citanje."
  /v1/profakture/{id}/verzije:
    get:
      operationId: lista_verzije_profakture
      summary: Istorija verzija
      tags:
        - Proforma invoices
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:citanje
        - apiKey: []
      x-required-scopes:
        - profakture:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VerzijaProfaktureLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: verzija_profakture
                    verzija: 1
                    iznos: "12000.00"
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Istorija verzija. Allowed roles: per role/scope; scope:
        profakture:citanje."
  /v1/profakture/{profaktura_id}/stavke:
    get:
      operationId: lista_stavke_profakture
      summary: Stavke
      tags:
        - Proforma line items
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:citanje
        - apiKey: []
      x-required-scopes:
        - profakture:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/ProinvoiceIdPath"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StavkaLista"
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Stavke. Allowed roles: per role/scope; scope:
        profakture:citanje."
    post:
      operationId: dodaj_stavku_profakture
      summary: Add line item (new version)
      tags:
        - Proforma line items
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:pisanje
        - apiKey: []
      x-required-scopes:
        - profakture:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/ProinvoiceIdPath"
        - $ref: "#/components/parameters/IfMatch"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StavkaUnos"
            example:
              kolicina: "1"
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Profaktura"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: profaktura
                broj: "0123"
                verzija: 1
                iznos: "12000.00"
                placeno_iznos: "12000.00"
                poziv_na_broj:
                  model: "97"
                  vrednost: "4800042012301"
                  kontrolni_broj: "48"
                status: nacrt
                url_placanja: https://pay.uplaceno.rs/pay/pt_Xk29aQ
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: Amount change → new version (v+1), new PDF/QR, status back to
        `izdata`; customer gets an updated email. Forbidden if a payment exists
        (`409 nedozvoljen_prelaz_statusa`). Number and `poziv_na_broj`
        unchanged.
  /v1/profakture/{profaktura_id}/stavke/{id}:
    patch:
      operationId: izmeni_stavku_profakture
      summary: Izmena stavke (nova verzija)
      tags:
        - Proforma line items
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:pisanje
        - apiKey: []
      x-required-scopes:
        - profakture:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/ProinvoiceIdPath"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IfMatch"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StavkaIzmena"
            example:
              proizvod_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
              opis: Izrada sajta
              kolicina: "1"
              jedinica_mere: kom
              jedinicna_cena: "12000.00"
              stopa_pdv: "10"
              popust_procenat: "0"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Profaktura"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: profaktura
                broj: "0123"
                verzija: 1
                iznos: "12000.00"
                placeno_iznos: "12000.00"
                poziv_na_broj:
                  model: "97"
                  vrednost: "4800042012301"
                  kontrolni_broj: "48"
                status: nacrt
                url_placanja: https://pay.uplaceno.rs/pay/pt_Xk29aQ
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: Amount change → new version (v+1), new PDF/QR, status back to
        `izdata`; customer gets an updated email. Forbidden if a payment exists
        (`409 nedozvoljen_prelaz_statusa`). Number and `poziv_na_broj`
        unchanged.
    delete:
      operationId: obrisi_stavku_profakture
      summary: Delete line item (new version)
      tags:
        - Proforma line items
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:pisanje
        - apiKey: []
      x-required-scopes:
        - profakture:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/ProinvoiceIdPath"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IfMatch"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Profaktura"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: profaktura
                broj: "0123"
                verzija: 1
                iznos: "12000.00"
                placeno_iznos: "12000.00"
                poziv_na_broj:
                  model: "97"
                  vrednost: "4800042012301"
                  kontrolni_broj: "48"
                status: nacrt
                url_placanja: https://pay.uplaceno.rs/pay/pt_Xk29aQ
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: Amount change → new version (v+1), new PDF/QR, status back to
        `izdata`; customer gets an updated email. Forbidden if a payment exists
        (`409 nedozvoljen_prelaz_statusa`). Number and `poziv_na_broj`
        unchanged.
  /v1/numeracije:
    get:
      operationId: lista_numeracije
      summary: "List: numbering"
      tags:
        - Numbering
      security:
        - cookieAuth: []
        - oauth2:
            - organizacije:citanje
        - apiKey: []
      x-required-scopes:
        - organizacije:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NumeracijaLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: numeracija
                    serija: default
                    prefiks: PF-
                    pocetni_broj: 1
                    najveci_dodeljeni: 123
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: List numbering. Allowed roles: per role/scope; scope:
        organizacije:citanje."
  /v1/numeracije/{id}:
    get:
      operationId: preuzmi_numeracije
      summary: "Get: numbering"
      tags:
        - Numbering
      security:
        - cookieAuth: []
        - oauth2:
            - organizacije:citanje
        - apiKey: []
      x-required-scopes:
        - organizacije:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Numeracija"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: numeracija
                serija: default
                prefiks: PF-
                pocetni_broj: 1
                najveci_dodeljeni: 123
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Get numbering. Allowed roles: per role/scope; scope:
        organizacije:citanje."
    patch:
      operationId: izmeni_numeracije
      summary: "Update: numbering"
      tags:
        - Numbering
      security:
        - cookieAuth: []
        - oauth2:
            - organizacije:pisanje
        - apiKey: []
      x-required-scopes:
        - organizacije:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/NumeracijaIzmena"
            example:
              prefiks: primer
              pocetni_broj: 1
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Numeracija"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: numeracija
                serija: default
                prefiks: PF-
                pocetni_broj: 1
                najveci_dodeljeni: 123
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Partially updates: Update numbering. Allowed roles: per
        role/scope; scope: organizacije:pisanje."
  /v1/uplate:
    get:
      operationId: lista_uplate
      summary: "List: payments"
      tags:
        - Payments
      security:
        - cookieAuth: []
        - oauth2:
            - uplate:citanje
        - apiKey: []
      x-required-scopes:
        - uplate:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
        - name: status
          in: query
          schema:
            type: string
            enum:
              - primljena
              - uparena
              - delimicno_uparena
              - neuparena
              - zanemarena
        - name: izvor
          in: query
          schema:
            type: string
            enum:
              - email
              - rucno
              - sandbox
        - name: poziv_na_broj
          in: query
          schema:
            type: string
        - name: od
          in: query
          schema:
            type: string
            format: date-time
        - name: do
          in: query
          schema:
            type: string
            format: date-time
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UplataLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: uplata
                    izvor: email
                    iznos: "12000.00"
                    proknjizeno: 2026-11-01T08:00:00Z
                    status: primljena
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: List payments. Allowed roles: per role/scope; scope:
        uplate:citanje."
    post:
      operationId: kreiraj_uplate
      summary: "Create: payments"
      tags:
        - Payments
      security:
        - cookieAuth: []
        - oauth2:
            - uplate:pisanje
        - apiKey: []
      x-required-scopes:
        - uplate:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UplataKreiranje"
            example:
              bankovni_racun_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
              iznos: "12000.00"
              proknjizeno: 2026-11-01T08:00:00Z
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Uplata"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: uplata
                izvor: email
                iznos: "12000.00"
                proknjizeno: 2026-11-01T08:00:00Z
                status: primljena
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Creates: ili pokrece: Kreiranje: Uplate. Allowed roles: per
        role/scope; scope: uplate:pisanje."
  /v1/uplate/{id}:
    get:
      operationId: preuzmi_uplate
      summary: "Get: payments"
      tags:
        - Payments
      security:
        - cookieAuth: []
        - oauth2:
            - uplate:citanje
        - apiKey: []
      x-required-scopes:
        - uplate:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Uplata"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: uplata
                izvor: email
                iznos: "12000.00"
                proknjizeno: 2026-11-01T08:00:00Z
                status: primljena
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Get payments. Allowed roles: per role/scope; scope:
        uplate:citanje."
    patch:
      operationId: izmeni_uplate
      summary: "Update: payments"
      tags:
        - Payments
      security:
        - cookieAuth: []
        - oauth2:
            - uplate:pisanje
        - apiKey: []
      x-required-scopes:
        - uplate:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UplataIzmena"
            example:
              napomena: primer
              status: zanemarena
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Uplata"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: uplata
                izvor: email
                iznos: "12000.00"
                proknjizeno: 2026-11-01T08:00:00Z
                status: primljena
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Partially updates: Update payments. Allowed roles: per role/scope;
        scope: uplate:pisanje."
  /v1/potvrde-uplate:
    get:
      operationId: lista_potvrde_uplate
      summary: "List: PDF payment proofs"
      tags:
        - PDF payment proofs
      security:
        - cookieAuth: []
        - oauth2:
            - potvrde:citanje
        - apiKey: []
      x-required-scopes:
        - potvrde:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
        - name: status
          in: query
          schema:
            type: string
            enum:
              - otpremljena
              - u_proveri
              - prihvacena
              - odbijena
              - istekla
              - potvrdjena
        - name: profaktura_id
          in: query
          schema:
            type: string
            format: uuid
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PotvrdaUplateLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: potvrda_uplate
                    profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    status: otpremljena
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: List PDF payment proofs. Allowed roles: per role/scope;
        scope: potvrde:citanje."
  /v1/potvrde-uplate/{id}:
    get:
      operationId: preuzmi_potvrde_uplate
      summary: "Get: PDF payment proofs"
      tags:
        - PDF payment proofs
      security:
        - cookieAuth: []
        - oauth2:
            - potvrde:citanje
        - apiKey: []
      x-required-scopes:
        - potvrde:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PotvrdaUplate"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: potvrda_uplate
                profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                status: otpremljena
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Get PDF payment proofs. Allowed roles: per role/scope;
        scope: potvrde:citanje."
    delete:
      operationId: obrisi_potvrde_uplate
      summary: "Delete: PDF payment proofs"
      tags:
        - PDF payment proofs
      security:
        - cookieAuth: []
        - oauth2:
            - potvrde:pisanje
        - apiKey: []
      x-required-scopes:
        - potvrde:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "204":
          description: Success, no content
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: Deletes the R2 file (GDPR); proforma status is recalculated.
  /v1/potvrde-uplate/{id}/odobri:
    post:
      operationId: odobri_potvrdu_uplate
      summary: manual prihvatanje
      tags:
        - PDF payment proofs
      description: Manual approval → proforma `privremeno_placena` for 48–72 h (never
        `placeno` without bank confirmation). No digital-signature check; uses
        extracted data and payment matching.
      security:
        - cookieAuth: []
        - oauth2:
            - potvrde:pisanje
        - apiKey: []
      x-required-scopes:
        - potvrde:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OdlukaOPotvrdi"
            example:
              razlog: primer
              sati_privremeno: 48
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PotvrdaUplate"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: potvrda_uplate
                profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                status: otpremljena
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/potvrde-uplate/{id}/odbij:
    post:
      operationId: odbij_potvrdu_uplate
      summary: Odbijanje potvrde
      tags:
        - PDF payment proofs
      description: Reject proof. No digital-signature verification; decision uses
        extracted data (`izvuceno`, `provere`) and payment matching.
      security:
        - cookieAuth: []
        - oauth2:
            - potvrde:pisanje
        - apiKey: []
      x-required-scopes:
        - potvrde:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OdlukaOPotvrdi"
            example:
              razlog: primer
              sati_privremeno: 48
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PotvrdaUplate"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: potvrda_uplate
                profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                status: otpremljena
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/prijem-ingest:
    post:
      operationId: upload_prijem_ingest
      summary: "Upload: PDF izvod"
      tags:
        - Payments
      security:
        - cookieAuth: []
        - oauth2:
            - prijem:pisanje
        - apiKey: []
      x-allowed-roles:
        - vlasnik
        - administrator
        - knjigovodja
      x-required-scopes:
        - prijem:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                adresa_za_prijem_id:
                  type: string
                  format: uuid
      responses:
        "201":
          description: Statement received and processed
        "409":
          description: Duplikat — `kod` = `izvod_vec_obradjen`, polje `prijem_ingest_id`
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "422":
          $ref: "#/components/responses/Validation"
        default:
          $ref: "#/components/responses/Error"
  /v1/uparivanja:
    get:
      operationId: lista_uparivanja
      summary: "List: reconciliation"
      tags:
        - Reconciliation
      security:
        - cookieAuth: []
        - oauth2:
            - uplate:citanje
        - apiKey: []
      x-required-scopes:
        - uplate:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
        - name: uplata_id
          in: query
          schema:
            type: string
            format: uuid
        - name: profaktura_id
          in: query
          schema:
            type: string
            format: uuid
        - name: status
          in: query
          schema:
            type: string
            enum:
              - automatsko
              - rucno
              - odbijena
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UparivanjeLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: uparivanje
                    uplata_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    iznos: "12000.00"
                    status: automatsko
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: List reconciliation. Allowed roles: per role/scope;
        scope: uplate:citanje."
    post:
      operationId: kreiraj_uparivanja
      summary: "Create: reconciliation"
      tags:
        - Reconciliation
      security:
        - cookieAuth: []
        - oauth2:
            - uparivanje:pisanje
        - apiKey: []
      x-required-scopes:
        - uparivanje:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UparivanjeKreiranje"
            example:
              uplata_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
              profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Uparivanje"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: uparivanje
                uplata_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                iznos: "12000.00"
                status: automatsko
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: Manual match; never blocked by plan limits. Locks proforma number.
  /v1/uparivanja/{id}:
    get:
      operationId: preuzmi_uparivanja
      summary: "Get: reconciliation"
      tags:
        - Reconciliation
      security:
        - cookieAuth: []
        - oauth2:
            - uplate:citanje
        - apiKey: []
      x-required-scopes:
        - uplate:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Uparivanje"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: uparivanje
                uplata_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                iznos: "12000.00"
                status: automatsko
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Get reconciliation. Allowed roles: per role/scope; scope:
        uplate:citanje."
    delete:
      operationId: obrisi_uparivanja
      summary: "Delete: reconciliation"
      tags:
        - Reconciliation
      security:
        - cookieAuth: []
        - oauth2:
            - uparivanje:pisanje
        - apiKey: []
      x-required-scopes:
        - uparivanje:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "204":
          description: Success, no content
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Unmatch: restores amounts and statuses; number stays `locked`."
  /v1/adrese-za-prijem:
    get:
      operationId: lista_adrese_za_prijem
      summary: "List: inbound email"
      tags:
        - Inbound email
      security:
        - cookieAuth: []
        - oauth2:
            - prijem:citanje
        - apiKey: []
      x-required-scopes:
        - prijem:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AdresaZaPrijemLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: adresa_za_prijem
                    adresa: lizzard-x7k2@in.uplaceno.rs
                    bankovni_racun_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    banka: intesa
                    aktivan: true
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: List inbound email. Allowed roles: per role/scope; scope:
        prijem:citanje."
    post:
      operationId: kreiraj_adrese_za_prijem
      summary: "Create: inbound email"
      tags:
        - Inbound email
      security:
        - cookieAuth: []
        - oauth2:
            - prijem:pisanje
        - apiKey: []
      x-required-scopes:
        - prijem:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AdresaZaPrijemKreiranje"
            example:
              bankovni_racun_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
              banka: intesa
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AdresaZaPrijem"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: adresa_za_prijem
                adresa: lizzard-x7k2@in.uplaceno.rs
                bankovni_racun_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                banka: intesa
                aktivan: true
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Creates: ili pokrece: Kreiranje: Email ingest. Allowed roles: per
        role/scope; scope: prijem:pisanje."
  /v1/adrese-za-prijem/{id}:
    get:
      operationId: preuzmi_adrese_za_prijem
      summary: "Get: inbound email"
      tags:
        - Inbound email
      security:
        - cookieAuth: []
        - oauth2:
            - prijem:citanje
        - apiKey: []
      x-required-scopes:
        - prijem:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AdresaZaPrijem"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: adresa_za_prijem
                adresa: lizzard-x7k2@in.uplaceno.rs
                bankovni_racun_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                banka: intesa
                aktivan: true
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Get inbound email. Allowed roles: per role/scope; scope:
        prijem:citanje."
    patch:
      operationId: izmeni_adrese_za_prijem
      summary: "Update: inbound email"
      tags:
        - Inbound email
      security:
        - cookieAuth: []
        - oauth2:
            - prijem:pisanje
        - apiKey: []
      x-required-scopes:
        - prijem:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AdresaZaPrijemIzmena"
            example:
              aktivan: true
              dozvoljeni_posiljaoci:
                - primer
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AdresaZaPrijem"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: adresa_za_prijem
                adresa: lizzard-x7k2@in.uplaceno.rs
                bankovni_racun_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                banka: intesa
                aktivan: true
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Partially updates: Update inbound email. Allowed roles: per
        role/scope; scope: prijem:pisanje."
    delete:
      operationId: obrisi_adrese_za_prijem
      summary: "Delete: inbound email"
      tags:
        - Inbound email
      security:
        - cookieAuth: []
        - oauth2:
            - prijem:pisanje
        - apiKey: []
      x-required-scopes:
        - prijem:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "204":
          description: Success, no content
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Deletes or revokes: Delete inbound email. Allowed roles: per
        role/scope; scope: prijem:pisanje."
  /v1/audit-dogadjaji:
    get:
      operationId: lista_audit_dogadjaje
      summary: Audit log
      tags:
        - Audit
      description: "Retencija po planu (Osnovni: pretpostavka 30 dana)."
      security:
        - cookieAuth: []
        - oauth2:
            - audit:citanje
        - apiKey: []
      x-required-scopes:
        - audit:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
        - name: akter
          in: query
          schema:
            type: string
        - name: akcija
          in: query
          schema:
            type: string
        - name: od
          in: query
          schema:
            type: string
            format: date-time
        - name: do
          in: query
          schema:
            type: string
            format: date-time
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuditDogadjajLista"
              example:
                objekat: lista
                podaci:
                  - id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    objekat: audit_dogadjaj
                    tip_aktera: korisnik
                    akcija: profaktura.otkazana
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
                sledeci_kursor: eyJpZCI6IjAxOTJlNGExIn0
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/audit-dogadjaji/{id}:
    get:
      operationId: preuzmi_audit_dogadjaj
      summary: Get audit event
      tags:
        - Audit
      security:
        - cookieAuth: []
        - oauth2:
            - audit:citanje
        - apiKey: []
      x-required-scopes:
        - audit:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuditDogadjaj"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: audit_dogadjaj
                tip_aktera: korisnik
                akcija: profaktura.otkazana
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      description: "Returns: Get audit event. Allowed roles: per role/scope; scope:
        audit:citanje."
  /v1/adrese-za-prijem/{id}/test-email:
    post:
      operationId: pokreni_test_email_banke
      summary: Test prosledjivanja mejla banke
      tags:
        - Inbound email
      description: Vezano za postojecu adresu za prijem (banka + bank racun). Korisnik
        prosledi obavestenje banke na `adresa_za_prosledjivanje`; test istice
        posle 30 min. Uspesan test (`parsiran`) postavlja
        `status_verifikacije=verifikovana` i zavrsava korak `banka`. Najvise 1
        aktivan test po adresi (`409 konflikt`).
      security:
        - cookieAuth: []
        - oauth2:
            - prijem:pisanje
        - apiKey: []
      x-required-scopes:
        - prijem:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IdempotencyKey"
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TestEmailBanke"
              example:
                objekat: test_email_banke
                test_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                adresa_za_prosledjivanje: lizzard-x7k2@in.uplaceno.rs
                status: ceka
                istice: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/adrese-za-prijem/{id}/test-email/{test_id}:
    get:
      operationId: preuzmi_test_email_banke
      summary: Status testa mejla banke
      tags:
        - Inbound email
      description: Frontend poll-uje svake 3 s dok status nije `parsiran` ili `greska`.
      security:
        - cookieAuth: []
        - oauth2:
            - prijem:citanje
        - apiKey: []
      x-required-scopes:
        - prijem:citanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
        - knjigovodja
        - posmatrac
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - name: test_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TestEmailBankeStatus"
              example:
                objekat: test_email_banke
                test_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                status: ceka
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/webhookovi/isporuke:
    get:
      operationId: lista_webhook_isporuka
      summary: Istorija delivery webhooka
      tags:
        - Webhooks
      description: "**Beta**. List delivery attempts; pagination `limit`/`kursor`.
        Manual event resend allowed for 30 days after the last failure."
      security:
        - cookieAuth: []
        - oauth2:
            - webhookovi:citanje
        - apiKey: []
      x-required-scopes:
        - webhookovi:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
        - name: status
          in: query
          schema:
            type: string
            enum:
              - uspesna
              - neuspesna
              - ceka
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookIsporukaLista"
              example:
                objekat: lista
                podaci:
                  - objekat: webhook_isporuka
                    id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
                    pokusaj: 1
                    status: uspesna
                    http_status: 200
                    kreirano: 2026-11-02T09:00:04+01:00
                sledeci_kursor: null
                ima_jos: false
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/webhookovi/dogadjaji/{id}:
    get:
      operationId: detalj_webhook_dogadjaja
      summary: Get webhook event
      tags:
        - Webhooks
      description: "**Beta**. One `id_dogadjaja` with body and delivery state."
      security:
        - cookieAuth: []
        - oauth2:
            - webhookovi:citanje
        - apiKey: []
      x-required-scopes:
        - webhookovi:citanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookDogadjajZapis"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        default:
          $ref: "#/components/responses/Error"
  /v1/webhookovi/dogadjaji/{id}/ponovi:
    post:
      operationId: ponovi_webhook_dogadjaj
      summary: Ponovna delivery dogadjaja
      tags:
        - Webhooks
      description: "**Beta**. Manually resends the same `id_dogadjaja`. Rate limit
        10/min per endpoint."
      security:
        - cookieAuth: []
        - oauth2:
            - webhookovi:pisanje
        - apiKey: []
      x-required-scopes:
        - webhookovi:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IdempotencyKey"
      responses:
        "202":
          description: Ponovna delivery zakazana
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookPonoviOdgovor"
              example:
                objekat: webhook_ponovi
                id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
                status: zakazano
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/webhookovi/{id}/test:
    post:
      operationId: testiraj_webhook
      summary: Test delivery webhooka
      tags:
        - Webhooks
      description: "Sinhrono salje primer payload-a izabranog `dogadjaj`
        (podrazumevano `faktura.placena`) na URL endpointa, sa pravim potpisom i
        `X-Uplaceno-Okruzenje: sandbox`; timeout 10 s, bez ponovnih pokusaja.
        Odgovor nosi ishod delivery (i kod neuspeha je HTTP 200). Uspesan test
        zavrsava korak `webhook`. Rate limit 10/min po endpointu."
      security:
        - cookieAuth: []
        - oauth2:
            - webhookovi:pisanje
        - apiKey: []
      x-required-scopes:
        - webhookovi:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookTestZahtev"
            example:
              dogadjaj: profaktura.kreirana
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookTestRezultat"
              example:
                objekat: webhook_test
                isporuka_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                dogadjaj: profaktura.kreirana
                status_isporuke: uspesna
                http_status: 200
                trajanje_ms: 184
                odgovor: primer
                poslato: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/sandbox/simulacija-uplate:
    post:
      operationId: simuliraj_uplatu
      summary: Simulacija uplate (samo sandbox)
      tags:
        - Sandbox
      description: Samo `okruzenje=sandbox` (inace `409 samo_sandbox`). Creates laznu
        uplatu (`proformas` ili `poziv_na_broj`, `iznos`, opciono `platilac`)
        koja prolazi kroz pravo uparivanje i salje prave sandbox webhookove
        (`uplata.primljena`, `proforma.placena`/`delimicno_placena`,
        `faktura.placena`). Navesti bar jedno od `proformas` i `poziv_na_broj`.
      security:
        - cookieAuth: []
        - oauth2:
            - uplate:pisanje
        - apiKey: []
      x-required-scopes:
        - uplate:pisanje
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SimulacijaUplate"
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Uplata"
              example:
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                objekat: uplata
                izvor: email
                iznos: "12000.00"
                proknjizeno: 2026-11-01T08:00:00Z
                status: primljena
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/SamoSandbox"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/webhookovi:
    post:
      operationId: kreiraj_webhook
      summary: Registracija webhook URL-a
      tags:
        - Webhooks
      description: "Privremeno (1.4.1), ceka potvrdu. Minimalni CRUD: najvise 1 URL po
        organization i okruzenju, prima sve dogadjaje. Korak `webhook` i dalje
        moze da se preskoci. Vec postoji URL: `409 konflikt` (prvo DELETE).
        Odgovor jednom vraca `tajna_za_potpis`."
      security:
        - cookieAuth: []
        - oauth2:
            - webhookovi:pisanje
        - apiKey: []
      x-required-scopes:
        - webhookovi:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookEndpointKreiranje"
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookEndpoint"
              example:
                objekat: webhook_endpoint
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                url: https://primer.rs/uplaceno/webhook
                okruzenje: live
                aktivan: true
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
    get:
      operationId: lista_webhookova
      summary: Lista webhook URL-ova
      tags:
        - Webhooks
      description: "Privremeno (1.4.1), ceka potvrdu. Minimalni CRUD: najvise 1 URL po
        organization i okruzenju, prima sve dogadjaje. Korak `webhook` i dalje
        moze da se preskoci."
      security:
        - cookieAuth: []
        - oauth2:
            - webhookovi:citanje
        - apiKey: []
      x-required-scopes:
        - webhookovi:citanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookEndpointLista"
              example:
                objekat: lista
                podaci:
                  - objekat: webhook_endpoint
                    id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    url: https://primer.rs/uplaceno/webhook
                    okruzenje: live
                    aktivan: true
                    kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
  /v1/webhookovi/{id}:
    delete:
      operationId: obrisi_webhook
      summary: Delete webhook URL
      tags:
        - Webhooks
      description: "Privremeno (1.4.1), ceka potvrdu. Minimalni CRUD: najvise 1 URL po
        organization i okruzenju, prima sve dogadjaje. Korak `webhook` i dalje
        moze da se preskoci. Brisanje ne vraca korak `webhook` iz `zavrseno`."
      security:
        - cookieAuth: []
        - oauth2:
            - webhookovi:pisanje
        - apiKey: []
      x-required-scopes:
        - webhookovi:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "204":
          description: Deleted
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
    patch:
      operationId: izmeni_webhook
      summary: Izmena webhook URL-a
      tags:
        - Webhooks
      description: Privremeno (1.4.2), ceka potvrdu. Menja `url` i/ili `aktivan`;
        tajna ostaje ista.
      security:
        - cookieAuth: []
        - oauth2:
            - webhookovi:pisanje
        - apiKey: []
      x-required-scopes:
        - webhookovi:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookEndpointIzmena"
            example:
              aktivan: true
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookEndpoint"
              example:
                objekat: webhook_endpoint
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                url: https://primer.rs/uplaceno/webhook
                okruzenje: live
                aktivan: true
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
  /v1/racuni:
    get:
      operationId: lista_racuna
      summary: "Pregled racuna: lista izdatih racuna"
      tags:
        - Invoices
      description: >+
        Privremeno (1.4.2), ceka potvrdu. Lista izdatih racuna (samo posle
        uparene uplate). **Pravilo izdavanja**: racun/faktura se izdaje TEK
        POSLE uparene uplate. Pre uplate postoji samo predracun (proforma,
        naslov `Predracun` ili `Zahtev za placanje`) koji NIJE poreska isprava i
        nosi napomenu `Ovo nije poreska isprava`. Nacin izdavanja se IZVODI
        (klijent ga ne salje) iz `poreski_status` i `u_fiskalizaciji`
        organization i `tip_kupca`:


        | organization | Kupac (`tip_kupca`) | `nacini_izdavanja` |

        |---|---|---|

        | pdv_obveznik | pravno_lice | e_faktura_sef |

        | pdv_obveznik | fizicko_lice | fiskalni_racun |

        | pausalac, `u_fiskalizaciji=false` | bilo koji | pdf_racun |

        | pausalac, `u_fiskalizaciji=true` | bilo koji | pdf_racun,
        fiskalni_racun |

      security:
        - cookieAuth: []
        - oauth2:
            - racuni:citanje
        - apiKey: []
      x-required-scopes:
        - racuni:citanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
        - knjigovodja
        - posmatrac
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
        - name: nacin_izdavanja
          in: query
          schema:
            $ref: "#/components/schemas/NacinIzdavanja"
        - name: status
          in: query
          schema:
            type: string
        - name: kupac_id
          in: query
          schema:
            type: string
            format: uuid
        - name: profaktura_id
          in: query
          schema:
            type: string
            format: uuid
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RacunLista"
              example:
                objekat: lista
                podaci:
                  - objekat: racun
                    id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    broj: R-0001/2026
                    profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e02
                    uplata_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e03
                    tip_kupca: pravno_lice
                    nacin_izdavanja: e_faktura_sef
                    nacini_izdavanja:
                      - e_faktura_sef
                    status: poslat_u_sef
                    iznos: "12000.00"
                    kreirano: 2026-11-02T09:00:00+01:00
                ima_jos: true
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
  /v1/racuni/{id}:
    get:
      operationId: preuzmi_racun
      summary: "Pregled racuna: detalj"
      tags:
        - Invoices
      description: Privremeno (1.4.2), ceka potvrdu. Detalj izdatog racuna sa statusom
        SEF/fiskalizacije.
      security:
        - cookieAuth: []
        - oauth2:
            - racuni:citanje
        - apiKey: []
      x-required-scopes:
        - racuni:citanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
        - knjigovodja
        - posmatrac
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Racun"
              example:
                objekat: racun
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                broj: R-0001/2026
                profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e02
                uplata_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e03
                tip_kupca: pravno_lice
                nacin_izdavanja: e_faktura_sef
                nacini_izdavanja:
                  - e_faktura_sef
                status: poslat_u_sef
                iznos: "12000.00"
                kreirano: 2026-11-02T09:00:00+01:00
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
  /v1/sabloni-dokumenata:
    get:
      operationId: lista_sablona
      summary: Lista sablona dokumenata
      tags:
        - Document studio
      description: Privremeno (1.4.2), ceka potvrdu. Sabloni organization iz `X-Org-Id`.
      security:
        - cookieAuth: []
        - oauth2:
            - sabloni:citanje
        - apiKey: []
      x-required-scopes:
        - sabloni:citanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
        - knjigovodja
        - posmatrac
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
        - name: vrsta_dokumenta
          in: query
          schema:
            $ref: "#/components/schemas/VrstaDokumenta"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SablonDokumentaLista"
              example:
                objekat: lista
                podaci:
                  - objekat: sablon_dokumenta
                    id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                    naziv: Osnovni plavi
                    vrsta_dokumenta: predracun
                    boje:
                      primarna: "#0B5FFF"
                      sekundarna: "#111827"
                      akcenat: "#F59E0B"
                      tekst: "#111827"
                    polja:
                      - polje: logo
                        redosled: 1
                    pozicija_qr: gore_desno
                    podrazumevani: true
                    kreirano: 2026-11-01T08:00:00Z
                ima_jos: true
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
    post:
      operationId: kreiraj_sablon
      summary: Kreiranje sablona
      tags:
        - Document studio
      description: Privremeno (1.4.2), ceka potvrdu. Creates sablon. Prvi sablon za
        vrstu dokumenta postaje podrazumevani.
      security:
        - cookieAuth: []
        - oauth2:
            - sabloni:pisanje
        - apiKey: []
      x-required-scopes:
        - sabloni:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SablonDokumentaKreiranje"
            example:
              naziv: Osnovni plavi
              vrsta_dokumenta: predracun
      responses:
        "201":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SablonDokumenta"
              example:
                objekat: sablon_dokumenta
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                naziv: Osnovni plavi
                vrsta_dokumenta: predracun
                boje:
                  primarna: "#0B5FFF"
                  sekundarna: "#111827"
                  akcenat: "#F59E0B"
                  tekst: "#111827"
                polja:
                  - polje: logo
                    redosled: 1
                pozicija_qr: gore_desno
                podrazumevani: true
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
  /v1/sabloni-dokumenata/{id}:
    get:
      operationId: preuzmi_sablon
      summary: Get template
      tags:
        - Document studio
      description: Privremeno (1.4.2), ceka potvrdu. Detalj sablona.
      security:
        - cookieAuth: []
        - oauth2:
            - sabloni:citanje
        - apiKey: []
      x-required-scopes:
        - sabloni:citanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
        - knjigovodja
        - posmatrac
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SablonDokumenta"
              example:
                objekat: sablon_dokumenta
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                naziv: Osnovni plavi
                vrsta_dokumenta: predracun
                boje:
                  primarna: "#0B5FFF"
                  sekundarna: "#111827"
                  akcenat: "#F59E0B"
                  tekst: "#111827"
                polja:
                  - polje: logo
                    redosled: 1
                pozicija_qr: gore_desno
                podrazumevani: true
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
    patch:
      operationId: izmeni_sablon
      summary: Izmena sablona
      tags:
        - Document studio
      description: Privremeno (1.4.2), ceka potvrdu. Menja sablon i povecava
        `verzija`. Vec izdati dokumenti zadrzavaju verziju sablona sa kojom su
        izdati.
      security:
        - cookieAuth: []
        - oauth2:
            - sabloni:pisanje
        - apiKey: []
      x-required-scopes:
        - sabloni:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SablonDokumentaIzmena"
            example:
              naziv: Osnovni plavi
              naslov: Predracun
              boje:
                primarna: "#0B5FFF"
                sekundarna: "#111827"
                akcenat: "#F59E0B"
                tekst: "#111827"
              font: inter
              polja:
                - polje: logo
                  redosled: 1
              pozicija_qr: gore_desno
              napomena: primer
              podnozje: primer
              jezik: sr-Latn
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SablonDokumenta"
              example:
                objekat: sablon_dokumenta
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                naziv: Osnovni plavi
                vrsta_dokumenta: predracun
                boje:
                  primarna: "#0B5FFF"
                  sekundarna: "#111827"
                  akcenat: "#F59E0B"
                  tekst: "#111827"
                polja:
                  - polje: logo
                    redosled: 1
                pozicija_qr: gore_desno
                podrazumevani: true
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
    delete:
      operationId: obrisi_sablon
      summary: Delete template
      tags:
        - Document studio
      description: Privremeno (1.4.2), ceka potvrdu. Podrazumevani sablon ne moze da
        se obrise (`409 sablon_u_upotrebi`).
      security:
        - cookieAuth: []
        - oauth2:
            - sabloni:pisanje
        - apiKey: []
      x-required-scopes:
        - sabloni:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SablonDokumenta"
              example:
                objekat: sablon_dokumenta
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                naziv: Osnovni plavi
                vrsta_dokumenta: predracun
                boje:
                  primarna: "#0B5FFF"
                  sekundarna: "#111827"
                  akcenat: "#F59E0B"
                  tekst: "#111827"
                polja:
                  - polje: logo
                    redosled: 1
                pozicija_qr: gore_desno
                podrazumevani: true
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
  /v1/sabloni-dokumenata/{id}/logo:
    put:
      operationId: otpremi_logo_sablona
      summary: Otpremanje logotipa (R2, multipart)
      tags:
        - Document studio
      description: "Privremeno (1.4.2), ceka potvrdu. `multipart/form-data`, polje
        `logo`. Cuva se u R2 (`logo_url`). Pogresan sadrzaj: `422
        nevazeci_logo`."
      security:
        - cookieAuth: []
        - oauth2:
            - sabloni:pisanje
        - apiKey: []
      x-required-scopes:
        - sabloni:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SablonDokumenta"
              example:
                objekat: sablon_dokumenta
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                naziv: Osnovni plavi
                vrsta_dokumenta: predracun
                boje:
                  primarna: "#0B5FFF"
                  sekundarna: "#111827"
                  akcenat: "#F59E0B"
                  tekst: "#111827"
                polja:
                  - polje: logo
                    redosled: 1
                pozicija_qr: gore_desno
                podrazumevani: true
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "413":
          $ref: "#/components/responses/TooLarge"
        "415":
          $ref: "#/components/responses/Unsupported"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: "#/components/schemas/LogoOtpremanje"
      x-privremeno: true
    delete:
      operationId: obrisi_logo_sablona
      summary: Delete logo
      tags:
        - Document studio
      description: Privremeno (1.4.2), ceka potvrdu. Uklanja logo iz R2.
      security:
        - cookieAuth: []
        - oauth2:
            - sabloni:pisanje
        - apiKey: []
      x-required-scopes:
        - sabloni:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SablonDokumenta"
              example:
                objekat: sablon_dokumenta
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                naziv: Osnovni plavi
                vrsta_dokumenta: predracun
                boje:
                  primarna: "#0B5FFF"
                  sekundarna: "#111827"
                  akcenat: "#F59E0B"
                  tekst: "#111827"
                polja:
                  - polje: logo
                    redosled: 1
                pozicija_qr: gore_desno
                podrazumevani: true
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
  /v1/sabloni-dokumenata/{id}/pregled:
    post:
      operationId: pregledaj_sablon
      summary: Pregled sablona (PDF ili HTML)
      tags:
        - Document studio
      description: Privremeno (1.4.2), ceka potvrdu. Renderuje sablon sa primerom
        podataka (ili `primer_podataka`) i opcionim nesacuvanim `izmene`.
        Returns `application/pdf` ili `text/html` po `format`. Ne menja stanje.
      security:
        - cookieAuth: []
        - oauth2:
            - sabloni:citanje
        - apiKey: []
      x-required-scopes:
        - sabloni:citanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PregledSablonaZahtev"
            example:
              format: pdf
              izmene:
                naziv: Osnovni plavi
                naslov: Predracun
                boje:
                  primarna: "#0B5FFF"
                  sekundarna: "#111827"
                  akcenat: "#F59E0B"
                  tekst: "#111827"
                font: inter
                polja:
                  - polje: logo
                    redosled: 1
                pozicija_qr: gore_desno
                napomena: primer
                podnozje: primer
                jezik: sr-Latn
              primer_podataka:
                kupac:
                  naziv: TEST KUPAC
                stavke:
                  - naziv: Usluga
                    kolicina: "1"
                    cena: "10000.00"
                    stopa_pdv: 20
      responses:
        "200":
          description: Pregled dokumenta
          content:
            application/pdf:
              schema:
                type: string
                contentMediaType: application/pdf
            text/html:
              schema:
                type: string
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
  /v1/sabloni-dokumenata/podrazumevani:
    get:
      operationId: preuzmi_podrazumevane_sablone
      summary: Podrazumevani sabloni po vrsti dokumenta
      tags:
        - Document studio
      description: Privremeno (1.4.2), ceka potvrdu. Mapa vrsta_dokumenta -> sablon_id
        (null = sistemski sablon).
      security:
        - cookieAuth: []
        - oauth2:
            - sabloni:citanje
        - apiKey: []
      x-required-scopes:
        - sabloni:citanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
        - knjigovodja
        - posmatrac
      parameters:
        - $ref: "#/components/parameters/XOrgId"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PodrazumevaniSabloni"
              example:
                objekat: podrazumevani_sabloni
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
    put:
      operationId: postavi_podrazumevani_sablon
      summary: Postavljanje podrazumevanog sablona
      tags:
        - Document studio
      description: Privremeno (1.4.2), ceka potvrdu. Postavlja podrazumevani sablon za
        vrstu dokumenta (predracun, faktura, e_faktura, fiskalni_racun).
        `vrsta_dokumenta` mora da se poklapa sa sablonom.
      security:
        - cookieAuth: []
        - oauth2:
            - sabloni:pisanje
        - apiKey: []
      x-required-scopes:
        - sabloni:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PodrazumevaniSablonZahtev"
            example:
              vrsta_dokumenta: predracun
              sablon_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PodrazumevaniSabloni"
              example:
                objekat: podrazumevani_sabloni
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
  /v1/profakture/{id}/pregled:
    get:
      operationId: pregledaj_profakturu
      summary: Pregled predracuna sa primenjenim sablonom
      tags:
        - Proforma invoices
      description: Privremeno (1.4.2), ceka potvrdu. PDF ili HTML konkretnog
        predracuna sa primenjenim sablonom. Uvek sadrzi `Ovo nije poreska
        isprava`.
      security:
        - cookieAuth: []
        - oauth2:
            - profakture:citanje
        - apiKey: []
      x-required-scopes:
        - profakture:citanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
        - knjigovodja
        - posmatrac
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - name: format
          in: query
          schema:
            type: string
            enum:
              - pdf
              - html
            default: pdf
        - name: sablon_id
          in: query
          schema:
            type: string
            format: uuid
          description: "Opciono: drugi sablon (inace podrazumevani za vrstu dokumenta)"
      responses:
        "200":
          description: Pregled dokumenta
          content:
            application/pdf:
              schema:
                type: string
                contentMediaType: application/pdf
            text/html:
              schema:
                type: string
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
  /v1/racuni/{id}/pregled:
    get:
      operationId: pregledaj_racun
      summary: Pregled ili PDF racuna sa primenjenim sablonom
      tags:
        - Invoices
      description: "Privremeno (1.4.2), ceka potvrdu. PDF ili HTML izdatog racuna sa
        sablonom (verzijom) sa kojom je izdat. Za `e_faktura_sef` vraca
        vizuelizaciju; zvanican dokument je u SEF-u. Ako je u obradi: `409
        dokument_jos_nije_izdat`."
      security:
        - cookieAuth: []
        - oauth2:
            - racuni:citanje
        - apiKey: []
      x-required-scopes:
        - racuni:citanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
        - knjigovodja
        - posmatrac
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - name: format
          in: query
          schema:
            type: string
            enum:
              - pdf
              - html
            default: pdf
      responses:
        "200":
          description: Pregled dokumenta
          content:
            application/pdf:
              schema:
                type: string
                contentMediaType: application/pdf
            text/html:
              schema:
                type: string
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
  /v1/webhookovi/{id}/rotiraj-tajnu:
    post:
      operationId: rotiraj_tajnu_webhooka
      summary: Rotacija tajne za potpis
      tags:
        - Webhooks
      description: Privremeno (1.4.2), ceka potvrdu. Generise novu `tajna_za_potpis`
        (vraca se samo u ovom odgovoru). Tokom `stara_vazi_sekundi`
        `X-Uplaceno-Potpis` nosi dva `v1=` potpisa.
      security:
        - cookieAuth: []
        - oauth2:
            - webhookovi:pisanje
        - apiKey: []
      x-required-scopes:
        - webhookovi:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookRotacijaZahtev"
            example:
              stara_vazi_sekundi: 3600
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookEndpoint"
              example:
                objekat: webhook_endpoint
                id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
                url: https://primer.rs/uplaceno/webhook
                okruzenje: live
                aktivan: true
                kreirano: 2026-11-01T08:00:00Z
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
      x-privremeno: true
  /v1/podesavanja/sef:
    get:
      operationId: citaj_sef_podesavanja
      summary: SEF podesavanja organization
      tags:
        - SEF (e-invoice)
      description: Returns aktivno okruzenje i masku API kljuca (`kljuc_poslednje4`)
        po okruzenju. Pun kljuc se nikad ne vraca.
      security:
        - cookieAuth: []
        - oauth2:
            - sef:citanje
        - apiKey: []
      x-required-scopes:
        - sef:citanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
        - knjigovodja
        - posmatrac
      parameters:
        - $ref: "#/components/parameters/XOrgId"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SefPodesavanja"
              example:
                objekat: sef_podesavanja
                aktivno_okruzenje: test
                test:
                  konfigurisano: true
                  kljuc_poslednje4: "1234"
                live:
                  konfigurisano: false
                  kljuc_poslednje4: null
                azurirano: 2026-11-03T09:00:00+01:00
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
    put:
      operationId: sacuvaj_sef_podesavanja
      summary: Sacuvaj SEF API kljuc i/ili aktivno okruzenje
      tags:
        - SEF (e-invoice)
      description: Postavlja API kljuc za `okruzenje` (test|live) i/ili
        `aktivno_okruzenje`. Za prelazak na live obavezni su
        `aktivno_okruzenje=live` i `potvrda_live=true`. Odgovor vraca samo
        `kljuc_poslednje4`.
      security:
        - cookieAuth: []
        - oauth2:
            - sef:pisanje
        - apiKey: []
      x-required-scopes:
        - sef:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SefPodesavanjaIzmena"
            example:
              okruzenje: test
              api_kljuc: sef_test_primer
              aktivno_okruzenje: test
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SefPodesavanja"
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
    delete:
      operationId: obrisi_sef_podesavanja
      summary: Obrisi SEF podesavanja (kljuc) za okruzenje
      tags:
        - SEF (e-invoice)
      description: Brise sacuvani API kljuc za `okruzenje` (query, podrazumevano
        aktivno). Ne brise istoriju dokumenata.
      security:
        - cookieAuth: []
        - oauth2:
            - sef:pisanje
        - apiKey: []
      x-required-scopes:
        - sef:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - name: okruzenje
          in: query
          schema:
            $ref: "#/components/schemas/SefOkruzenje"
          description: Okruzenje ciji se kljuc brise; bez parametra brise aktivno.
      responses:
        "204":
          description: Deleted
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/podesavanja/sef/test:
    post:
      operationId: testiraj_sef_vezu
      summary: Testiraj vezu sa SEF API-jem
      tags:
        - SEF (e-invoice)
      description: Proverava da li sacuvani API kljuc za aktivno (ili navedeno)
        okruzenje radi. Ne salje fakture.
      security:
        - cookieAuth: []
        - oauth2:
            - sef:pisanje
        - apiKey: []
      x-required-scopes:
        - sef:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
        - knjigovodja
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                okruzenje:
                  $ref: "#/components/schemas/SefOkruzenje"
            example:
              okruzenje: test
      responses:
        "200":
          description: Rezultat testa
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SefTestRezultat"
              example:
                objekat: sef_test
                okruzenje: test
                uspesno: true
                poruka: Veza sa SEF demo okruzenjem je uspesna.
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/sef/kupci/{pib}:
    get:
      operationId: proveri_sef_kupca
      summary: Provera da li je kupac registrovan na SEF-u
      tags:
        - SEF (e-invoice)
      description: Proverava registraciju pravnog lica na SEF-u po PIB-u (kes u
        `sef_kupci_kes`). Ako nije na SEF-u, nacin izdavanja za
        pdv_obveznik+pravno_lice pada na `pdf_racun`.
      security:
        - cookieAuth: []
        - oauth2:
            - sef:citanje
        - apiKey: []
      x-required-scopes:
        - sef:citanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
        - knjigovodja
        - posmatrac
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - name: pib
          in: path
          required: true
          schema:
            type: string
            pattern: ^\d{9}$
          description: PIB kupca (9 cifara, bez RS prefiksa)
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SefKupacStatus"
              example:
                objekat: sef_kupac
                pib: "100000001"
                registrovan: true
                jbkjs: null
                izvor: kes
                provereno: 2026-11-03T09:00:00+01:00
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/racuni/{id}/sef/posalji:
    post:
      operationId: posalji_racun_na_sef
      summary: Posalji racun na SEF
      tags:
        - SEF (e-invoice)
        - Invoices
      description: Generise UBL 2.1 SRB CIUS i salje na SEF (`sales-invoice/ubl`) sa
        stabilnim `requestId` (idempotentnost). `sendToCir=Yes` kada kupac ima
        JBKJS. Emituje `racun.sef_poslat` ili `racun.sef_greska`.
      security:
        - cookieAuth: []
        - oauth2:
            - sef:pisanje
        - apiKey: []
      x-required-scopes:
        - sef:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
        - knjigovodja
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IdempotencyKey"
      responses:
        "200":
          description: Poslato ili vec poslato (idempotentno)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Racun"
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/racuni/{id}/sef/otkazi:
    post:
      operationId: otkazi_racun_na_sef
      summary: Otkazi racun na SEF-u
      tags:
        - SEF (e-invoice)
        - Invoices
      description: Poziva SEF cancel za ranije poslati racun.
      security:
        - cookieAuth: []
        - oauth2:
            - sef:pisanje
        - apiKey: []
      x-required-scopes:
        - sef:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
        - knjigovodja
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                komentar:
                  type: string
                  maxLength: 500
            example:
              komentar: Pogresan iznos
      responses:
        "200":
          description: Otkazano
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Racun"
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
  /v1/racuni/{id}/sef/storniraj:
    post:
      operationId: storniraj_racun_na_sef
      summary: Storniraj racun na SEF-u
      tags:
        - SEF (e-invoice)
        - Invoices
      description: Poziva SEF storno za prihvaceni racun.
      security:
        - cookieAuth: []
        - oauth2:
            - sef:pisanje
        - apiKey: []
      x-required-scopes:
        - sef:pisanje
      x-dozvoljene-uloge:
        - vlasnik
        - administrator
        - knjigovodja
      parameters:
        - $ref: "#/components/parameters/XOrgId"
        - $ref: "#/components/parameters/Id"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                komentar:
                  type: string
                  maxLength: 500
            example:
              komentar: Storno po dogovoru
      responses:
        "200":
          description: Stornirano
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Racun"
          headers:
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "422":
          $ref: "#/components/responses/Validation"
        "429":
          $ref: "#/components/responses/TooMany"
        default:
          $ref: "#/components/responses/Error"
components:
  securitySchemes:
    oauth2:
      type: oauth2
      description: OIDC Authorization Code + PKCE (dashboard, third-party with
        consent) and Client Credentials (server-to-server). Access token 15
        minutes, rotating refresh; token carries `org_id` and `env` claims.
      flows:
        authorizationCode:
          authorizationUrl: https://auth.uplaceno.rs/oauth2/authorize
          tokenUrl: https://auth.uplaceno.rs/oauth2/token
          refreshUrl: https://auth.uplaceno.rs/oauth2/token
          scopes:
            organizacije:citanje: Čitanje organizacija
            organizacije:pisanje: Izmena organizacija, numeracije i podešavanja
            clanovi:citanje: Čitanje članova
            clanovi:pisanje: Članovi i pozivnice
            uloge:citanje: Čitanje uloga i kataloga dozvola
            api_kljucevi:pisanje: Upravljanje API ključevima
            audit:citanje: Audit log
            naplata:citanje: Plan, sedišta i potrošnja
            banka:citanje: Čitanje bankovnih računa
            banka:pisanje: Izmena bankovnih računa
            kupci:citanje: Čitanje kupaca
            kupci:pisanje: Izmena kupaca
            proizvodi:citanje: Čitanje proizvoda
            proizvodi:pisanje: Izmena proizvoda
            zahtevi_za_placanje:pisanje: Payment requests (porudžbine)
            profakture:citanje: Čitanje profaktura
            profakture:pisanje: Izdavanje i izmena profaktura
            uplate:citanje: Čitanje uplata
            uplate:pisanje: Ručne uplate i potvrde
            potvrde:citanje: Čitanje PDF potvrda
            potvrde:pisanje: Odobravanje/odbijanje PDF potvrda
            uparivanje:pisanje: Ručno uparivanje
            prijem:pisanje: Email ingest adrese
            onboarding:citanje: Citanje stanja onboardinga i preduslova
            onboarding:pisanje: Izmena koraka onboardinga i aktivacija produkcije
            webhookovi:pisanje: Webhook endpointi i test isporuke
            api_kljucevi:citanje: Citanje API kljuceva (bez tajni)
            uparivanje:citanje: Citanje uparivanja
            prijem:citanje: Citanje adresa za prijem i testova
            webhookovi:citanje: Citanje webhook endpointa
            zahtevi_za_placanje:citanje: Citanje zahteva za placanje
            racuni:citanje: Pregled izdatih racuna
            sabloni:citanje: Citanje sablona dokumenata
            sabloni:pisanje: "Studio racuna: izmena sablona, logo, podrazumevani sablon"
            sef:citanje: Citanje SEF podesavanja i statusa kupca/racuna
            sef:pisanje: SEF podesavanja, test veze, slanje/otkaz/storno (ukljucuje citanje)
        clientCredentials:
          tokenUrl: https://auth.uplaceno.rs/oauth2/token
          scopes:
            organizacije:citanje: Čitanje organizacija
            organizacije:pisanje: Izmena organizacija, numeracije i podešavanja
            clanovi:citanje: Čitanje članova
            clanovi:pisanje: Članovi i pozivnice
            uloge:citanje: Čitanje uloga i kataloga dozvola
            api_kljucevi:pisanje: Upravljanje API ključevima
            audit:citanje: Audit log
            naplata:citanje: Plan, sedišta i potrošnja
            banka:citanje: Čitanje bankovnih računa
            banka:pisanje: Izmena bankovnih računa
            kupci:citanje: Čitanje kupaca
            kupci:pisanje: Izmena kupaca
            proizvodi:citanje: Čitanje proizvoda
            proizvodi:pisanje: Izmena proizvoda
            zahtevi_za_placanje:pisanje: Payment requests (porudžbine)
            profakture:citanje: Čitanje profaktura
            profakture:pisanje: Izdavanje i izmena profaktura
            uplate:citanje: Čitanje uplata
            uplate:pisanje: Ručne uplate i potvrde
            potvrde:citanje: Čitanje PDF potvrda
            potvrde:pisanje: Odobravanje/odbijanje PDF potvrda
            uparivanje:pisanje: Ručno uparivanje
            prijem:pisanje: Email ingest adrese
            onboarding:citanje: Citanje stanja onboardinga i preduslova
            onboarding:pisanje: Izmena koraka onboardinga i aktivacija produkcije
            webhookovi:pisanje: Webhook endpointi i test isporuke
            api_kljucevi:citanje: Citanje API kljuceva (bez tajni)
            uparivanje:citanje: Citanje uparivanja
            prijem:citanje: Citanje adresa za prijem i testova
            webhookovi:citanje: Citanje webhook endpointa
            zahtevi_za_placanje:citanje: Citanje zahteva za placanje
            racuni:citanje: Pregled izdatih racuna
            sabloni:citanje: Citanje sablona dokumenata
            sabloni:pisanje: "Studio racuna: izmena sablona, logo, podrazumevani sablon"
            sef:citanje: Citanje SEF podesavanja i statusa kupca/racuna
            sef:pisanje: SEF podesavanja, test veze, slanje/otkaz/storno (ukljucuje citanje)
    oidc:
      type: openIdConnect
      openIdConnectUrl: https://auth.uplaceno.rs/.well-known/openid-configuration
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: upl_live_* | upl_test_*
      description: "`Authorization: Bearer upl_test_…`. Only SHA-256 hash stored;
        prefix determines environment."
    cookieAuth:
      type: apiKey
      in: cookie
      name: __Host-uplaceno_sesija
      description: >-
        Sesijski kolacic dashboard-a. Produkcija: `__Host-uplaceno_sesija`
        (HttpOnly, Secure, SameSite=Lax, Path=/). Lokalno: `uplaceno_sesija`
        (HttpOnly, SameSite=Lax). Sesija se cuva hesirana (SHA-256) u D1,
        opoziva se odjavom ili promenom lozinke.


        **CSRF**: svaki zahtev sa kolacicem koji menja stanje
        (POST/PATCH/PUT/DELETE) mora imati `Origin` header jednak dozvoljenom
        poreklu dashboard-a (npr. `https://app.uplaceno.rs`, lokalno
        `http://localhost:5173`); u suprotnom `403 neispravno_poreklo`. Zahtevi
        sa Bearer tokenom/API kljucem nisu pogodjeni.
  parameters:
    Limit:
      name: limit
      in: query
      schema:
        type: integer
        minimum: 1
        maximum: 200
        default: 50
    Cursor:
      name: kursor
      in: query
      schema:
        type: string
      description: Opaque cursor from `sledeci_kursor`
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      schema:
        type: string
        minLength: 8
        maxLength: 255
      example: 7f1c2e9a-wc-order-1043
      description: "Required on every POST. Response cached 24 h (KV); same key +
        different body → `409 ponovljen_kljuc_idempotentnosti`. Response
        includes `Idempotent-Replayed: true` on replay. Exceptions (optional
        key): `/v1/nalog/*`, `/v1/nalog/pristupni-kljucevi/*`,
        `/v1/ja/sesije/opozovi-ostale`, public `/plati/*`."
    IdempotencyKeyOptional:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        maxLength: 255
      description: "Opcion. Na `/v1/nalog/*` (prijava, registracija, potvrda-emaila,
        zaboravljena-lozinka, nova-lozinka, odjava) i na WebAuthn
        opcijama/verifikaciji pristupnog kljuca NIJE required: te operacije su
        prirodno idempotentne ili jednokratne (izazov/token se trosi). Ako se
        posalje, ponavljanje sa istim kljucem u 24 h vraca isti odgovor; lozinke
        i izazovi se nikad ne kesiraju u citljivom obliku."
    XOrgId:
      name: X-Organizacija-Id
      in: header
      required: false
      schema:
        type: string
        format: uuid
      description: Active organization. Required for user OIDC tokens with multiple
        orgs; for API key/client credentials the org is in the credential
        (header must match or be omitted).
    Id:
      name: id
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: UUID v7
    OrgIdPath:
      name: organizacija_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    ProinvoiceIdPath:
      name: profaktura_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    IfMatch:
      name: If-Match
      in: header
      required: false
      schema:
        type: string
      description: "`verzija_reda` proformas; nepoklapanje → `409 version_conflict`"
    PayToken:
      name: token
      in: path
      required: true
      schema:
        type: string
        pattern: ^pt_[A-Za-z0-9]{22,}$
      example: pt_Xk29aQb7Lm3Np8Rs4Tv6Wy
    InviteToken:
      name: token
      in: path
      required: true
      schema:
        type: string
  responses:
    BadRequest:
      description: Bad request
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/Problem"
          example:
            type: https://docs.uplaceno.rs/errors/neispravan_zahtev
            title: Neispravan zahtev
            status: 400
            kod: neispravan_zahtev
            zahtev_id: req_0192e4a1c0de
    Unauthorized:
      description: Missing or invalid token/key
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/Problem"
          example:
            type: https://docs.uplaceno.rs/errors/nije_prijavljen
            title: Potrebna autentikacija
            status: 401
            kod: nije_prijavljen
            zahtev_id: req_0192e4a1c0de
    Forbidden:
      description: "Nedovoljna prava: `zabranjeno`, `nedovoljan_opseg`,
        `funkcija_nije_u_planu`, `organization`"
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/Problem"
          examples:
            funkcija_nije_u_planu:
              value:
                type: https://docs.uplaceno.rs/errors/funkcija_nije_u_planu
                title: Funkcija nije u planu
                status: 403
                kod: funkcija_nije_u_planu
                detail: Webhookovi u live okruženju zahtevaju Srednji plan.
                meta:
                  funkcija: webhooks
                  potreban_plan: srednji
            nedovoljan_scope:
              value:
                type: https://docs.uplaceno.rs/errors/nedovoljan_opseg
                title: Nedostaje scope
                status: 403
                kod: nedovoljan_opseg
                meta:
                  potrebno:
                    - profakture:pisanje
            organizacija_samo_za_citanje:
              value:
                type: https://docs.uplaceno.rs/errors/organizacija_samo_za_citanje
                title: Organizacija je samo za čitanje
                status: 403
                kod: organizacija_samo_za_citanje
    NotFound:
      description: Not found (or not in this organization/environment)
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/Problem"
          example:
            type: https://docs.uplaceno.rs/errors/nije_pronadjeno
            title: Nije pronađeno
            status: 404
            kod: nije_pronadjeno
            zahtev_id: req_0192e4a1c0de
    Conflict:
      description: "Konflikt: `konflikt`, `konflikt_verzije`,
        `nedozvoljen_prelaz_statusa`, `ponovljen_kljuc_idempotentnosti`,
        `opseg_brojeva_potrosen`, `duplikat_potvrde`"
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/Problem"
          examples:
            opseg_brojeva_potrosen:
              value:
                type: https://docs.uplaceno.rs/errors/opseg_brojeva_potrosen
                title: Opseg brojeva 0001–9999 je potrošen
                status: 409
                kod: opseg_brojeva_potrosen
                meta:
                  serija: default
                  slobodnih: 0
            nedozvoljen_prelaz_statusa:
              value:
                type: https://docs.uplaceno.rs/errors/nedozvoljen_prelaz_statusa
                title: Nedozvoljen prelaz statusa
                status: 409
                kod: nedozvoljen_prelaz_statusa
                detail: Profaktura ima uplatu i ne može biti otkazana.
                meta:
                  od: delimicno_placeno
                  do: otkazan
            ponovljen_idempotency_kljuc:
              value:
                type: https://docs.uplaceno.rs/errors/ponovljen_kljuc_idempotentnosti
                title: Idempotency-Key već korišćen sa drugim telom
                status: 409
                kod: ponovljen_kljuc_idempotentnosti
    PaymentRequired:
      description: "Limit paketa: `limit_paketa` (proforma i korisnici); ostalo:
        `dostignut_limit_organizacija`, `dostignut_limit_bankovnih_racuna`"
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/Problem"
          examples:
            limit_paketa_profaktura:
              value:
                type: https://docs.uplaceno.rs/errors/limit_paketa
                title: Limit paketa
                status: 402
                kod: limit_paketa
                detail: Dostigli ste mesečni limit profaktura za vaš paket.
                meta:
                  vrsta: profaktura
                  limit: 50
                  iskorisceno: 50
                  period: 2026-11
            limit_paketa_mesta:
              value:
                type: https://docs.uplaceno.rs/errors/limit_paketa
                title: Limit paketa
                status: 402
                kod: limit_paketa
                detail: Dostigli ste limit korisnika za vaš paket.
                meta:
                  vrsta: mesta
                  limit: 1
                  iskorisceno: 1
    Validation:
      description: Validation failed
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/Problem"
          example:
            type: https://docs.uplaceno.rs/errors/neispravni_podaci
            title: Neispravni podaci
            status: 422
            kod: neispravni_podaci
            greske:
              - polje: broj_racuna
                kod: neispravan_kontrolni_broj
                poruka: Kontrolni broj (mod 97) nije ispravan
    TooMany:
      description: Too many requests
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/Problem"
          example:
            type: https://docs.uplaceno.rs/errors/previse_zahteva
            title: Previše zahteva
            status: 429
            kod: previse_zahteva
            zahtev_id: req_0192e4a1c0de
      headers:
        Retry-After:
          schema:
            type: integer
          description: Sekunde
        RateLimit-Limit:
          $ref: "#/components/headers/RateLimit-Limit"
        RateLimit-Remaining:
          $ref: "#/components/headers/RateLimit-Remaining"
        RateLimit-Reset:
          $ref: "#/components/headers/RateLimit-Reset"
    TooLarge:
      description: File larger than 5 MB
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/Problem"
          example:
            type: https://docs.uplaceno.rs/errors/fajl_prevelik
            title: Fajl je prevelik
            status: 413
            kod: fajl_prevelik
            zahtev_id: req_0192e4a1c0de
    Unsupported:
      description: Fajl nije PDF
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/Problem"
          example:
            type: https://docs.uplaceno.rs/errors/nepodrzan_tip_fajla
            title: Dozvoljen je samo PDF
            status: 415
            kod: nepodrzan_tip_fajla
            zahtev_id: req_0192e4a1c0de
    Error:
      description: Unexpected error
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/Problem"
          example:
            type: https://docs.uplaceno.rs/errors/interna_greska
            title: Interna greška
            status: 500
            kod: interna_greska
            zahtev_id: req_0192e4a1c0de
    NisuIspunjeniPreduslovi:
      description: "`422 nisu_ispunjeni_preduslovi`; `meta.preduslovi` nosi
        neispunjene stavke"
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/Problem"
          example:
            type: https://docs.uplaceno.rs/errors/nisu_ispunjeni_preduslovi
            title: Nisu ispunjeni preduslovi
            status: 422
            detail: Pre aktivacije produkcije zavrsi sve obavezne korake.
            meta:
              preduslovi:
                - kljuc: test_profaktura_placena
                  proverava: sistem
                  status: nije_ispunjen
            zahtev_id: req_0192e4a1c0de
            kod: nisu_ispunjeni_preduslovi
    SamoSandbox:
      description: "`409 samo_sandbox`: radi samo sa sandbox kredencijalom
        (`okruzenje=sandbox`)"
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/Problem"
          example:
            type: https://docs.uplaceno.rs/errors/samo_sandbox
            title: Samo sandbox
            status: 409
            kod: samo_sandbox
            detail: Koristi upl_test_ kljuc ili sandbox token.
  schemas:
    Problem:
      type: object
      properties:
        type:
          type: string
          format: uri
          example: https://docs.uplaceno.rs/errors/dostignut_limit_plana
        title:
          type: string
          example: Dostignut mesečni limit profaktura
        status:
          type: integer
          example: 402
        error:
          type: object
          description: Short error shape (`code` = `kod`, `message` = `detail`) for simple
            clients.
          properties:
            code:
              type: string
            message:
              type: string
            details: {}
          required:
            - code
            - message
        kod:
          type: string
          enum:
            - neispravan_zahtev
            - neispravni_podaci
            - nije_prijavljen
            - neispravan_token
            - zabranjeno
            - nedovoljan_opseg
            - funkcija_nije_u_planu
            - organizacija_samo_za_citanje
            - nije_pronadjeno
            - konflikt
            - konflikt_verzije
            - ponovljen_kljuc_idempotentnosti
            - nedozvoljen_prelaz_statusa
            - opseg_brojeva_potrosen
            - limit_paketa
            - dostignut_limit_plana
            - dostignut_limit_mesta
            - dostignut_limit_organizacija
            - dostignut_limit_bankovnih_racuna
            - stopa_pdv_nije_dozvoljena
            - premasen_broj_pokusaja
            - duplikat_potvrde
            - izvod_vec_obradjen
            - profaktura_ne_postoji
            - nepodrzan_tip_fajla
            - fajl_prevelik
            - previse_zahteva
            - interna_greska
            - pogresni_podaci
            - neispravan_ili_istekao_token
            - email_nije_potvrdjen
            - email_zauzet
            - slaba_lozinka
            - uslovi_nisu_prihvaceni
            - neispravno_poreklo
            - turnstile_neuspesan
            - korak_ne_moze_biti_preskocen
            - nedozvoljen_redosled_koraka
            - korak_nije_ispunjen
            - nisu_ispunjeni_preduslovi
            - samo_sandbox
            - sablon_u_upotrebi
            - nevazeci_logo
            - dokument_jos_nije_izdat
            - nedostaju_podaci_pravnog_lica
          example: limit_paketa
          description: Kanonski kod greske (ASCII srpski, stabilan). Polja RFC 9457
            (`type`, `title`, `status`, `detail`, `instance`) ostaju na
            engleskom; `type` URL zavrsava istim kodom.
        detail:
          type: string
          example: Iskorišćeno 50 od 50 profaktura za period 2026-11.
        instance:
          type: string
          example: /v1/profakture/0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        zahtev_id:
          type: string
          example: req_0192e4a1c0de
        greske:
          type: array
          items:
            type: object
            properties:
              polje:
                type: string
                example: kupac.pib
              kod:
                type: string
                example: neispravan_format
              poruka:
                type: string
            required:
              - polje
              - kod
        meta:
          type: object
          additionalProperties: true
          example:
            limit: 50
            iskorisceno: 50
            period: 2026-11
      required:
        - type
        - title
        - status
        - kod
      description: RFC 9457 problem+json sa stabilnim `kod`
    Organizacija:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: organizacija
          readOnly: true
        sifra_organizacije:
          type: string
          pattern: ^\d{5}$
          example: "00042"
          description: Unique 5-digit code used in `poziv_na_broj`
          readOnly: true
        naziv:
          type: string
          example: Lizzard Solutions DOO
        pib:
          type: string
          pattern: ^\d{9}$
          example: "112233445"
        maticni_broj:
          type: string
          pattern: ^\d{8}$
          example: "21876543"
        adresa:
          $ref: "#/components/schemas/Adresa"
        u_sistemu_pdv:
          type: boolean
          example: true
          description: Whether the organization is VAT-registered (`u_sistemu_pdv`)
        email:
          type: string
          format: email
        telefon:
          type:
            - string
            - "null"
          minLength: 6
          maxLength: 20
          pattern: ^[\d+\s\-/()]+$
          description: Opcioni kontakt telefon vlasnika za podršku; nije deo registracije.
          example: +381 61 123 4567
        email_za_prijem:
          type:
            - string
            - "null"
          format: email
          readOnly: true
          description: System address where banks send statements and PDF payment proofs.
            System-generated; clients cannot change it. Missing until a
            `adrese_za_prijem` row exists (live environment).
          example: primerprodavnica.100000008@uplaceno.rs
        logo_url:
          type:
            - string
            - "null"
          format: uri
        vlasnik_korisnik_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        status:
          type: string
          enum:
            - aktivan
            - samo_citanje
          readOnly: true
        limit_mesta:
          type: integer
          example: 1
          readOnly: true
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
        tekuci_racun:
          type: string
          pattern: ^\d{18}$
          description: Tekuci racun za IPS QR, 18 cifara bez crtica (3 banka + 13 broj + 2
            kontrolni mod 97)
          example: "160000000012345678"
        u_produkciji:
          type: boolean
          readOnly: true
          description: true posle POST /v1/onboarding/produkcija/aktivacija
        produkcija_aktivirana:
          type:
            - string
            - "null"
          format: date-time
          readOnly: true
        poreski_status:
          $ref: "#/components/schemas/PoreskiStatus"
        u_fiskalizaciji:
          type: boolean
          default: false
          x-privremeno: true
          description: organization je u sistemu fiskalizacije (ESIR/PFR). Za pausalca
            dodaje `fiskalni_racun` uz `pdf_racun`; PDV obveznik izdaje fiskalni
            racun fizickim licima nezavisno od ovog polja.
        rok_cuvanja:
          $ref: "#/components/schemas/RokCuvanja"
          default: 10_godina
          description: How long we keep statement PDFs and business records before
            deletion/anonymization. Owner only.
      required:
        - id
        - objekat
        - sifra_organizacije
        - naziv
        - status
        - kreirano
    RokCuvanja:
      type: string
      enum:
        - 1_godina
        - 3_godina
        - 5_godina
        - 10_godina
        - po_dogovoru
      description: Business data retention period. `po_dogovoru` is legacy (no
        automatic purge). Default `10_godina`.
      example: 10_godina
    OrganizacijaLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/Organizacija"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    Adresa:
      type: object
      properties:
        ulica:
          type: string
          example: Bulevar oslobođenja 1
        grad:
          type: string
          example: Novi Sad
        postanski_broj:
          type: string
          example: "21000"
        drzava:
          type: string
          default: RS
          example: RS
      required:
        - ulica
        - grad
    OrganizacijaKreiranje:
      type: object
      properties:
        naziv:
          type: string
        pib:
          type: string
          pattern: ^\d{9}$
        maticni_broj:
          type: string
          pattern: ^\d{8}$
        adresa:
          $ref: "#/components/schemas/Adresa"
        email:
          type: string
          format: email
        u_sistemu_pdv:
          type: boolean
        tekuci_racun:
          type: string
          pattern: ^\d{18}$
          description: Tekuci racun za IPS QR, 18 cifara bez crtica (3 banka + 13 broj + 2
            kontrolni mod 97)
          example: "160000000012345678"
        poreski_status:
          $ref: "#/components/schemas/PoreskiStatus"
        u_fiskalizaciji:
          type: boolean
          default: false
          x-privremeno: true
          description: organization je u sistemu fiskalizacije (ESIR/PFR). Za pausalca
            dodaje `fiskalni_racun` uz `pdf_racun`; PDV obveznik izdaje fiskalni
            racun fizickim licima nezavisno od ovog polja.
      required:
        - naziv
        - pib
        - adresa
        - u_sistemu_pdv
    OrganizacijaIzmena:
      type: object
      properties:
        u_sistemu_pdv:
          type: boolean
          description: Promena vazi samo za nove proformas
        naziv:
          type: string
        adresa:
          $ref: "#/components/schemas/Adresa"
        email:
          type: string
          format: email
        telefon:
          type:
            - string
            - "null"
          minLength: 6
          maxLength: 20
          pattern: ^[\d+\s\-/()]+$
          description: Opcioni kontakt telefon vlasnika za podršku. Prazno briše vrednost.
            Dozvoljeni znakovi +, cifre, razmaci, -, /, ( ).
          example: +381 61 123 4567
        logo_url:
          type:
            - string
            - "null"
          format: uri
        tekuci_racun:
          type: string
          pattern: ^\d{18}$
          description: Tekuci racun za IPS QR, 18 cifara bez crtica (3 banka + 13 broj + 2
            kontrolni mod 97)
          example: "160000000012345678"
        pib:
          type: string
          pattern: ^\d{9}$
          description: Can be changed only until the organization is activated for
            production (then `409 nedozvoljen_prelaz_statusa`)
        maticni_broj:
          type: string
          pattern: ^\d{8}$
          description: Can be changed only until the organization is activated for
            production (then `409 nedozvoljen_prelaz_statusa`)
        poreski_status:
          $ref: "#/components/schemas/PoreskiStatus"
        u_fiskalizaciji:
          type: boolean
          default: false
          x-privremeno: true
          description: organization je u sistemu fiskalizacije (ESIR/PFR). Za pausalca
            dodaje `fiskalni_racun` uz `pdf_racun`; PDV obveznik izdaje fiskalni
            racun fizickim licima nezavisno od ovog polja.
        rok_cuvanja:
          $ref: "#/components/schemas/RokCuvanja"
          description: Menja samo vlasnik organization (`403 zabranjeno` za ostale uloge).
            Upisuje se u audit `organization.izmenjena`.
    Clan:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: clan
          readOnly: true
        korisnik_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        email:
          type: string
          format: email
        naziv:
          type: string
        uloga_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        kljuc_uloge:
          type: string
          enum:
            - vlasnik
            - administrator
            - knjigovodja
            - posmatrac
          description: "MVP: built-in roles only"
        status:
          type: string
          enum:
            - aktivan
            - suspendovan
        pridruzen:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - korisnik_id
        - uloga_id
        - status
        - kreirano
    ClanLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/Clan"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    ClanIzmena:
      type: object
      properties:
        uloga_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        status:
          type: string
          enum:
            - aktivan
            - suspendovan
    Pozivnica:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: pozivnica
          readOnly: true
        email:
          type: string
          format: email
          example: knjigovodja@primer.rs
        uloga_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        status:
          type: string
          enum:
            - na_cekanju
            - prihvacena
            - opozvana
            - istekla
          readOnly: true
        istice:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
        pozvao:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - email
        - uloga_id
        - status
        - istice
        - kreirano
    PozivnicaLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/Pozivnica"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    PozivnicaKreiranje:
      type: object
      properties:
        email:
          type: string
          format: email
        uloga_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - email
        - uloga_id
    Uloga:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: uloga
          readOnly: true
        kljuc:
          type: string
          example: knjigovodja
        naziv:
          type: string
          example: Knjigovođa
        ugradjena:
          type: boolean
        zamrznuta:
          type: boolean
        dozvole:
          type: array
          items:
            type: string
          example:
            - profakture:citanje
            - uplate:citanje
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - kljuc
        - naziv
        - ugradjena
        - dozvole
        - kreirano
    UlogaLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/Uloga"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    Dozvola:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: dozvola
          readOnly: true
        kljuc:
          type: string
          example: profakture:otkazivanje
        opis:
          type: string
        minimalni_plan:
          type: string
          enum:
            - osnovni
            - srednji
            - napredni
        oauth_opsezi:
          type: array
          items:
            type: string
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - kljuc
        - minimalni_plan
        - oauth_opsezi
        - kreirano
    DozvolaLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/Dozvola"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    ApiKljuc:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: api_kljuc
          readOnly: true
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
          description: Determined solely from the key/token
        naziv:
          type: string
          example: WooCommerce prodavnica
        prefiks:
          type: string
          example: upl_test_7Hk2
          readOnly: true
        opsezi:
          type: array
          items:
            type: string
            enum:
              - organizacije:citanje
              - organizacije:pisanje
              - clanovi:citanje
              - clanovi:pisanje
              - uloge:citanje
              - api_kljucevi:pisanje
              - audit:citanje
              - naplata:citanje
              - banka:citanje
              - banka:pisanje
              - kupci:citanje
              - kupci:pisanje
              - proizvodi:citanje
              - proizvodi:pisanje
              - zahtevi_za_placanje:pisanje
              - profakture:citanje
              - profakture:pisanje
              - uplate:citanje
              - uplate:pisanje
              - potvrde:citanje
              - potvrde:pisanje
              - uparivanje:pisanje
              - prijem:pisanje
        poslednje_korisceno:
          type:
            - string
            - "null"
          format: date-time
          readOnly: true
        istice:
          type:
            - string
            - "null"
          format: date-time
        opozvano:
          type:
            - string
            - "null"
          format: date-time
          readOnly: true
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - naziv
        - prefiks
        - opsezi
        - kreirano
    ApiKljucLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/ApiKljuc"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    ApiKljucKreiranje:
      type: object
      properties:
        naziv:
          type: string
        opsezi:
          type: array
          minItems: 1
          items:
            type: string
            enum:
              - organizacije:citanje
              - organizacije:pisanje
              - clanovi:citanje
              - clanovi:pisanje
              - uloge:citanje
              - api_kljucevi:pisanje
              - audit:citanje
              - naplata:citanje
              - banka:citanje
              - banka:pisanje
              - kupci:citanje
              - kupci:pisanje
              - proizvodi:citanje
              - proizvodi:pisanje
              - zahtevi_za_placanje:pisanje
              - profakture:citanje
              - profakture:pisanje
              - uplate:citanje
              - uplate:pisanje
              - potvrde:citanje
              - potvrde:pisanje
              - uparivanje:pisanje
              - prijem:pisanje
        istice:
          type:
            - string
            - "null"
          format: date-time
      required:
        - naziv
        - opsezi
      description: Key environment (`upl_test_`/`upl_live_`) = credential environment
        used for the call; scopes cannot exceed caller permissions.
    ApiKljucSaTajnom:
      allOf:
        - $ref: "#/components/schemas/ApiKljuc"
        - type: object
          properties:
            tajna:
              type: string
              readOnly: true
              description: Prikazuje se SAMO jednom
              example: upl_test_7Hk2Q9xR4vLmN8pT3sW6yZ1aB5cD
          required:
            - tajna
    Plan:
      type: object
      properties:
        objekat:
          type: string
          const: plan
        sifra_plana:
          type: string
          enum:
            - osnovni
            - srednji
            - napredni
          example: osnovni
        status:
          type: string
          enum:
            - aktivan
            - docnja
            - otkazan
        limit_organizacija:
          type: integer
          example: 1
        iskorisceno_organizacija:
          type: integer
          example: 1
        mesta_po_organizaciji:
          type: integer
          example: 1
        profaktura_mesecno:
          type:
            - integer
            - "null"
          description: "`null` means unlimited"
          example: 50
        bankovnih_racuna_po_organizaciji:
          type:
            - integer
            - "null"
          example: 1
        funkcije:
          type: array
          items:
            type: string
          example:
            - profakture
            - ips_qr
            - uparivanje_mejlom
            - potvrde_uplate
            - sandbox
        pocetak_perioda:
          type: string
          format: date
          example: 2026-11-15
        kraj_perioda:
          type: string
          format: date
          example: 2026-11-15
      required:
        - sifra_plana
        - limit_organizacija
        - mesta_po_organizaciji
        - funkcije
      description: Plan belongs to the owner (`user_plans`); limits apply across all
        their organizations
    Mesta:
      type: object
      properties:
        objekat:
          type: string
          const: mesta
        limit:
          type: integer
          example: 1
        aktivni_clanovi:
          type: integer
          example: 1
        pozivnice_na_cekanju:
          type: integer
          example: 0
        slobodno:
          type: integer
          example: 0
      required:
        - limit
        - aktivni_clanovi
        - pozivnice_na_cekanju
        - slobodno
    Potrosnja:
      type: object
      properties:
        objekat:
          type: string
          const: potrosnja
        period:
          type: string
          pattern: ^\d{4}-\d{2}$
          example: 2026-11
        izdato_profaktura:
          type: integer
          example: 37
        limit_profaktura:
          type:
            - integer
            - "null"
          description: "`null` means unlimited"
          example: 50
        procenat:
          type: number
          example: 74
        upozorenje:
          type: boolean
          description: true na ≥80%
        po_organizaciji:
          type: array
          items:
            type: object
            properties:
              organizacija_id:
                type: string
                format: uuid
                description: UUID v7
                example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
              izdato_profaktura:
                type: integer
        sandbox:
          type: object
          properties:
            izdato_profaktura:
              type: integer
            meki_limit:
              type: integer
              example: 1000
      required:
        - period
        - izdato_profaktura
        - limit_profaktura
    BankovniRacun:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: bankovni_racun
          readOnly: true
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
          description: Determined solely from the key/token
        broj_racuna:
          type: string
          pattern: ^\d{18}$
          description: 18 digits, mod-97 validated
          example: "160000000012345678"
        naziv_banke:
          type: string
          example: Banca Intesa
          readOnly: true
        oznaka:
          type: string
        podrazumevani:
          type: boolean
        status:
          type: string
          enum:
            - aktivan
            - arhiviran
          readOnly: true
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - broj_racuna
        - podrazumevani
        - kreirano
    BankovniRacunLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/BankovniRacun"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    BankovniRacunKreiranje:
      type: object
      properties:
        broj_racuna:
          type: string
          pattern: ^\d{3}-?\d{1,13}-?\d{2}$
          description: Prihvata i format sa crticama; normalizuje se na 18 cifara
        oznaka:
          type: string
        podrazumevani:
          type: boolean
          default: true
      required:
        - broj_racuna
    BankovniRacunIzmena:
      type: object
      properties:
        oznaka:
          type: string
        podrazumevani:
          type: boolean
    Kupac:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: kupac
          readOnly: true
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
          description: Determined solely from the key/token
        tip:
          type: string
          enum:
            - fizicko_lice
            - pravno_lice
          deprecated: true
          description: "Zastarelo (1.4.2): isto kao `tip_kupca`; server prihvata oba"
        naziv:
          type: string
          example: Petar Petrović
        email:
          type:
            - string
            - "null"
          format: email
          example: petar@primer.rs
        telefon:
          type:
            - string
            - "null"
        pib:
          type:
            - string
            - "null"
          pattern: ^\d{9}$
        maticni_broj:
          type:
            - string
            - "null"
          pattern: ^\d{8}$
        jbkjs:
          type:
            - string
            - "null"
          maxLength: 32
          description: JBKJS (javni sektor); ako postoji, SEF salje sa sendToCir=Yes
          example: "12345"
        adresa:
          oneOf:
            - $ref: "#/components/schemas/Adresa"
            - type: "null"
        eksterna_oznaka:
          type:
            - string
            - "null"
          maxLength: 128
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
        tip_kupca:
          $ref: "#/components/schemas/TipKupca"
      required:
        - id
        - objekat
        - naziv
        - kreirano
        - tip_kupca
      if:
        properties:
          tip_kupca:
            const: pravno_lice
        required:
          - tip_kupca
      then:
        required:
          - pib
          - maticni_broj
        properties:
          pib:
            type: string
            pattern: ^\d{9}$
          maticni_broj:
            type: string
            pattern: ^\d{8}$
        additionalProperties: true
      x-privremeno: true
    KupacLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/Kupac"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    KupacKreiranje:
      type: object
      properties:
        tip:
          type: string
          enum:
            - fizicko_lice
            - pravno_lice
          deprecated: true
          description: "Zastarelo (1.4.2): isto kao `tip_kupca`; server prihvata oba"
        naziv:
          type: string
          example: Petar Petrović
        email:
          type:
            - string
            - "null"
          format: email
          example: petar@primer.rs
        telefon:
          type:
            - string
            - "null"
        pib:
          type:
            - string
            - "null"
          pattern: ^\d{9}$
        maticni_broj:
          type:
            - string
            - "null"
          pattern: ^\d{8}$
        jbkjs:
          type:
            - string
            - "null"
          maxLength: 32
          description: JBKJS (javni sektor); ako postoji, SEF salje sa sendToCir=Yes
          example: "12345"
        adresa:
          oneOf:
            - $ref: "#/components/schemas/Adresa"
            - type: "null"
        eksterna_oznaka:
          type:
            - string
            - "null"
          maxLength: 128
        tip_kupca:
          $ref: "#/components/schemas/TipKupca"
      required:
        - naziv
        - tip_kupca
      if:
        properties:
          tip_kupca:
            const: pravno_lice
        required:
          - tip_kupca
      then:
        required:
          - pib
          - maticni_broj
        properties:
          pib:
            type: string
            pattern: ^\d{9}$
          maticni_broj:
            type: string
            pattern: ^\d{8}$
        additionalProperties: true
      x-privremeno: true
      example:
        tip_kupca: pravno_lice
        naziv: Kupac DOO
        pib: "101234567"
        maticni_broj: "21876543"
        email: kupac@primer.rs
    KupacIzmena:
      type: object
      properties:
        tip:
          type: string
          enum:
            - fizicko_lice
            - pravno_lice
          deprecated: true
          description: "Zastarelo (1.4.2): isto kao `tip_kupca`; server prihvata oba"
        naziv:
          type: string
          example: Petar Petrović
        email:
          type:
            - string
            - "null"
          format: email
          example: petar@primer.rs
        telefon:
          type:
            - string
            - "null"
        pib:
          type:
            - string
            - "null"
          pattern: ^\d{9}$
        maticni_broj:
          type:
            - string
            - "null"
          pattern: ^\d{8}$
        adresa:
          oneOf:
            - $ref: "#/components/schemas/Adresa"
            - type: "null"
        eksterna_oznaka:
          type:
            - string
            - "null"
          maxLength: 128
        tip_kupca:
          $ref: "#/components/schemas/TipKupca"
    Proizvod:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: proizvod
          readOnly: true
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
          description: Determined solely from the key/token
        naziv:
          type: string
          example: Izrada sajta
        sifra_artikla:
          type:
            - string
            - "null"
        jedinica_mere:
          type: string
          example: kom
        jedinicna_cena:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
        stopa_pdv:
          type:
            - string
            - "null"
          enum:
            - "10"
            - "20"
            - null
          description: Stopa PDV-a u %. Ako organization ima u_sistemu_pdv=true, obavezno
            10 ili 20; ako je false, mora biti null (bez PDV-a), inace 422
            vat_rate_not_allowed.
        aktivan:
          type: boolean
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - naziv
        - jedinica_mere
        - jedinicna_cena
        - stopa_pdv
        - kreirano
    ProizvodLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/Proizvod"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    ProizvodKreiranje:
      type: object
      properties:
        naziv:
          type: string
          example: Izrada sajta
        sifra_artikla:
          type:
            - string
            - "null"
        jedinica_mere:
          type: string
          example: kom
        jedinicna_cena:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
        stopa_pdv:
          type:
            - string
            - "null"
          enum:
            - "10"
            - "20"
            - null
          description: Stopa PDV-a u %. Ako organization ima u_sistemu_pdv=true, obavezno
            10 ili 20; ako je false, mora biti null (bez PDV-a), inace 422
            vat_rate_not_allowed.
      required:
        - naziv
        - jedinicna_cena
    ProizvodIzmena:
      type: object
      properties:
        naziv:
          type: string
          example: Izrada sajta
        sifra_artikla:
          type:
            - string
            - "null"
        jedinica_mere:
          type: string
          example: kom
        jedinicna_cena:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
        stopa_pdv:
          type:
            - string
            - "null"
          enum:
            - "10"
            - "20"
            - null
          description: Stopa PDV-a u %. Ako organization ima u_sistemu_pdv=true, obavezno
            10 ili 20; ako je false, mora biti null (bez PDV-a), inace 422
            vat_rate_not_allowed.
        aktivan:
          type: boolean
    StavkaUnos:
      type: object
      properties:
        proizvod_id:
          type:
            - string
            - "null"
          format: uuid
        opis:
          type: string
          example: Izrada sajta
        kolicina:
          type: string
          pattern: ^\d+(\.\d{1,3})?$
          example: "1"
        jedinica_mere:
          type: string
          example: kom
        jedinicna_cena:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
        stopa_pdv:
          type:
            - string
            - "null"
          enum:
            - "10"
            - "20"
            - null
          description: Stopa PDV-a u %. Ako organization ima u_sistemu_pdv=true, obavezno
            10 ili 20; ako je false, mora biti null (bez PDV-a), inace 422
            vat_rate_not_allowed.
        popust_procenat:
          type: string
          pattern: ^\d{1,2}(\.\d{1,2})?$
          default: "0"
      required:
        - kolicina
      description: If `product_id` is set, unspecified fields are taken from the product
    Stavka:
      allOf:
        - type: object
          properties:
            id:
              type: string
              format: uuid
              description: UUID v7
              example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
              readOnly: true
            objekat:
              type: string
              const: stavka_profakture
            redni_broj:
              type: integer
            ukupno_stavka:
              type: string
              pattern: ^\d{1,13}\.\d{2}$
              description: Amount in RSD as a decimal string with 2 fraction digits; currency
                is always RSD (no currency field)
              example: "12000.00"
              readOnly: true
            iznos_pdv:
              type: string
              pattern: ^\d{1,13}\.\d{2}$
              description: Amount in RSD as a decimal string with 2 fraction digits; currency
                is always RSD (no currency field)
              example: "12000.00"
              readOnly: true
          required:
            - id
            - redni_broj
            - ukupno_stavka
        - $ref: "#/components/schemas/StavkaUnos"
    StavkaLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/Stavka"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    StavkaIzmena:
      type: object
      properties:
        proizvod_id:
          type:
            - string
            - "null"
          format: uuid
        opis:
          type: string
          example: Izrada sajta
        kolicina:
          type: string
          pattern: ^\d+(\.\d{1,3})?$
          example: "1"
        jedinica_mere:
          type: string
          example: kom
        jedinicna_cena:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
        stopa_pdv:
          type:
            - string
            - "null"
          enum:
            - "10"
            - "20"
            - null
          description: Stopa PDV-a u %. Ako organization ima u_sistemu_pdv=true, obavezno
            10 ili 20; ako je false, mora biti null (bez PDV-a), inace 422
            vat_rate_not_allowed.
        popust_procenat:
          type: string
          pattern: ^\d{1,2}(\.\d{1,2})?$
          default: "0"
    ZahtevZaPlacanje:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: zahtev_za_placanje
          readOnly: true
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
          description: Determined solely from the key/token
        izvor:
          type: string
          enum:
            - api
            - plugin
            - link
            - kontrolna_tabla
            - pretplata
        eksterna_oznaka:
          type:
            - string
            - "null"
          maxLength: 128
          example: WC-ORDER-1043
        kupac_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        iznos:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
          readOnly: true
        status:
          type: string
          enum:
            - otvoren
            - delimicno_placeno
            - placeno
            - istekla
            - otkazan
          readOnly: true
        profaktura_id:
          type: string
          format: uuid
          description: UUID v7 – automatski izdata proforma
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        profaktura:
          $ref: "#/components/schemas/Profaktura"
          readOnly: true
        metapodaci:
          $ref: "#/components/schemas/Metapodaci"
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - izvor
        - kupac_id
        - iznos
        - status
        - profaktura_id
        - kreirano
    ZahtevZaPlacanjeLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/ZahtevZaPlacanje"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    Metapodaci:
      type: object
      maxProperties: 20
      additionalProperties:
        type: string
        maxLength: 500
      example:
        porudzbina_id: "1043"
    ZahtevZaPlacanjeKreiranje:
      type: object
      properties:
        kupac_id:
          type: string
          format: uuid
          description: Existing customer (or inline `kupac`)
        kupac:
          $ref: "#/components/schemas/KupacKreiranje"
        stavke:
          type: array
          minItems: 1
          maxItems: 200
          items:
            $ref: "#/components/schemas/StavkaUnos"
        bankovni_racun_id:
          type: string
          format: uuid
          description: "Default: default bank account"
        eksterna_oznaka:
          type: string
          maxLength: 128
        vazi_do:
          type: string
          format: date
          example: 2026-11-15
        rok_placanja:
          type: string
          format: date
          example: 2026-11-15
        napomena:
          type: string
          maxLength: 2000
        posalji_mejl:
          type: boolean
          default: true
          description: Automatically emails the customer with the /pay link
        metapodaci:
          $ref: "#/components/schemas/Metapodaci"
      required:
        - stavke
      description: POST automatski izdaje proformas (status `izdata`, broj, poziv na
        broj, PDF i QR asinhrono).
      examples:
        - kupac:
            tip_kupca: fizicko_lice
            naziv: Petar Petrović
            email: petar@primer.rs
          stavke:
            - opis: Izrada sajta
              kolicina: "1"
              jedinicna_cena: "12000.00"
              stopa_pdv: "20"
          eksterna_oznaka: WC-ORDER-1043
          vazi_do: 2026-11-15
          rok_placanja: 2026-11-15
    ZahtevZaPlacanjeIzmena:
      type: object
      properties:
        eksterna_oznaka:
          type: string
        metapodaci:
          $ref: "#/components/schemas/Metapodaci"
      description: Iznos/stavke se menjaju preko stavki proformas (nova verzija)
    Profaktura:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: profaktura
          readOnly: true
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
          description: Determined solely from the key/token
        zahtev_za_placanje_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj:
          type: string
          pattern: ^\d{4}$
          example: "0123"
          readOnly: true
        oznaka_broja:
          type: string
          example: PF-0123/2026
          readOnly: true
        godina:
          type: integer
          example: 2026
          readOnly: true
        ciklus:
          type: integer
          minimum: 0
          maximum: 99
          example: 1
          readOnly: true
        verzija:
          type: integer
          example: 1
          readOnly: true
        kupac_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        bankovni_racun_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        iznos:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
          readOnly: true
        osnovica:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
          readOnly: true
        ukupan_pdv:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
          readOnly: true
        placeno_iznos:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
          readOnly: true
        poziv_na_broj:
          $ref: "#/components/schemas/PozivNaBroj"
          readOnly: true
        datum_izdavanja:
          type: string
          format: date
          example: 2026-11-15
        vazi_do:
          type: string
          format: date
          example: 2026-11-15
        rok_placanja:
          type: string
          format: date
          example: 2026-11-15
        status:
          type: string
          enum:
            - nacrt
            - izdata
            - poslata
            - pregledana
            - privremeno_placena
            - delimicno_placeno
            - placeno
            - preplacena
            - konvertovana
            - istekla
            - otkazan
          description: converted se ne javlja u Osnovnom planu
          readOnly: true
        privremeno_placeno_do:
          type:
            - string
            - "null"
          format: date-time
          readOnly: true
        url_placanja:
          type: string
          format: uri
          example: https://pay.uplaceno.rs/pay/pt_Xk29aQ
          readOnly: true
        status_pdf:
          type: string
          enum:
            - na_cekanju
            - spreman
            - neuspesan
          readOnly: true
        poslato:
          type:
            - string
            - "null"
          format: date-time
          readOnly: true
        pregledano:
          type:
            - string
            - "null"
          format: date-time
          readOnly: true
        stavke:
          type: array
          items:
            $ref: "#/components/schemas/Stavka"
        napomena:
          type:
            - string
            - "null"
        napomena_pdv:
          type:
            - string
            - "null"
          example: Obveznik nije u sistemu PDV-a.
          description: Popunjeno kad organization nije u sistemu PDV-a; stampa se na
            proformas
          readOnly: true
        verzija_reda:
          type: integer
          description: For optimistic locking (`If-Match`)
          readOnly: true
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
        poreska_isprava:
          type: boolean
          const: false
          readOnly: true
          x-privremeno: true
          description: Predracun nikad nije poreska isprava; napomena `Ovo nije poreska
            isprava` je uvek na dokumentu.
        naslov_dokumenta:
          type: string
          enum:
            - Predracun
            - Zahtev za placanje
          default: Predracun
          x-privremeno: true
        racun_id:
          type:
            - string
            - "null"
          format: uuid
          readOnly: true
          x-privremeno: true
          description: Popunjava se kad je racun izdat posle uparene uplate
        tip_kupca:
          $ref: "#/components/schemas/TipKupca"
        nacini_izdavanja:
          type: array
          items:
            $ref: "#/components/schemas/NacinIzdavanja"
          readOnly: true
          x-privremeno: true
          example:
            - e_faktura_sef
          description: >+
            Izveden, klijent ga ne salje.


            | organization | Kupac (`tip_kupca`) | `nacini_izdavanja` |

            |---|---|---|

            | pdv_obveznik | pravno_lice | e_faktura_sef |

            | pdv_obveznik | fizicko_lice | fiskalni_racun |

            | pausalac, `u_fiskalizaciji=false` | bilo koji | pdf_racun |

            | pausalac, `u_fiskalizaciji=true` | bilo koji | pdf_racun,
            fiskalni_racun |

      required:
        - id
        - objekat
        - broj
        - verzija
        - iznos
        - placeno_iznos
        - poziv_na_broj
        - status
        - url_placanja
        - kreirano
      description: >-
        **Issuing rule**: invoice/tax document is issued ONLY AFTER a matched
        payment. Pre uplate postoji samo proforma (`predracun`) (profaktura,
        naslov `Predracun` ili `Zahtev za placanje`) koji NOT a tax document i
        nosi napomenu `Ovo nije poreska isprava`. Issuing method is DERIVED
        (client does not send it) iz `poreski_status` i `u_fiskalizaciji`
        organizacije i `tip_kupca`:


        | Organization | Customer (`tip_kupca`) | `nacini_izdavanja` |

        |---|---|---|

        | pdv_obveznik | pravno_lice | e_faktura_sef |

        | pdv_obveznik | fizicko_lice | fiskalni_racun |

        | pausalac, `u_fiskalizaciji=false` | bilo koji | pdf_racun |

        | pausalac, `u_fiskalizaciji=true` | bilo koji | pdf_racun,
        fiskalni_racun |
    ProfakturaLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/Profaktura"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    PozivNaBroj:
      type: object
      properties:
        model:
          type: string
          const: "97"
        vrednost:
          type: string
          pattern: ^\d{13}$
          example: "4800042012301"
          description: KK + osnova(org_code 5 + broj 4 + ciklus 2)
        kontrolni_broj:
          type: string
          pattern: ^\d{2}$
          example: "48"
        ips_oznaka:
          type: string
          example: RO:974800042012301
      required:
        - model
        - vrednost
        - kontrolni_broj
    ProfakturaIzmena:
      type: object
      properties:
        kupac_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        bankovni_racun_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        vazi_do:
          type: string
          format: date
          example: 2026-11-15
        rok_placanja:
          type: string
          format: date
          example: 2026-11-15
        napomena:
          type:
            - string
            - "null"
        tip_kupca:
          $ref: "#/components/schemas/TipKupca"
        kupac:
          $ref: "#/components/schemas/KupacKreiranje"
      description: PDF-affecting change creates a new version; does not change number
        or `poziv_na_broj`. Provisional (1.4.2), pending confirmation.
        `tip_kupca` required on update (server re-derives `nacini_izdavanja`).
      required:
        - tip_kupca
      x-privremeno: true
    ProfakturaOtkazivanje:
      type: object
      properties:
        razlog:
          type: string
          maxLength: 500
    ProfakturaSlanje:
      type: object
      properties:
        do:
          type: string
          format: email
          description: "Podrazumevano: mejl kupca"
        kopija:
          type: array
          items:
            type: string
            format: email
          maxItems: 5
    ProfakturaPonovnoIzdavanje:
      type: object
      properties:
        vazi_do:
          type: string
          format: date
          example: 2026-11-15
        rok_placanja:
          type: string
          format: date
          example: 2026-11-15
        posalji_mejl:
          type: boolean
          default: true
      description: "Za expired/cancelled bez uplata: nova proforma (novi broj/ciklus),
        stara ostaje za audit"
    VerzijaProfakture:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: verzija_profakture
          readOnly: true
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
          description: Determined solely from the key/token
        profaktura_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        verzija:
          type: integer
        iznos:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
        stavke:
          type: array
          items:
            $ref: "#/components/schemas/Stavka"
        pdf_url:
          type:
            - string
            - "null"
          format: uri
        razlog:
          type: string
          enum:
            - izdata
            - izmenjene_stavke
            - izmenjeni_podaci
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - verzija
        - iznos
        - kreirano
    VerzijaProfaktureLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/VerzijaProfakture"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    Numeracija:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: numeracija
          readOnly: true
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
          description: Determined solely from the key/token
        serija:
          type: string
          example: default
        prefiks:
          type: string
          maxLength: 8
          example: PF-
        pocetni_broj:
          type: integer
          minimum: 1
          maximum: 9999
          example: 1
        najveci_dodeljeni:
          type: integer
          example: 123
          readOnly: true
        slobodnih:
          type:
            - integer
            - "null"
          description: "`null` means unlimited (not a single 0001–9999 range)"
          example: 2
          readOnly: true
        iskoriscenih:
          type: integer
          readOnly: true
        upozorenje_popunjenosti:
          type: boolean
          description: ≥90% opsega
          readOnly: true
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - serija
        - prefiks
        - pocetni_broj
        - najveci_dodeljeni
        - kreirano
    NumeracijaLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/Numeracija"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    NumeracijaIzmena:
      type: object
      properties:
        prefiks:
          type: string
          maxLength: 8
        pocetni_broj:
          type: integer
          minimum: 1
          maximum: 9999
          description: Allowed only before the first issued proforma in the sequence
    Uplata:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: uplata
          readOnly: true
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
          description: Determined solely from the key/token
        izvor:
          type: string
          enum:
            - email
            - rucno
            - sandbox
          readOnly: true
        bankovni_racun_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        iznos:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
        proknjizeno:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
        platilac:
          type:
            - string
            - "null"
          example: PETAR PETROVIC
        racun_platioca:
          type:
            - string
            - "null"
        model_poziva:
          type:
            - string
            - "null"
          example: "97"
        poziv_na_broj:
          type:
            - string
            - "null"
          example: "4800042012301"
        poziv_ispravan:
          type:
            - boolean
            - "null"
          readOnly: true
        svrha:
          type:
            - string
            - "null"
        bankovna_transakcija_id:
          type:
            - string
            - "null"
        upareni_iznos:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
          readOnly: true
        status:
          type: string
          enum:
            - primljena
            - uparena
            - delimicno_uparena
            - neuparena
            - zanemarena
          readOnly: true
        napomena:
          type:
            - string
            - "null"
        dolazni_mejl_id:
          type:
            - string
            - "null"
          format: uuid
          readOnly: true
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - izvor
        - iznos
        - proknjizeno
        - status
        - kreirano
    UplataLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/Uplata"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    UplataKreiranje:
      type: object
      properties:
        bankovni_racun_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        iznos:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
        proknjizeno:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
        platilac:
          type: string
        model_poziva:
          type: string
        poziv_na_broj:
          type: string
        svrha:
          type: string
        profaktura_id:
          type: string
          format: uuid
          description: When set, immediately creates a manual match
        napomena:
          type: string
      required:
        - bankovni_racun_id
        - iznos
        - proknjizeno
      description: Manual payment entry (e.g. cash or bank without email notification)
    UplataIzmena:
      type: object
      properties:
        napomena:
          type:
            - string
            - "null"
        status:
          type: string
          enum:
            - zanemarena
          description: Samo unmatched → ignored
    PotvrdaUplate:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: potvrda_uplate
          readOnly: true
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
          description: Determined solely from the key/token
        profaktura_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        sha256:
          type: string
          pattern: ^[a-f0-9]{64}$
          readOnly: true
        velicina_fajla:
          type: integer
          readOnly: true
        izvuceno:
          type: object
          properties:
            poziv_na_broj:
              type:
                - string
                - "null"
            iznos:
              type:
                - string
                - "null"
            racun_primaoca:
              type:
                - string
                - "null"
            datum_uplate:
              type:
                - string
                - "null"
          readOnly: true
        provere:
          type: object
          properties:
            poziv_se_poklapa:
              type: boolean
            iznos_se_poklapa:
              type: boolean
            racun_se_poklapa:
              type: boolean
          readOnly: true
        ocena:
          type: number
          minimum: 0
          maximum: 1
          readOnly: true
        status:
          type: string
          enum:
            - otpremljena
            - u_proveri
            - prihvacena
            - odbijena
            - istekla
            - potvrdjena
          readOnly: true
        istice:
          type:
            - string
            - "null"
          format: date-time
          readOnly: true
        odlucio:
          type:
            - string
            - "null"
          format: uuid
          readOnly: true
        razlog_odbijanja:
          type:
            - string
            - "null"
        url_preuzimanja:
          type: string
          format: uri
          description: Potpisan R2 URL, 5 min
          readOnly: true
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - profaktura_id
        - status
        - kreirano
      description: PDF potvrda o uplati se NE proverava na digitalni potpis.
        Otpremanje validne PDF potvrde (PDF, do 5 MB, Turnstile) odmah daje
        proformas PRIVREMENI status placeno (`privremeno_placena`,
        `privremeno_placeno_do`) dok se uplata iz banke ne upari. Kad se uplata
        upari, status postaje `placena` i tek tada se izdaje racun; ako se
        uplata ne upari do `privremeno_placeno_do`, privremeni status istice i
        proforma se vraca u prethodni status. Prodavac moze rucno da odbije
        potvrdu (`/odbij`). Privremeni status NIJE dokaz uplate i ne izdaje
        racun.
      x-privremeno: true
    PotvrdaUplateLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/PotvrdaUplate"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    OdlukaOPotvrdi:
      type: object
      properties:
        razlog:
          type: string
          maxLength: 500
        sati_privremeno:
          type: integer
          minimum: 48
          maximum: 72
          default: 48
          description: Samo za approve
    Uparivanje:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: uparivanje
          readOnly: true
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
          description: Determined solely from the key/token
        uplata_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        profaktura_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        iznos:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
        pravilo:
          type: string
          enum:
            - tacan_poziv
            - delimican_poziv
            - predlog
            - rucno
            - sandbox
          readOnly: true
        pouzdanost:
          type: number
          minimum: 0
          maximum: 1
          readOnly: true
        status:
          type: string
          enum:
            - automatsko
            - rucno
            - odbijena
          readOnly: true
        kreirao:
          type:
            - string
            - "null"
          format: uuid
          readOnly: true
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - uplata_id
        - profaktura_id
        - iznos
        - status
        - kreirano
    UparivanjeLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/Uparivanje"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    UparivanjeKreiranje:
      type: object
      properties:
        uplata_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        profaktura_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        iznos:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: "Podrazumevano: min(ostatak uplate, ostatak proformas)"
          example: "12000.00"
      required:
        - uplata_id
        - profaktura_id
    AdresaZaPrijem:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: adresa_za_prijem
          readOnly: true
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
          description: Determined solely from the key/token
        adresa:
          type: string
          format: email
          example: lizzard-x7k2@in.uplaceno.rs
          readOnly: true
        bankovni_racun_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        banka:
          type: string
          enum:
            - intesa
            - otp
            - raiffeisen
          description: MVP parseri
        dozvoljeni_posiljaoci:
          type: array
          items:
            type: string
          example:
            - obavestenja@bancaintesa.rs
        aktivan:
          type: boolean
        poslednji_prijem:
          type:
            - string
            - "null"
          format: date-time
          readOnly: true
        status_verifikacije:
          type: string
          enum:
            - na_cekanju
            - verifikovana
            - ne_radi
          readOnly: true
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - adresa
        - bankovni_racun_id
        - banka
        - aktivan
        - kreirano
    AdresaZaPrijemLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/AdresaZaPrijem"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    AdresaZaPrijemKreiranje:
      type: object
      properties:
        bankovni_racun_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        banka:
          type: string
          enum:
            - intesa
            - otp
            - raiffeisen
          description: MVP parseri
        predlog_lokalnog_dela:
          type: string
          pattern: ^[a-z0-9-]{3,20}$
          description: Opcioni predlog lokalnog dela samo pri kreiranju. Posle upisa
            adresa je nepromenljiva.
        dozvoljeni_posiljaoci:
          type: array
          items:
            type: string
      required:
        - bankovni_racun_id
        - banka
    AdresaZaPrijemIzmena:
      type: object
      description: Only `aktivan` and `dozvoljeni_posiljaoci` are mutable. `adresa`
        and `predlog_lokalnog_dela` return `422 neispravni_podaci` and do not
        change the stored address.
      properties:
        aktivan:
          type: boolean
        dozvoljeni_posiljaoci:
          type: array
          items:
            type: string
    AuditDogadjaj:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: audit_dogadjaj
          readOnly: true
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
          description: Determined solely from the key/token
        tip_aktera:
          type: string
          enum:
            - korisnik
            - api_kljuc
            - oauth_klijent
            - sistem
            - kupac
        akter_id:
          type:
            - string
            - "null"
        akcija:
          type: string
          example: profaktura.otkazana
        tip_cilja:
          type: string
        cilj_id:
          type:
            - string
            - "null"
        ip:
          type:
            - string
            - "null"
        izmene:
          type: object
          additionalProperties: true
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - tip_aktera
        - akcija
        - kreirano
    AuditDogadjajLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/AuditDogadjaj"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    SimulacijaUplate:
      type: object
      properties:
        profaktura_id:
          type: string
          format: uuid
        poziv_na_broj:
          type: string
          description: "Alternativa proinvoice_id: testira parser/matcher"
        iznos:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          description: Amount in RSD as a decimal string with 2 fraction digits; currency
            is always RSD (no currency field)
          example: "12000.00"
        platilac:
          type: string
          default: TEST KUPAC
        nacin:
          type: string
          enum:
            - direktno
            - email
          default: direktno
          description: "`email` = generate a test bank email through the full ingest
            pipeline"
        banka:
          type: string
          enum:
            - intesa
            - otp
            - raiffeisen
      required:
        - iznos
      examples:
        - profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          iznos: "12000.00"
      anyOf:
        - required:
            - profaktura_id
        - required:
            - poziv_na_broj
    JavnoPlacanje:
      type: object
      properties:
        objekat:
          type: string
          const: javno_placanje
        prodavac:
          type: object
          properties:
            naziv:
              type: string
            pib:
              type: string
            adresa:
              $ref: "#/components/schemas/Adresa"
            logo_url:
              type:
                - string
                - "null"
        profaktura:
          type: object
          properties:
            oznaka_broja:
              type: string
            iznos:
              type: string
              pattern: ^\d{1,13}\.\d{2}$
              description: Amount in RSD as a decimal string with 2 fraction digits; currency
                is always RSD (no currency field)
              example: "12000.00"
            placeno_iznos:
              type: string
              pattern: ^\d{1,13}\.\d{2}$
              description: Amount in RSD as a decimal string with 2 fraction digits; currency
                is always RSD (no currency field)
              example: "12000.00"
            status:
              type: string
              enum:
                - nacrt
                - izdata
                - poslata
                - pregledana
                - privremeno_placena
                - delimicno_placeno
                - placeno
                - preplacena
                - konvertovana
                - istekla
                - otkazan
              description: converted se ne javlja u Osnovnom planu
            vazi_do:
              type: string
              format: date
              example: 2026-11-15
            rok_placanja:
              type: string
              format: date
              example: 2026-11-15
            stavke:
              type: array
              items:
                $ref: "#/components/schemas/Stavka"
        instrukcije_placanja:
          type: object
          properties:
            primalac:
              type: string
            broj_racuna:
              type: string
            iznos:
              type: string
              pattern: ^\d{1,13}\.\d{2}$
              description: Amount in RSD as a decimal string with 2 fraction digits; currency
                is always RSD (no currency field)
              example: "12000.00"
            model_poziva:
              type: string
              const: "97"
            poziv_na_broj:
              type: string
            svrha:
              type: string
              example: Uplata po profakturi PF-0123/2026
            sifra_placanja:
              type: string
              example: "289"
            ips_qr_png_url:
              type: string
              format: uri
            ips_qr_sadrzaj:
              type: string
              example: K:PR|V:01|C:1|R:160000000012345678|N:Lizzard Solutions
                DOO|I:RSD12000,00|SF:289|S:Uplata po
                profakturi|RO:974800042012301
        otpremanje_potvrde:
          type: object
          properties:
            dozvoljeno:
              type: boolean
            preostalo_pokusaja:
              type: integer
              maximum: 3
            maks_bajtova:
              type: integer
              const: 5242880
        pdf_url:
          type: string
          format: uri
      required:
        - profaktura
        - instrukcije_placanja
    RezultatOtpremanja:
      type: object
      properties:
        objekat:
          type: string
          const: potvrda_prijema
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        status:
          type: string
          enum:
            - otpremljena
            - u_proveri
            - prihvacena
            - odbijena
            - istekla
            - potvrdjena
        preostalo_pokusaja:
          type: integer
      required:
        - id
        - status
    WebAuthnOpcije:
      type: object
      properties:
        izazov_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        javni_kljuc:
          type: object
          additionalProperties: true
          description: WebAuthn JSON (PublicKeyCredential*OptionsJSON /
            RegistrationResponseJSON / AuthenticationResponseJSON, W3C Level 3)
        istice:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
      required:
        - izazov_id
        - javni_kljuc
      description: Challenge valid 5 min, stored in a Durable Object, single use
    PristupniKljucRegistracijaZahtev:
      type: object
      properties:
        naziv:
          type: string
          maxLength: 64
          example: MacBook Touch ID
        tip_autentifikatora:
          type: string
          enum:
            - platform
            - cross-platform
    PristupniKljucVerifikacijaZahtev:
      type: object
      properties:
        izazov_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        akreditiv:
          type: object
          additionalProperties: true
          description: WebAuthn JSON (PublicKeyCredential*OptionsJSON /
            RegistrationResponseJSON / AuthenticationResponseJSON, W3C Level 3)
        naziv:
          type: string
          maxLength: 64
      required:
        - izazov_id
        - akreditiv
    PristupniKljucPrijavaZahtev:
      type: object
      properties:
        email:
          type: string
          format: email
          description: Opciono; bez njega discoverable credentials (conditional UI)
    TokenOdgovor:
      type: object
      properties:
        access_token:
          type: string
        token_type:
          type: string
          const: Bearer
        expires_in:
          type: integer
          example: 900
        refresh_token:
          type: string
        id_token:
          type: string
        sesija_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - access_token
        - token_type
        - expires_in
      description: Isti format kao OIDC token endpoint
    PristupniKljuc:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: pristupni_kljuc
          readOnly: true
        akreditiv_id:
          type: string
          description: base64url
          readOnly: true
        naziv:
          type: string
          example: MacBook Touch ID
        transporti:
          type: array
          items:
            type: string
            enum:
              - usb
              - nfc
              - ble
              - internal
              - hybrid
          readOnly: true
        rezervna_kopija:
          type: boolean
          readOnly: true
        aaguid:
          type:
            - string
            - "null"
          readOnly: true
        poslednje_korisceno:
          type:
            - string
            - "null"
          format: date-time
          readOnly: true
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - akreditiv_id
        - naziv
        - kreirano
    PristupniKljucLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/PristupniKljuc"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    PristupniKljucIzmena:
      type: object
      properties:
        naziv:
          type: string
          maxLength: 64
      required:
        - naziv
    Sesija:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: sesija
          readOnly: true
        trenutna:
          type: boolean
        nacin_prijave:
          type: string
          enum:
            - pristupni_kljuc
            - magicni_link
            - google
            - lozinka_totp
        ip:
          type:
            - string
            - "null"
        pregledac:
          type:
            - string
            - "null"
        grad:
          type:
            - string
            - "null"
        poslednja_aktivnost:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
        istice:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - objekat
        - trenutna
        - nacin_prijave
        - poslednja_aktivnost
        - kreirano
    SesijaLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/Sesija"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
          description: Pass as `kursor` for the next page
          example: eyJpZCI6IjAxOTJlNGExIn0
      required:
        - objekat
        - podaci
        - ima_jos
        - sledeci_kursor
    Bezbednost:
      type: object
      properties:
        objekat:
          type: string
          const: bezbednost
        visefaktorska_ukljucena:
          type: boolean
        metode:
          type: array
          items:
            type: string
            enum:
              - pristupni_kljuc
              - totp
              - magicni_link
              - google
        broj_pristupnih_kljuceva:
          type: integer
        totp_ukljucen:
          type: boolean
        lozinka_postavljena:
          type: boolean
        poslednja_prijava:
          type:
            - string
            - "null"
          format: date-time
      required:
        - visefaktorska_ukljucena
        - metode
        - broj_pristupnih_kljuceva
    PromenaLozinkeZahtev:
      type: object
      properties:
        trenutna_lozinka:
          type: string
          format: password
        lozinka:
          type: string
          format: password
          minLength: 10
          maxLength: 128
      required:
        - lozinka
    TotpPodesavanje:
      type: object
      properties:
        objekat:
          type: string
          const: totp_podesavanje
        tajna:
          type: string
        otpauth_uri:
          type: string
          format: uri
      required:
        - tajna
        - otpauth_uri
    TotpPotvrdaZahtev:
      type: object
      properties:
        kod:
          type: string
          pattern: ^[0-9]{6}$
      required:
        - kod
    TotpProveraZahtev:
      type: object
      properties:
        lozinka:
          type: string
          format: password
        kod:
          type: string
    TotpKodovi:
      type: object
      properties:
        objekat:
          type: string
          const: totp_kodovi
        kodovi:
          type: array
          items:
            type: string
      required:
        - kodovi
    KorakTotp:
      type: object
      properties:
        objekat:
          type: string
          const: korak_totp
        izazov:
          type: string
        istice:
          type: string
          format: date-time
      required:
        - objekat
        - izazov
    PrijavaTotpZahtev:
      type: object
      properties:
        izazov:
          type: string
        kod:
          type: string
      required:
        - izazov
        - kod
    PrijavaZahtev:
      type: object
      properties:
        email:
          type: string
          format: email
          example: nemanja@lizzard.rs
        lozinka:
          type: string
          format: password
          minLength: 1
          maxLength: 256
        turnstile_token:
          type: string
      required:
        - email
        - lozinka
        - turnstile_token
    RegistracijaZahtev:
      type: object
      properties:
        ime:
          type: string
          maxLength: 120
          example: Nemanja Vukmirovic
        email:
          type: string
          format: email
        lozinka:
          type: string
          format: password
          minLength: 10
          maxLength: 256
          description: Min. 10 znakova; proverava se protiv liste procurelih lozinki; hes
            Argon2id
        turnstile_token:
          type: string
        uslovi_prihvaceni:
          type: boolean
          description: Acceptance of terms, privacy policy and SLA (`uslovi_prihvaceni`
            must be true)
      required:
        - ime
        - email
        - lozinka
        - uslovi_prihvaceni
        - turnstile_token
    TokenZahtev:
      type: object
      properties:
        token:
          type: string
          minLength: 32
      required:
        - token
    ZaboravljenaLozinkaZahtev:
      type: object
      properties:
        email:
          type: string
          format: email
        turnstile_token:
          type: string
      required:
        - email
        - turnstile_token
    NovaLozinkaZahtev:
      type: object
      properties:
        token:
          type: string
          minLength: 32
        lozinka:
          type: string
          format: password
          minLength: 10
          maxLength: 256
      required:
        - token
        - lozinka
    Poruka:
      type: object
      properties:
        objekat:
          type: string
          const: poruka
        poruka:
          type: string
          example: Ako nalog postoji, poslali smo uputstvo na email.
      required:
        - poruka
    Korisnik:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
          readOnly: true
        objekat:
          type: string
          const: korisnik
        ime:
          type: string
        email:
          type: string
          format: email
        email_potvrdjen:
          type: boolean
        kreirano:
          type: string
          format: date-time
          example: 2026-11-01T08:00:00Z
          readOnly: true
      required:
        - id
        - ime
        - email
        - email_potvrdjen
    OrganizacijaClanstvo:
      type: object
      properties:
        organizacija_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        naziv:
          type: string
        sifra_organizacije:
          type: string
          pattern: ^\d{5}$
        status:
          type: string
          enum:
            - aktivan
            - samo_citanje
        uloga_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        kljuc_uloge:
          type: string
          enum:
            - vlasnik
            - administrator
            - knjigovodja
            - posmatrac
        vlasnik:
          type: boolean
      required:
        - organizacija_id
        - naziv
        - kljuc_uloge
    Ja:
      type: object
      properties:
        objekat:
          type: string
          const: ja
        korisnik:
          $ref: "#/components/schemas/Korisnik"
        organizacije:
          type: array
          items:
            $ref: "#/components/schemas/OrganizacijaClanstvo"
        aktivna_organizacija_id:
          type:
            - string
            - "null"
          format: uuid
      required:
        - korisnik
        - organizacije
    PrijavaOdgovor:
      $ref: "#/components/schemas/Ja"
    TipDogadjaja:
      type: string
      description: Svi tipovi webhook dogadjaja (ASCII srpski, tackasta notacija)
      enum:
        - profaktura.kreirana
        - profaktura.izdata
        - profaktura.poslata
        - profaktura.pregledana
        - profaktura.izmenjena
        - profaktura.ponovo_izdata
        - profaktura.delimicno_placena
        - profaktura.placena
        - profaktura.istekla
        - profaktura.otkazana
        - profaktura.konvertovana
        - faktura.kreirana
        - faktura.izmenjena
        - faktura.otkazana
        - faktura.privremeno_placena
        - faktura.privremeno_placanje_isteklo
        - faktura.delimicno_placena
        - faktura.placena
        - faktura.preplacena
        - faktura.u_docnji
        - uplata.primljena
        - uplata.uparena
        - uplata.neuparena
        - uplata.uparivanje_ponisteno
        - potvrda_uplate.prihvacena
        - potvrda_uplate.odbijena
        - fiskalni_racun.izdat
        - fiskalni_racun.neuspesan
        - sef_faktura.poslata
        - sef_faktura.prihvacena
        - sef_faktura.odbijena
        - pretplata.obnovljena
        - pretplata.u_docnji
        - pretplata.otkazana
        - potrosnja.upozorenje_limita
        - potrosnja.limit_dostignut
        - organizacija.produkcija_aktivirana
        - onboarding.korak_zavrsen
        - racun.sef_poslat
        - racun.sef_prihvacen
        - racun.sef_odbijen
        - racun.sef_greska
    WebhookPodaciProfaktura:
      type: object
      description: proforma u Beta webhook omotu
      properties:
        id:
          type: string
          format: uuid
        broj:
          type: string
          example: PF-0042/2026
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          example: "12000.00"
        placeno_ukupno:
          type: string
          pattern: ^-?\d+\.\d{2}$
          example: "12000.00"
        valuta:
          type: string
          const: RSD
        status:
          type: string
          example: placena
        poziv_na_broj:
          type: string
          example: 97 47 12345 0042 01
        id_kupca:
          type: string
          format: uuid
      required:
        - id
        - iznos
        - valuta
        - status
      additionalProperties: false
    WebhookPodaciUplata:
      type: object
      properties:
        id:
          type: string
          format: uuid
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
        datum_valute:
          type: string
          format: date
          example: 2026-11-02
        platilac:
          type: string
          example: Primer d.o.o.
        nacin_uparivanja:
          type: string
          enum:
            - automatsko
            - rucno
            - potvrda
      required:
        - id
        - iznos
        - nacin_uparivanja
      additionalProperties: false
    WebhookDogadjajEnvelope:
      type: object
      description: Beta shared envelope (e.g. `profaktura.placena`, `uplata.uparena`)
      properties:
        id_dogadjaja:
          type: string
          format: uuid
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
        kreirano:
          type: string
          format: date-time
          example: 2026-11-02T09:00:03+01:00
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
        podaci:
          type: object
          properties:
            profaktura:
              $ref: "#/components/schemas/WebhookPodaciProfaktura"
            uplata:
              $ref: "#/components/schemas/WebhookPodaciUplata"
          additionalProperties: false
      required:
        - id_dogadjaja
        - dogadjaj
        - kreirano
        - okruzenje
        - id_organizacije
        - podaci
      additionalProperties: false
      example:
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        dogadjaj: profaktura.placena
        kreirano: 2026-11-02T09:00:03+01:00
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        podaci:
          profaktura:
            id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
            broj: PF-0042/2026
            iznos: "12000.00"
            placeno_ukupno: "12000.00"
            valuta: RSD
            status: placena
            poziv_na_broj: 97 47 12345 0042 01
            id_kupca: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e02
          uplata:
            id: 0192e4a3-1111-7000-8000-000000000099
            iznos: "12000.00"
            datum_valute: 2026-11-02
            platilac: Primer d.o.o.
            nacin_uparivanja: automatsko
    WebhookIsporuka:
      type: object
      properties:
        objekat:
          const: webhook_isporuka
        id_dogadjaja:
          type: string
          format: uuid
        pokusaj:
          type: integer
        status:
          type: string
          enum:
            - uspesna
            - neuspesna
            - ceka
        http_status:
          type:
            - integer
            - "null"
        kreirano:
          type: string
          format: date-time
      required:
        - objekat
        - id_dogadjaja
        - pokusaj
        - status
        - kreirano
    WebhookIsporukaLista:
      type: object
      properties:
        objekat:
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/WebhookIsporuka"
        sledeci_kursor:
          type:
            - string
            - "null"
        ima_jos:
          type: boolean
      required:
        - objekat
        - podaci
        - ima_jos
    WebhookDogadjajZapis:
      type: object
      properties:
        objekat:
          const: webhook_dogadjaj
        id:
          type: string
          format: uuid
        dogadjaj:
          type: string
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
        kreirano:
          type: string
          format: date-time
        telo:
          $ref: "#/components/schemas/WebhookDogadjajEnvelope"
        isporuka_status:
          type: string
          enum:
            - uspesna
            - neuspesna
            - ceka
      required:
        - objekat
        - id
        - dogadjaj
        - okruzenje
        - kreirano
        - isporuka_status
    WebhookPonoviOdgovor:
      type: object
      properties:
        objekat:
          const: webhook_ponovi
        id_dogadjaja:
          type: string
          format: uuid
        status:
          const: zakazano
      required:
        - objekat
        - id_dogadjaja
        - status
    DogadjajProfakturaKreirana:
      type: object
      description: Payload za `proforma.kreirana` (ranije `proinvoice.created`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: profaktura.kreirana
          description: Event type
          example: profaktura.kreirana
        id_profakture:
          type: string
          format: uuid
          description: ID proformas (UUID v7)
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture:
          type: string
          description: Oznaka broja
          example: PF-0123/2026
        verzija:
          type: integer
          description: Verzija objekta (redosled delivery nije garantovan)
          example: 1
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        poziv_na_broj:
          type: string
          description: Poziv na broj, model 97
          example: 97 47 12345 0123 01
        id_kupca:
          type: string
          format: uuid
          description: ID kupca
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        kreirano_u:
          type: string
          format: date-time
          description: Vreme kreiranja (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_profakture
        - iznos
        - valuta
        - kreirano_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: profaktura.kreirana
        id_profakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture: PF-0123/2026
        verzija: 1
        iznos: "12000.00"
        valuta: RSD
        poziv_na_broj: 97 47 12345 0123 01
        id_kupca: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        kreirano_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajProfakturaIzdata:
      type: object
      description: Payload za `proforma.izdata` (ranije `proinvoice.issued`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: profaktura.izdata
          description: Event type
          example: profaktura.izdata
        id_profakture:
          type: string
          format: uuid
          description: ID proformas (UUID v7)
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture:
          type: string
          description: Oznaka broja
          example: PF-0123/2026
        verzija:
          type: integer
          description: Verzija objekta (redosled delivery nije garantovan)
          example: 1
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        poziv_na_broj:
          type: string
          description: Poziv na broj, model 97
          example: 97 47 12345 0123 01
        id_kupca:
          type: string
          format: uuid
          description: ID kupca
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        datum_izdavanja:
          type: string
          format: date
          example: 2026-11-02
        rok_placanja:
          type: string
          format: date
          example: 2026-11-09
        url_placanja:
          type: string
          description: Javni link za placanje
          example: https://pay.uplaceno.rs/plati/pt_Xk29aQ
          format: uri
        izdato_u:
          type: string
          format: date-time
          description: Vreme izdavanja (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_profakture
        - broj_profakture
        - iznos
        - valuta
        - izdato_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: profaktura.izdata
        id_profakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture: PF-0123/2026
        verzija: 1
        iznos: "12000.00"
        valuta: RSD
        poziv_na_broj: 97 47 12345 0123 01
        id_kupca: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        datum_izdavanja: 2026-11-02
        rok_placanja: 2026-11-09
        url_placanja: https://pay.uplaceno.rs/plati/pt_Xk29aQ
        izdato_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajProfakturaPoslata:
      type: object
      description: Payload za `proforma.poslata` (ranije `proinvoice.sent`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: profaktura.poslata
          description: Event type
          example: profaktura.poslata
        id_profakture:
          type: string
          format: uuid
          description: ID proformas (UUID v7)
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture:
          type: string
          description: Oznaka broja
          example: PF-0123/2026
        verzija:
          type: integer
          description: Verzija objekta (redosled delivery nije garantovan)
          example: 1
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        poziv_na_broj:
          type: string
          description: Poziv na broj, model 97
          example: 97 47 12345 0123 01
        id_kupca:
          type: string
          format: uuid
          description: ID kupca
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        email_primaoca:
          type: string
          description: Kome je poslat mejl
          example: kupac@primer.rs
          format: email
        poslato_u:
          type: string
          format: date-time
          description: Vreme slanja (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_profakture
        - poslato_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: profaktura.poslata
        id_profakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture: PF-0123/2026
        verzija: 1
        iznos: "12000.00"
        valuta: RSD
        poziv_na_broj: 97 47 12345 0123 01
        id_kupca: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        email_primaoca: kupac@primer.rs
        poslato_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajProfakturaPregledana:
      type: object
      description: Payload za `proforma.pregledana` (ranije `proinvoice.viewed`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: profaktura.pregledana
          description: Event type
          example: profaktura.pregledana
        id_profakture:
          type: string
          format: uuid
          description: ID proformas (UUID v7)
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture:
          type: string
          description: Oznaka broja
          example: PF-0123/2026
        verzija:
          type: integer
          description: Verzija objekta (redosled delivery nije garantovan)
          example: 1
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        poziv_na_broj:
          type: string
          description: Poziv na broj, model 97
          example: 97 47 12345 0123 01
        id_kupca:
          type: string
          format: uuid
          description: ID kupca
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        pregledano_u:
          type: string
          format: date-time
          description: Prvo otvaranje linka (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_profakture
        - pregledano_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: profaktura.pregledana
        id_profakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture: PF-0123/2026
        verzija: 1
        iznos: "12000.00"
        valuta: RSD
        poziv_na_broj: 97 47 12345 0123 01
        id_kupca: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        pregledano_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajProfakturaIzmenjena:
      type: object
      description: Payload za `proforma.izmenjena` (ranije `proinvoice.updated`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: profaktura.izmenjena
          description: Event type
          example: profaktura.izmenjena
        id_profakture:
          type: string
          format: uuid
          description: ID proformas (UUID v7)
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture:
          type: string
          description: Oznaka broja
          example: PF-0123/2026
        verzija:
          type: integer
          description: Verzija objekta (redosled delivery nije garantovan)
          example: 1
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        poziv_na_broj:
          type: string
          description: Poziv na broj, model 97
          example: 97 47 12345 0123 01
        id_kupca:
          type: string
          format: uuid
          description: ID kupca
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        prethodna_verzija:
          type: integer
          example: 1
        prethodni_iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Iznos pre izmene (decimal string)
          example: "10000.00"
        izmenjeno_u:
          type: string
          format: date-time
          description: Vreme izmene (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_profakture
        - verzija
        - iznos
        - valuta
        - izmenjeno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: profaktura.izmenjena
        id_profakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture: PF-0123/2026
        verzija: 1
        iznos: "12000.00"
        valuta: RSD
        poziv_na_broj: 97 47 12345 0123 01
        id_kupca: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        prethodna_verzija: 1
        prethodni_iznos: "10000.00"
        izmenjeno_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajProfakturaPonovoIzdata:
      type: object
      description: Payload za `proforma.ponovo_izdata` (ranije `proinvoice.reissued`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: profaktura.ponovo_izdata
          description: Event type
          example: profaktura.ponovo_izdata
        id_profakture:
          type: string
          format: uuid
          description: ID proformas (UUID v7)
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture:
          type: string
          description: Oznaka broja
          example: PF-0123/2026
        verzija:
          type: integer
          description: Verzija objekta (redosled delivery nije garantovan)
          example: 1
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        poziv_na_broj:
          type: string
          description: Poziv na broj, model 97
          example: 97 47 12345 0123 01
        id_kupca:
          type: string
          format: uuid
          description: ID kupca
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        prethodna_verzija:
          type: integer
          example: 1
        prethodni_iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Iznos pre izmene (decimal string)
          example: "10000.00"
        razlog:
          type: string
          description: Razlog
          example: izmenjene_stavke
          enum:
            - izmenjene_stavke
            - izmenjeni_podaci
        ponovo_izdato_u:
          type: string
          format: date-time
          description: Vreme ponovnog izdavanja (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_profakture
        - verzija
        - iznos
        - valuta
        - ponovo_izdato_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: profaktura.ponovo_izdata
        id_profakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture: PF-0123/2026
        verzija: 1
        iznos: "12000.00"
        valuta: RSD
        poziv_na_broj: 97 47 12345 0123 01
        id_kupca: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        prethodna_verzija: 1
        prethodni_iznos: "10000.00"
        razlog: izmenjene_stavke
        ponovo_izdato_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajProfakturaDelimicnoPlacena:
      type: object
      description: Payload za `proforma.delimicno_placena` (ranije
        `proinvoice.partially_paid`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: profaktura.delimicno_placena
          description: Event type
          example: profaktura.delimicno_placena
        id_profakture:
          type: string
          format: uuid
          description: ID proformas (UUID v7)
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture:
          type: string
          description: Oznaka broja
          example: PF-0123/2026
        verzija:
          type: integer
          description: Verzija objekta (redosled delivery nije garantovan)
          example: 1
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        poziv_na_broj:
          type: string
          description: Poziv na broj, model 97
          example: 97 47 12345 0123 01
        id_kupca:
          type: string
          format: uuid
          description: ID kupca
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        placeno_iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Ukupno uplaceno do sada (decimal string)
          example: "6000.00"
        preostalo:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Preostalo za uplatu (decimal string)
          example: "6000.00"
        placeno_u:
          type: string
          format: date-time
          description: Vreme poslednje uplate (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_profakture
        - iznos
        - valuta
        - placeno_iznos
        - preostalo
        - placeno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: profaktura.delimicno_placena
        id_profakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture: PF-0123/2026
        verzija: 1
        iznos: "12000.00"
        valuta: RSD
        poziv_na_broj: 97 47 12345 0123 01
        id_kupca: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        placeno_iznos: "6000.00"
        preostalo: "6000.00"
        placeno_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajProfakturaPlacena:
      type: object
      description: Payload za `proforma.placena` (ranije `proinvoice.paid`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: profaktura.placena
          description: Event type
          example: profaktura.placena
        id_profakture:
          type: string
          format: uuid
          description: ID proformas (UUID v7)
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture:
          type: string
          description: Oznaka broja
          example: PF-0123/2026
        verzija:
          type: integer
          description: Verzija objekta (redosled delivery nije garantovan)
          example: 1
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        poziv_na_broj:
          type: string
          description: Poziv na broj, model 97
          example: 97 47 12345 0123 01
        id_kupca:
          type: string
          format: uuid
          description: ID kupca
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        placeno_iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Ukupno uplaceno (decimal string)
          example: "12000.00"
        placeno_u:
          type: string
          format: date-time
          description: Vreme uplate koja je zatvorila proformas (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_profakture
        - iznos
        - valuta
        - placeno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: profaktura.placena
        id_profakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture: PF-0123/2026
        verzija: 1
        iznos: "12000.00"
        valuta: RSD
        poziv_na_broj: 97 47 12345 0123 01
        id_kupca: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        placeno_iznos: "12000.00"
        placeno_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajProfakturaIstekla:
      type: object
      description: Payload za `proforma.istekla` (ranije `proinvoice.expired`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: profaktura.istekla
          description: Event type
          example: profaktura.istekla
        id_profakture:
          type: string
          format: uuid
          description: ID proformas (UUID v7)
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture:
          type: string
          description: Oznaka broja
          example: PF-0123/2026
        verzija:
          type: integer
          description: Verzija objekta (redosled delivery nije garantovan)
          example: 1
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        poziv_na_broj:
          type: string
          description: Poziv na broj, model 97
          example: 97 47 12345 0123 01
        id_kupca:
          type: string
          format: uuid
          description: ID kupca
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        isteklo_u:
          type: string
          format: date-time
          description: Istek roka vazenja (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_profakture
        - isteklo_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: profaktura.istekla
        id_profakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture: PF-0123/2026
        verzija: 1
        iznos: "12000.00"
        valuta: RSD
        poziv_na_broj: 97 47 12345 0123 01
        id_kupca: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        isteklo_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajProfakturaOtkazana:
      type: object
      description: Payload za `proforma.otkazana` (ranije `proinvoice.cancelled`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: profaktura.otkazana
          description: Event type
          example: profaktura.otkazana
        id_profakture:
          type: string
          format: uuid
          description: ID proformas (UUID v7)
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture:
          type: string
          description: Oznaka broja
          example: PF-0123/2026
        verzija:
          type: integer
          description: Verzija objekta (redosled delivery nije garantovan)
          example: 1
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        poziv_na_broj:
          type: string
          description: Poziv na broj, model 97
          example: 97 47 12345 0123 01
        id_kupca:
          type: string
          format: uuid
          description: ID kupca
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        razlog:
          type: string
          description: Razlog otkazivanja
          example: kupac odustao
        otkazano_u:
          type: string
          format: date-time
          description: Vreme otkazivanja (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_profakture
        - otkazano_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: profaktura.otkazana
        id_profakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture: PF-0123/2026
        verzija: 1
        iznos: "12000.00"
        valuta: RSD
        poziv_na_broj: 97 47 12345 0123 01
        id_kupca: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        razlog: kupac odustao
        otkazano_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajProfakturaKonvertovana:
      type: object
      description: Payload za `proforma.konvertovana` (ranije `proinvoice.converted`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: profaktura.konvertovana
          description: Event type
          example: profaktura.konvertovana
        id_profakture:
          type: string
          format: uuid
          description: ID proformas (UUID v7)
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture:
          type: string
          description: Oznaka broja
          example: PF-0123/2026
        verzija:
          type: integer
          description: Verzija objekta (redosled delivery nije garantovan)
          example: 1
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        poziv_na_broj:
          type: string
          description: Poziv na broj, model 97
          example: 97 47 12345 0123 01
        id_kupca:
          type: string
          format: uuid
          description: ID kupca
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        id_fakture:
          type: string
          description: ID nastalog konacnog dokumenta
          example: "1042"
        tip_dokumenta:
          type: string
          description: Vrsta konacnog dokumenta
          example: fiskalni_racun
          enum:
            - fiskalni_racun
            - sef_faktura
        konvertovano_u:
          type: string
          format: date-time
          description: Vreme konverzije (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_profakture
        - id_fakture
        - tip_dokumenta
        - konvertovano_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: profaktura.konvertovana
        id_profakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj_profakture: PF-0123/2026
        verzija: 1
        iznos: "12000.00"
        valuta: RSD
        poziv_na_broj: 97 47 12345 0123 01
        id_kupca: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        id_fakture: "1042"
        tip_dokumenta: fiskalni_racun
        konvertovano_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajFakturaKreirana:
      type: object
      description: Payload za `faktura.kreirana` (ranije `invoice.created`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: faktura.kreirana
          description: Event type
          example: faktura.kreirana
        id_fakture:
          type: string
          description: ID konacnog dokumenta (fakture)
          example: "1042"
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        id_profakture:
          type: string
          format: uuid
          description: Izvorna proforma
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        kreirano_u:
          type: string
          format: date-time
          description: Vreme kreiranja (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_fakture
        - iznos
        - valuta
        - kreirano_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: faktura.kreirana
        id_fakture: "1042"
        iznos: "12000.00"
        valuta: RSD
        id_profakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        kreirano_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajFakturaIzmenjena:
      type: object
      description: Payload za `faktura.izmenjena` (ranije `invoice.updated`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: faktura.izmenjena
          description: Event type
          example: faktura.izmenjena
        id_fakture:
          type: string
          description: ID konacnog dokumenta (fakture)
          example: "1042"
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        verzija:
          type: integer
          example: 2
        izmenjeno_u:
          type: string
          format: date-time
          description: Vreme izmene (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_fakture
        - iznos
        - valuta
        - izmenjeno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: faktura.izmenjena
        id_fakture: "1042"
        iznos: "12000.00"
        valuta: RSD
        verzija: 2
        izmenjeno_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajFakturaOtkazana:
      type: object
      description: Payload za `faktura.otkazana` (ranije `invoice.cancelled`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: faktura.otkazana
          description: Event type
          example: faktura.otkazana
        id_fakture:
          type: string
          description: ID konacnog dokumenta (fakture)
          example: "1042"
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        razlog:
          type: string
          description: Razlog otkazivanja
          example: storno
        otkazano_u:
          type: string
          format: date-time
          description: Vreme otkazivanja (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_fakture
        - otkazano_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: faktura.otkazana
        id_fakture: "1042"
        iznos: "12000.00"
        valuta: RSD
        razlog: storno
        otkazano_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajFakturaPrivremenoPlacena:
      type: object
      description: Payload za `faktura.privremeno_placena` (ranije `invoice.temporary_paid`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: faktura.privremeno_placena
          description: Event type
          example: faktura.privremeno_placena
        id_fakture:
          type: string
          description: ID konacnog dokumenta (fakture)
          example: "1042"
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        id_potvrde_uplate:
          type: string
          format: uuid
          description: Prihvacena PDF potvrda
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        privremeno_placeno_do:
          type: string
          format: date-time
          description: Do kada vazi privremeni status (RFC 3339 sa ofsetom)
          example: 2026-11-04T09:00:03+01:00
        privremeno_placeno_u:
          type: string
          format: date-time
          description: Vreme prihvatanja potvrde (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_fakture
        - iznos
        - valuta
        - privremeno_placeno_do
        - privremeno_placeno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: faktura.privremeno_placena
        id_fakture: "1042"
        iznos: "12000.00"
        valuta: RSD
        id_potvrde_uplate: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        privremeno_placeno_do: 2026-11-04T09:00:03+01:00
        privremeno_placeno_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajFakturaPrivremenoPlacanjeIsteklo:
      type: object
      description: Payload za `faktura.privremeno_placanje_isteklo` (ranije
        `invoice.temporary_expired`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: faktura.privremeno_placanje_isteklo
          description: Event type
          example: faktura.privremeno_placanje_isteklo
        id_fakture:
          type: string
          description: ID konacnog dokumenta (fakture)
          example: "1042"
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        id_potvrde_uplate:
          type: string
          format: uuid
          description: PDF potvrda
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        isteklo_u:
          type: string
          format: date-time
          description: Istek privremenog statusa bez uplate iz banke (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_fakture
        - isteklo_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: faktura.privremeno_placanje_isteklo
        id_fakture: "1042"
        iznos: "12000.00"
        valuta: RSD
        id_potvrde_uplate: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        isteklo_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajFakturaDelimicnoPlacena:
      type: object
      description: Payload za `faktura.delimicno_placena` (ranije `invoice.partially_paid`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: faktura.delimicno_placena
          description: Event type
          example: faktura.delimicno_placena
        id_fakture:
          type: string
          description: ID konacnog dokumenta (fakture)
          example: "1042"
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        placeno_iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Ukupno uplaceno do sada (decimal string)
          example: "6000.00"
        preostalo:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Preostalo za uplatu (decimal string)
          example: "6000.00"
        placeno_u:
          type: string
          format: date-time
          description: Vreme poslednje uplate (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_fakture
        - iznos
        - valuta
        - placeno_iznos
        - preostalo
        - placeno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: faktura.delimicno_placena
        id_fakture: "1042"
        iznos: "12000.00"
        valuta: RSD
        placeno_iznos: "6000.00"
        preostalo: "6000.00"
        placeno_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajFakturaPlacena:
      type: object
      description: Payload za `faktura.placena` (ranije `invoice.paid`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: faktura.placena
          description: Event type
          example: faktura.placena
        id_fakture:
          type: string
          description: ID konacnog dokumenta (fakture)
          example: "1042"
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        placeno_u:
          type: string
          format: date-time
          description: Vreme uplate koja je zatvorila fakturu (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_fakture
        - iznos
        - valuta
        - placeno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: faktura.placena
        id_fakture: "1042"
        iznos: "12000.00"
        valuta: RSD
        placeno_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajFakturaPreplacena:
      type: object
      description: Payload za `faktura.preplacena` (ranije `invoice.overpaid`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: faktura.preplacena
          description: Event type
          example: faktura.preplacena
        id_fakture:
          type: string
          description: ID konacnog dokumenta (fakture)
          example: "1042"
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        placeno_iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Ukupno uplaceno (decimal string)
          example: "12500.00"
        preplata:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Visak uplate (decimal string)
          example: "500.00"
        placeno_u:
          type: string
          format: date-time
          description: Vreme uplate (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_fakture
        - iznos
        - valuta
        - placeno_iznos
        - preplata
        - placeno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: faktura.preplacena
        id_fakture: "1042"
        iznos: "12000.00"
        valuta: RSD
        placeno_iznos: "12500.00"
        preplata: "500.00"
        placeno_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajFakturaUDocnji:
      type: object
      description: Payload za `faktura.u_docnji` (ranije `invoice.overdue`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: faktura.u_docnji
          description: Event type
          example: faktura.u_docnji
        id_fakture:
          type: string
          description: ID konacnog dokumenta (fakture)
          example: "1042"
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Total amount (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        rok_placanja:
          type: string
          format: date
          example: 2026-11-09
        preostalo:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Unpaid balance (decimal string)
          example: "12000.00"
        u_docnji_od:
          type: string
          format: date-time
          description: Kada je rok istekao (RFC 3339 sa ofsetom)
          example: 2026-11-10T00:00:00+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_fakture
        - rok_placanja
        - preostalo
        - u_docnji_od
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: faktura.u_docnji
        id_fakture: "1042"
        iznos: "12000.00"
        valuta: RSD
        rok_placanja: 2026-11-09
        preostalo: "12000.00"
        u_docnji_od: 2026-11-10T00:00:00+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajUplataPrimljena:
      type: object
      description: Payload za `uplata.primljena` (ranije `payment.received`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: uplata.primljena
          description: Event type
          example: uplata.primljena
        id_uplate:
          type: string
          format: uuid
          description: ID uplate
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Iznos uplate (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        platilac:
          type: string
          description: Payer name
          example: Petar Petrovic
        racun_platioca:
          type: string
          description: Racun platioca
          example: 160-0000000123456-78
        poziv_na_broj:
          type: string
          description: Poziv na broj iz naloga
          example: 97 47 12345 0123 01
        proknjizeno_u:
          type: string
          format: date-time
          description: Vreme knjizenja u banci (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_uplate
        - iznos
        - valuta
        - proknjizeno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: uplata.primljena
        id_uplate: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        iznos: "12000.00"
        valuta: RSD
        platilac: Petar Petrovic
        racun_platioca: 160-0000000123456-78
        poziv_na_broj: 97 47 12345 0123 01
        proknjizeno_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajUplataNeuparena:
      type: object
      description: Payload za `uplata.neuparena` (ranije `payment.unmatched`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: uplata.neuparena
          description: Event type
          example: uplata.neuparena
        id_uplate:
          type: string
          format: uuid
          description: ID uplate
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Iznos uplate (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        platilac:
          type: string
          description: Payer name
          example: Petar Petrovic
        racun_platioca:
          type: string
          description: Racun platioca
          example: 160-0000000123456-78
        poziv_na_broj:
          type: string
          description: Poziv na broj iz naloga
          example: 97 47 12345 0123 01
        proknjizeno_u:
          type: string
          format: date-time
          description: Vreme knjizenja u banci (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        razlog:
          type: string
          description: Zasto nije uparena
          example: neispravan_poziv
          enum:
            - neispravan_poziv
            - nepoznat_poziv
            - iznos_se_ne_poklapa
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_uplate
        - iznos
        - valuta
        - razlog
        - proknjizeno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: uplata.neuparena
        id_uplate: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        iznos: "12000.00"
        valuta: RSD
        platilac: Petar Petrovic
        racun_platioca: 160-0000000123456-78
        poziv_na_broj: 97 47 12345 0123 01
        proknjizeno_u: 2026-11-02T09:00:03+01:00
        razlog: neispravan_poziv
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajPotvrdaUplatePrihvacena:
      type: object
      description: Payload za `potvrda_uplate.prihvacena` (ranije `payment_proof.accepted`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: potvrda_uplate.prihvacena
          description: Event type
          example: potvrda_uplate.prihvacena
        id_potvrde_uplate:
          type: string
          format: uuid
          description: ID PDF potvrde
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        id_profakture:
          type: string
          format: uuid
          description: ID proformas
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Iznos sa potvrde (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        odluceno_u:
          type: string
          format: date-time
          description: Vreme odluke (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        privremeno_placeno_do:
          type: string
          format: date-time
          description: Do kada vazi privremeni status (RFC 3339 sa ofsetom)
          example: 2026-11-04T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_potvrde_uplate
        - id_profakture
        - odluceno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: potvrda_uplate.prihvacena
        id_potvrde_uplate: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        id_profakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        iznos: "12000.00"
        valuta: RSD
        odluceno_u: 2026-11-02T09:00:03+01:00
        privremeno_placeno_do: 2026-11-04T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajPotvrdaUplateOdbijena:
      type: object
      description: Payload za `potvrda_uplate.odbijena` (ranije `payment_proof.rejected`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: potvrda_uplate.odbijena
          description: Event type
          example: potvrda_uplate.odbijena
        id_potvrde_uplate:
          type: string
          format: uuid
          description: ID PDF potvrde
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        id_profakture:
          type: string
          format: uuid
          description: ID proformas
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Iznos sa potvrde (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        odluceno_u:
          type: string
          format: date-time
          description: Vreme odluke (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        razlog_odbijanja:
          type: string
          description: Razlog odbijanja
          example: iznos se ne poklapa
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_potvrde_uplate
        - id_profakture
        - razlog_odbijanja
        - odluceno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: potvrda_uplate.odbijena
        id_potvrde_uplate: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        id_profakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        iznos: "12000.00"
        valuta: RSD
        odluceno_u: 2026-11-02T09:00:03+01:00
        razlog_odbijanja: iznos se ne poklapa
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajFiskalniRacunIzdat:
      type: object
      description: Payload za `fiskalni_racun.izdat` (ranije `fiscal_receipt.issued`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: fiskalni_racun.izdat
          description: Event type
          example: fiskalni_racun.izdat
        id_fiskalnog_racuna:
          type: string
          description: Broj racuna iz PFR-a
          example: ABCD1234-ABCD1234-1042
        id_fakture:
          type: string
          description: ID fakture
          example: "1042"
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Iznos (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        izdato_u:
          type: string
          format: date-time
          description: Vreme fiskalizacije (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_fiskalnog_racuna
        - id_fakture
        - iznos
        - valuta
        - izdato_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: fiskalni_racun.izdat
        id_fiskalnog_racuna: ABCD1234-ABCD1234-1042
        id_fakture: "1042"
        iznos: "12000.00"
        valuta: RSD
        izdato_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajFiskalniRacunNeuspesan:
      type: object
      description: Payload za `fiskalni_racun.neuspesan` (ranije `fiscal_receipt.failed`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: fiskalni_racun.neuspesan
          description: Event type
          example: fiskalni_racun.neuspesan
        id_fakture:
          type: string
          description: ID fakture
          example: "1042"
        kod_greske:
          type: string
          description: Kod greske
          example: pfr_nedostupan
        poruka:
          type: string
          description: Opis greske
        neuspesno_u:
          type: string
          format: date-time
          description: Vreme pokusaja (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_fakture
        - kod_greske
        - neuspesno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: fiskalni_racun.neuspesan
        id_fakture: "1042"
        kod_greske: pfr_nedostupan
        neuspesno_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajSefFakturaPoslata:
      type: object
      description: Payload za `sef_faktura.poslata` (ranije `sef_invoice.sent`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: sef_faktura.poslata
          description: Event type
          example: sef_faktura.poslata
        id_sef_fakture:
          type: string
          description: ID u SEF-u
          example: "123456"
        id_fakture:
          type: string
          description: ID fakture
          example: "1042"
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Iznos (decimal string)
          example: "12000.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        poslato_u:
          type: string
          format: date-time
          description: Vreme slanja (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_sef_fakture
        - id_fakture
        - poslato_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: sef_faktura.poslata
        id_sef_fakture: "123456"
        id_fakture: "1042"
        iznos: "12000.00"
        valuta: RSD
        poslato_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajSefFakturaPrihvacena:
      type: object
      description: Payload za `sef_faktura.prihvacena` (ranije `sef_invoice.accepted`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: sef_faktura.prihvacena
          description: Event type
          example: sef_faktura.prihvacena
        id_sef_fakture:
          type: string
          description: ID u SEF-u
          example: "123456"
        id_fakture:
          type: string
          description: ID fakture
          example: "1042"
        prihvaceno_u:
          type: string
          format: date-time
          description: Vreme prihvatanja (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_sef_fakture
        - id_fakture
        - prihvaceno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: sef_faktura.prihvacena
        id_sef_fakture: "123456"
        id_fakture: "1042"
        prihvaceno_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajSefFakturaOdbijena:
      type: object
      description: Payload za `sef_faktura.odbijena` (ranije `sef_invoice.rejected`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: sef_faktura.odbijena
          description: Event type
          example: sef_faktura.odbijena
        id_sef_fakture:
          type: string
          description: ID u SEF-u
          example: "123456"
        id_fakture:
          type: string
          description: ID fakture
          example: "1042"
        razlog:
          type: string
          description: Razlog odbijanja kupca
        odbijeno_u:
          type: string
          format: date-time
          description: Vreme odbijanja (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_sef_fakture
        - id_fakture
        - odbijeno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: sef_faktura.odbijena
        id_sef_fakture: "123456"
        id_fakture: "1042"
        odbijeno_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajPretplataObnovljena:
      type: object
      description: Payload za `pretplata.obnovljena` (ranije `subscription.renewed`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: pretplata.obnovljena
          description: Event type
          example: pretplata.obnovljena
        sifra_plana:
          type: string
          description: Plan
          example: srednji
          enum:
            - osnovni
            - srednji
            - napredni
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Cena perioda (decimal string)
          example: "2990.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        vazi_do:
          type: string
          format: date-time
          description: Kraj novog perioda (RFC 3339 sa ofsetom)
          example: 2026-12-02T00:00:00+01:00
        obnovljeno_u:
          type: string
          format: date-time
          description: Vreme obnove (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - sifra_plana
        - iznos
        - valuta
        - vazi_do
        - obnovljeno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: pretplata.obnovljena
        sifra_plana: srednji
        iznos: "2990.00"
        valuta: RSD
        vazi_do: 2026-12-02T00:00:00+01:00
        obnovljeno_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajPretplataUDocnji:
      type: object
      description: Payload za `pretplata.u_docnji` (ranije `subscription.past_due`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: pretplata.u_docnji
          description: Event type
          example: pretplata.u_docnji
        sifra_plana:
          type: string
          description: Plan
          example: srednji
          enum:
            - osnovni
            - srednji
            - napredni
        iznos:
          type: string
          pattern: ^-?\d+\.\d{2}$
          description: Dug (decimal string)
          example: "2990.00"
        valuta:
          type: string
          const: RSD
          description: "Currency (MVP: RSD only)"
          example: RSD
        u_docnji_od:
          type: string
          format: date-time
          description: Pocetak docnje (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - sifra_plana
        - iznos
        - valuta
        - u_docnji_od
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: pretplata.u_docnji
        sifra_plana: srednji
        iznos: "2990.00"
        valuta: RSD
        u_docnji_od: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajPretplataOtkazana:
      type: object
      description: Payload za `pretplata.otkazana` (ranije `subscription.cancelled`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: pretplata.otkazana
          description: Event type
          example: pretplata.otkazana
        sifra_plana:
          type: string
          description: Plan
          example: srednji
          enum:
            - osnovni
            - srednji
            - napredni
        otkazano_u:
          type: string
          format: date-time
          description: Vreme otkazivanja (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - sifra_plana
        - otkazano_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: pretplata.otkazana
        sifra_plana: srednji
        otkazano_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajPotrosnjaUpozorenjeLimita:
      type: object
      description: Payload za `potrosnja.upozorenje_limita` (ranije `usage.limit_warning`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: potrosnja.upozorenje_limita
          description: Event type
          example: potrosnja.upozorenje_limita
        metrika:
          type: string
          description: Sta se meri
          example: profakture
          enum:
            - profakture
            - mesta
            - bankovni_racuni
            - organizacije
        iskorisceno:
          type: integer
          example: 40
        limit:
          type: integer
          example: 50
        procenat:
          type: integer
          example: 80
        period:
          type: string
          description: Billing period
          example: 2026-11
        nastalo_u:
          type: string
          format: date-time
          description: Vreme merenja (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - metrika
        - iskorisceno
        - limit
        - procenat
        - nastalo_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: potrosnja.upozorenje_limita
        metrika: profakture
        iskorisceno: 40
        limit: 50
        procenat: 80
        period: 2026-11
        nastalo_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajPotrosnjaLimitDostignut:
      type: object
      description: Payload za `potrosnja.limit_dostignut` (ranije `usage.limit_reached`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: potrosnja.limit_dostignut
          description: Event type
          example: potrosnja.limit_dostignut
        metrika:
          type: string
          description: Sta se meri
          example: profakture
          enum:
            - profakture
            - mesta
            - bankovni_racuni
            - organizacije
        iskorisceno:
          type: integer
          example: 50
        limit:
          type: integer
          example: 50
        procenat:
          type: integer
          example: 100
        period:
          type: string
          description: Billing period
          example: 2026-11
        nastalo_u:
          type: string
          format: date-time
          description: Vreme merenja (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - metrika
        - iskorisceno
        - limit
        - procenat
        - nastalo_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: potrosnja.limit_dostignut
        metrika: profakture
        iskorisceno: 50
        limit: 50
        procenat: 100
        period: 2026-11
        nastalo_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajOrganizacijaProdukcijaAktivirana:
      type: object
      description: Payload za `organization.produkcija_aktivirana` (ranije `novo u 1.4`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: organizacija.produkcija_aktivirana
          description: Event type
          example: organizacija.produkcija_aktivirana
        id_korisnika:
          type: string
          format: uuid
          description: Ko je aktivirao
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        aktivirano_u:
          type: string
          format: date-time
          description: Vreme aktivacije (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_korisnika
        - aktivirano_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: organizacija.produkcija_aktivirana
        id_korisnika: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        aktivirano_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajOnboardingKorakZavrsen:
      type: object
      description: Payload za `onboarding.korak_zavrsen` (ranije `novo u 1.4`)
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: onboarding.korak_zavrsen
          description: Event type
          example: onboarding.korak_zavrsen
        korak:
          type: string
          description: Korak
          example: banka
          enum:
            - registracija
            - firma
            - plan
            - banka
            - test_profaktura
            - webhook
            - produkcija
        status:
          type: string
          description: Ishod koraka
          example: zavrseno
          enum:
            - zavrseno
            - preskoceno
        procenat:
          type: integer
          minimum: 0
          maximum: 100
          example: 57
        zavrseno_u:
          type: string
          format: date-time
          description: Vreme zavrsetka (RFC 3339 sa ofsetom)
          example: 2026-11-02T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          description: Event ID; identical on every delivery retry (idempotency)
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          description: Environment
          example: live
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          description: Seller organization
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - korak
        - status
        - procenat
        - zavrseno_u
        - id_dogadjaja
        - okruzenje
      additionalProperties: false
      example:
        dogadjaj: onboarding.korak_zavrsen
        korak: banka
        status: zavrseno
        procenat: 57
        zavrseno_u: 2026-11-02T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: live
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    SefOkruzenje:
      type: string
      enum:
        - test
        - live
      description: SEF API okruzenje (demo=test, produkcija=live)
    SefStatus:
      type: string
      enum:
        - nije_poslato
        - u_pripremi
        - poslat
        - prihvacen
        - odbijen
        - greska
        - otkazan
        - storniran
      description: Status slanja racuna ka SEF-u
    SefKljucMaska:
      type: object
      additionalProperties: false
      properties:
        konfigurisano:
          type: boolean
        kljuc_poslednje4:
          type:
            - string
            - "null"
          minLength: 4
          maxLength: 4
          description: Poslednje 4 karaktera API kljuca; null ako nije konfigurisano
          example: "1234"
      required:
        - konfigurisano
        - kljuc_poslednje4
    SefPodesavanja:
      type: object
      additionalProperties: false
      properties:
        objekat:
          type: string
          const: sef_podesavanja
        aktivno_okruzenje:
          $ref: "#/components/schemas/SefOkruzenje"
        test:
          $ref: "#/components/schemas/SefKljucMaska"
        live:
          $ref: "#/components/schemas/SefKljucMaska"
        azurirano:
          type:
            - string
            - "null"
          format: date-time
          readOnly: true
          example: 2026-11-03T09:00:00+01:00
      required:
        - objekat
        - aktivno_okruzenje
        - test
        - live
    SefPodesavanjaIzmena:
      type: object
      additionalProperties: false
      properties:
        okruzenje:
          $ref: "#/components/schemas/SefOkruzenje"
          description: Okruzenje za koje se cuva `api_kljuc`
        api_kljuc:
          type: string
          minLength: 8
          maxLength: 256
          writeOnly: true
          description: SEF API kljuc; cuva se sifrovan (AES-GCM); u odgovoru samo poslednje4
        aktivno_okruzenje:
          $ref: "#/components/schemas/SefOkruzenje"
        potvrda_live:
          type: boolean
          description: Obavezno `true` kada se `aktivno_okruzenje` postavlja na `live`
      description: At least one of `api_kljuc` (with `okruzenje`) or
        `aktivno_okruzenje` must be sent
    SefTestRezultat:
      type: object
      additionalProperties: false
      properties:
        objekat:
          type: string
          const: sef_test
        okruzenje:
          $ref: "#/components/schemas/SefOkruzenje"
        uspesno:
          type: boolean
        poruka:
          type: string
          example: Veza sa SEF demo okruzenjem je uspesna.
      required:
        - objekat
        - okruzenje
        - uspesno
        - poruka
    SefKupacStatus:
      type: object
      additionalProperties: false
      properties:
        objekat:
          type: string
          const: sef_kupac
        pib:
          type: string
          pattern: ^\d{9}$
        registrovan:
          type: boolean
        jbkjs:
          type:
            - string
            - "null"
          description: JBKJS ako je poznat
        izvor:
          type: string
          enum:
            - kes
            - sef
        provereno:
          type: string
          format: date-time
          example: 2026-11-03T09:00:00+01:00
      required:
        - objekat
        - pib
        - registrovan
        - izvor
        - provereno
    DogadjajRacunSefPoslat:
      type: object
      description: Payload za `racun.sef_poslat`
      additionalProperties: false
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: racun.sef_poslat
          example: racun.sef_poslat
        id_racuna:
          type: string
          format: uuid
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        id_fakture:
          type: string
          format: uuid
          description: Isto kao id_racuna (stil webhookova)
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        sef_invoice_id:
          type:
            - string
            - "null"
          example: "123456"
        sef_okruzenje:
          $ref: "#/components/schemas/SefOkruzenje"
        poslato_u:
          type: string
          format: date-time
          example: 2026-11-03T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
          example: 0192e4a2-0000-7000-8000-000000001042
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - dogadjaj
        - id_racuna
        - id_fakture
        - sef_okruzenje
        - poslato_u
        - id_dogadjaja
        - okruzenje
      example:
        dogadjaj: racun.sef_poslat
        id_racuna: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        id_fakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        sef_invoice_id: "123456"
        sef_okruzenje: test
        poslato_u: 2026-11-03T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: sandbox
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajRacunSefPrihvacen:
      type: object
      description: Payload za `racun.sef_prihvacen`
      additionalProperties: false
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: racun.sef_prihvacen
          example: racun.sef_prihvacen
        id_racuna:
          type: string
          format: uuid
        id_fakture:
          type: string
          format: uuid
        sef_invoice_id:
          type:
            - string
            - "null"
        sef_okruzenje:
          $ref: "#/components/schemas/SefOkruzenje"
        prihvaceno_u:
          type: string
          format: date-time
          example: 2026-11-03T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
      required:
        - dogadjaj
        - id_racuna
        - id_fakture
        - sef_okruzenje
        - prihvaceno_u
        - id_dogadjaja
        - okruzenje
      example:
        dogadjaj: racun.sef_prihvacen
        id_racuna: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        id_fakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        sef_invoice_id: "123456"
        sef_okruzenje: test
        prihvaceno_u: 2026-11-03T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: sandbox
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajRacunSefOdbijen:
      type: object
      description: Payload za `racun.sef_odbijen`
      additionalProperties: false
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: racun.sef_odbijen
          example: racun.sef_odbijen
        id_racuna:
          type: string
          format: uuid
        id_fakture:
          type: string
          format: uuid
        sef_invoice_id:
          type:
            - string
            - "null"
        sef_okruzenje:
          $ref: "#/components/schemas/SefOkruzenje"
        razlog:
          type:
            - string
            - "null"
        odbijeno_u:
          type: string
          format: date-time
          example: 2026-11-03T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
      required:
        - dogadjaj
        - id_racuna
        - id_fakture
        - sef_okruzenje
        - odbijeno_u
        - id_dogadjaja
        - okruzenje
      example:
        dogadjaj: racun.sef_odbijen
        id_racuna: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        id_fakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        sef_invoice_id: "123456"
        sef_okruzenje: test
        razlog: Neispravni podaci
        odbijeno_u: 2026-11-03T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: sandbox
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    DogadjajRacunSefGreska:
      type: object
      description: Payload za `racun.sef_greska`
      additionalProperties: false
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          const: racun.sef_greska
          example: racun.sef_greska
        id_racuna:
          type: string
          format: uuid
        id_fakture:
          type: string
          format: uuid
        sef_okruzenje:
          $ref: "#/components/schemas/SefOkruzenje"
        greska:
          type: string
          example: SEF je vratio 500
        desilo_se_u:
          type: string
          format: date-time
          example: 2026-11-03T09:00:03+01:00
        id_dogadjaja:
          type: string
          format: uuid
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
        id_organizacije:
          type: string
          format: uuid
      required:
        - dogadjaj
        - id_racuna
        - id_fakture
        - sef_okruzenje
        - greska
        - desilo_se_u
        - id_dogadjaja
        - okruzenje
      example:
        dogadjaj: racun.sef_greska
        id_racuna: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        id_fakture: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        sef_okruzenje: test
        greska: SEF je vratio 500
        desilo_se_u: 2026-11-03T09:00:03+01:00
        id_dogadjaja: 0192e4a2-0000-7000-8000-000000001042
        okruzenje: sandbox
        id_organizacije: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
    KorakOnboardinga:
      type: string
      enum:
        - registracija
        - firma
        - plan
        - banka
        - test_profaktura
        - webhook
        - produkcija
      description: "Fiksni redosled: registracija -> firma -> plan -> banka ->
        test_profaktura -> webhook -> produkcija"
    StatusKoraka:
      type: string
      enum:
        - nije_zapoceto
        - u_toku
        - zavrseno
        - preskoceno
    OnboardingKorak:
      type: object
      properties:
        korak:
          $ref: "#/components/schemas/KorakOnboardinga"
        redni_broj:
          type: integer
          minimum: 1
          maximum: 7
          example: 4
        status:
          $ref: "#/components/schemas/StatusKoraka"
        moze_se_preskociti:
          type: boolean
          readOnly: true
        preskoceno_razlog:
          type:
            - string
            - "null"
          maxLength: 500
        zavrseno:
          type:
            - string
            - "null"
          format: date-time
          readOnly: true
        azurirano:
          type: string
          format: date-time
          readOnly: true
          example: 2026-11-01T08:00:00Z
        provera:
          type: string
          enum:
            - sistem
            - korisnik
          readOnly: true
          description: sistem = status postavlja server kad je uslov ispunjen; korisnik =
            korisnik oznacava zavrsetak (server i dalje proverava uslov)
        potvrdjuje:
          type:
            - array
            - "null"
          items:
            type: string
            enum:
              - vlasnik
              - administrator
              - knjigovodja
              - posmatrac
          readOnly: true
          description: "Uloge koje smeju da zavrse korak (firma: vlasnik, administrator;
            plan i produkcija: vlasnik)"
          example:
            - vlasnik
            - administrator
      required:
        - korak
        - redni_broj
        - status
        - moze_se_preskociti
        - azurirano
    Onboarding:
      type: object
      properties:
        objekat:
          type: string
          const: onboarding
        organizacija_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
        koraci:
          type: array
          items:
            $ref: "#/components/schemas/OnboardingKorak"
          minItems: 7
          maxItems: 7
        procenat:
          type: integer
          minimum: 0
          maximum: 100
          example: 57
          description: round(100 * (zavrseno + preskoceno) / 7)
        trenutni_korak:
          oneOf:
            - $ref: "#/components/schemas/KorakOnboardinga"
            - type: "null"
          description: Prvi korak koji nije zavrseno/preskoceno; null kad je sve gotovo
        u_produkciji:
          type: boolean
        azurirano:
          type: string
          format: date-time
          readOnly: true
          example: 2026-11-01T08:00:00Z
      required:
        - objekat
        - organizacija_id
        - koraci
        - procenat
        - trenutni_korak
        - u_produkciji
    OnboardingKorakIzmena:
      type: object
      properties:
        status:
          type: string
          enum:
            - u_toku
            - zavrseno
            - preskoceno
        preskoceno_razlog:
          type: string
          minLength: 3
          maxLength: 500
          description: Obavezno kad je status preskoceno
      required:
        - status
    TestEmailBanke:
      type: object
      properties:
        objekat:
          type: string
          const: test_email_banke
        test_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        adresa_za_prijem_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        adresa_za_prosledjivanje:
          type: string
          format: email
          example: lizzard-x7k2@in.uplaceno.rs
          description: Na ovu adresu prosledi bilo koje obavestenje banke o uplati
        status:
          type: string
          enum:
            - ceka
            - primljen
            - parsiran
            - greska
        istice:
          type: string
          format: date-time
          readOnly: true
          example: 2026-11-01T08:00:00Z
        kreirano:
          type: string
          format: date-time
          readOnly: true
          example: 2026-11-01T08:00:00Z
      required:
        - objekat
        - test_id
        - adresa_za_prosledjivanje
        - status
        - istice
    TestEmailBankeStatus:
      type: object
      properties:
        objekat:
          type: string
          const: test_email_banke
        test_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        adresa_za_prijem_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        adresa_za_prosledjivanje:
          type: string
          format: email
          example: lizzard-x7k2@in.uplaceno.rs
          description: Na ovu adresu prosledi bilo koje obavestenje banke o uplati
        status:
          type: string
          enum:
            - ceka
            - primljen
            - parsiran
            - greska
        istice:
          type: string
          format: date-time
          readOnly: true
          example: 2026-11-01T08:00:00Z
        kreirano:
          type: string
          format: date-time
          readOnly: true
          example: 2026-11-01T08:00:00Z
        primljeno:
          type:
            - string
            - "null"
          format: date-time
        posiljalac:
          type:
            - string
            - "null"
          format: email
        dozvoljen_posiljalac:
          type:
            - boolean
            - "null"
        rezultat:
          type:
            - object
            - "null"
          description: Parsirani podaci (status parsiran)
          properties:
            banka:
              type: string
              enum:
                - intesa
                - otp
                - raiffeisen
            iznos:
              type: string
              example: "12000.00"
            platilac:
              type: string
            racun_platioca:
              type: string
            poziv_na_broj:
              type: string
            model_poziva:
              type: string
              example: "97"
            svrha:
              type: string
            proknjizeno:
              type: string
              format: date-time
        greska:
          type:
            - object
            - "null"
          properties:
            kod:
              type: string
              enum:
                - nepoznat_format
                - nepoznat_posiljalac
                - nema_iznosa
                - istekao_test
            poruka:
              type: string
      required:
        - objekat
        - test_id
        - status
    TestProfakturaZahtev:
      type: object
      properties:
        iznos:
          type: string
          pattern: ^\d{1,13}\.\d{2}$
          default: "1200.00"
          example: "1200.00"
        kupac_email:
          type: string
          format: email
          description: Opciono; bez njega se mejl ne salje
    TestProfaktura:
      type: object
      properties:
        objekat:
          type: string
          const: test_profaktura
        profaktura_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        oznaka_broja:
          type: string
          example: PF-0001/2026
        iznos:
          type: string
          example: "1200.00"
        poziv_na_broj:
          $ref: "#/components/schemas/PozivNaBroj"
        url_placanja:
          type: string
          format: uri
          example: https://pay.uplaceno.rs/plati/pt_Xk29aQ
        qr_url:
          type: string
          format: uri
          description: PNG IPS QR (GET /v1/proformas/{id}/qr.png)
        qr_svg:
          type: string
          description: Inline SVG IPS QR (NBS, tag RO:97)
        ips_qr_sadrzaj:
          type: string
          description: Sirovi IPS string
          example: K:PR|V:01|C:1|R:160000000012345678|N:Primer Prodavnica
            DOO|I:RSD1200,00|SF:289|S:Profaktura PF-0001/2026|RO:97...
        simulacija:
          type: string
          description: "Sledeci korak: POST /v1/sandbox/simulacija-uplate sa ovim proformas"
          example: /v1/sandbox/simulacija-uplate
      required:
        - objekat
        - profaktura_id
        - url_placanja
        - qr_url
        - qr_svg
        - poziv_na_broj
        - iznos
    WebhookTestZahtev:
      type: object
      properties:
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
          default: faktura.placena
    WebhookTestRezultat:
      type: object
      properties:
        objekat:
          type: string
          const: webhook_test
        isporuka_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        dogadjaj:
          $ref: "#/components/schemas/TipDogadjaja"
        status_isporuke:
          type: string
          enum:
            - uspesna
            - neuspesna
            - istek_vremena
            - greska_veze
          description: uspesna = bilo koji 2xx
        http_status:
          type:
            - integer
            - "null"
          example: 200
          description: null ako nije stigao odgovor
        trajanje_ms:
          type: integer
          example: 184
        odgovor:
          type:
            - string
            - "null"
          maxLength: 2048
          description: Telo odgovora, skraceno na 2048 bajtova
        odgovor_skracen:
          type: boolean
        poslato_telo:
          type: object
          description: Telo koje je poslato (primer payload-a izabranog dogadjaja,
            okruzenje sandbox)
        poslato:
          type: string
          format: date-time
          readOnly: true
          example: 2026-11-01T08:00:00Z
      required:
        - objekat
        - isporuka_id
        - dogadjaj
        - status_isporuke
        - http_status
        - trajanje_ms
        - odgovor
        - poslato
    ProdukcijaPreduslov:
      type: object
      properties:
        kljuc:
          type: string
          enum:
            - email_potvrdjen
            - firma_podaci_ispravni
            - firma_potvrdjena
            - plan_aktivan
            - bankovni_racun_povezan
            - test_email_banke_parsiran
            - test_profaktura_placena
            - uslovi_prihvaceni
        opis:
          type: string
          example: Test profaktura placena u sandboxu
        proverava:
          type: string
          enum:
            - sistem
            - administrator
          description: sistem = automatska provera; administrator = rucna potvrda
            vlasnika/administratora organization
        status:
          type: string
          enum:
            - ispunjen
            - nije_ispunjen
            - ceka_proveru
        obavezan:
          type: boolean
          description: test_email_banke_parsiran je uvek false (preporuceno, nije
            preduslov za produkciju) - Privremeno (1.4.1), ceka potvrdu.
        korak:
          $ref: "#/components/schemas/KorakOnboardinga"
        poruka:
          type:
            - string
            - "null"
          example: Nijedna test profaktura nije placena.
      required:
        - kljuc
        - opis
        - proverava
        - status
        - obavezan
    ProdukcijaPreduslovi:
      type: object
      properties:
        objekat:
          type: string
          const: produkcija_preduslovi
        svi_ispunjeni:
          type: boolean
        u_produkciji:
          type: boolean
        preduslovi:
          type: array
          items:
            $ref: "#/components/schemas/ProdukcijaPreduslov"
      required:
        - objekat
        - svi_ispunjeni
        - u_produkciji
        - preduslovi
    ProdukcijaAktivacijaZahtev:
      type: object
      properties:
        uslovi_prihvaceni:
          type: boolean
          const: true
          description: Administrator potvrdjuje uslove koriscenja i tacnost podataka firme
      required:
        - uslovi_prihvaceni
    ProdukcijaAktivacija:
      type: object
      properties:
        objekat:
          type: string
          const: produkcija_aktivacija
        organizacija_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        u_produkciji:
          type: boolean
          const: true
        aktivirano:
          type: string
          format: date-time
        aktivirao:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        vec_aktivirano:
          type: boolean
          description: true kad je ponovljen poziv (idempotentno, 200 bez nove akcije)
      required:
        - objekat
        - organizacija_id
        - u_produkciji
        - aktivirano
        - aktivirao
        - vec_aktivirano
    OnboardingPlanZahtev:
      type: object
      properties:
        sifra_plana:
          type: string
          enum:
            - osnovni
            - srednji
            - napredni
          example: osnovni
      required:
        - sifra_plana
    OnboardingPlan:
      type: object
      properties:
        objekat:
          type: string
          const: onboarding_plan
        sifra_plana:
          type: string
          enum:
            - osnovni
            - srednji
            - napredni
        status_naplate:
          type: string
          enum:
            - nije_pokrenuta
          description: "MVP: naplata se pokrece kasnije (posle aktivacije produkcije);
            izbor ne skida novac"
        izabrano:
          type: string
          format: date-time
          readOnly: true
          example: 2026-11-01T08:00:00Z
        izabrao:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        onboarding:
          $ref: "#/components/schemas/Onboarding"
      required:
        - objekat
        - sifra_plana
        - status_naplate
        - izabrano
        - izabrao
        - onboarding
    WebhookEndpoint:
      type: object
      properties:
        objekat:
          type: string
          const: webhook_endpoint
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        url:
          type: string
          format: uri
          pattern: ^https://
          example: https://primer.rs/uplaceno/webhook
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
        aktivan:
          type: boolean
        tajna_za_potpis:
          type:
            - string
            - "null"
          readOnly: true
          description: "`whsec_...`; vraca se SAMO u odgovoru na POST, kasnije null"
          example: whsec_9fK2...
        kreirano:
          type: string
          format: date-time
          readOnly: true
          example: 2026-11-01T08:00:00Z
      required:
        - objekat
        - id
        - url
        - okruzenje
        - aktivan
        - kreirano
    WebhookEndpointKreiranje:
      type: object
      properties:
        url:
          type: string
          format: uri
          pattern: ^https://
          maxLength: 2048
          description: Samo HTTPS (u sandboxu dozvoljen i http://localhost)
      required:
        - url
    WebhookEndpointLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/WebhookEndpoint"
          maxItems: 1
      required:
        - objekat
        - podaci
    FirmaPotvrdaZahtev:
      type: object
      properties:
        podaci_tacni:
          type: boolean
          const: true
          description: Potvrdjujem da su naziv, PIB, maticni broj, adresa i tekuci racun
            tacni
      required:
        - podaci_tacni
    FirmaPotvrda:
      type: object
      properties:
        objekat:
          type: string
          const: firma_potvrda
        organizacija_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        potvrdjeno:
          type: string
          format: date-time
          readOnly: true
          example: 2026-11-01T08:00:00Z
        potvrdio:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        uloga_potvrdioca:
          type: string
          enum:
            - vlasnik
            - administrator
        onboarding:
          $ref: "#/components/schemas/Onboarding"
      required:
        - objekat
        - organizacija_id
        - potvrdjeno
        - potvrdio
        - uloga_potvrdioca
        - onboarding
    PoreskiStatus:
      type: string
      enum:
        - pdv_obveznik
        - pausalac
      x-privremeno: true
      description: Privremeno (1.4.2), ceka potvrdu. pdv_obveznik <=>
        `u_sistemu_pdv=true` (stope 10/20); pausalac <=> `u_sistemu_pdv=false`
        (bez PDV-a, racun kao PDF). Server drzi oba polja uskladjena.
    TipKupca:
      type: string
      enum:
        - fizicko_lice
        - pravno_lice
      x-privremeno: true
      description: "Privremeno (1.4.2), ceka potvrdu. pravno_lice (preduzetnik ili
        firma) zahteva `pib` (9 cifara) i `maticni_broj` (8 cifara); nedostaju:
        `422 nedostaju_podaci_pravnog_lica`."
    NacinIzdavanja:
      type: string
      enum:
        - e_faktura_sef
        - fiskalni_racun
        - pdf_racun
      x-privremeno: true
      description: >+
        Privremeno (1.4.2), ceka potvrdu. Izvodi se na serveru, klijent ga ne
        salje.


        | organization | Kupac (`tip_kupca`) | `nacini_izdavanja` |

        |---|---|---|

        | pdv_obveznik | pravno_lice | e_faktura_sef |

        | pdv_obveznik | fizicko_lice | fiskalni_racun |

        | pausalac, `u_fiskalizaciji=false` | bilo koji | pdf_racun |

        | pausalac, `u_fiskalizaciji=true` | bilo koji | pdf_racun,
        fiskalni_racun |

    VrstaDokumenta:
      type: string
      enum:
        - predracun
        - faktura
        - e_faktura
        - fiskalni_racun
      x-privremeno: true
      description: Vrsta dokumenta za sablon. `predracun` nije poreska isprava.
    OnboardingPoreskiStatusZahtev:
      type: object
      properties:
        poreski_status:
          $ref: "#/components/schemas/PoreskiStatus"
        u_fiskalizaciji:
          type: boolean
          default: false
          x-privremeno: true
          description: organization je u sistemu fiskalizacije (ESIR/PFR). Za pausalca
            dodaje `fiskalni_racun` uz `pdf_racun`; PDV obveznik izdaje fiskalni
            racun fizickim licima nezavisno od ovog polja.
      required:
        - poreski_status
      example:
        poreski_status: pausalac
        u_fiskalizaciji: true
      x-privremeno: true
    OnboardingPoreskiStatus:
      type: object
      properties:
        objekat:
          type: string
          const: onboarding_poreski_status
        poreski_status:
          $ref: "#/components/schemas/PoreskiStatus"
        u_sistemu_pdv:
          type: boolean
        izabrano:
          type: string
          format: date-time
          readOnly: true
          example: 2026-11-01T08:00:00Z
        onboarding:
          $ref: "#/components/schemas/Onboarding"
        u_fiskalizaciji:
          type: boolean
        nacini_izdavanja:
          type: object
          readOnly: true
          description: Izvedeni nacini po tipu kupca
          properties:
            fizicko_lice:
              type: array
              items:
                $ref: "#/components/schemas/NacinIzdavanja"
            pravno_lice:
              type: array
              items:
                $ref: "#/components/schemas/NacinIzdavanja"
          example:
            fizicko_lice:
              - pdf_racun
              - fiskalni_racun
            pravno_lice:
              - pdf_racun
              - fiskalni_racun
      required:
        - objekat
        - poreski_status
        - u_sistemu_pdv
        - izabrano
        - u_fiskalizaciji
      x-privremeno: true
    Racun:
      type: object
      properties:
        objekat:
          type: string
          const: racun
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        okruzenje:
          type: string
          enum:
            - live
            - sandbox
          readOnly: true
        broj:
          type: string
          example: R-0001/2026
        profaktura_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        uplata_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        kupac_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        tip_kupca:
          $ref: "#/components/schemas/TipKupca"
        nacin_izdavanja:
          allOf:
            - $ref: "#/components/schemas/NacinIzdavanja"
          readOnly: true
          description: >+
            Izveden (jedan racun = jedan nacin; pausalac u fiskalizaciji dobija
            dva racuna: pdf_racun i fiskalni_racun).


            | organization | Kupac (`tip_kupca`) | `nacini_izdavanja` |

            |---|---|---|

            | pdv_obveznik | pravno_lice | e_faktura_sef |

            | pdv_obveznik | fizicko_lice | fiskalni_racun |

            | pausalac, `u_fiskalizaciji=false` | bilo koji | pdf_racun |

            | pausalac, `u_fiskalizaciji=true` | bilo koji | pdf_racun,
            fiskalni_racun |

        status:
          type: string
          enum:
            - u_obradi
            - izdat
            - poslat_u_sef
            - prihvacen_u_sef
            - odbijen_u_sef
            - fiskalizovan
            - greska
        iznos:
          type: string
          example: "12000.00"
        iznos_pdv:
          type: string
          example: "2000.00"
        sablon_id:
          type:
            - string
            - "null"
          format: uuid
        sef_id:
          type:
            - string
            - "null"
          example: "123456"
        sef_status:
          allOf:
            - $ref: "#/components/schemas/SefStatus"
          readOnly: true
          description: Status slanja na SEF
        sef_invoice_id:
          type:
            - string
            - "null"
          readOnly: true
          description: ID fakture u SEF-u
          example: "123456"
        sef_okruzenje:
          type:
            - string
            - "null"
          enum:
            - test
            - live
            - null
          readOnly: true
          description: SEF okruzenje u kom je racun poslat
        sef_greska:
          type:
            - string
            - "null"
          readOnly: true
          description: Poslednja greska sa SEF-a
        fiskalni_broj:
          type:
            - string
            - "null"
          example: ABCD1234-ABCD1234-1042
        pdf_url:
          type:
            - string
            - "null"
          format: uri
        izdato:
          type:
            - string
            - "null"
          format: date-time
        kreirano:
          type: string
          format: date-time
          readOnly: true
          example: 2026-11-01T08:00:00Z
        nacini_izdavanja:
          type: array
          items:
            $ref: "#/components/schemas/NacinIzdavanja"
          readOnly: true
          x-privremeno: true
          example:
            - e_faktura_sef
          description: >+
            Izveden, klijent ga ne salje.


            | organization | Kupac (`tip_kupca`) | `nacini_izdavanja` |

            |---|---|---|

            | pdv_obveznik | pravno_lice | e_faktura_sef |

            | pdv_obveznik | fizicko_lice | fiskalni_racun |

            | pausalac, `u_fiskalizaciji=false` | bilo koji | pdf_racun |

            | pausalac, `u_fiskalizaciji=true` | bilo koji | pdf_racun,
            fiskalni_racun |

      required:
        - objekat
        - id
        - broj
        - profaktura_id
        - uplata_id
        - nacin_izdavanja
        - status
        - iznos
        - kreirano
      description: >+
        Privremeno (1.4.2), ceka potvrdu. Izdat racun. Nastaje automatski posle
        uparene uplate; nema POST. **Pravilo izdavanja**: racun/faktura se
        izdaje TEK POSLE uparene uplate. Pre uplate postoji samo predracun
        (proforma, naslov `Predracun` ili `Zahtev za placanje`) koji NIJE
        poreska isprava i nosi napomenu `Ovo nije poreska isprava`. Nacin
        izdavanja se IZVODI (klijent ga ne salje) iz `poreski_status` i
        `u_fiskalizaciji` organization i `tip_kupca`:


        | organization | Kupac (`tip_kupca`) | `nacini_izdavanja` |

        |---|---|---|

        | pdv_obveznik | pravno_lice | e_faktura_sef |

        | pdv_obveznik | fizicko_lice | fiskalni_racun |

        | pausalac, `u_fiskalizaciji=false` | bilo koji | pdf_racun |

        | pausalac, `u_fiskalizaciji=true` | bilo koji | pdf_racun,
        fiskalni_racun |

      example:
        objekat: racun
        id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        broj: R-0001/2026
        profaktura_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e02
        uplata_id: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e03
        tip_kupca: pravno_lice
        nacin_izdavanja: e_faktura_sef
        nacini_izdavanja:
          - e_faktura_sef
        status: poslat_u_sef
        iznos: "12000.00"
        kreirano: 2026-11-02T09:00:00+01:00
      x-privremeno: true
    RacunLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/Racun"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
      required:
        - objekat
        - podaci
        - ima_jos
      x-privremeno: true
    SablonPolje:
      type: object
      properties:
        polje:
          type: string
          enum:
            - logo
            - podaci_prodavca
            - podaci_kupca
            - broj_i_datum
            - stavke
            - zbir
            - pdv_rekapitulacija
            - ips_qr
            - uputstvo_za_placanje
            - napomena
            - potpis
            - podnozje
        vidljivo:
          type: boolean
          default: true
        redosled:
          type: integer
          minimum: 1
          example: 1
        oznaka:
          type:
            - string
            - "null"
          maxLength: 80
          description: Prilagodjen naslov sekcije
        okvir:
          description: "Slobodan raspored na A4 (210 × 297 mm), poreklo je gornji levi
            ugao. Celi milimetri. `null` ili izostavljen okvir znaci da blok
            nije postavljen. Kad je postavljen: `sirina` i `visina` su najmanje
            8, a kutija staje na stranicu (`x + sirina` ≤ 210, `y + visina` ≤
            297). Pisati sme samo plan Napredni."
          type:
            - object
            - "null"
          properties:
            x:
              type: integer
              minimum: 0
            y:
              type: integer
              minimum: 0
            sirina:
              type: integer
              minimum: 0
            visina:
              type: integer
              minimum: 0
          required:
            - x
            - y
            - sirina
            - visina
        sloj:
          type: integer
          minimum: 0
          maximum: 200
          description: Redosled crtanja. Veci sloj je iznad. Pisati sme samo plan Napredni.
        stil:
          type: object
          description: Izgled bloka. Pisati sme samo plan Napredni.
          properties:
            font:
              type: string
              enum:
                - inter
                - bebas
                - jetbrains
            velicina:
              type: integer
              minimum: 8
              maximum: 48
            podebljano:
              type: boolean
            kurziv:
              type: boolean
            link:
              type:
                - string
                - "null"
              maxLength: 200
            sajt:
              type:
                - string
                - "null"
              maxLength: 200
      required:
        - polje
        - redosled
      x-privremeno: true
    SablonBoje:
      type: object
      properties:
        primarna:
          type: string
          pattern: ^#[0-9A-Fa-f]{6}$
          example: "#0B5FFF"
        sekundarna:
          type: string
          pattern: ^#[0-9A-Fa-f]{6}$
          example: "#111827"
        akcenat:
          type:
            - string
            - "null"
          pattern: ^#[0-9A-Fa-f]{6}$
          example: "#F59E0B"
        tekst:
          type: string
          pattern: ^#[0-9A-Fa-f]{6}$
          default: "#111827"
      x-privremeno: true
    PozicijaQr:
      type: string
      enum:
        - gore_desno
        - dole_desno
        - dole_levo
        - uz_zbir
        - skriveno
      default: dole_desno
      description: Pozicija IPS QR koda; `skriveno` nije dozvoljeno za `predracun`.
      x-privremeno: true
    SablonDokumenta:
      type: object
      properties:
        objekat:
          type: string
          const: sablon_dokumenta
        id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        organizacija_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
        naziv:
          type: string
          maxLength: 120
          example: Osnovni plavi
        vrsta_dokumenta:
          $ref: "#/components/schemas/VrstaDokumenta"
        naslov:
          type: string
          maxLength: 60
          example: Predracun
          description: "Za `predracun`: `Predracun` ili `Zahtev za placanje`"
        boje:
          $ref: "#/components/schemas/SablonBoje"
        font:
          type: string
          enum:
            - inter
            - roboto
            - noto_serif
          default: inter
        polja:
          type: array
          items:
            $ref: "#/components/schemas/SablonPolje"
          description: Lista polja i njihov redosled
        pozicija_qr:
          $ref: "#/components/schemas/PozicijaQr"
        margina_mm:
          type: integer
          minimum: 8
          maximum: 25
          default: 12
          description: Margina stranice u milimetrima. Podrazumevano 12. Pisati sme samo
            plan Napredni.
        napomena:
          type:
            - string
            - "null"
          maxLength: 1000
          description: Za `predracun` server uvek dodaje `Ovo nije poreska isprava`
        podnozje:
          type:
            - string
            - "null"
          maxLength: 500
        jezik:
          type: string
          enum:
            - sr-Latn
            - sr-Cyrl
          default: sr-Latn
        logo_url:
          type:
            - string
            - "null"
          format: uri
          readOnly: true
        podrazumevani:
          type: boolean
          readOnly: true
        verzija:
          type: integer
          readOnly: true
          example: 3
        kreirano:
          type: string
          format: date-time
          readOnly: true
          example: 2026-11-01T08:00:00Z
        azurirano:
          type: string
          format: date-time
          readOnly: true
          example: 2026-11-01T08:00:00Z
        izmenio:
          type: string
          readOnly: true
          maxLength: 120
          description: Ime ili email osobe koja je poslednja sacuvala sablon.
      required:
        - objekat
        - id
        - naziv
        - vrsta_dokumenta
        - boje
        - polja
        - pozicija_qr
        - podrazumevani
        - kreirano
      description: Privremeno (1.4.2), ceka potvrdu. Sablon dokumenta organization
        (Studio racuna).
      x-privremeno: true
    SablonDokumentaKreiranje:
      type: object
      properties:
        naziv:
          type: string
          maxLength: 120
          example: Osnovni plavi
        vrsta_dokumenta:
          $ref: "#/components/schemas/VrstaDokumenta"
        naslov:
          type: string
          maxLength: 60
          example: Predracun
          description: "Za `predracun`: `Predracun` ili `Zahtev za placanje`"
        boje:
          $ref: "#/components/schemas/SablonBoje"
        font:
          type: string
          enum:
            - inter
            - roboto
            - noto_serif
          default: inter
        polja:
          type: array
          items:
            $ref: "#/components/schemas/SablonPolje"
          description: Lista polja i njihov redosled
        pozicija_qr:
          $ref: "#/components/schemas/PozicijaQr"
        margina_mm:
          type: integer
          minimum: 8
          maximum: 25
          default: 12
          description: Margina stranice u milimetrima. Podrazumevano 12. Pisati sme samo
            plan Napredni.
        napomena:
          type:
            - string
            - "null"
          maxLength: 1000
          description: Za `predracun` server uvek dodaje `Ovo nije poreska isprava`
        podnozje:
          type:
            - string
            - "null"
          maxLength: 500
        jezik:
          type: string
          enum:
            - sr-Latn
            - sr-Cyrl
          default: sr-Latn
      required:
        - naziv
        - vrsta_dokumenta
      x-privremeno: true
    SablonDokumentaIzmena:
      type: object
      properties:
        naziv:
          type: string
          maxLength: 120
          example: Osnovni plavi
        naslov:
          type: string
          maxLength: 60
          example: Predracun
          description: "Za `predracun`: `Predracun` ili `Zahtev za placanje`"
        boje:
          $ref: "#/components/schemas/SablonBoje"
        font:
          type: string
          enum:
            - inter
            - roboto
            - noto_serif
          default: inter
        polja:
          type: array
          items:
            $ref: "#/components/schemas/SablonPolje"
          description: Lista polja i njihov redosled
        pozicija_qr:
          $ref: "#/components/schemas/PozicijaQr"
        margina_mm:
          type: integer
          minimum: 8
          maximum: 25
          default: 12
          description: Margina stranice u milimetrima. Podrazumevano 12. Pisati sme samo
            plan Napredni.
        napomena:
          type:
            - string
            - "null"
          maxLength: 1000
          description: Za `predracun` server uvek dodaje `Ovo nije poreska isprava`
        podnozje:
          type:
            - string
            - "null"
          maxLength: 500
        jezik:
          type: string
          enum:
            - sr-Latn
            - sr-Cyrl
          default: sr-Latn
      x-privremeno: true
    SablonDokumentaLista:
      type: object
      properties:
        objekat:
          type: string
          const: lista
        podaci:
          type: array
          items:
            $ref: "#/components/schemas/SablonDokumenta"
        ima_jos:
          type: boolean
        sledeci_kursor:
          type:
            - string
            - "null"
      required:
        - objekat
        - podaci
        - ima_jos
      x-privremeno: true
    PodrazumevaniSabloni:
      type: object
      properties:
        objekat:
          type: string
          const: podrazumevani_sabloni
        predracun:
          type:
            - string
            - "null"
          format: uuid
        faktura:
          type:
            - string
            - "null"
          format: uuid
        e_faktura:
          type:
            - string
            - "null"
          format: uuid
        fiskalni_racun:
          type:
            - string
            - "null"
          format: uuid
      required:
        - objekat
      x-privremeno: true
    PodrazumevaniSablonZahtev:
      type: object
      properties:
        vrsta_dokumenta:
          $ref: "#/components/schemas/VrstaDokumenta"
        sablon_id:
          type: string
          format: uuid
          description: UUID v7
          example: 0192e4a1-7c3b-7d4e-9a10-3f5b2c8d9e01
      required:
        - vrsta_dokumenta
        - sablon_id
      x-privremeno: true
    PregledSablonaZahtev:
      type: object
      properties:
        format:
          type: string
          enum:
            - pdf
            - html
          default: pdf
        izmene:
          $ref: "#/components/schemas/SablonDokumentaIzmena"
          description: Nesacuvane izmene koje se primenjuju samo na pregled
        primer_podataka:
          type: object
          additionalProperties: true
          description: Primer podataka (kupac, stavke, iznos); bez njega server koristi
            ugradjeni primer
          example:
            kupac:
              naziv: TEST KUPAC
            stavke:
              - naziv: Usluga
                kolicina: "1"
                cena: "10000.00"
                stopa_pdv: 20
      x-privremeno: true
    LogoOtpremanje:
      type: object
      properties:
        logo:
          type: string
          contentMediaType: image/png
          description: PNG, JPEG ili SVG, najvise 1 MB, preporuceno 600x200
      required:
        - logo
      x-privremeno: true
    WebhookEndpointIzmena:
      type: object
      properties:
        url:
          type: string
          format: uri
          pattern: ^https://
          maxLength: 2048
        aktivan:
          type: boolean
      x-privremeno: true
    WebhookRotacijaZahtev:
      type: object
      properties:
        stara_vazi_sekundi:
          type: integer
          minimum: 0
          maximum: 86400
          default: 3600
          description: Koliko dugo i stara tajna vazi (potpis nosi oba v1)
      x-privremeno: true
    ProfakturaKreiranje:
      type: object
      properties:
        kupac_id:
          type: string
          format: uuid
          description: Existing customer (or inline `kupac`)
        kupac:
          $ref: "#/components/schemas/KupacKreiranje"
        stavke:
          type: array
          minItems: 1
          maxItems: 200
          items:
            $ref: "#/components/schemas/StavkaUnos"
        bankovni_racun_id:
          type: string
          format: uuid
          description: "Default: default bank account"
        eksterna_oznaka:
          type: string
          maxLength: 128
        vazi_do:
          type: string
          format: date
          example: 2026-11-15
        rok_placanja:
          type: string
          format: date
          example: 2026-11-15
        napomena:
          type: string
          maxLength: 2000
        posalji_mejl:
          type: boolean
          default: true
          description: Automatically emails the customer with the /pay link
        metapodaci:
          $ref: "#/components/schemas/Metapodaci"
        tip_kupca:
          $ref: "#/components/schemas/TipKupca"
      required:
        - stavke
        - tip_kupca
      description: >+
        Privremeno (1.4.2), ceka potvrdu. Kreiranje predracuna. `tip_kupca` je
        required i mora da se poklapa sa `kupac.tip_kupca` (if/then u
        KupacKreiranje); za `pravno_lice` inline `kupac` mora imati `pib` i
        `maticni_broj` (ili `kupac_id` postojeceg kupca sa njima, inace `422
        nedostaju_podaci_pravnog_lica`). **Pravilo izdavanja**: racun/faktura se
        izdaje TEK POSLE uparene uplate. Pre uplate postoji samo predracun
        (proforma, naslov `Predracun` ili `Zahtev za placanje`) koji NIJE
        poreska isprava i nosi napomenu `Ovo nije poreska isprava`. Nacin
        izdavanja se IZVODI (klijent ga ne salje) iz `poreski_status` i
        `u_fiskalizaciji` organization i `tip_kupca`:


        | organization | Kupac (`tip_kupca`) | `nacini_izdavanja` |

        |---|---|---|

        | pdv_obveznik | pravno_lice | e_faktura_sef |

        | pdv_obveznik | fizicko_lice | fiskalni_racun |

        | pausalac, `u_fiskalizaciji=false` | bilo koji | pdf_racun |

        | pausalac, `u_fiskalizaciji=true` | bilo koji | pdf_racun,
        fiskalni_racun |

      x-privremeno: true
      example:
        tip_kupca: pravno_lice
        kupac:
          tip_kupca: pravno_lice
          naziv: Kupac DOO
          pib: "101234567"
          maticni_broj: "21876543"
        stavke:
          - opis: Izrada sajta
            kolicina: "1"
            jedinicna_cena: "12000.00"
            stopa_pdv: "20"
  headers:
    RateLimit-Limit:
      description: Kvota u tekucem prozoru
      schema:
        type: integer
        example: 600
    RateLimit-Remaining:
      description: Preostalo zahteva u prozoru
      schema:
        type: integer
        example: 598
    RateLimit-Reset:
      description: Sekundi do resetovanja prozora
      schema:
        type: integer
        example: 42
webhooks:
  profaktura.kreirana:
    post:
      operationId: webhook_profaktura_kreirana
      summary: profaktura.kreirana
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `proinvoice.created`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajProfakturaKreirana"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  profaktura.izdata:
    post:
      operationId: webhook_profaktura_izdata
      summary: profaktura.izdata
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `proinvoice.issued`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajProfakturaIzdata"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  profaktura.poslata:
    post:
      operationId: webhook_profaktura_poslata
      summary: profaktura.poslata
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `proinvoice.sent`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajProfakturaPoslata"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  profaktura.pregledana:
    post:
      operationId: webhook_profaktura_pregledana
      summary: profaktura.pregledana
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `proinvoice.viewed`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajProfakturaPregledana"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  profaktura.izmenjena:
    post:
      operationId: webhook_profaktura_izmenjena
      summary: profaktura.izmenjena
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `proinvoice.updated`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajProfakturaIzmenjena"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  profaktura.ponovo_izdata:
    post:
      operationId: webhook_profaktura_ponovo_izdata
      summary: profaktura.ponovo_izdata
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `proinvoice.reissued`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajProfakturaPonovoIzdata"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  profaktura.delimicno_placena:
    post:
      operationId: webhook_profaktura_delimicno_placena
      summary: profaktura.delimicno_placena
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `proinvoice.partially_paid`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajProfakturaDelimicnoPlacena"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  profaktura.placena:
    post:
      operationId: webhook_profaktura_placena
      summary: profaktura.placena
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `proinvoice.paid`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookDogadjajEnvelope"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  profaktura.istekla:
    post:
      operationId: webhook_profaktura_istekla
      summary: profaktura.istekla
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `proinvoice.expired`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajProfakturaIstekla"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  profaktura.otkazana:
    post:
      operationId: webhook_profaktura_otkazana
      summary: profaktura.otkazana
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `proinvoice.cancelled`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajProfakturaOtkazana"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  profaktura.konvertovana:
    post:
      operationId: webhook_profaktura_konvertovana
      summary: profaktura.konvertovana
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `proinvoice.converted`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajProfakturaKonvertovana"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  faktura.kreirana:
    post:
      operationId: webhook_faktura_kreirana
      summary: faktura.kreirana
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `invoice.created`. Privremeno (1.4.2), ceka potvrdu. Resurs: `GET
        /v1/racuni/{id}` (izdat racun posle uparene uplate)."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajFakturaKreirana"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-privremeno: true
  faktura.izmenjena:
    post:
      operationId: webhook_faktura_izmenjena
      summary: faktura.izmenjena
      description: "**In preparation** (no REST resource yet; payload may change).
        Sent as POST to the registered seller webhook URL. Former name:
        `invoice.updated`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajFakturaIzmenjena"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-status: u_pripremi
  faktura.otkazana:
    post:
      operationId: webhook_faktura_otkazana
      summary: faktura.otkazana
      description: "**In preparation** (no REST resource yet; payload may change).
        Sent as POST to the registered seller webhook URL. Former name:
        `invoice.cancelled`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajFakturaOtkazana"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-status: u_pripremi
  faktura.privremeno_placena:
    post:
      operationId: webhook_faktura_privremeno_placena
      summary: faktura.privremeno_placena
      description: "**In preparation** (no REST resource yet; payload may change).
        Sent as POST to the registered seller webhook URL. Former name:
        `invoice.temporary_paid`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajFakturaPrivremenoPlacena"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-status: u_pripremi
  faktura.privremeno_placanje_isteklo:
    post:
      operationId: webhook_faktura_privremeno_placanje_isteklo
      summary: faktura.privremeno_placanje_isteklo
      description: "**In preparation** (no REST resource yet; payload may change).
        Sent as POST to the registered seller webhook URL. Former name:
        `invoice.temporary_expired`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajFakturaPrivremenoPlacanjeIsteklo"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-status: u_pripremi
  faktura.delimicno_placena:
    post:
      operationId: webhook_faktura_delimicno_placena
      summary: faktura.delimicno_placena
      description: "**In preparation** (no REST resource yet; payload may change).
        Sent as POST to the registered seller webhook URL. Former name:
        `invoice.partially_paid`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajFakturaDelimicnoPlacena"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-status: u_pripremi
  faktura.placena:
    post:
      operationId: webhook_faktura_placena
      summary: faktura.placena
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `invoice.paid`. Privremeno (1.4.2), ceka potvrdu. Resurs: `GET
        /v1/racuni/{id}` (izdat racun posle uparene uplate)."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajFakturaPlacena"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-privremeno: true
  faktura.preplacena:
    post:
      operationId: webhook_faktura_preplacena
      summary: faktura.preplacena
      description: "**In preparation** (no REST resource yet; payload may change).
        Sent as POST to the registered seller webhook URL. Former name:
        `invoice.overpaid`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajFakturaPreplacena"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-status: u_pripremi
  faktura.u_docnji:
    post:
      operationId: webhook_faktura_u_docnji
      summary: faktura.u_docnji
      description: "**In preparation** (no REST resource yet; payload may change).
        Sent as POST to the registered seller webhook URL. Former name:
        `invoice.overdue`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajFakturaUDocnji"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-status: u_pripremi
  uplata.primljena:
    post:
      operationId: webhook_uplata_primljena
      summary: uplata.primljena
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `payment.received`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajUplataPrimljena"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  uplata.uparena:
    post:
      operationId: webhook_uplata_uparena
      summary: uplata.uparena
      description: "**Beta (target)**. Same event from automatic matching, manual
        matching, or an approved proof; `podaci.uplata.nacin_uparivanja`:
        automatsko|rucno|potvrda."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Dogadjaj
          in: header
          required: true
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Pokusaj
          in: header
          required: true
          schema:
            type: integer
            minimum: 1
            maximum: 8
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` ili dva `v1` pri rotaciji tajne; HMAC-SHA256
            nad `"<t>.<sirovo telo>"`'
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookDogadjajEnvelope"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-status: beta
  uplata.uparivanje_ponisteno:
    post:
      operationId: webhook_uplata_uparivanje_ponisteno
      summary: uplata.uparivanje_ponisteno
      description: "**Beta (target)**. Matching undone; proforma restored to the
        previous payment status."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Dogadjaj
          in: header
          required: true
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Pokusaj
          in: header
          required: true
          schema:
            type: integer
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookDogadjajEnvelope"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-status: beta
  uplata.neuparena:
    post:
      operationId: webhook_uplata_neuparena
      summary: uplata.neuparena
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `payment.unmatched`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajUplataNeuparena"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  potvrda_uplate.prihvacena:
    post:
      operationId: webhook_potvrda_uplate_prihvacena
      summary: potvrda_uplate.prihvacena
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `payment_proof.accepted`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajPotvrdaUplatePrihvacena"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  potvrda_uplate.odbijena:
    post:
      operationId: webhook_potvrda_uplate_odbijena
      summary: potvrda_uplate.odbijena
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `payment_proof.rejected`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajPotvrdaUplateOdbijena"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  fiskalni_racun.izdat:
    post:
      operationId: webhook_fiskalni_racun_izdat
      summary: fiskalni_racun.izdat
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `fiscal_receipt.issued`. Privremeno (1.4.2), ceka potvrdu. Resurs:
        `GET /v1/racuni/{id}` (izdat racun posle uparene uplate)."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajFiskalniRacunIzdat"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-privremeno: true
  fiskalni_racun.neuspesan:
    post:
      operationId: webhook_fiskalni_racun_neuspesan
      summary: fiskalni_racun.neuspesan
      description: "**In preparation** (no REST resource yet; payload may change).
        Sent as POST to the registered seller webhook URL. Former name:
        `fiscal_receipt.failed`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajFiskalniRacunNeuspesan"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-status: u_pripremi
  sef_faktura.poslata:
    post:
      operationId: webhook_sef_faktura_poslata
      summary: sef_faktura.poslata
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `sef_invoice.sent`. Privremeno (1.4.2), ceka potvrdu. Resurs: `GET
        /v1/racuni/{id}` (izdat racun posle uparene uplate)."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajSefFakturaPoslata"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-privremeno: true
  sef_faktura.prihvacena:
    post:
      operationId: webhook_sef_faktura_prihvacena
      summary: sef_faktura.prihvacena
      description: "**In preparation** (no REST resource yet; payload may change).
        Sent as POST to the registered seller webhook URL. Former name:
        `sef_invoice.accepted`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajSefFakturaPrihvacena"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-status: u_pripremi
  sef_faktura.odbijena:
    post:
      operationId: webhook_sef_faktura_odbijena
      summary: sef_faktura.odbijena
      description: "**In preparation** (no REST resource yet; payload may change).
        Sent as POST to the registered seller webhook URL. Former name:
        `sef_invoice.rejected`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajSefFakturaOdbijena"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
      x-status: u_pripremi
  pretplata.obnovljena:
    post:
      operationId: webhook_pretplata_obnovljena
      summary: pretplata.obnovljena
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `subscription.renewed`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajPretplataObnovljena"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  pretplata.u_docnji:
    post:
      operationId: webhook_pretplata_u_docnji
      summary: pretplata.u_docnji
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `subscription.past_due`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajPretplataUDocnji"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  pretplata.otkazana:
    post:
      operationId: webhook_pretplata_otkazana
      summary: pretplata.otkazana
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `subscription.cancelled`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajPretplataOtkazana"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  potrosnja.upozorenje_limita:
    post:
      operationId: webhook_potrosnja_upozorenje_limita
      summary: potrosnja.upozorenje_limita
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `usage.limit_warning`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajPotrosnjaUpozorenjeLimita"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  potrosnja.limit_dostignut:
    post:
      operationId: webhook_potrosnja_limit_dostignut
      summary: potrosnja.limit_dostignut
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `usage.limit_reached`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajPotrosnjaLimitDostignut"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  organizacija.produkcija_aktivirana:
    post:
      operationId: webhook_organizacija_produkcija_aktivirana
      summary: organizacija.produkcija_aktivirana
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `novo u 1.4`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajOrganizacijaProdukcijaAktivirana"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  onboarding.korak_zavrsen:
    post:
      operationId: webhook_onboarding_korak_zavrsen
      summary: onboarding.korak_zavrsen
      description: "Salje se kao POST na registrovani webhook URL prodavca. Ranije
        ime: `novo u 1.4`."
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajOnboardingKorakZavrsen"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  racun.sef_poslat:
    post:
      operationId: webhook_racun_sef_poslat
      summary: racun.sef_poslat
      description: Salje se kao POST na registrovani webhook URL prodavca kada je
        racun uspesno poslat na SEF.
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajRacunSefPoslat"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  racun.sef_prihvacen:
    post:
      operationId: webhook_racun_sef_prihvacen
      summary: racun.sef_prihvacen
      description: Salje se kada kupac prihvati e-fakturu na SEF-u.
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajRacunSefPrihvacen"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  racun.sef_odbijen:
    post:
      operationId: webhook_racun_sef_odbijen
      summary: racun.sef_odbijen
      description: Salje se kada kupac odbije e-fakturu na SEF-u.
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajRacunSefOdbijen"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
  racun.sef_greska:
    post:
      operationId: webhook_racun_sef_greska
      summary: racun.sef_greska
      description: Salje se kada slanje ili obrada na SEF-u ne uspe.
      tags:
        - Webhookovi
      parameters:
        - name: X-Uplaceno-Potpis
          in: header
          required: true
          description: '`t=<unix>,v1=<hex>` or two `v1` values while rotating the secret;
            HMAC-SHA256 with secret over `"<t>.<raw body>"`; reject `t` older
            than 5 min'
          schema:
            type: string
        - name: X-Uplaceno-Id-Dogadjaja
          in: header
          required: true
          description: Same as `id_dogadjaja` in the body
          schema:
            type: string
            format: uuid
        - name: X-Uplaceno-Okruzenje
          in: header
          required: true
          schema:
            type: string
            enum:
              - live
              - sandbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DogadjajRacunSefGreska"
      responses:
        "200":
          description: Accepted (any 2xx); otherwise triggers a retry
