API reference

Referință generată local din OpenAPI, fără cereri către un server API.

Authentication and usage / Download OpenAPI JSON

Seller-save, series-create, series-continue and logo operations are app/CLI configuration, not exposed by API v1. See docs/api.md.

API information, servers and protocol extensions
{
  "openapi": "3.1.0",
  "info": {
    "title": "fiscalm API",
    "version": "1.0.0",
    "description": "Seller-save, series-create, series-continue and logo operations are app/CLI configuration, not exposed by API v1. See docs/api.md."
  },
  "x-shop-webhooks": {
    "events": [
      "invoice.issued",
      "invoice.spv_accepted",
      "invoice.spv_rejected",
      "invoice.collected",
      "order.refused"
    ],
    "description": "Live-only, at-least-once delivery to operator-configured webhook_url with webhook_secret. Never accept a destination from an order; redirects refuse. Verify the signature against the raw body and check freshness before deduplicating by event ID. Non-2xx/transport errors retry with exponential backoff capped at one hour; crashes can redeliver the same event. Only statement-confirmed collection emits invoice.collected, never shop payment metadata.",
    "headers": {
      "X-ContaHub-Timestamp": "ASCII Unix seconds used in the signature; reject stale timestamps.",
      "X-ContaHub-Event-Id": "Stable event ID, identical to payload id. Deduplicate after signature verification.",
      "X-ContaHub-Signature": "sha256=<hex HMAC-SHA256(webhook_secret, ASCII timestamp + '.' + raw UTF-8 body)>"
    },
    "payload": {
      "id": "Stable event ID",
      "type": "One of events",
      "company": "Company key",
      "order_id": "Order ID; may be null on intake refusal",
      "external_id": "Shop order reference",
      "channel": "Shop channel ID",
      "invoice_id": "Invoice ID; may be null on intake refusal",
      "reason": "Optional safe refusal code, never raw SPV, buyer, bank or exception data"
    }
  },
  "x-browser-auth": {
    "origin": "Pinned FINREC_PUBLIC_URL HTTPS origin; Host is checked even for public routes, except /healthz. Forwarded headers are ignored unless the backend is private to an explicitly trusted proxy.",
    "cookie": {
      "name": "__Host-session",
      "attributes": "Path=/; Secure; HttpOnly; SameSite=Strict",
      "idle_days": 14,
      "absolute_days": 30,
      "step_up_minutes": 10
    },
    "me": {
      "method": "GET",
      "path": "/web/api/me",
      "session": "any",
      "response": "me (id, username, display_name, role, can), auth (via, method, recovery_only), factors (password_totp, passkeys_available, passkeys). Passkey metadata: id (base64url), name, backup_eligible, backed_up, created_at, last_used_at; no public-key material or secrets. A missing/expired/insecure cookie returns 401 with methods.password=true and methods.passkey indicating DNS-origin support."
    },
    "post": {
      "/auth/passkey/options": {
        "session": "public",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {},
          "required": []
        }
      },
      "/auth/passkey/finish": {
        "session": "public",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "ticket": {
              "type": "string",
              "writeOnly": true
            },
            "credential_id": {
              "type": "string",
              "writeOnly": true
            },
            "user_handle": {
              "type": "string",
              "writeOnly": true
            },
            "client_data": {
              "type": "string",
              "writeOnly": true
            },
            "authenticator_data": {
              "type": "string",
              "writeOnly": true
            },
            "signature": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "ticket",
            "credential_id",
            "user_handle",
            "client_data",
            "authenticator_data",
            "signature"
          ]
        }
      },
      "/auth/step-up/passkey/options": {
        "session": "normal",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {},
          "required": []
        }
      },
      "/auth/step-up/passkey/finish": {
        "session": "normal",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "ticket": {
              "type": "string",
              "writeOnly": true
            },
            "credential_id": {
              "type": "string",
              "writeOnly": true
            },
            "user_handle": {
              "type": "string",
              "writeOnly": true
            },
            "client_data": {
              "type": "string",
              "writeOnly": true
            },
            "authenticator_data": {
              "type": "string",
              "writeOnly": true
            },
            "signature": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "ticket",
            "credential_id",
            "user_handle",
            "client_data",
            "authenticator_data",
            "signature"
          ]
        }
      },
      "/auth/setup/passkey/options": {
        "session": "public",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "link": {
              "type": "string",
              "writeOnly": true
            },
            "name": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "link",
            "name"
          ]
        }
      },
      "/auth/setup/passkey/finish": {
        "session": "public",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "link": {
              "type": "string",
              "writeOnly": true
            },
            "ticket": {
              "type": "string",
              "writeOnly": true
            },
            "credential_id": {
              "type": "string",
              "writeOnly": true
            },
            "client_data": {
              "type": "string",
              "writeOnly": true
            },
            "attestation": {
              "type": "string",
              "writeOnly": true
            },
            "transports": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "link",
            "ticket",
            "credential_id",
            "client_data",
            "attestation",
            "transports"
          ]
        }
      },
      "/auth/me/passkey/options": {
        "session": "normal",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "name": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "name"
          ]
        }
      },
      "/auth/me/passkey/finish": {
        "session": "normal",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "ticket": {
              "type": "string",
              "writeOnly": true
            },
            "credential_id": {
              "type": "string",
              "writeOnly": true
            },
            "client_data": {
              "type": "string",
              "writeOnly": true
            },
            "attestation": {
              "type": "string",
              "writeOnly": true
            },
            "transports": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "ticket",
            "credential_id",
            "client_data",
            "attestation",
            "transports"
          ]
        }
      },
      "/auth/me/passkey/rename": {
        "session": "normal",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "credential_id": {
              "type": "string",
              "writeOnly": true
            },
            "name": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "credential_id",
            "name"
          ]
        }
      },
      "/auth/me/passkey/remove": {
        "session": "normal",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "credential_id": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "credential_id"
          ]
        }
      },
      "/auth/passkey/recovery": {
        "session": "public",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "username": {
              "type": "string"
            },
            "code": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "username",
            "code"
          ]
        }
      },
      "/auth/recover/passkey/options": {
        "session": "recovery",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "name": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "name"
          ]
        }
      },
      "/auth/recover/passkey/finish": {
        "session": "recovery",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "ticket": {
              "type": "string",
              "writeOnly": true
            },
            "credential_id": {
              "type": "string",
              "writeOnly": true
            },
            "client_data": {
              "type": "string",
              "writeOnly": true
            },
            "attestation": {
              "type": "string",
              "writeOnly": true
            },
            "transports": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "ticket",
            "credential_id",
            "client_data",
            "attestation",
            "transports"
          ]
        }
      },
      "/auth/password": {
        "session": "public",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "username": {
              "type": "string"
            },
            "password": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "username",
            "password"
          ]
        }
      },
      "/auth/totp": {
        "session": "public",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "ticket": {
              "type": "string",
              "writeOnly": true
            },
            "code": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "ticket",
            "code"
          ]
        }
      },
      "/auth/recovery": {
        "session": "public",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "ticket": {
              "type": "string",
              "writeOnly": true
            },
            "code": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "ticket",
            "code"
          ]
        }
      },
      "/auth/step-up/password": {
        "session": "normal",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "password": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "password"
          ]
        }
      },
      "/auth/step-up/totp": {
        "session": "normal",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "ticket": {
              "type": "string",
              "writeOnly": true
            },
            "code": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "ticket",
            "code"
          ]
        }
      },
      "/auth/setup/inspect": {
        "session": "public",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "link": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "link"
          ]
        }
      },
      "/auth/setup/begin": {
        "session": "public",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "link": {
              "type": "string",
              "writeOnly": true
            },
            "password": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "link",
            "password"
          ]
        }
      },
      "/auth/setup/finish": {
        "session": "public",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "link": {
              "type": "string",
              "writeOnly": true
            },
            "ticket": {
              "type": "string",
              "writeOnly": true
            },
            "code": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "link",
            "ticket",
            "code"
          ]
        }
      },
      "/auth/recover/begin": {
        "session": "recovery",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {},
          "required": []
        }
      },
      "/auth/recover/finish": {
        "session": "recovery",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "ticket": {
              "type": "string",
              "writeOnly": true
            },
            "code": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "ticket",
            "code"
          ]
        }
      },
      "/auth/me/password-change": {
        "session": "normal",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "password": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "password"
          ]
        }
      },
      "/auth/me/totp/begin": {
        "session": "normal",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {},
          "required": []
        }
      },
      "/auth/me/totp/finish": {
        "session": "normal",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "ticket": {
              "type": "string",
              "writeOnly": true
            },
            "code": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "ticket",
            "code"
          ]
        }
      },
      "/auth/me/recovery-codes": {
        "session": "normal",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {},
          "required": []
        }
      },
      "/auth/me/session-close": {
        "session": "normal",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string",
              "writeOnly": true
            }
          },
          "required": [
            "id"
          ]
        }
      },
      "/auth/me/sessions-close-others": {
        "session": "normal",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {},
          "required": []
        }
      },
      "/auth/signout": {
        "session": "any",
        "body": {
          "type": "object",
          "additionalProperties": false,
          "properties": {},
          "required": []
        }
      }
    },
    "transport": "POST requires a matching Origin, application/json, at most 4096 bytes, no ambiguous framing, and same-origin Sec-Fetch-Site when supplied. No CORS. One shared 20-per-minute IP budget across authentication flows, persistent account lockout and 5-try single-use factor tickets.",
    "responses": "Password returns only a ticket, never a session. TOTP or verified passkey sign-in sets the HttpOnly cookie. Setup begin returns ticket, secret and otpauth URI; setup finish returns 10 recovery codes and sets the cookie. link means only the setup URL fragment. Recovery-only sessions can read me, replace the factor permitted by their proof, or sign out; finalization clears every session and the cookie. auth.method is password_totp, passkey, recovery (password plus recovery code), or recovery_code (code-only passkey recovery). signout takes {} and clears the cookie. No raw session id is in JSON.",
    "passkeys": {
      "origin": "Requires a DNS host in the pinned HTTPS origin; HTTPS IP installs refuse passkey operations with 400. Changing the RP host requires re-enrolment or CLI/admin reset.",
      "options": "Options endpoints return {ok,ticket,publicKey}. publicKey is WebAuthn JSON options with unpadded base64url binary values, UV required, and discoverable credentials. Registration requests residentKey required, attestation none and ES256/EdDSA/RS256. No account name is submitted for passkey sign-in; step-up is fixed to the current cookie's account.",
      "proof": "All binary proof fields are canonical unpadded base64url strings. transports is a JSON-array string of browser hints, never identity proof. Challenge/type/origin/RP/UP/UV, exact credential owner and userHandle, signature and counter are checked. A positive counter must increase, including refusal of a return to zero. One-use tickets are five minutes and five attempts. Failed proof commits its attempt; final publication errors roll back factor/counter, ticket and session together.",
      "registration": "setup/passkey uses a current one-time factorless-account setup link. me/passkey add/rename/remove requires a normal recent own session of any role under the write lock. No body user id is accepted. Last-factor removal refuses. Adding a key closes other own sessions; setup/sign-in/step-up rotate the presented cookie atomically.",
      "recovery": "passkey/recovery accepts username plus one 80-bit code only when the account has passkeys and no complete password/TOTP method, with no existing browser session. It issues only recovery_code/recovery_only access. recover/passkey options/finish accept only that exact proof/session/user, replace all old keys and password/TOTP, rotate codes, close every session/ticket/link and clear the cookie. Fresh key sign-in is required. Existing password-and-code recovery stays confined to TOTP replacement; recovery provenance cannot cross flows."
    },
    "own_account": "GET /web/api/me includes active sessions (one-way id digest, current flag, method, created_at, last_seen_at, user_agent, ip) and recovery_codes_remaining. POST /auth/me/recovery-codes regenerates ten codes once, voiding the old set; /auth/me/session-close accepts only an own session id, clearing the cookie when current; /auth/me/sessions-close-others keeps the current session. Password replacement POST /auth/me/password-change {password} hashes outside the write lock, rechecks the proved credentials and closes other sessions and pending tickets; TOTP replacement POST /auth/me/totp/begin {} returns a pending secret/URI/ticket, and /auth/me/totp/finish {ticket,code} activates only that session’s verified replacement and regenerates codes. The old factor works until commit; no password-only factor/removal path exists. All own-account mutations require a normal session of any role plus step-up within ten minutes, rechecked under the write lock. No supplied user id is accepted. Recovery-only sessions are refused.",
    "sensitive_actions": {
      "status": 401,
      "body": {
        "ok": false,
        "reauth": true
      },
      "description": "A normal cookie session needs fresh authentication for user administration, session-close, token creation and supplier-IBAN confirmation/revocation. Step-up takes the identity from the current cookie, never from a submitted username."
    },
    "download": {
      "method": "POST",
      "path": "/web/api/download",
      "body": {
        "co": "Company key",
        "v": "Exact displayed payment-file version"
      },
      "role": "member",
      "response": "CSV attachment, or 409 if changed. Requires live mode, Origin and JSON. Session and role are rechecked under the writer lock before snapshot and download record; a late refusal returns 403 without CSV. The old GET is refused."
    }
  },
  "x-app-token-management": {
    "list": "/web/api/tokens: normal accounts see only their own metadata; administrators see all, including revoked historical ownerless entries.",
    "create": "/web/api/token-create {name,scope}: fresh normal session; current user is owner. Administrator/member may choose read or write; readonly may choose read only. Returns done.id/token/scope once.",
    "revoke": "/web/api/token-revoke {id}: normal session, own token only; administrators may revoke any. Owner, enabled actor and live administrator status are checked inside the same write lock. No body owner/actor override is accepted.",
    "capabilities": "me.can.own_tokens permits the own-token surface; me.can.manage_tokens permits administrator visibility/revocation; me.can.write limits the offered scopes. Bearer credentials never manage credentials."
  },
  "x-app-user-administration": {
    "role": "manage_users",
    "get": {
      "/web/api/users": [
        "id",
        "username",
        "display_name",
        "role",
        "disabled_at",
        "locked_until",
        "password_totp",
        "passkeys",
        "last_signin"
      ],
      "/web/api/user-sessions?id=<user id>": [
        "id",
        "method",
        "created_at",
        "last_seen_at",
        "user_agent",
        "ip"
      ],
      "/web/api/auth-events": "Latest 100 events, newest first: at, kind, user_id, actor, detail. No secrets."
    },
    "post": {
      "user-create": {
        "path": "/web/api/user-create",
        "fields": [
          "username",
          "display_name",
          "role"
        ]
      },
      "user-update": {
        "path": "/web/api/user-update",
        "fields": [
          "id",
          "display_name",
          "role"
        ]
      },
      "user-disable": {
        "path": "/web/api/user-disable",
        "fields": [
          "id"
        ]
      },
      "user-enable": {
        "path": "/web/api/user-enable",
        "fields": [
          "id"
        ]
      },
      "user-unlock": {
        "path": "/web/api/user-unlock",
        "fields": [
          "id"
        ]
      },
      "user-setup-link": {
        "path": "/web/api/user-setup-link",
        "fields": [
          "id"
        ]
      },
      "user-reset": {
        "path": "/web/api/user-reset",
        "fields": [
          "id"
        ]
      },
      "session-close": {
        "path": "/web/api/session-close",
        "fields": [
          "id"
        ]
      }
    },
    "description": "Normal administrator cookie required. Every mutation also requires step-up within 10 minutes, rechecked under the same write lock. Unknown fields and actor/owner overrides are refused. user-create and setup/reset return done.url only once: a relative /setup#id.secret link valid 72 hours. Session id is a stored digest, never the raw cookie. Disabled users lose browser access and tokens immediately. Cannot remove the last working administrator. No company access restrictions."
  },
  "x-app-ai-cli": {
    "route": "/web/api/integration-cli",
    "effect": "local",
    "role": "connect_integrations",
    "description": "App administrator only. Origin required on POST; JSON up to 4096 bytes. Official CLI-owned login, status and logout. No credentials or raw output are exposed; configuration is allowed in shadow.",
    "get": {
      "provider": [
        "claude-cli",
        "codex-cli"
      ]
    },
    "post": {
      "op": [
        "start",
        "code",
        "cancel",
        "logout"
      ],
      "provider": [
        "claude-cli",
        "codex-cli"
      ],
      "code": "Only for code: one authorization code, 1..2048 characters, sent to CLI stdin, never persisted or logged."
    },
    "response": {
      "provider": "CLI provider, or empty before login",
      "state": [
        "idle",
        "waiting",
        "connected",
        "failed",
        "expired",
        "cancelled",
        "invalid_url"
      ],
      "url": "Only HTTPS on the selected provider's allowlisted domains; no userinfo, fragment or token query parameters",
      "code": "Only the short public device code, otherwise empty",
      "needs_code": "Whether CLI asks for a pasted authorization code",
      "readiness": [
        "ready",
        "missing",
        "not_logged_in"
      ],
      "install_command": "Native install or Docker rebuild command; absent on POST"
    }
  },
  "x-app-action-effects": {
    "onboarding-step": "local",
    "mode-switch": "local",
    "user-create": "local",
    "user-update": "local",
    "user-disable": "local",
    "user-enable": "local",
    "user-unlock": "local",
    "user-setup-link": "local",
    "user-reset": "local",
    "session-close": "local",
    "history-review": "local",
    "receipt-lines-save": "local",
    "receipt-invoice-confirm": "local",
    "update-checks": "local",
    "accountant-save": "local",
    "settlement-confirm": "local",
    "order-discard": "local",
    "emag-refund": "local",
    "emag-resolve": "local",
    "confirm-supplier-iban": "local",
    "revoke-supplier-iban": "local",
    "approve": "payment_file",
    "mark-paid": "local",
    "reopen": "local",
    "withdraw": "local",
    "imported": "payment_file",
    "restore": "payment_file",
    "pack-prepare": "local",
    "pack-sent": "local",
    "check": "local",
    "mail-answer": "local",
    "rule-pause": "local",
    "rule-resume": "local",
    "rule-supplier-autopay": "local",
    "rule-partner-not-mailed": "local",
    "rule-reminders": "local",
    "issued-mark": "local",
    "issued-unmark": "local",
    "resolve-debit": "local",
    "card-owner": "local",
    "tx-link": "local",
    "tx-unlink": "local",
    "memory-forget": "local",
    "token-create": "local",
    "token-revoke": "local",
    "upload-link-create": "local",
    "upload-link-revoke": "local",
    "integration-add": "local",
    "integration-update": "local",
    "integration-clear": "local",
    "integration-enable": "local",
    "integration-default": "local",
    "integration-remove": "local",
    "company-lookup": "local",
    "company-add": "local",
    "company-update": "local",
    "company-bank": "local",
    "company-account": "local",
    "company-alias-add": "local",
    "company-alias-remove": "local",
    "statement-csv-format": "local",
    "bank-setup": "local",
    "bank-connect": "local",
    "bank-disconnect": "local",
    "bank-accounts": "local",
    "integration-connect": "local"
  },
  "x-app-action-roles": {
    "onboarding-step": "manage_firms",
    "mode-switch": "manage_firms",
    "user-create": "manage_users",
    "user-update": "manage_users",
    "user-disable": "manage_users",
    "user-enable": "manage_users",
    "user-unlock": "manage_users",
    "user-setup-link": "manage_users",
    "user-reset": "manage_users",
    "session-close": "manage_users",
    "history-review": "manage_firms",
    "receipt-lines-save": "member",
    "receipt-invoice-confirm": "member",
    "update-checks": "manage_firms",
    "accountant-save": "manage_firms",
    "settlement-confirm": "member",
    "order-discard": "member",
    "emag-refund": "member",
    "emag-resolve": "member",
    "confirm-supplier-iban": "confirm_supplier_iban",
    "revoke-supplier-iban": "confirm_supplier_iban",
    "approve": "member",
    "mark-paid": "member",
    "reopen": "member",
    "withdraw": "member",
    "imported": "member",
    "restore": "member",
    "pack-prepare": "member",
    "pack-sent": "member",
    "check": "member",
    "mail-answer": "member",
    "rule-pause": "manage_rules",
    "rule-resume": "manage_rules",
    "rule-supplier-autopay": "manage_rules",
    "rule-partner-not-mailed": "manage_rules",
    "rule-reminders": "manage_rules",
    "issued-mark": "member",
    "issued-unmark": "member",
    "resolve-debit": "member",
    "card-owner": "member",
    "tx-link": "member",
    "tx-unlink": "member",
    "memory-forget": "member",
    "token-create": "own_tokens",
    "token-revoke": "own_tokens",
    "upload-link-create": "member",
    "upload-link-revoke": "member",
    "integration-add": "manage_integrations",
    "integration-update": "manage_integrations",
    "integration-clear": "manage_integrations",
    "integration-enable": "manage_integrations",
    "integration-default": "manage_integrations",
    "integration-remove": "manage_integrations",
    "company-lookup": "manage_firms",
    "company-add": "manage_firms",
    "company-update": "manage_firms",
    "company-bank": "manage_firms",
    "company-account": "manage_firms",
    "company-alias-add": "manage_firms",
    "company-alias-remove": "manage_firms",
    "statement-csv-format": "member",
    "bank-setup": "connect_integrations",
    "bank-connect": "connect_integrations",
    "bank-disconnect": "connect_integrations",
    "bank-accounts": "connect_integrations",
    "integration-connect": "connect_integrations"
  },
  "x-invoicing-action-effects": {
    "recurrence-create": "local",
    "recurrence-pause": "local",
    "recurrence-resume": "local",
    "recurrence-delete": "local",
    "logo": "local",
    "logo-remove": "local",
    "seller-save": "local",
    "series-create": "local",
    "series-continue": "local",
    "client-lookup": "local",
    "client-save": "local",
    "draft-save": "local",
    "upload": "anaf_upload",
    "draft-delete": "local",
    "issue": "local",
    "storno": "local",
    "resolve-upload": "local",
    "auto-upload": "local"
  },
  "x-app-actions": {
    "onboarding-step": "Save current installation onboarding step with outcome done/later (bank also accepts save to persist sources without advancing); mode/company/ready cannot be skipped. Company requires company key; bank requires bank_mail and bank_open as 1/0. Administrator only; audited with acting user.",
    "mode-switch": "mode and expected: live/sandbox; confirmed=yes. Fresh administrator session required. Audited.",
    "user-create": "Account administration; fresh administrator session required. username display_name role.",
    "user-update": "Account administration; fresh administrator session required. id display_name role.",
    "user-disable": "Account administration; fresh administrator session required. id.",
    "user-enable": "Account administration; fresh administrator session required. id.",
    "user-unlock": "Account administration; fresh administrator session required. id.",
    "user-setup-link": "Account administration; fresh administrator session required. id.",
    "user-reset": "Account administration; fresh administrator session required. id.",
    "session-close": "Account administration; fresh administrator session required. id.",
    "history-review": "Review one pending history PDF by digest, correcting invoice fields or excluding it. Local only; never confirms payment.",
    "receipt-lines-save": "id: receipt SHA; revision: displayed version; payload: JSON string with lines (name, unit, quantity, net after discounts excluding VAT, vat percentage), total, currency, payment (cash/card/empty). Empty lines skip. 4 KB.",
    "receipt-invoice-confirm": "id: receipt SHA; revision; invoice: displayed unique proposal ID. Rechecks under lock, never confirms payment. Local operation.",
    "update-checks": "on (\"1\" or \"0\"). App administrator only. Enable or disable the anonymous daily GitHub Releases check, also allowed in shadow mode.",
    "accountant-save": "cui (existing partner), senders (newline-separated addresses, at most ten), recipient, co. App admin configuration.",
    "order-discard": "co, id: company-scoped order sheet ID. App-only local configuration.",
    "confirm-supplier-iban": "id, optional iban (if supplied, must equal the exact invoice account), confirmed:\"yes\"",
    "revoke-supplier-iban": "id, confirmed:\"yes\"",
    "rule-pause": "id (company-qualified rule id)",
    "rule-resume": "id (company-qualified rule id)",
    "rule-supplier-autopay": "cui (a partner's, from the state), on (1/0)",
    "rule-partner-not-mailed": "partner (a partner's id, from the state), on (1/0)",
    "rule-reminders": "after_days (digit string, 1..365)",
    "card-owner": "tx (an observed card transaction), owner (a companies[].key or personal); first answer wins, never confirms payment",
    "tx-link": "kind (documents, the default; label: Fără document, reason one of bank_fee, interest, personal, other and an optional note for the accountant, required for other, at most 200 characters; transfer: Transfer între conturi; advance: Avans, who the administrator or associate, 1 to 100 characters), tx (a transactions.rows[].id; for an explanation already made, its link.tx), invoices (comma-separated ids: issued[].id for a credit, invoices[].id for a debit) or payment (one payments.*[].item_id, debits only), reason (\"\" or one of rest, courier_fee, bank_fee, fx, other), note (other only, 1 to 200 characters), was (the row's explanation.link.id, \"\" for none), remember (\"\", or one of the row's remember keys: iban, card for a label only, name; never for a transfer)",
    "tx-unlink": "tx, was (the explanation's id)",
    "memory-forget": "id (a transactions.remembered[].id)",
    "token-create": "name, scope (read/write). Fresh normal session; owner is the current user; read-only accounts can create read tokens only. Returns secret once.",
    "token-revoke": "id. Normal session; revokes own credential, administrator may revoke any.",
    "integration-add": "kind, name, f_<field> per field",
    "integration-update": "id, optional name, f_<field>",
    "integration-clear": "id, key",
    "integration-enable": "id, on (\"1\" or \"0\")",
    "integration-default": "id",
    "integration-remove": "id",
    "company-lookup": "{ \"cui\": \"12345674\" }",
    "company-add": "{ \"cui\": \"12345674\", \"name\": \"Exemplu\", \"palette\": \"blue\" } (name, palette optional)",
    "company-update": "{ \"key\": \"EXEMPLU\", \"name\": \"Alt nume\", \"palette\": \"rose\" } (at least one display field)",
    "company-bank": "{ \"key\": \"EXEMPLU\", \"iban\": \"<RON IBAN>\" } (both required)",
    "company-account": "{ \"key\": \"EXEMPLU\", \"iban\": \"<IBAN>\", \"currency\": \"EUR\" } (all required)",
    "company-alias-add": "{ \"key\": \"EXEMPLU\", \"alias\": \"Exemplu Grup\" } (both required)",
    "company-alias-remove": "{ \"key\": \"EXEMPLU\", \"alias\": \"Exemplu Grup\" } (both required)",
    "statement-csv-format": "account, co; column names from finrec.bank.csv.FIELDS plus date_format and decimal, all strings. App admin configuration.",
    "bank-setup": "operation: prepare (generate key once, return public certificate and configured callback URLs; no network) or check (verify Enable Banking application). No private key or session is returned. Read-only banking allowed in shadow mode.",
    "bank-connect": "bank (catalogue ID), co; no other fields. App admin; starts read-only account consent.",
    "bank-disconnect": "bank (catalogue ID), co; no other fields. Stops future local bank reads and cancels pending consent choices. Keeps all history and statement imports; no provider call or remote revocation.",
    "bank-accounts": "operation=list returns only the creator’s unexpired masked account offers. operation=confirm, offer (opaque ID), accounts (opaque IDs) registers and connects exactly the selected accounts atomically. No IBAN, URL, session or provider UID is accepted.",
    "integration-connect": "id (the ANAF integration)"
  }
}

/api/v1/mcp

POST /api/v1/mcp
{
  "operationId": "mcp",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/MCP"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "202": {
      "description": "Notification accepted, no response body"
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object"
        }
      }
    }
  }
}

/api/v1/meta

GET /api/v1/meta
{
  "operationId": "meta",
  "security": [],
  "parameters": [],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/openapi.json

GET /api/v1/openapi.json
{
  "operationId": "openapi",
  "security": [],
  "parameters": [],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/OpenAPI"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies

GET /api/v1/companies
{
  "operationId": "companies",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "limit",
      "in": "query",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 200,
        "default": 50
      }
    },
    {
      "name": "cursor",
      "in": "query",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CompanyPage"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/upload-links

GET /api/v1/companies/{co}/upload-links
{
  "operationId": "upload_links",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/UploadLinkList"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
POST /api/v1/companies/{co}/upload-links
{
  "operationId": "upload_link_create",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Action"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "label"
          ],
          "additionalProperties": false,
          "properties": {
            "co": {
              "type": "string"
            },
            "label": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "expires_in_days": {
              "type": "integer",
              "minimum": 1,
              "maximum": 365,
              "default": 30
            },
            "max_files": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9223372036854776000,
              "default": 100
            }
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/upload-links/{id}/revoke

POST /api/v1/companies/{co}/upload-links/{id}/revoke
{
  "operationId": "upload_link_revoke",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Action"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "co": {
              "type": "string"
            }
          },
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/state

GET /api/v1/companies/{co}/state
{
  "operationId": "state",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/State"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/state-summary

GET /api/v1/companies/{co}/state-summary
{
  "operationId": "state_summary",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/StateSummary"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/detail

GET /api/v1/companies/{co}/detail
{
  "operationId": "state_detail",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "kind",
      "in": "query",
      "required": true,
      "schema": {
        "enum": [
          "invoice",
          "issued",
          "document",
          "mail",
          "settlement",
          "order",
          "transaction"
        ]
      }
    },
    {
      "name": "id",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "cursor",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 200,
        "default": 50
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/StateDetail"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/transaction-choices

GET /api/v1/companies/{co}/transaction-choices
{
  "operationId": "transaction_choices",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "collection",
      "in": "query",
      "schema": {
        "type": "string",
        "enum": [
          "partners",
          "invoices",
          "payments",
          "selected"
        ]
      }
    },
    {
      "name": "partner",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "q",
      "in": "query",
      "schema": {
        "type": "string",
        "maxLength": 200
      }
    },
    {
      "name": "cursor",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 200,
        "default": 50
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/TransactionChoices"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/partner-pages

GET /api/v1/companies/{co}/partner-pages
{
  "operationId": "partner_pages",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "collection",
      "in": "query",
      "schema": {
        "enum": [
          "invoices",
          "issued",
          "transactions",
          "held",
          "settlements",
          "remembered",
          "report_formats"
        ]
      }
    },
    {
      "name": "cursor",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 200,
        "default": 50
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PartnerPages"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/state-list

GET /api/v1/companies/{co}/state-list
{
  "operationId": "state_list",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 200,
        "default": 50
      }
    },
    {
      "name": "cursor",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "status",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "month",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "collection",
      "in": "query",
      "required": true,
      "schema": {
        "enum": [
          "invoices",
          "issued",
          "documents",
          "partners",
          "expenses",
          "transactions",
          "upcoming",
          "candidates"
        ]
      }
    },
    {
      "name": "id",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "partner",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "tx",
      "in": "query",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/StateListPage"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/browse

GET /api/v1/companies/{co}/browse
{
  "operationId": "state_browse",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 200,
        "default": 50
      }
    },
    {
      "name": "cursor",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "screen",
      "in": "query",
      "required": true,
      "schema": {
        "enum": [
          "vanzari",
          "cheltuieli",
          "bonuri",
          "parteneri",
          "tranzactii",
          "payment_prepare",
          "payment_file",
          "payment_confirm",
          "payment_paid",
          "report_received",
          "report_issued",
          "report_tasks",
          "report_bank",
          "report_advances",
          "report_docs",
          "report_not_mailed"
        ]
      }
    },
    {
      "name": "f",
      "in": "query",
      "schema": {
        "enum": [
          "",
          "open",
          "late",
          "all",
          "in",
          "out",
          "storno",
          "accountant"
        ]
      }
    },
    {
      "name": "q",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "month",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "from",
      "in": "query",
      "schema": {
        "type": "string",
        "format": "date"
      }
    },
    {
      "name": "to",
      "in": "query",
      "schema": {
        "type": "string",
        "format": "date"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/BrowsePage"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/report-pages

GET /api/v1/companies/{co}/report-pages
{
  "operationId": "state_report_pages",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "month",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 200,
        "default": 50
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ReportPages"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/dashboard-list

GET /api/v1/companies/{co}/dashboard-list
{
  "operationId": "dashboard_list",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 200,
        "default": 50
      }
    },
    {
      "name": "cursor",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "collection",
      "in": "query",
      "required": true,
      "schema": {
        "enum": [
          "upcoming",
          "held_money"
        ]
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/DashboardPage"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/search

GET /api/v1/companies/{co}/search
{
  "operationId": "state_search",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "q",
      "in": "query",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/SearchResults"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/tasks

GET /api/v1/companies/{co}/tasks
{
  "operationId": "state_tasks",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 200,
        "default": 50
      }
    },
    {
      "name": "cursor",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "group",
      "in": "query",
      "schema": {
        "enum": [
          "",
          "payments"
        ]
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/TaskPage"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoices/received

GET /api/v1/companies/{co}/invoices/received
{
  "operationId": "received",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 200,
        "default": 50
      }
    },
    {
      "name": "cursor",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "status",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "month",
      "in": "query",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ReceivedPage"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoices/received/{id}

GET /api/v1/companies/{co}/invoices/received/{id}
{
  "operationId": "received_one",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Received"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoices/issued

GET /api/v1/companies/{co}/invoices/issued
{
  "operationId": "issued",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 200,
        "default": 50
      }
    },
    {
      "name": "cursor",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "status",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "month",
      "in": "query",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/IssuedPage"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoices/issued/{id}

GET /api/v1/companies/{co}/invoices/issued/{id}
{
  "operationId": "issued_one",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Issued"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/payments

GET /api/v1/companies/{co}/payments
{
  "operationId": "payments",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 200,
        "default": 50
      }
    },
    {
      "name": "cursor",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "status",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "month",
      "in": "query",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PaymentPage"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/payments/{id}

GET /api/v1/companies/{co}/payments/{id}
{
  "operationId": "payment_one",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Payment"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/documents

GET /api/v1/companies/{co}/documents
{
  "operationId": "documents",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 200,
        "default": 50
      }
    },
    {
      "name": "cursor",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "status",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "month",
      "in": "query",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/DocumentPage"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/documents/{sha}

GET /api/v1/companies/{co}/documents/{sha}
{
  "operationId": "document_one",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "sha",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Document"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/documents/{sha}/file

GET /api/v1/companies/{co}/documents/{sha}/file
{
  "operationId": "document_file",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "sha",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/pdf": {
          "schema": {
            "$ref": "#/components/schemas/File"
          }
        },
        "image/heic": {
          "schema": {
            "$ref": "#/components/schemas/File"
          }
        },
        "image/heif": {
          "schema": {
            "$ref": "#/components/schemas/File"
          }
        },
        "image/jpeg": {
          "schema": {
            "$ref": "#/components/schemas/File"
          }
        },
        "image/png": {
          "schema": {
            "$ref": "#/components/schemas/File"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/reports/{month}/pack

GET /api/v1/companies/{co}/reports/{month}/pack
{
  "operationId": "pack_file",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "month",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "version",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[a-f0-9]{64}$"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/zip": {
          "schema": {
            "$ref": "#/components/schemas/File"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        },
        "Content-Disposition": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/reports/{month}

GET /api/v1/companies/{co}/reports/{month}
{
  "operationId": "report",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "month",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Report"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/actions/{action}

POST /api/v1/companies/{co}/actions/{action}
{
  "operationId": "action",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "action",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "enum": [
          "settlement-confirm",
          "emag-refund",
          "emag-resolve",
          "approve",
          "mark-paid",
          "reopen",
          "withdraw",
          "imported",
          "restore",
          "pack-prepare",
          "pack-sent",
          "check",
          "mail-answer",
          "issued-mark",
          "issued-unmark",
          "resolve-debit",
          "upload-link-create",
          "upload-link-revoke",
          "integration-add",
          "integration-update",
          "integration-clear",
          "integration-enable",
          "integration-default",
          "integration-remove"
        ]
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Action"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "additionalProperties": {
            "type": [
              "string",
              "integer"
            ]
          },
          "description": "Flat string/integer fields, no booleans. co, if supplied, must match the URL. See x-action-fields for each action. Integration changes require app authentication and return app_required for bearer requests."
        }
      }
    }
  },
  "x-action-fields": {
    "settlement-confirm": "id: 32-hex report ID; tx: 20-hex exact displayed credit ID; confirmed: yes. Local operation; v1 requires a write key owned by an active person (else 403 person_owned_key_required). Rechecks all evidence under lock. Effect: local; allowed in shadow.",
    "emag-refund": "id: company-scoped order sheet ID; prepares a refund draft, never sends money. Effect: local; allowed in shadow.",
    "emag-resolve": "id: company-scoped order sheet ID; acknowledges the current review. Effect: local; allowed in shadow.",
    "approve": "id Effect: payment_file; requires LIVE.",
    "mark-paid": "id Effect: local; allowed in shadow.",
    "reopen": "id Effect: local; allowed in shadow.",
    "withdraw": "id Effect: local; allowed in shadow.",
    "imported": "v (a download version) or missing (the missing version) Effect: payment_file; requires LIVE.",
    "restore": "missing Effect: payment_file; requires LIVE.",
    "pack-prepare": "month: YYYY-MM. Freeze the company ZIP for download. Local in both modes. Effect: local; allowed in shadow.",
    "pack-sent": "month, version: exact prepared ZIP SHA-256. Human confirms sending only that snapshot. Effect: local; allowed in shadow.",
    "check": "No fields. Starts the tick; permitted in shadow mode, which the tick respects. Effect: local; allowed in shadow.",
    "mail-answer": "In v1 who must equal the URL company or none (else wrong_company). key (a to_check[].key this co is offered for), who (one of its companies, or none: not an invoice), optional total (the index into its totals as a digit string, needed when it has several), optional remember (1: the exact sender address goes the same way next time) Effect: local; allowed in shadow.",
    "issued-mark": "id, note (1 to 200 characters) Effect: local; allowed in shadow.",
    "issued-unmark": "id Effect: local; allowed in shadow.",
    "resolve-debit": "tx, target (one of its candidates[].id) Effect: local; allowed in shadow.",
    "upload-link-create": "label; optional expires_in_days (1..365), max_files (positive integer). Write scope required; explicit upload-link routes are also available. Effect: local; allowed in shadow.",
    "upload-link-revoke": "id: upload link ID. Write scope required; explicit upload-link routes are also available. Effect: local; allowed in shadow.",
    "integration-add": "App authentication required; bearer requests return 403 app_required. Effect: local; allowed in shadow.",
    "integration-update": "App authentication required; bearer requests return 403 app_required. Effect: local; allowed in shadow.",
    "integration-clear": "App authentication required; bearer requests return 403 app_required. Effect: local; allowed in shadow.",
    "integration-enable": "App authentication required; bearer requests return 403 app_required. Effect: local; allowed in shadow.",
    "integration-default": "App authentication required; bearer requests return 403 app_required. Effect: local; allowed in shadow.",
    "integration-remove": "App authentication required; bearer requests return 403 app_required. Effect: local; allowed in shadow."
  }
}

/api/v1/companies/{co}/invoicing/recurrences

GET /api/v1/companies/{co}/invoicing/recurrences
{
  "operationId": "invoicing_recurrences",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Recurrences"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing

GET /api/v1/companies/{co}/invoicing
{
  "operationId": "invoicing_workspace",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/InvoicingWorkspace"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/drafts/{id}

GET /api/v1/companies/{co}/invoicing/drafts/{id}
{
  "operationId": "invoicing_draft",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/InvoicingDraft"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/issued/{id}

GET /api/v1/companies/{co}/invoicing/issued/{id}
{
  "operationId": "invoicing_issued",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/InvoicingIssued"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/issued/{id}/pdf

GET /api/v1/companies/{co}/invoicing/issued/{id}/pdf
{
  "operationId": "invoicing_pdf",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/pdf": {
          "schema": {
            "$ref": "#/components/schemas/File"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        },
        "Content-Disposition": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/issued/{id}/xml

GET /api/v1/companies/{co}/invoicing/issued/{id}/xml
{
  "operationId": "invoicing_xml",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/xml": {
          "schema": {
            "$ref": "#/components/schemas/File"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        },
        "Content-Disposition": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/recurrence-create

POST /api/v1/companies/{co}/invoicing/recurrence-create
{
  "operationId": "invoicing_recurrence-create",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/InvoicingAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "draft_id": {
              "type": "string"
            },
            "first_period": {
              "type": "string",
              "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])$"
            },
            "day": {
              "type": "integer",
              "minimum": 1,
              "maximum": 31
            },
            "due_days": {
              "type": "integer",
              "minimum": 0,
              "maximum": 365
            },
            "co": {
              "type": "string"
            }
          },
          "required": [
            "draft_id",
            "day",
            "due_days"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/recurrence-pause

POST /api/v1/companies/{co}/invoicing/recurrence-pause
{
  "operationId": "invoicing_recurrence-pause",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/InvoicingAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "co": {
              "type": "string"
            }
          },
          "required": [
            "id"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/recurrence-resume

POST /api/v1/companies/{co}/invoicing/recurrence-resume
{
  "operationId": "invoicing_recurrence-resume",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/InvoicingAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "co": {
              "type": "string"
            }
          },
          "required": [
            "id"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/recurrence-delete

POST /api/v1/companies/{co}/invoicing/recurrence-delete
{
  "operationId": "invoicing_recurrence-delete",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/InvoicingAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "co": {
              "type": "string"
            }
          },
          "required": [
            "id"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/client-lookup

POST /api/v1/companies/{co}/invoicing/client-lookup
{
  "operationId": "invoicing_client-lookup",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/InvoicingAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "cui": {
              "type": "string"
            },
            "co": {
              "type": "string"
            }
          },
          "required": [
            "cui"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/client-save

POST /api/v1/companies/{co}/invoicing/client-save
{
  "operationId": "invoicing_client-save",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/InvoicingAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "client": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "cui": {
                  "type": "string"
                },
                "vat_id": {
                  "type": "string"
                },
                "tax_id": {
                  "type": "string"
                },
                "ro_vat_status": {
                  "type": "string"
                },
                "reg_com": {
                  "type": "string"
                },
                "iban": {
                  "type": "string"
                },
                "bank": {
                  "type": "string"
                },
                "account_name": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "phone": {
                  "type": "string"
                },
                "country": {
                  "type": "string"
                },
                "private": {
                  "type": "boolean"
                },
                "vat_payer": {
                  "type": "boolean"
                },
                "efactura_registered": {
                  "type": "boolean"
                },
                "inactive": {
                  "type": "boolean"
                },
                "address": {
                  "type": "object",
                  "properties": {
                    "street": {
                      "type": "string"
                    },
                    "city": {
                      "type": "string"
                    },
                    "county": {
                      "type": "string"
                    },
                    "postal_code": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    }
                  },
                  "required": [],
                  "additionalProperties": false
                }
              },
              "required": [
                "name",
                "address",
                "vat_payer"
              ],
              "additionalProperties": false
            },
            "co": {
              "type": "string"
            }
          },
          "required": [
            "client"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/draft-save

POST /api/v1/companies/{co}/invoicing/draft-save

Echo the draft version read from the workspace. Existing-draft saves require it; issue always requires it. Stale versions return stale_draft (409).

{
  "operationId": "invoicing_draft-save",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/InvoicingAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "description": "Echo the draft version read from the workspace. Existing-draft saves require it; issue always requires it. Stale versions return stale_draft (409).",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "series": {
              "type": "string"
            },
            "client_id": {
              "type": "string"
            },
            "issue_date": {
              "type": "string"
            },
            "due_date": {
              "type": "string"
            },
            "currency": {
              "type": "string"
            },
            "notes": {
              "type": "string"
            },
            "delivery_date": {
              "type": [
                "string",
                "null"
              ]
            },
            "version": {
              "type": "integer",
              "minimum": 1
            },
            "advance_invoice": {
              "type": "boolean"
            },
            "advance_payment_date": {
              "type": [
                "string",
                "null"
              ]
            },
            "supply_country": {
              "type": "string"
            },
            "lines": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "quantity": {
                    "type": "string"
                  },
                  "unit": {
                    "type": "string"
                  },
                  "unit_price": {
                    "type": "string"
                  },
                  "vat_category": {
                    "type": "string"
                  },
                  "vat_rate": {
                    "type": "string"
                  },
                  "exemption": {
                    "type": "string"
                  },
                  "gross_unit_price": {
                    "type": "string"
                  }
                },
                "required": [
                  "description",
                  "quantity",
                  "unit",
                  "unit_price",
                  "vat_category",
                  "vat_rate"
                ],
                "additionalProperties": false
              }
            },
            "co": {
              "type": "string"
            }
          },
          "required": [
            "series",
            "client_id",
            "issue_date",
            "due_date",
            "currency",
            "notes",
            "lines"
          ],
          "additionalProperties": false,
          "dependentRequired": {
            "id": [
              "version"
            ]
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/upload

POST /api/v1/companies/{co}/invoicing/upload
{
  "operationId": "invoicing_upload",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/InvoicingAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "co": {
              "type": "string"
            }
          },
          "required": [
            "id"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/draft-delete

POST /api/v1/companies/{co}/invoicing/draft-delete
{
  "operationId": "invoicing_draft-delete",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/InvoicingAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "version": {
              "type": "integer",
              "minimum": 1
            },
            "co": {
              "type": "string"
            }
          },
          "required": [
            "id"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/issue

POST /api/v1/companies/{co}/invoicing/issue

Echo the draft version read from the workspace. Existing-draft saves require it; issue always requires it. Stale versions return stale_draft (409).

{
  "operationId": "invoicing_issue",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "Idempotency-Key",
      "in": "header",
      "required": false,
      "schema": {
        "type": "string",
        "pattern": "^[A-Za-z0-9._:-]{1,128}$",
        "maxLength": 128
      },
      "description": "Per token and company for 24 hours. Same operation and JSON body replays the exact committed result; changed operation/body returns 409. Retry a 500 with the same key/body. Refusals are not cached. Issue/storno and replay commit atomically; SPV upload follows commit and its outcome must be read separately. Other routes reject this header."
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/InvoicingAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "description": "Echo the draft version read from the workspace. Existing-draft saves require it; issue always requires it. Stale versions return stale_draft (409).",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "version": {
              "type": "integer",
              "minimum": 1
            },
            "co": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "version"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/storno

POST /api/v1/companies/{co}/invoicing/storno
{
  "operationId": "invoicing_storno",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "Idempotency-Key",
      "in": "header",
      "required": false,
      "schema": {
        "type": "string",
        "pattern": "^[A-Za-z0-9._:-]{1,128}$",
        "maxLength": 128
      },
      "description": "Per token and company for 24 hours. Same operation and JSON body replays the exact committed result; changed operation/body returns 409. Retry a 500 with the same key/body. Refusals are not cached. Issue/storno and replay commit atomically; SPV upload follows commit and its outcome must be read separately. Other routes reject this header."
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/InvoicingAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "reason": {
              "type": "string"
            },
            "lines": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            },
            "co": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "reason"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/resolve-upload

POST /api/v1/companies/{co}/invoicing/resolve-upload
{
  "operationId": "invoicing_resolve-upload",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/InvoicingAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "checked_in_spv": {
              "type": "boolean"
            },
            "upload_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "co": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "checked_in_spv",
            "upload_id"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/invoicing/auto-upload

POST /api/v1/companies/{co}/invoicing/auto-upload

App-admin configuration only. Bearer requests always return 403 admin_required.

{
  "operationId": "invoicing_auto-upload",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "App admin required; bearer tokens cannot change automation rules.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "description": "App-admin configuration only. Bearer requests always return 403 admin_required.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "on": {
              "type": "boolean"
            },
            "co": {
              "type": "string"
            }
          },
          "required": [
            "on"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/orders

POST /api/v1/companies/{co}/orders

Atomic shop order intake; live-only lifecycle webhooks use HMAC-SHA256(timestamp + dot + raw JSON), X-ContaHub-Signature, durable retries and stable event IDs. See x-shop-webhooks in this schema.

{
  "operationId": "orders_create",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/OrderAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "description": "Atomic shop order intake; live-only lifecycle webhooks use HMAC-SHA256(timestamp + dot + raw JSON), X-ContaHub-Signature, durable retries and stable event IDs. See x-shop-webhooks in this schema.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "channel": {
              "type": "string"
            },
            "external_id": {
              "type": "string"
            },
            "placed_at": {
              "type": "string",
              "format": "date"
            },
            "currency": {
              "type": "string"
            },
            "prices_include_vat": {
              "type": "boolean"
            },
            "buyer": {
              "type": "object",
              "properties": {
                "type": {
                  "enum": [
                    "person",
                    "company"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "cui": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "address": {
                  "type": "object",
                  "properties": {
                    "street": {
                      "type": "string"
                    },
                    "city": {
                      "type": "string"
                    },
                    "county": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    },
                    "postal": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "street",
                    "city",
                    "county",
                    "country"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "type",
                "name",
                "address"
              ],
              "additionalProperties": false
            },
            "lines": {
              "type": "array",
              "minItems": 1,
              "maxItems": 1000,
              "items": {
                "type": "object",
                "properties": {
                  "sku": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "quantity": {
                    "type": "string",
                    "pattern": "^-?[0-9]+([.,][0-9]{1,12})?$"
                  },
                  "unit": {
                    "type": "string"
                  },
                  "unit_price": {
                    "type": "string",
                    "pattern": "^-?[0-9]+([.,][0-9]{1,12})?$"
                  },
                  "vat_rate": {
                    "type": "string",
                    "pattern": "^-?[0-9]+([.,][0-9]{1,12})?$"
                  }
                },
                "required": [
                  "description",
                  "quantity",
                  "unit",
                  "unit_price",
                  "vat_rate"
                ],
                "additionalProperties": false
              }
            },
            "payment": {
              "type": "object",
              "properties": {
                "method": {
                  "enum": [
                    "card",
                    "cod",
                    "transfer",
                    "other"
                  ]
                },
                "processor": {
                  "type": "string"
                },
                "paid": {
                  "type": "boolean"
                }
              },
              "required": [
                "method",
                "paid"
              ],
              "additionalProperties": false
            },
            "awb": {
              "type": "object",
              "properties": {
                "courier": {
                  "type": "string"
                },
                "number": {
                  "type": "string"
                },
                "picked_up_at": {
                  "type": "string",
                  "format": "date"
                },
                "delivered_at": {
                  "type": "string",
                  "format": "date"
                },
                "returned_at": {
                  "type": "string",
                  "format": "date"
                }
              },
              "required": [
                "courier",
                "number"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "channel",
            "external_id",
            "placed_at",
            "currency",
            "prices_include_vat",
            "buyer",
            "lines",
            "payment"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}
GET /api/v1/companies/{co}/orders
{
  "operationId": "orders_list",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 200,
        "default": 50
      }
    },
    {
      "name": "cursor",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "status",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "month",
      "in": "query",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "channel",
      "in": "query",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/OrderPage"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/orders/{id}

GET /api/v1/companies/{co}/orders/{id}
{
  "operationId": "orders_one",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Order"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

/api/v1/companies/{co}/orders/{id}/awb

POST /api/v1/companies/{co}/orders/{id}/awb
{
  "operationId": "orders_awb",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/OrderAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "courier": {
              "type": "string"
            },
            "number": {
              "type": "string"
            },
            "picked_up_at": {
              "type": "string",
              "format": "date"
            },
            "delivered_at": {
              "type": "string",
              "format": "date"
            },
            "returned_at": {
              "type": "string",
              "format": "date"
            }
          },
          "required": [
            "courier",
            "number"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/orders/{id}/cancel

POST /api/v1/companies/{co}/orders/{id}/cancel
{
  "operationId": "orders_cancel",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/OrderAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {},
          "required": [],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/orders/{id}/refund

POST /api/v1/companies/{co}/orders/{id}/refund
{
  "operationId": "orders_refund",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/OrderAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "lines": {
              "type": "array",
              "minItems": 1,
              "uniqueItems": true,
              "items": {
                "type": "integer",
                "minimum": 1
              }
            }
          },
          "required": [],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/orders/{id}/discard

POST /api/v1/companies/{co}/orders/{id}/discard
{
  "operationId": "orders_discard",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/OrderAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {},
          "required": [],
          "additionalProperties": false
        }
      }
    }
  }
}

/api/v1/companies/{co}/orders/{id}/delivery

POST /api/v1/companies/{co}/orders/{id}/delivery
{
  "operationId": "orders_delivery",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "co",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/OrderAction"
          }
        }
      },
      "headers": {
        "ContaHub-API-Version": {
          "schema": {
            "const": "1"
          }
        }
      }
    },
    "400": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "405": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "415": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Request refused",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "picked_up_at": {
              "type": [
                "string",
                "null"
              ],
              "format": "date"
            },
            "returned_at": {
              "type": [
                "string",
                "null"
              ],
              "format": "date"
            }
          },
          "required": [
            "picked_up_at",
            "returned_at"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}

Schemas and security

securitySchemes
{
  "sessionCookie": {
    "type": "apiKey",
    "in": "cookie",
    "name": "__Host-session"
  },
  "bearerAuth": {
    "type": "http",
    "scheme": "bearer",
    "description": "User-owned, scoped install-wide fiscalm token. Rights are scope intersected with the owner’s current role; a disabled owner returns 401, read-only writes return 403 insufficient_scope. All routes require the configured Host and port."
  }
}
schemas
{
  "Meta": {
    "type": "object",
    "properties": {
      "product": {
        "type": "string"
      },
      "version": {
        "type": "string"
      }
    },
    "required": [
      "product",
      "version"
    ]
  },
  "Rule": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "company": {
        "type": "string"
      },
      "kind": {
        "enum": [
          "spv_auto_upload",
          "accountant_pack",
          "receipt_upload",
          "supplier_autopay",
          "client_reminders"
        ]
      },
      "enabled": {
        "type": "boolean"
      },
      "can_pause": {
        "type": "boolean"
      },
      "can_resume": {
        "type": "boolean"
      },
      "can_edit": {
        "type": "boolean"
      },
      "label": {
        "type": [
          "string",
          "null"
        ]
      },
      "waiting_manual": {
        "type": "integer"
      },
      "waiting_queue": {
        "type": "integer"
      },
      "reason": {
        "enum": [
          null,
          "paused",
          "shadow_mode",
          "iban_changed",
          "iban_unproved",
          "supplier_inactive",
          "invoice_refused",
          "revoked",
          "expired",
          "exhausted",
          "invalid_settings"
        ]
      },
      "settings": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "after_days": {
                "type": "integer"
              },
              "source": {
                "enum": [
                  "firm",
                  "default"
                ]
              }
            },
            "required": [
              "after_days",
              "source"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "last": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "action": {
                "type": "string"
              },
              "date": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "count": {
                "type": "integer"
              }
            },
            "required": [
              "action",
              "date",
              "count"
            ]
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "required": [
      "id",
      "company",
      "kind",
      "enabled",
      "can_pause",
      "can_resume",
      "can_edit",
      "label",
      "waiting_manual",
      "waiting_queue",
      "reason",
      "settings",
      "last"
    ]
  },
  "Company": {
    "type": "object",
    "properties": {
      "key": {
        "type": "string"
      },
      "name": {
        "type": "string"
      },
      "legal_name": {
        "type": "string"
      },
      "palette": {
        "type": "string"
      },
      "links": {
        "type": "object",
        "additionalProperties": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        }
      }
    },
    "required": [
      "key",
      "name",
      "legal_name",
      "palette",
      "links"
    ]
  },
  "Received": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "company": {
        "type": "string"
      },
      "supplier": {
        "type": "string"
      },
      "number": {
        "type": "string"
      },
      "currency": {
        "type": "string"
      },
      "status": {
        "type": "string",
        "description": "open; linked to a payment file; marked by a user awaiting proof; paid with confirmation; or skipped."
      },
      "issue_date": {
        "type": [
          "string",
          "null"
        ]
      },
      "due_date": {
        "type": [
          "string",
          "null"
        ]
      },
      "payment_state": {
        "type": [
          "string",
          "null"
        ],
        "description": "For a linked invoice: held, in_file, lost or imported; otherwise null."
      },
      "paid_at": {
        "type": [
          "string",
          "null"
        ]
      },
      "bon": {
        "type": [
          "string",
          "null"
        ],
        "description": "Linked receipt document ID, or null. Never infer a link from matching amounts alone."
      },
      "total": {
        "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
        "type": "string",
        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
      },
      "credits": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "number": {
              "type": "string"
            },
            "amount": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            }
          },
          "required": [
            "id",
            "number",
            "amount"
          ]
        },
        "description": "Unambiguously linked received credit notes, scoped to this company, supplier and currency."
      },
      "credit_note": {
        "type": "boolean",
        "description": "An unmatched received credit note; never payable."
      },
      "covered": {
        "description": "Amount covered by explicit transaction links.",
        "type": "string",
        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
      },
      "left": {
        "description": "Remaining payable amount after credit notes and explicit links; zero when closed.",
        "type": "string",
        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
      },
      "overdue": {
        "type": "boolean"
      },
      "can_approve": {
        "type": "boolean"
      },
      "can_mark_paid": {
        "type": "boolean"
      },
      "can_withdraw": {
        "type": "boolean"
      },
      "can_reopen": {
        "type": "boolean"
      },
      "proved": {
        "type": "boolean",
        "description": "True only with payment evidence. A manual paid mark is not bank or mail proof."
      },
      "links": {
        "type": "object",
        "additionalProperties": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        }
      }
    },
    "required": [
      "id",
      "company",
      "supplier",
      "number",
      "currency",
      "status",
      "issue_date",
      "due_date",
      "payment_state",
      "paid_at",
      "bon",
      "total",
      "credits",
      "credit_note",
      "covered",
      "left",
      "overdue",
      "can_approve",
      "can_mark_paid",
      "can_withdraw",
      "can_reopen",
      "proved",
      "links"
    ]
  },
  "Issued": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "company": {
        "type": "string"
      },
      "number": {
        "type": "string"
      },
      "client": {
        "type": "string"
      },
      "currency": {
        "type": "string"
      },
      "status": {
        "type": "string",
        "description": "A user's collected mark awaits proof; a statement-backed collection is distinct and cannot be unmarked."
      },
      "note": {
        "type": "string"
      },
      "issue_date": {
        "type": [
          "string",
          "null"
        ]
      },
      "due_date": {
        "type": [
          "string",
          "null"
        ]
      },
      "collected_at": {
        "type": [
          "string",
          "null"
        ]
      },
      "how": {
        "type": [
          "string",
          "null"
        ]
      },
      "days_overdue": {
        "type": "integer"
      },
      "total": {
        "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
        "type": "string",
        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
      },
      "credited": {
        "description": "Total of issued credit notes against this invoice.",
        "type": "string",
        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
      },
      "covered": {
        "description": "Amount covered by explicit transaction links.",
        "type": "string",
        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
      },
      "owed": {
        "description": "Outstanding amount after credit notes and explicit coverage.",
        "type": "string",
        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
      },
      "left": {
        "description": "Remaining amount to collect; zero once closed.",
        "type": "string",
        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
      },
      "can_mark": {
        "type": "boolean"
      },
      "can_unmark": {
        "type": "boolean"
      },
      "can_resolve": {
        "type": "boolean",
        "description": "Whether an uncertain upload can currently be resolved after checking SPV; never retry blindly."
      },
      "can_storno": {
        "type": "boolean"
      },
      "can_upload": {
        "type": "boolean"
      },
      "pdf": {
        "type": "boolean"
      },
      "rejected": {
        "type": "boolean"
      },
      "order_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "order_sheet_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "sales_origin": {
        "type": "string"
      },
      "order_number": {
        "type": [
          "string",
          "null"
        ]
      },
      "awb": {
        "type": [
          "object",
          "null"
        ]
      },
      "cod_at_courier": {
        "type": "boolean"
      },
      "origin": {
        "enum": [
          "contahub",
          "spv"
        ],
        "description": "contahub is a retained storage identifier for local invoices; spv is ANAF read-back."
      },
      "local_id": {
        "type": [
          "string",
          "null"
        ],
        "description": "Local immutable invoice ID when mapped to an SPV row; null otherwise."
      },
      "storno_of": {
        "type": [
          "string",
          "null"
        ]
      },
      "reversed_by": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "spv": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "at": {
            "type": [
              "string",
              "null"
            ]
          },
          "environment": {
            "enum": [
              "prod",
              "test"
            ],
            "description": "Effective ANAF environment; TEST has no fiscal value."
          }
        },
        "required": [
          "state",
          "errors",
          "at"
        ]
      },
      "links": {
        "type": "object",
        "additionalProperties": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        }
      }
    },
    "required": [
      "id",
      "company",
      "number",
      "client",
      "currency",
      "status",
      "note",
      "issue_date",
      "due_date",
      "collected_at",
      "how",
      "days_overdue",
      "total",
      "credited",
      "covered",
      "owed",
      "left",
      "can_mark",
      "can_unmark",
      "can_resolve",
      "can_storno",
      "can_upload",
      "pdf",
      "rejected",
      "order_id",
      "order_sheet_id",
      "sales_origin",
      "order_number",
      "awb",
      "cod_at_courier",
      "origin",
      "local_id",
      "storno_of",
      "reversed_by",
      "spv",
      "links"
    ]
  },
  "Document": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Company-owned document SHA-256, not a filesystem path."
      },
      "company": {
        "type": "string"
      },
      "vendor": {
        "type": "string"
      },
      "month": {
        "type": "string"
      },
      "currency": {
        "type": "string"
      },
      "note": {
        "type": "string"
      },
      "date": {
        "type": [
          "string",
          "null"
        ]
      },
      "invoice": {
        "type": [
          "string",
          "null"
        ]
      },
      "card": {
        "type": [
          "string",
          "null"
        ]
      },
      "partner": {
        "type": [
          "string",
          "null"
        ]
      },
      "amount": {
        "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
        "type": "string",
        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
      },
      "sent": {
        "type": "boolean"
      },
      "files": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "type": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "type"
          ]
        },
        "description": "Opaque file IDs for guarded downloads; never storage paths."
      },
      "mail": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "sender": {
                "type": "string"
              },
              "subject": {
                "type": "string"
              },
              "date": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "number": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "sender",
              "subject",
              "date",
              "number"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "items": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "unit": {
                      "type": "string"
                    },
                    "quantity": {
                      "type": "string"
                    },
                    "net": {
                      "type": "string"
                    },
                    "vat": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "name",
                    "unit",
                    "quantity",
                    "net",
                    "vat"
                  ]
                }
              },
              "total": {
                "type": "string"
              },
              "currency": {
                "type": "string"
              },
              "payment": {
                "type": "string"
              },
              "provenance": {
                "type": "string"
              },
              "state": {
                "type": "string"
              },
              "revision": {
                "type": "integer"
              },
              "verified": {
                "type": "boolean"
              },
              "proposal": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "payment_mismatch": {
                "type": "boolean"
              }
            },
            "required": [
              "lines",
              "total",
              "currency",
              "payment",
              "provenance",
              "state",
              "revision",
              "verified",
              "proposal",
              "payment_mismatch"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "links": {
        "type": "object",
        "additionalProperties": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        }
      }
    },
    "required": [
      "id",
      "company",
      "vendor",
      "month",
      "currency",
      "note",
      "date",
      "invoice",
      "card",
      "partner",
      "amount",
      "sent",
      "files",
      "mail",
      "items",
      "links"
    ]
  },
  "Payment": {
    "type": "object",
    "properties": {
      "kind": {
        "type": "string"
      },
      "payee": {
        "type": "string"
      },
      "ref": {
        "type": "string"
      },
      "details": {
        "type": "string"
      },
      "amount": {
        "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
        "type": "string",
        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
      },
      "due": {
        "type": [
          "string",
          "null"
        ]
      },
      "ef_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "paid_at": {
        "type": [
          "string",
          "null"
        ]
      },
      "id": {
        "type": "string"
      },
      "company": {
        "type": "string"
      },
      "status": {
        "type": "string"
      },
      "month": {
        "type": "string"
      },
      "links": {
        "type": "object",
        "additionalProperties": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        }
      }
    },
    "required": [
      "kind",
      "payee",
      "ref",
      "details",
      "amount",
      "due",
      "ef_id",
      "paid_at",
      "id",
      "company",
      "status",
      "month",
      "links"
    ]
  },
  "Report": {
    "type": "object",
    "properties": {
      "company": {
        "type": "string"
      },
      "month": {
        "type": "string"
      },
      "status": {
        "type": "string"
      },
      "sent_on": {
        "type": [
          "string",
          "null"
        ]
      },
      "version": {
        "type": [
          "string",
          "null"
        ]
      },
      "docs": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "vendor": {
              "type": [
                "string",
                "null"
              ]
            },
            "date": {
              "type": [
                "string",
                "null"
              ]
            },
            "kind": {
              "type": "string"
            },
            "note": {
              "type": "string"
            }
          },
          "required": [
            "vendor",
            "date",
            "kind",
            "note"
          ]
        }
      },
      "not_mailed": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "received": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "documents": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "issued": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "to_check": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "bank": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "statement": {
                "type": "boolean"
              },
              "error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "balanced": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "card": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "date": {
                      "type": "string"
                    },
                    "who": {
                      "type": "string"
                    },
                    "orig": {
                      "type": "string"
                    },
                    "amount": {
                      "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                    },
                    "doc": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "date",
                    "who",
                    "orig",
                    "amount",
                    "doc"
                  ]
                }
              },
              "efactura_suppliers": {
                "type": "integer"
              },
              "advances": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "date": {
                      "type": "string"
                    },
                    "amount": {
                      "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                    }
                  },
                  "required": [
                    "date",
                    "amount"
                  ]
                }
              }
            },
            "required": [
              "statement",
              "error",
              "balanced",
              "card",
              "efactura_suppliers",
              "advances"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "links": {
        "type": "object",
        "additionalProperties": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        }
      }
    },
    "required": [
      "company",
      "month",
      "status",
      "sent_on",
      "version",
      "docs",
      "not_mailed",
      "received",
      "documents",
      "issued",
      "to_check",
      "bank",
      "links"
    ]
  },
  "State": {
    "type": "object",
    "properties": {
      "co": {
        "type": "string"
      },
      "dashboard": {
        "$ref": "#/components/schemas/Dashboard"
      },
      "dashboard_pages": {
        "$ref": "#/components/schemas/DashboardPages"
      },
      "task_summary": {
        "$ref": "#/components/schemas/TaskPage"
      },
      "accountant": {
        "type": "object",
        "properties": {
          "cui": {
            "type": "string"
          },
          "senders": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "recipient": {
            "type": "string"
          }
        },
        "required": [
          "cui",
          "senders",
          "recipient"
        ]
      },
      "transactions": {
        "type": "object",
        "properties": {
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "company": {
                  "type": "string"
                },
                "date": {
                  "type": "string"
                },
                "direction": {
                  "enum": [
                    "debit",
                    "credit"
                  ]
                },
                "amount": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                "currency": {
                  "type": "string"
                },
                "account": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "counterparty": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "details": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "card": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "card_owner": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source": {
                  "enum": [
                    "statement",
                    "bank"
                  ]
                },
                "orig": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "amount": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        },
                        "currency": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "amount",
                        "currency"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "explanation": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "const": "payment"
                        },
                        "invoices": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "payments": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string"
                              },
                              "payee": {
                                "type": "string"
                              },
                              "ref": {
                                "type": "string"
                              },
                              "details": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "payee",
                              "ref",
                              "details"
                            ]
                          }
                        },
                        "link": {
                          "$ref": "#/components/schemas/TxLink"
                        }
                      },
                      "required": [
                        "kind",
                        "invoices",
                        "payments"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "const": "collection"
                        },
                        "issued": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "settlement": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "link": {
                          "$ref": "#/components/schemas/TxLink"
                        }
                      },
                      "required": [
                        "kind",
                        "issued",
                        "settlement"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "const": "receipt"
                        },
                        "invoices": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "document": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "kind",
                        "invoices",
                        "document"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "const": "label"
                        },
                        "label": {
                          "enum": [
                            "bank_fee",
                            "interest",
                            "personal",
                            "other"
                          ]
                        },
                        "note": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "link": {
                          "$ref": "#/components/schemas/TxLink"
                        }
                      },
                      "required": [
                        "kind",
                        "label",
                        "note",
                        "link"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "const": "advance"
                        },
                        "who": {
                          "type": "string"
                        },
                        "link": {
                          "$ref": "#/components/schemas/TxLink"
                        }
                      },
                      "required": [
                        "kind",
                        "who",
                        "link"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "const": "transfer"
                        },
                        "other": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "link": {
                          "$ref": "#/components/schemas/TxLink"
                        }
                      },
                      "required": [
                        "kind",
                        "other",
                        "link"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "proposal": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "const": "invoices"
                        },
                        "invoices": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "kind",
                        "invoices"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "const": "receipt"
                        },
                        "document": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "document"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "const": "settlement"
                        },
                        "settlement": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "settlement"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "const": "remembered"
                        },
                        "memory": {
                          "type": "string"
                        },
                        "as": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "enum": [
                                "documents",
                                "label",
                                "transfer",
                                "advance"
                              ]
                            },
                            "partner": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "reason": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "note": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "partner",
                            "reason",
                            "note"
                          ]
                        }
                      },
                      "required": [
                        "kind",
                        "memory",
                        "as"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "partner": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "can_link": {
                  "type": "boolean"
                },
                "remember": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "id",
                "company",
                "date",
                "direction",
                "amount",
                "currency",
                "account",
                "counterparty",
                "details",
                "card",
                "card_owner",
                "source",
                "orig",
                "explanation",
                "proposal",
                "partner",
                "can_link",
                "remember"
              ]
            }
          },
          "to_explain": {
            "type": "integer"
          },
          "reasons": {
            "type": "object",
            "properties": {
              "credit": {
                "type": "object",
                "properties": {
                  "less": {
                    "type": "array",
                    "items": {
                      "enum": [
                        "rest",
                        "courier_fee",
                        "bank_fee",
                        "fx",
                        "other"
                      ]
                    }
                  },
                  "more": {
                    "type": "array",
                    "items": {
                      "enum": [
                        "rest",
                        "courier_fee",
                        "bank_fee",
                        "fx",
                        "other"
                      ]
                    }
                  }
                },
                "required": [
                  "less",
                  "more"
                ]
              },
              "debit": {
                "type": "object",
                "properties": {
                  "less": {
                    "type": "array",
                    "items": {
                      "enum": [
                        "rest",
                        "courier_fee",
                        "bank_fee",
                        "fx",
                        "other"
                      ]
                    }
                  },
                  "more": {
                    "type": "array",
                    "items": {
                      "enum": [
                        "rest",
                        "courier_fee",
                        "bank_fee",
                        "fx",
                        "other"
                      ]
                    }
                  }
                },
                "required": [
                  "less",
                  "more"
                ]
              }
            },
            "required": [
              "credit",
              "debit"
            ]
          },
          "remembered": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "by": {
                  "type": "string"
                },
                "shown": {
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                },
                "who_by": {
                  "type": "string"
                },
                "at": {
                  "type": "string"
                },
                "partner": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "by",
                "shown",
                "kind",
                "note",
                "who_by",
                "at",
                "partner",
                "reason"
              ]
            }
          }
        },
        "required": [
          "rows",
          "to_explain",
          "reasons",
          "remembered"
        ]
      },
      "onboarding": {
        "type": "object",
        "properties": {
          "step": {
            "type": "string"
          },
          "completed": {
            "type": "object"
          },
          "company": {
            "type": "string"
          },
          "bank_mail": {
            "type": "boolean"
          },
          "bank_open": {
            "type": "boolean"
          }
        },
        "required": [
          "step",
          "completed",
          "company",
          "bank_mail",
          "bank_open"
        ]
      },
      "live": {
        "type": "boolean",
        "description": "False without state/LIVE. Configuration may be allowed, but money actions and outward writes refuse."
      },
      "today": {
        "type": "string",
        "description": "Engine date in ISO YYYY-MM-DD; clients do not recalculate due dates or money rules."
      },
      "partners": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "company": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "last": {
              "type": "string"
            },
            "cui": {
              "type": [
                "string",
                "null"
              ]
            },
            "vat_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "country": {
              "type": [
                "string",
                "null"
              ]
            },
            "client_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "ro_vat_status": {
              "type": [
                "string",
                "null"
              ]
            },
            "confirmed": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "at": {
                      "type": "string"
                    },
                    "by": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "invoice": {
                      "type": "string"
                    },
                    "iban_last4": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "at",
                    "by",
                    "invoice",
                    "iban_last4"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "held": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "invoice": {
                    "type": "string"
                  },
                  "amount": {
                    "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                    "type": "string",
                    "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                  },
                  "currency": {
                    "type": "string"
                  }
                },
                "required": [
                  "invoice",
                  "amount",
                  "currency"
                ]
              }
            },
            "report_formats": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "signature": {
                    "type": "string"
                  },
                  "source": {
                    "type": "string"
                  },
                  "mapping": {
                    "type": "object"
                  },
                  "courier": {
                    "type": "string"
                  }
                },
                "required": [
                  "signature",
                  "source",
                  "mapping",
                  "courier"
                ]
              }
            },
            "address": {
              "type": [
                "object",
                "null"
              ]
            },
            "iban_last4": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "roles": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "received": {
              "type": "integer"
            },
            "issued": {
              "type": "integer"
            },
            "late": {
              "type": "integer"
            },
            "payable": {
              "type": "object"
            },
            "receivable": {
              "type": "object"
            },
            "anaf_status": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "checked_at": {
                      "type": "string"
                    },
                    "vat_since": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "inactive_register_removed_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "registration_status": {
                      "type": "string"
                    },
                    "vat_payer": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "efactura_registered": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "inactive": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "vat_on_collection": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "checked_at",
                    "vat_since",
                    "inactive_register_removed_at",
                    "registration_status",
                    "vat_payer",
                    "efactura_registered",
                    "inactive",
                    "vat_on_collection"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "anaf_error": {
              "enum": [
                null,
                "unavailable",
                "not_found",
                "invalid_response"
              ]
            },
            "anaf_eligible": {
              "type": "boolean"
            },
            "autopay": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "can_set_autopay": {
              "type": "boolean"
            },
            "not_mailed": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "can_set_not_mailed": {
              "type": "boolean"
            }
          },
          "required": [
            "id",
            "company",
            "name",
            "last",
            "cui",
            "vat_id",
            "country",
            "client_id",
            "ro_vat_status",
            "confirmed",
            "held",
            "report_formats",
            "address",
            "iban_last4",
            "roles",
            "received",
            "issued",
            "late",
            "payable",
            "receivable",
            "anaf_status",
            "anaf_error",
            "anaf_eligible",
            "autopay",
            "can_set_autopay",
            "not_mailed",
            "can_set_not_mailed"
          ]
        }
      },
      "recurrences": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Recurrence"
        }
      },
      "companies": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "key": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "legal_name": {
              "type": "string"
            },
            "palette": {
              "type": "string"
            },
            "late": {
              "type": "integer"
            }
          },
          "required": [
            "key",
            "name",
            "legal_name",
            "palette",
            "late"
          ]
        }
      },
      "payable": {
        "type": "object"
      },
      "receivable": {
        "type": "object"
      },
      "invoices": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "company": {
              "type": "string"
            },
            "supplier": {
              "type": "string"
            },
            "number": {
              "type": "string"
            },
            "currency": {
              "type": "string"
            },
            "status": {
              "type": "string"
            },
            "issue_date": {
              "type": [
                "string",
                "null"
              ]
            },
            "due_date": {
              "type": [
                "string",
                "null"
              ]
            },
            "payment_state": {
              "type": [
                "string",
                "null"
              ]
            },
            "paid_at": {
              "type": [
                "string",
                "null"
              ]
            },
            "bon": {
              "type": [
                "string",
                "null"
              ]
            },
            "total": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "credits": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "number": {
                    "type": "string"
                  },
                  "amount": {
                    "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                    "type": "string",
                    "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                  }
                },
                "required": [
                  "id",
                  "number",
                  "amount"
                ]
              }
            },
            "credit_note": {
              "type": "boolean"
            },
            "covered": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "left": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "overdue": {
              "type": "boolean"
            },
            "can_approve": {
              "type": "boolean"
            },
            "can_mark_paid": {
              "type": "boolean"
            },
            "can_withdraw": {
              "type": "boolean"
            },
            "can_reopen": {
              "type": "boolean"
            },
            "proved": {
              "type": "boolean"
            }
          },
          "required": [
            "id",
            "company",
            "supplier",
            "number",
            "currency",
            "status",
            "issue_date",
            "due_date",
            "payment_state",
            "paid_at",
            "bon",
            "total",
            "credits",
            "credit_note",
            "covered",
            "left",
            "overdue",
            "can_approve",
            "can_mark_paid",
            "can_withdraw",
            "can_reopen",
            "proved"
          ]
        }
      },
      "issued": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "company": {
              "type": "string"
            },
            "number": {
              "type": "string"
            },
            "client": {
              "type": "string"
            },
            "currency": {
              "type": "string"
            },
            "status": {
              "type": "string"
            },
            "note": {
              "type": "string"
            },
            "issue_date": {
              "type": [
                "string",
                "null"
              ]
            },
            "due_date": {
              "type": [
                "string",
                "null"
              ]
            },
            "collected_at": {
              "type": [
                "string",
                "null"
              ]
            },
            "how": {
              "type": [
                "string",
                "null"
              ]
            },
            "days_overdue": {
              "type": "integer"
            },
            "total": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "credited": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "covered": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "owed": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "left": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "can_mark": {
              "type": "boolean"
            },
            "can_unmark": {
              "type": "boolean"
            },
            "can_resolve": {
              "type": "boolean"
            },
            "can_storno": {
              "type": "boolean"
            },
            "can_upload": {
              "type": "boolean"
            },
            "pdf": {
              "type": "boolean"
            },
            "rejected": {
              "type": "boolean"
            },
            "order_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "order_sheet_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "sales_origin": {
              "type": "string"
            },
            "order_number": {
              "type": [
                "string",
                "null"
              ]
            },
            "awb": {
              "type": [
                "object",
                "null"
              ]
            },
            "cod_at_courier": {
              "type": "boolean"
            },
            "origin": {
              "enum": [
                "contahub",
                "spv"
              ]
            },
            "local_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "storno_of": {
              "type": [
                "string",
                "null"
              ]
            },
            "reversed_by": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "spv": {
              "type": "object",
              "properties": {
                "state": {
                  "type": "string"
                },
                "errors": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "environment": {
                  "enum": [
                    "prod",
                    "test"
                  ],
                  "description": "Effective ANAF environment; TEST has no fiscal value."
                }
              },
              "required": [
                "state",
                "errors",
                "at"
              ]
            }
          },
          "required": [
            "id",
            "company",
            "number",
            "client",
            "currency",
            "status",
            "note",
            "issue_date",
            "due_date",
            "collected_at",
            "how",
            "days_overdue",
            "total",
            "credited",
            "covered",
            "owed",
            "left",
            "can_mark",
            "can_unmark",
            "can_resolve",
            "can_storno",
            "can_upload",
            "pdf",
            "rejected",
            "order_id",
            "order_sheet_id",
            "sales_origin",
            "order_number",
            "awb",
            "cod_at_courier",
            "origin",
            "local_id",
            "storno_of",
            "reversed_by",
            "spv"
          ]
        }
      },
      "documents": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "company": {
              "type": "string"
            },
            "vendor": {
              "type": "string"
            },
            "month": {
              "type": "string"
            },
            "currency": {
              "type": "string"
            },
            "note": {
              "type": "string"
            },
            "date": {
              "type": [
                "string",
                "null"
              ]
            },
            "invoice": {
              "type": [
                "string",
                "null"
              ]
            },
            "card": {
              "type": [
                "string",
                "null"
              ]
            },
            "partner": {
              "type": [
                "string",
                "null"
              ]
            },
            "amount": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "sent": {
              "type": "boolean"
            },
            "files": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "type"
                ]
              }
            },
            "mail": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "sender": {
                      "type": "string"
                    },
                    "subject": {
                      "type": "string"
                    },
                    "date": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "sender",
                    "subject",
                    "date",
                    "number"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "unit": {
                            "type": "string"
                          },
                          "quantity": {
                            "type": "string"
                          },
                          "net": {
                            "type": "string"
                          },
                          "vat": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "name",
                          "unit",
                          "quantity",
                          "net",
                          "vat"
                        ]
                      }
                    },
                    "total": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "payment": {
                      "type": "string"
                    },
                    "provenance": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    },
                    "revision": {
                      "type": "integer"
                    },
                    "verified": {
                      "type": "boolean"
                    },
                    "proposal": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "payment_mismatch": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "lines",
                    "total",
                    "currency",
                    "payment",
                    "provenance",
                    "state",
                    "revision",
                    "verified",
                    "proposal",
                    "payment_mismatch"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "id",
            "company",
            "vendor",
            "month",
            "currency",
            "note",
            "date",
            "invoice",
            "card",
            "partner",
            "amount",
            "sent",
            "files",
            "mail",
            "items"
          ]
        }
      },
      "expenses": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "company": {
              "type": "string"
            },
            "invoice": {
              "type": [
                "string",
                "null"
              ]
            },
            "document": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "id",
            "company",
            "invoice",
            "document"
          ]
        },
        "description": "Stored invoice/receipt links only. Ambiguous or contradictory links stay separate; no fuzzy matching here."
      },
      "inbox": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "sha": {
              "type": "string"
            },
            "uploaded_at": {
              "type": "string"
            },
            "link_label": {
              "type": "string"
            },
            "file_type": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "sha",
            "uploaded_at",
            "link_label",
            "file_type"
          ]
        }
      },
      "settlements": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "kind": {
              "type": "string"
            },
            "company": {
              "type": "string"
            },
            "partner": {
              "type": "string"
            },
            "source": {
              "type": "string"
            },
            "report_key": {
              "type": "string"
            },
            "status": {
              "type": "string"
            },
            "date": {
              "type": "string"
            },
            "currency": {
              "type": "string"
            },
            "credit": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "date": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "amount": {
                      "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                    }
                  },
                  "required": [
                    "id",
                    "date",
                    "currency",
                    "amount"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "invoice_count": {
              "type": "integer"
            },
            "confirmed_count": {
              "type": "integer"
            },
            "can_confirm": {
              "type": "boolean"
            },
            "human_confirmed": {
              "type": "boolean"
            },
            "payer": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name"
              ]
            },
            "gross": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "fee": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "net": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "error": {
              "type": [
                "string",
                "null"
              ]
            },
            "tx_key": {
              "type": [
                "string",
                "null"
              ]
            },
            "failed_line": {
              "type": [
                "integer",
                "null"
              ]
            },
            "sheet": {
              "type": "object",
              "properties": {
                "co": {
                  "type": "string"
                },
                "set": {
                  "type": "string"
                }
              },
              "required": [
                "co",
                "set"
              ]
            },
            "links": {
              "type": "object",
              "properties": {
                "transaction": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "issued": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "transaction",
                "issued"
              ]
            },
            "lines": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "position": {
                    "type": "integer"
                  },
                  "reference": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "awb": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "order": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "invoice": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "gross": {
                    "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                    "type": "string",
                    "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                  },
                  "fee": {
                    "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                    "type": "string",
                    "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                  },
                  "proved": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "position",
                  "reference",
                  "awb",
                  "order",
                  "invoice",
                  "gross",
                  "fee",
                  "proved"
                ]
              }
            }
          },
          "required": [
            "id",
            "kind",
            "company",
            "partner",
            "source",
            "report_key",
            "status",
            "date",
            "currency",
            "credit",
            "invoice_count",
            "confirmed_count",
            "can_confirm",
            "human_confirmed",
            "payer",
            "gross",
            "fee",
            "net",
            "error",
            "tx_key",
            "failed_line",
            "sheet",
            "links",
            "lines"
          ]
        }
      },
      "settlement_tasks": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string"
            },
            "id": {
              "type": "string"
            },
            "company": {
              "type": "string"
            },
            "reason": {
              "type": "string"
            },
            "line": {
              "type": [
                "integer",
                "null"
              ]
            },
            "credit": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "date": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "amount": {
                      "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                    }
                  },
                  "required": [
                    "id",
                    "date",
                    "currency",
                    "amount"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "invoice_count": {
              "type": "integer"
            },
            "net": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "currency": {
              "type": "string"
            },
            "sheet": {
              "type": "object",
              "properties": {
                "co": {
                  "type": "string"
                },
                "set": {
                  "type": "string"
                }
              },
              "required": [
                "co",
                "set"
              ]
            }
          },
          "required": [
            "kind",
            "id",
            "company",
            "reason",
            "line",
            "credit",
            "invoice_count",
            "net",
            "currency",
            "sheet"
          ]
        }
      },
      "settlement_transactions": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "company": {
              "type": "string"
            },
            "settlement": {
              "type": "string"
            },
            "currency": {
              "type": "string"
            },
            "fee": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "sheet": {
              "type": "object",
              "properties": {
                "co": {
                  "type": "string"
                },
                "tx": {
                  "type": "string"
                }
              },
              "required": [
                "co",
                "tx"
              ]
            },
            "links": {
              "type": "object",
              "properties": {
                "settlement": {
                  "type": "string"
                },
                "issued": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "settlement",
                "issued"
              ]
            }
          },
          "required": [
            "id",
            "company",
            "settlement",
            "currency",
            "fee",
            "sheet",
            "links"
          ]
        }
      },
      "cod": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer"
          },
          "totals": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "currency": {
                  "type": "string"
                },
                "total": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                }
              },
              "required": [
                "currency",
                "total"
              ]
            }
          },
          "overdue_days": {
            "type": "integer"
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "company": {
                  "type": "string"
                },
                "invoice": {
                  "type": "string"
                },
                "awb": {
                  "type": "object",
                  "properties": {
                    "courier": {
                      "type": "string"
                    },
                    "number": {
                      "type": "string"
                    },
                    "picked_up_at": {
                      "type": "string",
                      "format": "date"
                    },
                    "delivered_at": {
                      "type": "string",
                      "format": "date"
                    },
                    "returned_at": {
                      "type": "string",
                      "format": "date"
                    }
                  },
                  "required": [
                    "courier",
                    "number"
                  ],
                  "additionalProperties": false
                },
                "waiting": {
                  "type": "boolean"
                },
                "returned": {
                  "type": "boolean"
                },
                "collected": {
                  "type": "boolean"
                },
                "overdue": {
                  "type": "boolean"
                }
              },
              "required": [
                "id",
                "company",
                "invoice",
                "awb",
                "waiting",
                "returned",
                "collected",
                "overdue"
              ]
            }
          },
          "tasks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "company": {
                  "type": "string"
                },
                "invoice": {
                  "type": "string"
                },
                "sheet": {
                  "type": "object",
                  "properties": {
                    "co": {
                      "type": "string"
                    },
                    "iss": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "co",
                    "iss"
                  ]
                },
                "suggestion": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "kind",
                "id",
                "company",
                "invoice",
                "sheet",
                "suggestion"
              ]
            }
          }
        },
        "required": [
          "count",
          "totals",
          "overdue_days",
          "rows",
          "tasks"
        ]
      },
      "settlement_fees": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "report_id": {
              "type": "string"
            },
            "amount": {
              "type": "string"
            },
            "currency": {
              "type": "string"
            },
            "kind": {
              "type": "string"
            }
          },
          "required": [
            "report_id",
            "amount",
            "currency",
            "kind"
          ]
        }
      },
      "orders": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/OrderSheet"
        }
      },
      "order_tasks": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/OrderTask"
        }
      },
      "sales_origins": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "company": {
              "type": [
                "string",
                "null"
              ]
            },
            "label": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "company",
            "label"
          ]
        }
      },
      "cod_receivable": {
        "type": "object",
        "properties": {
          "total": {
            "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
            "type": "string",
            "pattern": "^-?[0-9]+\\.[0-9]{2}$"
          },
          "other": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "currency": {
                  "type": "string"
                },
                "total": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                }
              },
              "required": [
                "currency",
                "total"
              ]
            }
          },
          "count": {
            "type": "integer"
          }
        },
        "required": [
          "total",
          "other",
          "count"
        ]
      },
      "emag_tasks": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "external_id": {
              "type": "string"
            },
            "reason": {
              "type": "string"
            },
            "order_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "draft_id": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "id",
            "external_id",
            "reason",
            "order_id",
            "draft_id"
          ]
        }
      },
      "reminder_tasks": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string"
            },
            "id": {
              "type": "string"
            },
            "label": {
              "type": "string"
            },
            "subject": {
              "type": "string"
            },
            "body": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "id",
            "label",
            "subject",
            "body"
          ]
        }
      },
      "partner_tasks": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "kind": {
              "enum": [
                "inactive_supplier",
                "inactive_client"
              ]
            },
            "id": {
              "type": "string"
            },
            "company": {
              "type": "string"
            },
            "label": {
              "type": "string"
            },
            "detail": {
              "type": "string"
            },
            "checked_at": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "id",
            "company",
            "label",
            "detail",
            "checked_at"
          ]
        }
      },
      "upload_tasks": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string"
            },
            "id": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "id"
          ]
        }
      },
      "payments": {
        "type": "object",
        "properties": {
          "held": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string"
                },
                "payee": {
                  "type": "string"
                },
                "ref": {
                  "type": "string"
                },
                "details": {
                  "type": "string"
                },
                "amount": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                "due": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "ef_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "paid_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "kind",
                "payee",
                "ref",
                "details",
                "amount",
                "due",
                "ef_id",
                "paid_at"
              ]
            }
          },
          "in_file": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string"
                },
                "payee": {
                  "type": "string"
                },
                "ref": {
                  "type": "string"
                },
                "details": {
                  "type": "string"
                },
                "amount": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                "due": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "ef_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "paid_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "kind",
                "payee",
                "ref",
                "details",
                "amount",
                "due",
                "ef_id",
                "paid_at"
              ]
            }
          },
          "lost": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string"
                },
                "payee": {
                  "type": "string"
                },
                "ref": {
                  "type": "string"
                },
                "details": {
                  "type": "string"
                },
                "amount": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                "due": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "ef_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "paid_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "kind",
                "payee",
                "ref",
                "details",
                "amount",
                "due",
                "ef_id",
                "paid_at"
              ]
            }
          },
          "imported": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string"
                },
                "payee": {
                  "type": "string"
                },
                "ref": {
                  "type": "string"
                },
                "details": {
                  "type": "string"
                },
                "amount": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                "due": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "ef_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "paid_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "kind",
                "payee",
                "ref",
                "details",
                "amount",
                "due",
                "ef_id",
                "paid_at"
              ]
            }
          },
          "paid": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string"
                },
                "payee": {
                  "type": "string"
                },
                "ref": {
                  "type": "string"
                },
                "details": {
                  "type": "string"
                },
                "amount": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                "due": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "ef_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "paid_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "proved": {
                  "type": "boolean"
                }
              },
              "required": [
                "kind",
                "payee",
                "ref",
                "details",
                "amount",
                "due",
                "ef_id",
                "paid_at",
                "proved"
              ]
            }
          }
        },
        "required": [
          "held",
          "in_file",
          "lost",
          "imported",
          "paid"
        ]
      },
      "held_reason": {
        "type": "string"
      },
      "file": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "import_in": {
            "type": [
              "string",
              "null"
            ]
          },
          "version": {
            "type": "string"
          },
          "count": {
            "type": "integer"
          },
          "total": {
            "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
            "type": "string",
            "pattern": "^-?[0-9]+\\.[0-9]{2}$"
          },
          "downloads": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "version": {
                  "type": "string"
                },
                "items": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "count": {
                  "type": "integer"
                },
                "total": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                }
              },
              "required": [
                "version",
                "items",
                "at",
                "count",
                "total"
              ]
            }
          },
          "missing": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string"
                  },
                  "count": {
                    "type": "integer"
                  }
                },
                "required": [
                  "version",
                  "count"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "orphans": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "fresh_count": {
            "type": "integer"
          },
          "download_count": {
            "type": "integer"
          },
          "orphan_count": {
            "type": "integer"
          },
          "credit_hold": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "import_in",
          "version",
          "count",
          "total",
          "downloads",
          "missing",
          "orphans",
          "fresh_count",
          "download_count",
          "orphan_count",
          "credit_hold"
        ]
      },
      "reports": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "month": {
              "type": "string"
            },
            "status": {
              "type": "string"
            },
            "sent_on": {
              "type": [
                "string",
                "null"
              ]
            },
            "version": {
              "type": [
                "string",
                "null"
              ]
            },
            "docs": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "vendor": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "date": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "kind": {
                    "type": "string"
                  },
                  "note": {
                    "type": "string"
                  }
                },
                "required": [
                  "vendor",
                  "date",
                  "kind",
                  "note"
                ]
              }
            },
            "not_mailed": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "received": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "documents": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "issued": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "to_check": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "bank": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "statement": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "balanced": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "card": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string"
                          },
                          "who": {
                            "type": "string"
                          },
                          "orig": {
                            "type": "string"
                          },
                          "amount": {
                            "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                            "type": "string",
                            "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                          },
                          "doc": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "date",
                          "who",
                          "orig",
                          "amount",
                          "doc"
                        ]
                      }
                    },
                    "efactura_suppliers": {
                      "type": "integer"
                    },
                    "advances": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string"
                          },
                          "amount": {
                            "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                            "type": "string",
                            "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                          }
                        },
                        "required": [
                          "date",
                          "amount"
                        ]
                      }
                    }
                  },
                  "required": [
                    "statement",
                    "error",
                    "balanced",
                    "card",
                    "efactura_suppliers",
                    "advances"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "month",
            "status",
            "sent_on",
            "version",
            "docs",
            "not_mailed",
            "received",
            "documents",
            "issued",
            "to_check",
            "bank"
          ]
        }
      },
      "to_check": {
        "type": "array",
        "items": {
          "type": "object"
        }
      },
      "news": {
        "type": "array",
        "items": {
          "type": "object"
        }
      },
      "unreadable": {
        "type": "array",
        "items": {
          "type": "object"
        }
      },
      "ambiguous": {
        "type": "array",
        "items": {
          "type": "object"
        }
      },
      "bank_connections": {
        "type": "array",
        "items": {
          "type": "object"
        }
      },
      "refused": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "iban_last4": {
              "type": "string"
            },
            "supplier": {
              "type": "string"
            },
            "can_confirm": {
              "type": "boolean"
            },
            "confirmed": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "at": {
                      "type": "string"
                    },
                    "by": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "at",
                    "by"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "why": {
              "enum": [
                "iban_changed",
                "iban_unproved",
                "unclear",
                "supplier_inactive",
                "ready"
              ]
            },
            "refused_checked_at": {
              "type": [
                "string",
                "null"
              ]
            },
            "still_inactive": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          "required": [
            "id",
            "iban_last4",
            "supplier",
            "can_confirm",
            "confirmed",
            "why",
            "refused_checked_at",
            "still_inactive"
          ]
        },
        "description": "Stored automation/revocation refusals, plus unproved or changed supplier accounts on open invoices in live mode. Reading state never prepares payments."
      },
      "system": {
        "type": "object",
        "description": "Installation health, running version, and updates: enabled (daily anonymous GitHub Releases check), release (validated tag_name, html_url, published_at of a newer stable SemVer, or null), command (manual update command for this install kind)."
      },
      "rules": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Rule"
        }
      }
    },
    "required": [
      "co",
      "dashboard",
      "dashboard_pages",
      "task_summary",
      "accountant",
      "transactions",
      "onboarding",
      "live",
      "today",
      "partners",
      "recurrences",
      "companies",
      "payable",
      "receivable",
      "invoices",
      "issued",
      "documents",
      "expenses",
      "inbox",
      "settlements",
      "settlement_tasks",
      "settlement_transactions",
      "cod",
      "settlement_fees",
      "orders",
      "order_tasks",
      "sales_origins",
      "cod_receivable",
      "emag_tasks",
      "reminder_tasks",
      "partner_tasks",
      "upload_tasks",
      "payments",
      "held_reason",
      "file",
      "reports",
      "to_check",
      "news",
      "unreadable",
      "ambiguous",
      "bank_connections",
      "refused",
      "system",
      "rules"
    ]
  },
  "Sums": {
    "type": "object",
    "properties": {
      "total": {
        "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
        "type": "string",
        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
      },
      "other": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "currency": {
              "type": "string"
            },
            "total": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            }
          },
          "required": [
            "currency",
            "total"
          ]
        }
      }
    },
    "required": [
      "total",
      "other"
    ]
  },
  "DashboardPeriod": {
    "type": "object",
    "properties": {
      "from": {
        "type": "string"
      },
      "to": {
        "type": "string"
      },
      "in": {
        "$ref": "#/components/schemas/Sums"
      },
      "out": {
        "$ref": "#/components/schemas/Sums"
      },
      "left": {
        "$ref": "#/components/schemas/Sums"
      },
      "suppliers": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "partner": {
              "type": [
                "string",
                "null"
              ]
            },
            "company": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "total": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "other": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "currency": {
                    "type": "string"
                  },
                  "total": {
                    "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                    "type": "string",
                    "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                  }
                },
                "required": [
                  "currency",
                  "total"
                ]
              }
            },
            "count": {
              "type": "integer"
            }
          },
          "required": [
            "partner",
            "company",
            "name",
            "total",
            "other",
            "count"
          ]
        }
      },
      "clients": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "partner": {
              "type": [
                "string",
                "null"
              ]
            },
            "company": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "total": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "other": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "currency": {
                    "type": "string"
                  },
                  "total": {
                    "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                    "type": "string",
                    "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                  }
                },
                "required": [
                  "currency",
                  "total"
                ]
              }
            },
            "count": {
              "type": "integer"
            }
          },
          "required": [
            "partner",
            "company",
            "name",
            "total",
            "other",
            "count"
          ]
        }
      }
    },
    "required": [
      "from",
      "to",
      "in",
      "out",
      "left",
      "suppliers",
      "clients"
    ]
  },
  "Dashboard": {
    "type": "object",
    "properties": {
      "periods": {
        "type": "object",
        "properties": {
          "month": {
            "$ref": "#/components/schemas/DashboardPeriod"
          },
          "quarter": {
            "$ref": "#/components/schemas/DashboardPeriod"
          },
          "year": {
            "$ref": "#/components/schemas/DashboardPeriod"
          }
        },
        "required": [
          "month",
          "quarter",
          "year"
        ]
      },
      "months": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "month": {
              "type": "string"
            },
            "in": {
              "$ref": "#/components/schemas/Sums"
            },
            "out": {
              "$ref": "#/components/schemas/Sums"
            }
          },
          "required": [
            "month",
            "in",
            "out"
          ]
        }
      },
      "balances": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "company": {
              "type": "string"
            },
            "iban_last4": {
              "type": "string"
            },
            "currency": {
              "type": "string"
            },
            "bank": {
              "type": "string"
            },
            "balance": {
              "anyOf": [
                {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "day": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "company",
            "iban_last4",
            "currency",
            "bank",
            "balance",
            "day"
          ]
        }
      },
      "through": {
        "type": [
          "string",
          "null"
        ]
      },
      "upcoming": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "company": {
              "type": "string"
            },
            "date": {
              "type": "string"
            },
            "id": {
              "type": "string"
            },
            "who": {
              "type": "string"
            },
            "number": {
              "type": "string"
            },
            "currency": {
              "type": "string"
            },
            "side": {
              "enum": [
                "in",
                "out"
              ]
            },
            "kind": {
              "enum": [
                "invoice",
                "payment",
                "issued"
              ]
            },
            "amount": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            }
          },
          "required": [
            "company",
            "date",
            "id",
            "who",
            "number",
            "currency",
            "side",
            "kind",
            "amount"
          ]
        }
      },
      "to_explain": {
        "type": "integer"
      }
    },
    "required": [
      "periods",
      "months",
      "balances",
      "through",
      "upcoming",
      "to_explain"
    ]
  },
  "TxLink": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "tx": {
        "type": "string"
      },
      "note": {
        "type": "string"
      },
      "by": {
        "type": "string"
      },
      "at": {
        "type": "string"
      },
      "currency": {
        "type": "string"
      },
      "kind": {
        "enum": [
          "documents",
          "label",
          "transfer",
          "advance"
        ]
      },
      "partner": {
        "type": [
          "string",
          "null"
        ]
      },
      "other": {
        "type": [
          "string",
          "null"
        ]
      },
      "parts": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "amount": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "closed": {
              "type": "boolean"
            }
          },
          "required": [
            "id",
            "amount",
            "closed"
          ]
        }
      },
      "payments": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string"
            },
            "payee": {
              "type": "string"
            },
            "ref": {
              "type": "string"
            },
            "details": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "payee",
            "ref",
            "details"
          ]
        }
      },
      "reason": {
        "enum": [
          null,
          "rest",
          "courier_fee",
          "bank_fee",
          "fx",
          "other",
          "bank_fee",
          "interest",
          "personal",
          "other"
        ]
      },
      "difference": {
        "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
        "type": "string",
        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
      }
    },
    "required": [
      "id",
      "tx",
      "note",
      "by",
      "at",
      "currency",
      "kind",
      "partner",
      "other",
      "parts",
      "payments",
      "reason",
      "difference"
    ]
  },
  "Action": {
    "type": "object",
    "properties": {
      "ok": {
        "type": "boolean"
      },
      "message": {
        "type": "string",
        "description": "Romanian toast; clients should use error codes and capability flags, not parse this text."
      },
      "next": {
        "type": [
          "object",
          "null"
        ],
        "description": "Optional engine navigation target."
      },
      "done": {
        "type": [
          "object",
          "null"
        ],
        "description": "Optional identifiers/results returned by the completed action."
      },
      "state": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/State"
          },
          {
            "type": "null"
          }
        ],
        "description": "Refreshed state, or null if the action committed but state reload failed. Read again; do not repeat blindly."
      }
    },
    "required": [
      "ok",
      "message",
      "next",
      "done",
      "state"
    ]
  },
  "Error": {
    "type": "object",
    "properties": {
      "error": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ]
      }
    },
    "required": [
      "error"
    ]
  },
  "File": {
    "type": "string",
    "format": "binary"
  },
  "OpenAPI": {
    "type": "object"
  },
  "UploadLinkList": {
    "type": "array",
    "items": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "company": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "expires_at": {
          "type": "string"
        },
        "revoked_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "last_used_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "uploads": {
          "type": "integer"
        },
        "max_files": {
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "company",
        "label",
        "created_at",
        "expires_at",
        "revoked_at",
        "last_used_at",
        "uploads",
        "max_files"
      ]
    }
  },
  "MCP": {
    "type": "object",
    "description": "JSON-RPC 2.0, no batches, notifications return 202 without execution. Use tools/list for scope-filtered input schemas, tools/call for execution, ping for health. No resource or prompt capability is advertised. Legacy 2025-11-25 uses initialize; subsequent HTTP requests require MCP-Protocol-Version. Modern 2026-07-28 uses server/discover and params._meta io.modelcontextprotocol/protocolVersion plus clientCapabilities; HTTP requires matching MCP-Protocol-Version, Mcp-Method and Mcp-Name for tools/call. HTTP Accept includes application/json and text/event-stream. Tools return JSON text and structuredContent on success, isError on refusal. Invoice issue/storno tools accept idempotency_key with the same semantics as the HTTP header."
  },
  "CompanyPage": {
    "type": "object",
    "properties": {
      "data": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Company"
        }
      },
      "next_cursor": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "required": [
      "data",
      "next_cursor"
    ]
  },
  "ReceivedPage": {
    "type": "object",
    "properties": {
      "data": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Received"
        }
      },
      "next_cursor": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "required": [
      "data",
      "next_cursor"
    ]
  },
  "IssuedPage": {
    "type": "object",
    "properties": {
      "data": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Issued"
        }
      },
      "next_cursor": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "required": [
      "data",
      "next_cursor"
    ]
  },
  "DocumentPage": {
    "type": "object",
    "properties": {
      "data": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Document"
        }
      },
      "next_cursor": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "required": [
      "data",
      "next_cursor"
    ]
  },
  "PaymentPage": {
    "type": "object",
    "properties": {
      "data": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Payment"
        }
      },
      "next_cursor": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "required": [
      "data",
      "next_cursor"
    ]
  },
  "BrowsePage": {
    "type": "object",
    "properties": {
      "data": {
        "type": "array",
        "items": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "company": {
                  "type": "string"
                },
                "number": {
                  "type": "string"
                },
                "client": {
                  "type": "string"
                },
                "currency": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                },
                "issue_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "due_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "collected_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "how": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "days_overdue": {
                  "type": "integer"
                },
                "total": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                "credited": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                "covered": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                "owed": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                "left": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                "can_mark": {
                  "type": "boolean"
                },
                "can_unmark": {
                  "type": "boolean"
                },
                "can_resolve": {
                  "type": "boolean"
                },
                "can_storno": {
                  "type": "boolean"
                },
                "can_upload": {
                  "type": "boolean"
                },
                "pdf": {
                  "type": "boolean"
                },
                "rejected": {
                  "type": "boolean"
                },
                "order_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "order_sheet_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "sales_origin": {
                  "type": "string"
                },
                "order_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "awb": {
                  "type": [
                    "object",
                    "null"
                  ]
                },
                "cod_at_courier": {
                  "type": "boolean"
                },
                "origin": {
                  "enum": [
                    "contahub",
                    "spv"
                  ]
                },
                "local_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "storno_of": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "reversed_by": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "spv": {
                  "type": "object",
                  "properties": {
                    "state": {
                      "type": "string"
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "environment": {
                      "enum": [
                        "prod",
                        "test"
                      ],
                      "description": "Effective ANAF environment; TEST has no fiscal value."
                    }
                  },
                  "required": [
                    "state",
                    "errors",
                    "at"
                  ]
                }
              },
              "required": [
                "id",
                "company",
                "number",
                "client",
                "currency",
                "status",
                "note",
                "issue_date",
                "due_date",
                "collected_at",
                "how",
                "days_overdue",
                "total",
                "credited",
                "covered",
                "owed",
                "left",
                "can_mark",
                "can_unmark",
                "can_resolve",
                "can_storno",
                "can_upload",
                "pdf",
                "rejected",
                "order_id",
                "order_sheet_id",
                "sales_origin",
                "order_number",
                "awb",
                "cod_at_courier",
                "origin",
                "local_id",
                "storno_of",
                "reversed_by",
                "spv"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "company": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "last": {
                  "type": "string"
                },
                "cui": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "vat_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "country": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "client_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "ro_vat_status": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "confirmed": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "at": {
                          "type": "string"
                        },
                        "by": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "invoice": {
                          "type": "string"
                        },
                        "iban_last4": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "at",
                        "by",
                        "invoice",
                        "iban_last4"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "held": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "invoice": {
                        "type": "string"
                      },
                      "amount": {
                        "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                        "type": "string",
                        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                      },
                      "currency": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "invoice",
                      "amount",
                      "currency"
                    ]
                  }
                },
                "report_formats": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "signature": {
                        "type": "string"
                      },
                      "source": {
                        "type": "string"
                      },
                      "mapping": {
                        "type": "object"
                      },
                      "courier": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "signature",
                      "source",
                      "mapping",
                      "courier"
                    ]
                  }
                },
                "address": {
                  "type": [
                    "object",
                    "null"
                  ]
                },
                "iban_last4": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "roles": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "received": {
                  "type": "integer"
                },
                "issued": {
                  "type": "integer"
                },
                "late": {
                  "type": "integer"
                },
                "payable": {
                  "type": "object"
                },
                "receivable": {
                  "type": "object"
                },
                "anaf_status": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "checked_at": {
                          "type": "string"
                        },
                        "vat_since": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "inactive_register_removed_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "registration_status": {
                          "type": "string"
                        },
                        "vat_payer": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "efactura_registered": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "inactive": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "vat_on_collection": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "checked_at",
                        "vat_since",
                        "inactive_register_removed_at",
                        "registration_status",
                        "vat_payer",
                        "efactura_registered",
                        "inactive",
                        "vat_on_collection"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "anaf_error": {
                  "enum": [
                    null,
                    "unavailable",
                    "not_found",
                    "invalid_response"
                  ]
                },
                "anaf_eligible": {
                  "type": "boolean"
                },
                "autopay": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                },
                "can_set_autopay": {
                  "type": "boolean"
                },
                "not_mailed": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                },
                "can_set_not_mailed": {
                  "type": "boolean"
                }
              },
              "required": [
                "id",
                "company",
                "name",
                "last",
                "cui",
                "vat_id",
                "country",
                "client_id",
                "ro_vat_status",
                "confirmed",
                "held",
                "report_formats",
                "address",
                "iban_last4",
                "roles",
                "received",
                "issued",
                "late",
                "payable",
                "receivable",
                "anaf_status",
                "anaf_error",
                "anaf_eligible",
                "autopay",
                "can_set_autopay",
                "not_mailed",
                "can_set_not_mailed"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "company": {
                  "type": "string"
                },
                "invoice": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "company": {
                          "type": "string"
                        },
                        "supplier": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "issue_date": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "due_date": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "payment_state": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "paid_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "bon": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "total": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        },
                        "credits": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "number": {
                                "type": "string"
                              },
                              "amount": {
                                "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                                "type": "string",
                                "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                              }
                            },
                            "required": [
                              "id",
                              "number",
                              "amount"
                            ]
                          }
                        },
                        "credit_note": {
                          "type": "boolean"
                        },
                        "covered": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        },
                        "left": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        },
                        "overdue": {
                          "type": "boolean"
                        },
                        "can_approve": {
                          "type": "boolean"
                        },
                        "can_mark_paid": {
                          "type": "boolean"
                        },
                        "can_withdraw": {
                          "type": "boolean"
                        },
                        "can_reopen": {
                          "type": "boolean"
                        },
                        "proved": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "id",
                        "company",
                        "supplier",
                        "number",
                        "currency",
                        "status",
                        "issue_date",
                        "due_date",
                        "payment_state",
                        "paid_at",
                        "bon",
                        "total",
                        "credits",
                        "credit_note",
                        "covered",
                        "left",
                        "overdue",
                        "can_approve",
                        "can_mark_paid",
                        "can_withdraw",
                        "can_reopen",
                        "proved"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "document": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "company": {
                          "type": "string"
                        },
                        "vendor": {
                          "type": "string"
                        },
                        "month": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "note": {
                          "type": "string"
                        },
                        "date": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "invoice": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "card": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "partner": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "amount": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        },
                        "sent": {
                          "type": "boolean"
                        },
                        "files": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "type"
                            ]
                          }
                        },
                        "mail": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "sender": {
                                  "type": "string"
                                },
                                "subject": {
                                  "type": "string"
                                },
                                "date": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "number": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "sender",
                                "subject",
                                "date",
                                "number"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "items": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "lines": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "unit": {
                                        "type": "string"
                                      },
                                      "quantity": {
                                        "type": "string"
                                      },
                                      "net": {
                                        "type": "string"
                                      },
                                      "vat": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "name",
                                      "unit",
                                      "quantity",
                                      "net",
                                      "vat"
                                    ]
                                  }
                                },
                                "total": {
                                  "type": "string"
                                },
                                "currency": {
                                  "type": "string"
                                },
                                "payment": {
                                  "type": "string"
                                },
                                "provenance": {
                                  "type": "string"
                                },
                                "state": {
                                  "type": "string"
                                },
                                "revision": {
                                  "type": "integer"
                                },
                                "verified": {
                                  "type": "boolean"
                                },
                                "proposal": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "payment_mismatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "lines",
                                "total",
                                "currency",
                                "payment",
                                "provenance",
                                "state",
                                "revision",
                                "verified",
                                "proposal",
                                "payment_mismatch"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "company",
                        "vendor",
                        "month",
                        "currency",
                        "note",
                        "date",
                        "invoice",
                        "card",
                        "partner",
                        "amount",
                        "sent",
                        "files",
                        "mail",
                        "items"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "company",
                "invoice",
                "document"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "company": {
                  "type": "string"
                },
                "state": {
                  "enum": [
                    "open",
                    "held",
                    "in_file",
                    "lost",
                    "imported",
                    "marked",
                    "paid"
                  ]
                },
                "invoice": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "company": {
                          "type": "string"
                        },
                        "supplier": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "issue_date": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "due_date": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "payment_state": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "paid_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "bon": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "total": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        },
                        "credits": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "number": {
                                "type": "string"
                              },
                              "amount": {
                                "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                                "type": "string",
                                "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                              }
                            },
                            "required": [
                              "id",
                              "number",
                              "amount"
                            ]
                          }
                        },
                        "credit_note": {
                          "type": "boolean"
                        },
                        "covered": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        },
                        "left": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        },
                        "overdue": {
                          "type": "boolean"
                        },
                        "can_approve": {
                          "type": "boolean"
                        },
                        "can_mark_paid": {
                          "type": "boolean"
                        },
                        "can_withdraw": {
                          "type": "boolean"
                        },
                        "can_reopen": {
                          "type": "boolean"
                        },
                        "proved": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "id",
                        "company",
                        "supplier",
                        "number",
                        "currency",
                        "status",
                        "issue_date",
                        "due_date",
                        "payment_state",
                        "paid_at",
                        "bon",
                        "total",
                        "credits",
                        "credit_note",
                        "covered",
                        "left",
                        "overdue",
                        "can_approve",
                        "can_mark_paid",
                        "can_withdraw",
                        "can_reopen",
                        "proved"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "payment": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string"
                        },
                        "payee": {
                          "type": "string"
                        },
                        "ref": {
                          "type": "string"
                        },
                        "details": {
                          "type": "string"
                        },
                        "amount": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        },
                        "due": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "ef_id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "paid_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "proved": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "kind",
                        "payee",
                        "ref",
                        "details",
                        "amount",
                        "due",
                        "ef_id",
                        "paid_at"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "refused": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "iban_last4": {
                          "type": "string"
                        },
                        "supplier": {
                          "type": "string"
                        },
                        "can_confirm": {
                          "type": "boolean"
                        },
                        "confirmed": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "at": {
                                  "type": "string"
                                },
                                "by": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "at",
                                "by"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "why": {
                          "enum": [
                            "iban_changed",
                            "iban_unproved",
                            "unclear",
                            "supplier_inactive",
                            "ready"
                          ]
                        },
                        "refused_checked_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "still_inactive": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "iban_last4",
                        "supplier",
                        "can_confirm",
                        "confirmed",
                        "why",
                        "refused_checked_at",
                        "still_inactive"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "company",
                "state",
                "invoice",
                "payment",
                "refused"
              ]
            },
            {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "company": {
                      "type": "string"
                    },
                    "kind": {
                      "const": "purchase"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "company": {
                          "type": "string"
                        },
                        "invoice": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "company": {
                                  "type": "string"
                                },
                                "supplier": {
                                  "type": "string"
                                },
                                "number": {
                                  "type": "string"
                                },
                                "currency": {
                                  "type": "string"
                                },
                                "status": {
                                  "type": "string"
                                },
                                "issue_date": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "due_date": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "payment_state": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "paid_at": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "bon": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "total": {
                                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                                  "type": "string",
                                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                                },
                                "credits": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "number": {
                                        "type": "string"
                                      },
                                      "amount": {
                                        "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                                        "type": "string",
                                        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "number",
                                      "amount"
                                    ]
                                  }
                                },
                                "credit_note": {
                                  "type": "boolean"
                                },
                                "covered": {
                                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                                  "type": "string",
                                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                                },
                                "left": {
                                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                                  "type": "string",
                                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                                },
                                "overdue": {
                                  "type": "boolean"
                                },
                                "can_approve": {
                                  "type": "boolean"
                                },
                                "can_mark_paid": {
                                  "type": "boolean"
                                },
                                "can_withdraw": {
                                  "type": "boolean"
                                },
                                "can_reopen": {
                                  "type": "boolean"
                                },
                                "proved": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "id",
                                "company",
                                "supplier",
                                "number",
                                "currency",
                                "status",
                                "issue_date",
                                "due_date",
                                "payment_state",
                                "paid_at",
                                "bon",
                                "total",
                                "credits",
                                "credit_note",
                                "covered",
                                "left",
                                "overdue",
                                "can_approve",
                                "can_mark_paid",
                                "can_withdraw",
                                "can_reopen",
                                "proved"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "document": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "company": {
                                  "type": "string"
                                },
                                "vendor": {
                                  "type": "string"
                                },
                                "month": {
                                  "type": "string"
                                },
                                "currency": {
                                  "type": "string"
                                },
                                "note": {
                                  "type": "string"
                                },
                                "date": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "invoice": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "card": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "partner": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "amount": {
                                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                                  "type": "string",
                                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                                },
                                "sent": {
                                  "type": "boolean"
                                },
                                "files": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "type": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "type"
                                    ]
                                  }
                                },
                                "mail": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "sender": {
                                          "type": "string"
                                        },
                                        "subject": {
                                          "type": "string"
                                        },
                                        "date": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "number": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "sender",
                                        "subject",
                                        "date",
                                        "number"
                                      ]
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "items": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "lines": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "name": {
                                                "type": "string"
                                              },
                                              "unit": {
                                                "type": "string"
                                              },
                                              "quantity": {
                                                "type": "string"
                                              },
                                              "net": {
                                                "type": "string"
                                              },
                                              "vat": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "name",
                                              "unit",
                                              "quantity",
                                              "net",
                                              "vat"
                                            ]
                                          }
                                        },
                                        "total": {
                                          "type": "string"
                                        },
                                        "currency": {
                                          "type": "string"
                                        },
                                        "payment": {
                                          "type": "string"
                                        },
                                        "provenance": {
                                          "type": "string"
                                        },
                                        "state": {
                                          "type": "string"
                                        },
                                        "revision": {
                                          "type": "integer"
                                        },
                                        "verified": {
                                          "type": "boolean"
                                        },
                                        "proposal": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "payment_mismatch": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": [
                                        "lines",
                                        "total",
                                        "currency",
                                        "payment",
                                        "provenance",
                                        "state",
                                        "revision",
                                        "verified",
                                        "proposal",
                                        "payment_mismatch"
                                      ]
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "company",
                                "vendor",
                                "month",
                                "currency",
                                "note",
                                "date",
                                "invoice",
                                "card",
                                "partner",
                                "amount",
                                "sent",
                                "files",
                                "mail",
                                "items"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "company",
                        "invoice",
                        "document"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "company",
                    "kind",
                    "data"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "company": {
                      "type": "string"
                    },
                    "kind": {
                      "const": "issued"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "company": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        },
                        "client": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "note": {
                          "type": "string"
                        },
                        "issue_date": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "due_date": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "collected_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "how": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "days_overdue": {
                          "type": "integer"
                        },
                        "total": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        },
                        "credited": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        },
                        "covered": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        },
                        "owed": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        },
                        "left": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        },
                        "can_mark": {
                          "type": "boolean"
                        },
                        "can_unmark": {
                          "type": "boolean"
                        },
                        "can_resolve": {
                          "type": "boolean"
                        },
                        "can_storno": {
                          "type": "boolean"
                        },
                        "can_upload": {
                          "type": "boolean"
                        },
                        "pdf": {
                          "type": "boolean"
                        },
                        "rejected": {
                          "type": "boolean"
                        },
                        "order_id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "order_sheet_id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "sales_origin": {
                          "type": "string"
                        },
                        "order_number": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "awb": {
                          "type": [
                            "object",
                            "null"
                          ]
                        },
                        "cod_at_courier": {
                          "type": "boolean"
                        },
                        "origin": {
                          "enum": [
                            "contahub",
                            "spv"
                          ]
                        },
                        "local_id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "storno_of": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "reversed_by": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "spv": {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string"
                            },
                            "errors": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "at": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "environment": {
                              "enum": [
                                "prod",
                                "test"
                              ],
                              "description": "Effective ANAF environment; TEST has no fiscal value."
                            }
                          },
                          "required": [
                            "state",
                            "errors",
                            "at"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "company",
                        "number",
                        "client",
                        "currency",
                        "status",
                        "note",
                        "issue_date",
                        "due_date",
                        "collected_at",
                        "how",
                        "days_overdue",
                        "total",
                        "credited",
                        "covered",
                        "owed",
                        "left",
                        "can_mark",
                        "can_unmark",
                        "can_resolve",
                        "can_storno",
                        "can_upload",
                        "pdf",
                        "rejected",
                        "order_id",
                        "order_sheet_id",
                        "sales_origin",
                        "order_number",
                        "awb",
                        "cod_at_courier",
                        "origin",
                        "local_id",
                        "storno_of",
                        "reversed_by",
                        "spv"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "company",
                    "kind",
                    "data"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "company": {
                      "type": "string"
                    },
                    "kind": {
                      "const": "card"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "date": {
                          "type": "string"
                        },
                        "who": {
                          "type": "string"
                        },
                        "orig": {
                          "type": "string"
                        },
                        "amount": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        },
                        "doc": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "date",
                        "who",
                        "orig",
                        "amount",
                        "doc"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "company",
                    "kind",
                    "data"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "company": {
                      "type": "string"
                    },
                    "kind": {
                      "const": "bank"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "statement": {
                          "type": "boolean"
                        },
                        "error": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "balanced": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "card": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "date": {
                                "type": "string"
                              },
                              "who": {
                                "type": "string"
                              },
                              "orig": {
                                "type": "string"
                              },
                              "amount": {
                                "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                                "type": "string",
                                "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                              },
                              "doc": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "date",
                              "who",
                              "orig",
                              "amount",
                              "doc"
                            ]
                          }
                        },
                        "efactura_suppliers": {
                          "type": "integer"
                        },
                        "advances": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "date": {
                                "type": "string"
                              },
                              "amount": {
                                "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                                "type": "string",
                                "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                              }
                            },
                            "required": [
                              "date",
                              "amount"
                            ]
                          }
                        }
                      },
                      "required": [
                        "statement",
                        "error",
                        "balanced",
                        "card",
                        "efactura_suppliers",
                        "advances"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "company",
                    "kind",
                    "data"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "company": {
                      "type": "string"
                    },
                    "kind": {
                      "const": "mail"
                    },
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "id",
                    "company",
                    "kind",
                    "data"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "company": {
                      "type": "string"
                    },
                    "kind": {
                      "const": "ambiguous"
                    },
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "id",
                    "company",
                    "kind",
                    "data"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "company": {
                      "type": "string"
                    },
                    "kind": {
                      "const": "advance"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "date": {
                          "type": "string"
                        },
                        "amount": {
                          "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                          "type": "string",
                          "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                        }
                      },
                      "required": [
                        "date",
                        "amount"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "company",
                    "kind",
                    "data"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "company": {
                      "type": "string"
                    },
                    "kind": {
                      "const": "document"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "vendor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "date": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "kind": {
                          "type": "string"
                        },
                        "note": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "vendor",
                        "date",
                        "kind",
                        "note"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "company",
                    "kind",
                    "data"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "company": {
                      "type": "string"
                    },
                    "kind": {
                      "const": "not_mailed"
                    },
                    "data": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "company",
                    "kind",
                    "data"
                  ]
                }
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "company": {
                  "type": "string"
                },
                "transaction": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "company": {
                      "type": "string"
                    },
                    "date": {
                      "type": "string"
                    },
                    "direction": {
                      "enum": [
                        "debit",
                        "credit"
                      ]
                    },
                    "amount": {
                      "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "account": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "counterparty": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "details": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "card": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "card_owner": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source": {
                      "enum": [
                        "statement",
                        "bank"
                      ]
                    },
                    "orig": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "amount": {
                              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                              "type": "string",
                              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                            },
                            "currency": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "amount",
                            "currency"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "explanation": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "const": "payment"
                            },
                            "invoices": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "payments": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string"
                                  },
                                  "payee": {
                                    "type": "string"
                                  },
                                  "ref": {
                                    "type": "string"
                                  },
                                  "details": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "payee",
                                  "ref",
                                  "details"
                                ]
                              }
                            },
                            "link": {
                              "$ref": "#/components/schemas/TxLink"
                            }
                          },
                          "required": [
                            "kind",
                            "invoices",
                            "payments"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "const": "collection"
                            },
                            "issued": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "settlement": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "link": {
                              "$ref": "#/components/schemas/TxLink"
                            }
                          },
                          "required": [
                            "kind",
                            "issued",
                            "settlement"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "const": "receipt"
                            },
                            "invoices": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "document": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "invoices",
                            "document"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "const": "label"
                            },
                            "label": {
                              "enum": [
                                "bank_fee",
                                "interest",
                                "personal",
                                "other"
                              ]
                            },
                            "note": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "link": {
                              "$ref": "#/components/schemas/TxLink"
                            }
                          },
                          "required": [
                            "kind",
                            "label",
                            "note",
                            "link"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "const": "advance"
                            },
                            "who": {
                              "type": "string"
                            },
                            "link": {
                              "$ref": "#/components/schemas/TxLink"
                            }
                          },
                          "required": [
                            "kind",
                            "who",
                            "link"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "const": "transfer"
                            },
                            "other": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "link": {
                              "$ref": "#/components/schemas/TxLink"
                            }
                          },
                          "required": [
                            "kind",
                            "other",
                            "link"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "proposal": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "const": "invoices"
                            },
                            "invoices": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "kind",
                            "invoices"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "const": "receipt"
                            },
                            "document": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "kind",
                            "document"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "const": "settlement"
                            },
                            "settlement": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "kind",
                            "settlement"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "const": "remembered"
                            },
                            "memory": {
                              "type": "string"
                            },
                            "as": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "enum": [
                                    "documents",
                                    "label",
                                    "transfer",
                                    "advance"
                                  ]
                                },
                                "partner": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "reason": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "note": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "kind",
                                "partner",
                                "reason",
                                "note"
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "memory",
                            "as"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "partner": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "can_link": {
                      "type": "boolean"
                    },
                    "remember": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "id",
                    "company",
                    "date",
                    "direction",
                    "amount",
                    "currency",
                    "account",
                    "counterparty",
                    "details",
                    "card",
                    "card_owner",
                    "source",
                    "orig",
                    "explanation",
                    "proposal",
                    "partner",
                    "can_link",
                    "remember"
                  ]
                },
                "said": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "text": {
                          "type": "string"
                        },
                        "to": {
                          "type": "object",
                          "properties": {
                            "inv": {
                              "type": "string"
                            },
                            "iss": {
                              "type": "string"
                            },
                            "doc": {
                              "type": "string"
                            },
                            "set": {
                              "type": "string"
                            },
                            "tab": {
                              "enum": [
                                "plati",
                                "sarcini"
                              ]
                            }
                          },
                          "required": []
                        },
                        "proposal": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "text"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "company",
                "transaction",
                "said"
              ]
            }
          ]
        },
        "maxItems": 200
      },
      "total": {
        "type": "integer"
      },
      "next_cursor": {
        "type": [
          "string",
          "null"
        ]
      },
      "months": {
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    },
    "required": [
      "data",
      "total",
      "next_cursor",
      "months"
    ],
    "description": "One current app list page. Sales, purchases and partners are newest first with stable source-order ties. Filters run on complete entities; total counts all matches regardless of cursor, months covers the complete category before filters. Sales and partners return existing state rows; purchases/receipts return id, company, invoice and document. Sales alone accept f=storno (can_storno); partners alone accept f=accountant (a 2–10 digit CUI). Payment sections keep the existing source order and carry one invoice or payment plus its refusal; they accept no text/month/status filters. File totals/counts remain the complete summary scalars. Report sections require month (YYYY-MM), preserve section/source order and carry id/company/kind/data; they refuse f/q and include full ambiguous-candidate counts before nested bounding. A purchase scopes its invoice/receipt independently to the month's existing report references. Transactions return transaction plus said (text/optional target/proposal), derived from complete identities. They accept f=empty (unexplained), all, in or out; from/to are inclusive ISO dates and apply only to transactions. Their search includes bank text, raw/comma/grouped amounts and the same displayed explanation/proposal. Nested record lists are capped at 50; financial totals and currency aggregates stay complete. Cursor contains only date and ordinal, never payment keys; replace pages after writes/filter changes."
  },
  "DashboardPage": {
    "type": "object",
    "properties": {
      "data": {
        "type": "array",
        "items": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "company": {
                  "type": "string"
                },
                "date": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "who": {
                  "type": "string"
                },
                "number": {
                  "type": "string"
                },
                "currency": {
                  "type": "string"
                },
                "side": {
                  "enum": [
                    "in",
                    "out"
                  ]
                },
                "kind": {
                  "enum": [
                    "invoice",
                    "payment",
                    "issued"
                  ]
                },
                "amount": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                }
              },
              "required": [
                "company",
                "date",
                "id",
                "who",
                "number",
                "currency",
                "side",
                "kind",
                "amount"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "company": {
                  "type": "string"
                },
                "partner": {
                  "type": "string"
                },
                "currency": {
                  "type": "string"
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "amount": {
                  "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                }
              },
              "required": [
                "id",
                "company",
                "partner",
                "currency",
                "name",
                "amount"
              ]
            }
          ]
        }
      },
      "total": {
        "type": "integer"
      },
      "next_cursor": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "required": [
      "data",
      "total",
      "next_cursor"
    ],
    "description": "One page (default 50, maximum 200) of upcoming or held_money, with its complete total row count. Upcoming keeps full dashboard order: date, side, who, then original company/source order. Held amounts sum every exposure per partner/currency before paging, preserving company/partner/currency order. Cursor contains only company/source positions, never payment keys or names. Reads rebuild one firm at a time; no snapshot or cache. Replace pages after data/company changes. Only collection/limit/cursor are accepted."
  },
  "DashboardPages": {
    "type": "object",
    "properties": {
      "upcoming": {
        "$ref": "#/components/schemas/DashboardPage"
      },
      "held_money": {
        "$ref": "#/components/schemas/DashboardPage"
      }
    },
    "required": [
      "upcoming",
      "held_money"
    ],
    "description": "Initial 50-row panels built from the same complete state as totals. Continue using dashboard-list with the panel's cursor and the same company/ALL selection. No additional initial projection is required."
  },
  "ReportPages": {
    "type": "object",
    "properties": {
      "data": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "screen": {
              "enum": [
                "report_received",
                "report_issued",
                "report_tasks",
                "report_bank",
                "report_advances",
                "report_docs",
                "report_not_mailed"
              ]
            },
            "page": {
              "$ref": "#/components/schemas/BrowsePage"
            }
          },
          "required": [
            "screen",
            "page"
          ]
        }
      },
      "total": {
        "const": 7
      },
      "next_cursor": {
        "type": "null"
      }
    },
    "required": [
      "data",
      "total",
      "next_cursor"
    ],
    "description": "Initial pages for one company's existing report month, built from one complete projection. Each section has the requested limit (default 50, maximum 200), its exact total and its own browse cursor. Continue a section through browse with the same screen/month/limit. No cross-request cache or snapshot."
  },
  "SearchResults": {
    "type": "object",
    "properties": {
      "partners": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "company": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "cui": {
              "type": [
                "string",
                "null"
              ]
            },
            "vat_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "roles": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "last": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "company",
            "name",
            "cui",
            "vat_id",
            "roles",
            "last"
          ]
        },
        "maxItems": 6
      },
      "issued": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "company": {
              "type": "string"
            },
            "client": {
              "type": "string"
            },
            "number": {
              "type": "string"
            },
            "total": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "owed": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "currency": {
              "type": "string"
            },
            "issue_date": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "id",
            "company",
            "client",
            "number",
            "total",
            "owed",
            "currency",
            "issue_date"
          ]
        },
        "maxItems": 6
      },
      "invoices": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "company": {
              "type": "string"
            },
            "supplier": {
              "type": "string"
            },
            "number": {
              "type": "string"
            },
            "total": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "currency": {
              "type": "string"
            },
            "issue_date": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "id",
            "company",
            "supplier",
            "number",
            "total",
            "currency",
            "issue_date"
          ]
        },
        "maxItems": 6
      },
      "documents": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "company": {
              "type": "string"
            },
            "vendor": {
              "type": "string"
            },
            "amount": {
              "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "currency": {
              "type": "string"
            },
            "date": {
              "type": [
                "string",
                "null"
              ]
            },
            "month": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "company",
            "vendor",
            "amount",
            "currency",
            "date",
            "month"
          ]
        },
        "maxItems": 6
      }
    },
    "required": [
      "partners",
      "issued",
      "invoices",
      "documents"
    ],
    "description": "Six newest matches per category across complete company entities, with original identities and exact amounts. Every query word must match text or an amount prefix; decimal input fixes the whole units, negative input matches negative amounts only. Matching ignores case, combining diacritics and a tax ID's RO prefix. Queries below two normalized characters return empty categories; the app lists sections locally."
  },
  "TaskEntry": {
    "type": "object",
    "properties": {
      "key": {
        "type": "string"
      },
      "company": {
        "type": "string"
      },
      "urgent": {
        "type": "boolean"
      },
      "patch": {
        "type": "object"
      }
    },
    "required": [
      "key",
      "company",
      "urgent",
      "patch"
    ],
    "description": "Inputs for one existing task card, not a complete entity or decision. Merge patch into the company's summary for rendering only. Nested record lists contain at most 50 entries; use entity reads for details. Full file counts and monetary totals are scalars, never derived from the page. Key and urgency preserve task ordering and deduplication across companies."
  },
  "TaskPage": {
    "type": "object",
    "properties": {
      "total": {
        "type": "integer"
      },
      "urgent": {
        "type": "integer"
      },
      "group": {
        "enum": [
          "",
          "payments"
        ]
      },
      "data": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/TaskEntry"
        },
        "maxItems": 200
      },
      "highlights": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/TaskEntry"
        },
        "maxItems": 3
      },
      "next_cursor": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "required": [
      "total",
      "urgent",
      "group",
      "data",
      "highlights",
      "next_cursor"
    ],
    "description": "Complete deduplicated task counts, one bounded page, and the first three urgent tasks (otherwise first three). The cursor is a nonnegative offset; reads are current, so refresh after writes. group=payments returns only the payment-file questions, as on the payments screen."
  },
  "StateSummary": {
    "type": "object",
    "properties": {
      "co": {
        "$ref": "#/components/schemas/State/properties/co"
      },
      "dashboard": {
        "$ref": "#/components/schemas/State/properties/dashboard"
      },
      "dashboard_pages": {
        "$ref": "#/components/schemas/State/properties/dashboard_pages"
      },
      "task_summary": {
        "$ref": "#/components/schemas/TaskPage"
      },
      "accountant": {
        "type": "object",
        "properties": {
          "cui": {
            "type": "string"
          },
          "senders": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "recipient": {
            "type": "string"
          },
          "partner": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "cui": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name",
                  "cui"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "cui",
          "senders",
          "recipient",
          "partner"
        ]
      },
      "transactions": {
        "$ref": "#/components/schemas/State/properties/transactions"
      },
      "onboarding": {
        "$ref": "#/components/schemas/State/properties/onboarding"
      },
      "live": {
        "$ref": "#/components/schemas/State/properties/live"
      },
      "today": {
        "$ref": "#/components/schemas/State/properties/today"
      },
      "partners": {
        "$ref": "#/components/schemas/State/properties/partners"
      },
      "recurrences": {
        "$ref": "#/components/schemas/State/properties/recurrences"
      },
      "companies": {
        "$ref": "#/components/schemas/State/properties/companies"
      },
      "payable": {
        "$ref": "#/components/schemas/State/properties/payable"
      },
      "receivable": {
        "$ref": "#/components/schemas/State/properties/receivable"
      },
      "invoices": {
        "$ref": "#/components/schemas/State/properties/invoices"
      },
      "issued": {
        "$ref": "#/components/schemas/State/properties/issued"
      },
      "documents": {
        "$ref": "#/components/schemas/State/properties/documents"
      },
      "expenses": {
        "$ref": "#/components/schemas/State/properties/expenses"
      },
      "inbox": {
        "$ref": "#/components/schemas/State/properties/inbox"
      },
      "settlements": {
        "$ref": "#/components/schemas/State/properties/settlements"
      },
      "settlement_tasks": {
        "$ref": "#/components/schemas/State/properties/settlement_tasks"
      },
      "settlement_transactions": {
        "$ref": "#/components/schemas/State/properties/settlement_transactions"
      },
      "cod": {
        "$ref": "#/components/schemas/State/properties/cod"
      },
      "settlement_fees": {
        "$ref": "#/components/schemas/State/properties/settlement_fees"
      },
      "orders": {
        "$ref": "#/components/schemas/State/properties/orders"
      },
      "order_tasks": {
        "$ref": "#/components/schemas/State/properties/order_tasks"
      },
      "sales_origins": {
        "$ref": "#/components/schemas/State/properties/sales_origins"
      },
      "cod_receivable": {
        "$ref": "#/components/schemas/State/properties/cod_receivable"
      },
      "emag_tasks": {
        "$ref": "#/components/schemas/State/properties/emag_tasks"
      },
      "reminder_tasks": {
        "$ref": "#/components/schemas/State/properties/reminder_tasks"
      },
      "partner_tasks": {
        "$ref": "#/components/schemas/State/properties/partner_tasks"
      },
      "upload_tasks": {
        "$ref": "#/components/schemas/State/properties/upload_tasks"
      },
      "payments": {
        "$ref": "#/components/schemas/State/properties/payments"
      },
      "held_reason": {
        "$ref": "#/components/schemas/State/properties/held_reason"
      },
      "file": {
        "$ref": "#/components/schemas/State/properties/file"
      },
      "reports": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "month": {
              "type": "string"
            },
            "status": {
              "type": "string"
            },
            "sent_on": {
              "type": [
                "string",
                "null"
              ]
            },
            "version": {
              "type": [
                "string",
                "null"
              ]
            },
            "docs": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "vendor": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "date": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "kind": {
                    "type": "string"
                  },
                  "note": {
                    "type": "string"
                  }
                },
                "required": [
                  "vendor",
                  "date",
                  "kind",
                  "note"
                ]
              }
            },
            "not_mailed": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "received": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "documents": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "issued": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "to_check": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "bank": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "statement": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "balanced": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "card": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string"
                          },
                          "who": {
                            "type": "string"
                          },
                          "orig": {
                            "type": "string"
                          },
                          "amount": {
                            "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                            "type": "string",
                            "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                          },
                          "doc": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "date",
                          "who",
                          "orig",
                          "amount",
                          "doc"
                        ]
                      }
                    },
                    "efactura_suppliers": {
                      "type": "integer"
                    },
                    "advances": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string"
                          },
                          "amount": {
                            "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                            "type": "string",
                            "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                          }
                        },
                        "required": [
                          "date",
                          "amount"
                        ]
                      }
                    }
                  },
                  "required": [
                    "statement",
                    "error",
                    "balanced",
                    "card",
                    "efactura_suppliers",
                    "advances"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "counts": {
              "type": "object",
              "additionalProperties": {
                "type": "integer"
              }
            }
          },
          "required": [
            "month",
            "status",
            "sent_on",
            "version",
            "docs",
            "not_mailed",
            "received",
            "documents",
            "issued",
            "to_check",
            "bank",
            "counts"
          ]
        }
      },
      "to_check": {
        "$ref": "#/components/schemas/State/properties/to_check"
      },
      "news": {
        "$ref": "#/components/schemas/State/properties/news"
      },
      "unreadable": {
        "$ref": "#/components/schemas/State/properties/unreadable"
      },
      "ambiguous": {
        "$ref": "#/components/schemas/State/properties/ambiguous"
      },
      "bank_connections": {
        "$ref": "#/components/schemas/State/properties/bank_connections"
      },
      "refused": {
        "$ref": "#/components/schemas/State/properties/refused"
      },
      "system": {
        "$ref": "#/components/schemas/State/properties/system"
      },
      "rules": {
        "$ref": "#/components/schemas/State/properties/rules"
      },
      "upcoming_count": {
        "type": "integer"
      },
      "bounded": {
        "const": true
      },
      "record_counts": {
        "type": "object",
        "additionalProperties": {
          "type": "integer"
        }
      },
      "payment_counts": {
        "type": "object",
        "additionalProperties": {
          "type": "integer"
        }
      },
      "invoice_counts": {
        "type": "object",
        "additionalProperties": {
          "type": "integer"
        }
      }
    },
    "required": [
      "co",
      "dashboard",
      "dashboard_pages",
      "task_summary",
      "accountant",
      "transactions",
      "onboarding",
      "live",
      "today",
      "partners",
      "recurrences",
      "companies",
      "payable",
      "receivable",
      "invoices",
      "issued",
      "documents",
      "expenses",
      "inbox",
      "settlements",
      "settlement_tasks",
      "settlement_transactions",
      "cod",
      "settlement_fees",
      "orders",
      "order_tasks",
      "sales_origins",
      "cod_receivable",
      "emag_tasks",
      "reminder_tasks",
      "partner_tasks",
      "upload_tasks",
      "payments",
      "held_reason",
      "file",
      "reports",
      "to_check",
      "news",
      "unreadable",
      "ambiguous",
      "bank_connections",
      "refused",
      "system",
      "rules",
      "upcoming_count",
      "bounded",
      "record_counts",
      "payment_counts",
      "invoice_counts"
    ],
    "description": "App shell with complete monetary totals, rankings, task counts and three bounded task highlights. Historical entity, payment, transaction and task-source lists are empty. Report rows contain metadata and complete counts only; dashboard_pages retains bounded initial panels and their continuation cursors. The app endpoint also accepts ALL and returns per-company shells and deduplicated global tasks. Company/configuration identities and currency aggregates stay complete. Scalar counters describe the original full collections before trimming; record_counts.remembered counts the company's complete remembered transaction explanations. accountant.partner preserves the selected partner's id/name/CUI, or null if unavailable, without its history. Private mutation summaries may populate at most one changed-client partner and one issued invoice for canonical navigation; their nested history lists are bounded to 50. GET summaries keep those lists empty."
  },
  "PartnerPages": {
    "type": "object",
    "properties": {
      "state": {
        "$ref": "#/components/schemas/StateSummary"
      },
      "pages": {
        "type": "object",
        "properties": {
          "invoices": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/State/properties/invoices/items"
                },
                "maxItems": 200
              },
              "total": {
                "type": "integer"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "data",
              "total",
              "next_cursor"
            ]
          },
          "issued": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/State/properties/issued/items"
                },
                "maxItems": 200
              },
              "total": {
                "type": "integer"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "data",
              "total",
              "next_cursor"
            ]
          },
          "transactions": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "company": {
                      "type": "string"
                    },
                    "transaction": {
                      "$ref": "#/components/schemas/State/properties/transactions/properties/rows/items"
                    },
                    "said": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string"
                            },
                            "to": {
                              "type": "object",
                              "properties": {
                                "inv": {
                                  "type": "string"
                                },
                                "iss": {
                                  "type": "string"
                                },
                                "doc": {
                                  "type": "string"
                                },
                                "set": {
                                  "type": "string"
                                },
                                "tab": {
                                  "enum": [
                                    "plati",
                                    "sarcini"
                                  ]
                                }
                              },
                              "required": []
                            },
                            "proposal": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "text"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "company",
                    "transaction",
                    "said"
                  ]
                },
                "maxItems": 200
              },
              "total": {
                "type": "integer"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "data",
              "total",
              "next_cursor"
            ]
          },
          "held": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "invoice": {
                      "type": "string"
                    },
                    "number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "amount": {
                      "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                    },
                    "currency": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "invoice",
                    "number",
                    "amount",
                    "currency"
                  ]
                },
                "maxItems": 200
              },
              "total": {
                "type": "integer"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "data",
              "total",
              "next_cursor"
            ]
          },
          "settlements": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/State/properties/settlements/items"
                },
                "maxItems": 200
              },
              "total": {
                "type": "integer"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "data",
              "total",
              "next_cursor"
            ]
          },
          "remembered": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "memory": {
                      "$ref": "#/components/schemas/State/properties/transactions/properties/remembered/items"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "memory",
                    "text"
                  ]
                },
                "maxItems": 200
              },
              "total": {
                "type": "integer"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "data",
              "total",
              "next_cursor"
            ]
          },
          "report_formats": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/State/properties/partners/items/properties/report_formats/items"
                },
                "maxItems": 200
              },
              "total": {
                "type": "integer"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "data",
              "total",
              "next_cursor"
            ]
          }
        },
        "required": []
      }
    },
    "required": [
      "state",
      "pages"
    ],
    "description": "Partner sheet: one company shell with the complete partner identity, capabilities and monetary balances; its held/report-format histories are empty. Without collection, pages contains all seven collections from one complete projection. With collection, only that page is returned. Each page has its exact total, a nonnegative offset cursor and at most limit rows (default 50, maximum 200). Invoice order is newest issue date first, stable on ties; other collections retain source order. Transaction descriptions and remembered labels use complete identities before paging; held invoice numbers are explicit. Other nested record lists are capped at 50. Omit id only for the company's complete remembered collection. The app accepts ALL with id and resolves the partner's owning company directly; bearer ALL remains refused. Reads are current, not a cross-request snapshot; replace pages after writes."
  },
  "TransactionInvoiceChoice": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "number": {
        "type": "string"
      },
      "currency": {
        "type": "string"
      },
      "date": {
        "type": [
          "string",
          "null"
        ]
      },
      "partner": {
        "type": [
          "string",
          "null"
        ]
      },
      "left": {
        "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
        "type": "string",
        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
      },
      "total": {
        "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
        "type": "string",
        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
      },
      "selected": {
        "type": "boolean"
      },
      "position": {
        "type": "integer"
      }
    },
    "required": [
      "id",
      "number",
      "currency",
      "date",
      "partner",
      "left",
      "total",
      "selected",
      "position"
    ]
  },
  "TransactionChoices": {
    "type": "object",
    "properties": {
      "pages": {
        "type": "object",
        "properties": {
          "partners": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/State/properties/partners/items"
                },
                "maxItems": 200
              },
              "total": {
                "type": "integer"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "data",
              "total",
              "next_cursor"
            ]
          },
          "invoices": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TransactionInvoiceChoice"
                },
                "maxItems": 200
              },
              "total": {
                "type": "integer"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "data",
              "total",
              "next_cursor"
            ]
          },
          "selected": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TransactionInvoiceChoice"
                },
                "maxItems": 200
              },
              "total": {
                "type": "integer"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "data",
              "total",
              "next_cursor"
            ]
          },
          "payments": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "payment": {
                      "$ref": "#/components/schemas/State/properties/payments/properties/held/items"
                    }
                  },
                  "required": [
                    "id",
                    "payment"
                  ]
                },
                "maxItems": 200
              },
              "total": {
                "type": "integer"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "data",
              "total",
              "next_cursor"
            ]
          }
        },
        "required": []
      }
    },
    "required": [
      "pages"
    ],
    "description": "Current transaction-form choices, without linking or settling anything. Without collection, one full owner projection returns initial partners, invoices, payments and selected pages; with collection, just that page. Each has an exact matching total and offset cursor (default 50, maximum 200). Only partners of the transaction's direction are offered, including a credit holder's complete exposure. Invoices retain the existing open/marked, SPV-ready, non-rejected, positive-left and account/original-currency filters; amounts restore this link's own contribution before editing. Closed items selected by the current link remain available. selected pages all existing invoice choices independently of the primary row's nested-list cap; position preserves invoice order across pages/search. Invoices sort by date then case-folded number; partners by case-folded display name. Prepared payments retain held/in-file/lost/imported order, for debits with RON account or original currency only. Payment page IDs are keyed opaque identifiers; raw item_id is private and never appears in a cursor. q is an accent-insensitive display-text substring (maximum 200 characters); it excludes private payment keys. partner applies only to invoices or the initial bundle; selected always uses the current link's partner. Reads are current, not a cross-request snapshot; replace choices after writes."
  },
  "CoveredRow": {
    "oneOf": [
      {
        "type": "object",
        "properties": {
          "kind": {
            "const": "invoice"
          },
          "id": {
            "type": "string"
          },
          "number": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "amount": {
            "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
            "type": "string",
            "pattern": "^-?[0-9]+\\.[0-9]{2}$"
          },
          "left": {
            "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
            "type": "string",
            "pattern": "^-?[0-9]+\\.[0-9]{2}$"
          },
          "closed": {
            "type": "boolean"
          }
        },
        "required": [
          "kind",
          "id",
          "number",
          "currency",
          "amount",
          "left",
          "closed"
        ]
      },
      {
        "type": "object",
        "properties": {
          "kind": {
            "const": "payment"
          },
          "id": {
            "type": "string"
          },
          "payment": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string"
              },
              "payee": {
                "type": "string"
              },
              "ref": {
                "type": "string"
              },
              "details": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "payee",
              "ref",
              "details"
            ]
          }
        },
        "required": [
          "kind",
          "id",
          "payment"
        ]
      }
    ]
  },
  "StateDetail": {
    "type": "object",
    "properties": {
      "state": {
        "$ref": "#/components/schemas/StateSummary",
        "description": "Company shell with only the requested document and its purchase, receipt proposal, refusal and partner context populated."
      },
      "related": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "number": {
                      "type": "string"
                    },
                    "amount": {
                      "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                    }
                  },
                  "required": [
                    "id",
                    "number",
                    "amount"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "company": {
                      "type": "string"
                    },
                    "number": {
                      "type": "string"
                    },
                    "client": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "note": {
                      "type": "string"
                    },
                    "issue_date": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "due_date": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "collected_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "how": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "days_overdue": {
                      "type": "integer"
                    },
                    "total": {
                      "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                    },
                    "credited": {
                      "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                    },
                    "covered": {
                      "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                    },
                    "owed": {
                      "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                    },
                    "left": {
                      "description": "Exact decimal amount with two places; never binary floating point. Currency is a separate field.",
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                    },
                    "can_mark": {
                      "type": "boolean"
                    },
                    "can_unmark": {
                      "type": "boolean"
                    },
                    "can_resolve": {
                      "type": "boolean"
                    },
                    "can_storno": {
                      "type": "boolean"
                    },
                    "can_upload": {
                      "type": "boolean"
                    },
                    "pdf": {
                      "type": "boolean"
                    },
                    "rejected": {
                      "type": "boolean"
                    },
                    "order_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "order_sheet_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sales_origin": {
                      "type": "string"
                    },
                    "order_number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "awb": {
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "cod_at_courier": {
                      "type": "boolean"
                    },
                    "origin": {
                      "enum": [
                        "contahub",
                        "spv"
                      ]
                    },
                    "local_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "storno_of": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reversed_by": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "spv": {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string"
                        },
                        "errors": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "environment": {
                          "enum": [
                            "prod",
                            "test"
                          ],
                          "description": "Effective ANAF environment; TEST has no fiscal value."
                        }
                      },
                      "required": [
                        "state",
                        "errors",
                        "at"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "company",
                    "number",
                    "client",
                    "currency",
                    "status",
                    "note",
                    "issue_date",
                    "due_date",
                    "collected_at",
                    "how",
                    "days_overdue",
                    "total",
                    "credited",
                    "covered",
                    "owed",
                    "left",
                    "can_mark",
                    "can_unmark",
                    "can_resolve",
                    "can_storno",
                    "can_upload",
                    "pdf",
                    "rejected",
                    "order_id",
                    "order_sheet_id",
                    "sales_origin",
                    "order_number",
                    "awb",
                    "cod_at_courier",
                    "origin",
                    "local_id",
                    "storno_of",
                    "reversed_by",
                    "spv"
                  ]
                },
                {
                  "$ref": "#/components/schemas/State/properties/settlements/items/properties/lines/items"
                },
                {
                  "$ref": "#/components/schemas/CoveredRow"
                }
              ]
            },
            "maxItems": 200
          },
          "total": {
            "type": "integer"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "total",
          "next_cursor"
        ]
      },
      "transaction": {
        "type": "object",
        "properties": {
          "said": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string"
                  },
                  "to": {
                    "type": "object",
                    "properties": {
                      "inv": {
                        "type": "string"
                      },
                      "iss": {
                        "type": "string"
                      },
                      "doc": {
                        "type": "string"
                      },
                      "set": {
                        "type": "string"
                      },
                      "tab": {
                        "enum": [
                          "plati",
                          "sarcini"
                        ]
                      }
                    },
                    "required": []
                  },
                  "proposal": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "text"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "parts_count": {
            "type": "integer"
          },
          "payments_count": {
            "type": "integer"
          },
          "choices": {
            "$ref": "#/components/schemas/TransactionChoices/properties/pages"
          }
        },
        "required": [
          "said",
          "parts_count",
          "payments_count",
          "choices"
        ]
      }
    },
    "required": [
      "state",
      "related"
    ],
    "description": "One document, settlement, transaction or eMAG-task sheet, including an issued invoice's local-id alias. Money, identities and capabilities come from the complete company projection. related pages received credit notes, issued reversals or settlement lines in their existing order (default 50, maximum 200); its cursor continues through this same endpoint. The selected invoice contains the current related page. Receipt articles remain complete (at most 40). Other nested historical lists are capped at 50. Reads are current, not a cross-request snapshot. Order id uses the existing company:task_id sheet link; issued context identifies an already issued draft. The app also accepts ALL, reading only candidate owners of global IDs (or the first offered mail company), without retaining other firms' histories. Settlement totals/counts and confirmation capabilities precede paging. For transaction sheets only, transaction contains the complete said descriptor and exact link part/payment counts; related pages covered invoices then prepared payments in source order. Invoice numbers, remaining amounts and currencies have the existing missing-reference fallbacks. The shell keeps the selected transaction, its transfer counterpart, selected partner identities and settlement fee context; no unbounded form-choice arrays are included. The primary transaction's nested lists are capped at 50; use related and its exact total for covered rows. Editable transactions also bundle four initial transaction-choices pages from the same owner projection; immutable transactions carry an empty choices object. Continue/filter through transaction-choices."
  },
  "StateListPage": {
    "type": "object",
    "properties": {
      "data": {
        "type": "array",
        "items": {
          "type": "object"
        }
      },
      "next_cursor": {
        "type": [
          "string",
          "null"
        ]
      },
      "total": {
        "type": "integer"
      }
    },
    "required": [
      "data",
      "next_cursor",
      "total"
    ],
    "description": "Existing state rows, at most 200, ordered by id (upcoming by date:side:who:opaque_id; candidates by engine date/number order). total counts all rows matching filters regardless of the cursor. id retrieves one row independently of the cursor and filters, including an issued invoice's local_id; upcoming uses cursor_id. candidates requires tx from the same company and uses opaque cursor_id; id accepts public payment IDs. Partner identities are computed on complete company data before paging. Reads are current, not snapshot-isolated across requests; replace pages after writes. This bounds transport, not the work needed to project a single company."
  },
  "OrderSheet": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "company": {
        "type": "string"
      },
      "channel": {
        "type": "string"
      },
      "external_id": {
        "type": "string"
      },
      "placed_at": {
        "type": "string"
      },
      "body": {
        "type": "object"
      },
      "draft_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "client_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "draft_version": {
        "type": [
          "integer",
          "null"
        ]
      },
      "reason": {
        "type": [
          "object",
          "null"
        ]
      },
      "invoice_summary": {
        "type": [
          "object",
          "null"
        ]
      },
      "status": {
        "type": "string"
      },
      "awb": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "courier": {
                "type": "string"
              },
              "number": {
                "type": "string"
              },
              "picked_up_at": {
                "type": "string",
                "format": "date"
              },
              "delivered_at": {
                "type": "string",
                "format": "date"
              },
              "returned_at": {
                "type": "string",
                "format": "date"
              }
            },
            "required": [
              "courier",
              "number"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "invoice_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "spv": {
        "type": [
          "object",
          "null"
        ]
      },
      "links": {
        "type": "object",
        "properties": {
          "draft": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoice": {
            "type": [
              "string",
              "null"
            ]
          },
          "pdf": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "draft",
          "invoice",
          "pdf"
        ],
        "additionalProperties": false
      },
      "sheet_id": {
        "type": "string"
      },
      "channel_name": {
        "type": [
          "string",
          "null"
        ]
      },
      "company_name": {
        "type": "string"
      },
      "delivery": {
        "type": "object",
        "properties": {
          "picked_up_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "returned_at": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "picked_up_at",
          "returned_at"
        ],
        "additionalProperties": false
      },
      "cod_at_courier": {
        "type": "boolean"
      },
      "can_discard": {
        "type": "boolean"
      },
      "can_cancel": {
        "type": "boolean"
      }
    },
    "required": [
      "id",
      "company",
      "channel",
      "external_id",
      "placed_at",
      "body",
      "draft_id",
      "client_id",
      "draft_version",
      "reason",
      "invoice_summary",
      "status",
      "awb",
      "invoice_id",
      "spv",
      "links",
      "sheet_id",
      "channel_name",
      "company_name",
      "delivery",
      "cod_at_courier",
      "can_discard",
      "can_cancel"
    ],
    "additionalProperties": false
  },
  "OrderTask": {
    "type": "object",
    "properties": {
      "kind": {
        "const": "order_refused"
      },
      "id": {
        "type": "string"
      },
      "company": {
        "type": "string"
      },
      "order_id": {
        "type": "string"
      },
      "sheet": {
        "const": "ord"
      },
      "reason": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "label": {
        "type": "string"
      },
      "action": {
        "const": "order-discard"
      }
    },
    "required": [
      "kind",
      "id",
      "company",
      "order_id",
      "sheet",
      "reason",
      "label",
      "action"
    ],
    "additionalProperties": false
  },
  "Order": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "company": {
        "type": "string"
      },
      "channel": {
        "type": "string"
      },
      "external_id": {
        "type": "string"
      },
      "placed_at": {
        "type": "string"
      },
      "body": {
        "type": "object"
      },
      "draft_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "client_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "draft_version": {
        "type": [
          "integer",
          "null"
        ]
      },
      "reason": {
        "type": [
          "object",
          "null"
        ]
      },
      "invoice_summary": {
        "type": [
          "object",
          "null"
        ]
      },
      "status": {
        "type": "string"
      },
      "awb": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "courier": {
                "type": "string"
              },
              "number": {
                "type": "string"
              },
              "picked_up_at": {
                "type": "string",
                "format": "date"
              },
              "delivered_at": {
                "type": "string",
                "format": "date"
              },
              "returned_at": {
                "type": "string",
                "format": "date"
              }
            },
            "required": [
              "courier",
              "number"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "invoice_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "spv": {
        "type": [
          "object",
          "null"
        ]
      },
      "links": {
        "type": "object",
        "properties": {
          "draft": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoice": {
            "type": [
              "string",
              "null"
            ]
          },
          "pdf": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "draft",
          "invoice",
          "pdf"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "id",
      "company",
      "channel",
      "external_id",
      "placed_at",
      "body",
      "draft_id",
      "client_id",
      "draft_version",
      "reason",
      "invoice_summary",
      "status",
      "awb",
      "invoice_id",
      "spv",
      "links"
    ],
    "additionalProperties": false
  },
  "OrderAction": {
    "type": "object",
    "properties": {
      "ok": {
        "type": "boolean"
      },
      "message": {
        "type": "string"
      },
      "id": {
        "type": "string"
      },
      "draft_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "invoice_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "status": {
        "type": "string"
      },
      "order_status": {
        "type": "string"
      },
      "refund_draft_id": {
        "type": "string"
      }
    },
    "required": [
      "ok",
      "message",
      "id",
      "draft_id",
      "invoice_id",
      "status"
    ],
    "additionalProperties": false
  },
  "OrderPage": {
    "type": "object",
    "properties": {
      "data": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "company": {
              "type": "string"
            },
            "channel": {
              "type": "string"
            },
            "external_id": {
              "type": "string"
            },
            "placed_at": {
              "type": "string"
            },
            "body": {
              "type": "object"
            },
            "draft_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "client_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "draft_version": {
              "type": [
                "integer",
                "null"
              ]
            },
            "reason": {
              "type": [
                "object",
                "null"
              ]
            },
            "invoice_summary": {
              "type": [
                "object",
                "null"
              ]
            },
            "status": {
              "type": "string"
            },
            "awb": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "courier": {
                      "type": "string"
                    },
                    "number": {
                      "type": "string"
                    },
                    "picked_up_at": {
                      "type": "string",
                      "format": "date"
                    },
                    "delivered_at": {
                      "type": "string",
                      "format": "date"
                    },
                    "returned_at": {
                      "type": "string",
                      "format": "date"
                    }
                  },
                  "required": [
                    "courier",
                    "number"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "invoice_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "spv": {
              "type": [
                "object",
                "null"
              ]
            },
            "links": {
              "type": "object",
              "properties": {
                "draft": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "invoice": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "pdf": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "draft",
                "invoice",
                "pdf"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "id",
            "company",
            "channel",
            "external_id",
            "placed_at",
            "body",
            "draft_id",
            "client_id",
            "draft_version",
            "reason",
            "invoice_summary",
            "status",
            "awb",
            "invoice_id",
            "spv",
            "links"
          ],
          "additionalProperties": false
        }
      },
      "next_cursor": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "required": [
      "data",
      "next_cursor"
    ],
    "additionalProperties": false
  },
  "InvoicingDraft": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "series": {
        "type": "string"
      },
      "issue_date": {
        "type": "string"
      },
      "due_date": {
        "type": "string"
      },
      "currency": {
        "type": "string"
      },
      "notes": {
        "type": "string"
      },
      "advance_invoice": {
        "type": "boolean"
      },
      "advance_payment_date": {
        "type": [
          "string",
          "null"
        ]
      },
      "chargeability_date": {
        "type": [
          "string",
          "null"
        ]
      },
      "mentions": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "warnings": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "supply_country": {
        "type": "string"
      },
      "order_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "order_sheet_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "sales_origin": {
        "type": "string"
      },
      "order_number": {
        "type": [
          "string",
          "null"
        ]
      },
      "awb": {
        "type": [
          "object",
          "null"
        ]
      },
      "cod_at_courier": {
        "type": "boolean"
      },
      "version": {
        "type": "integer",
        "minimum": 1
      },
      "client_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "client": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "cui": {
            "type": "string"
          },
          "vat_id": {
            "type": "string"
          },
          "tax_id": {
            "type": "string"
          },
          "ro_vat_status": {
            "type": "string"
          },
          "reg_com": {
            "type": "string"
          },
          "iban": {
            "type": "string"
          },
          "bank": {
            "type": "string"
          },
          "account_name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "private": {
            "type": "boolean"
          },
          "vat_payer": {
            "type": "boolean"
          },
          "efactura_registered": {
            "type": "boolean"
          },
          "inactive": {
            "type": "boolean"
          },
          "address": {
            "type": "object",
            "properties": {
              "street": {
                "type": "string"
              },
              "city": {
                "type": "string"
              },
              "county": {
                "type": "string"
              },
              "postal_code": {
                "type": "string"
              },
              "country": {
                "type": "string"
              }
            },
            "required": [],
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "address",
          "vat_payer"
        ],
        "additionalProperties": false
      },
      "lines": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "description": {
              "type": "string"
            },
            "quantity": {
              "type": "string"
            },
            "unit": {
              "type": "string"
            },
            "unit_price": {
              "type": "string"
            },
            "vat_category": {
              "type": "string"
            },
            "vat_rate": {
              "type": "string"
            },
            "exemption": {
              "type": "string"
            },
            "gross_unit_price": {
              "type": "string"
            }
          },
          "required": [
            "description",
            "quantity",
            "unit",
            "unit_price",
            "vat_category",
            "vat_rate"
          ],
          "additionalProperties": false
        }
      },
      "delivery_date": {
        "type": [
          "string",
          "null"
        ]
      },
      "updated_at": {
        "type": [
          "string",
          "null"
        ]
      },
      "totals": {
        "type": "object",
        "properties": {
          "net": {
            "type": "string",
            "pattern": "^-?[0-9]+\\.[0-9]{2}$"
          },
          "vat": {
            "type": "string",
            "pattern": "^-?[0-9]+\\.[0-9]{2}$"
          },
          "total": {
            "type": "string",
            "pattern": "^-?[0-9]+\\.[0-9]{2}$"
          },
          "by_vat": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "category": {
                  "type": "string"
                },
                "rate": {
                  "type": "string"
                },
                "base": {
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                "vat": {
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                }
              },
              "required": [],
              "additionalProperties": false
            }
          },
          "total_ron": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_ron": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "exchange_rate": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "rate": {
                "type": "string"
              },
              "date": {
                "type": "string"
              }
            },
            "required": [],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "required": [],
    "additionalProperties": false
  },
  "InvoicingIssued": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "company": {
        "type": "string"
      },
      "series": {
        "type": "string"
      },
      "status": {
        "type": "string"
      },
      "version": {
        "type": "integer",
        "minimum": 1
      },
      "number": {
        "type": "integer"
      },
      "data": {
        "type": "object",
        "properties": {
          "issue_date": {
            "type": "string"
          },
          "due_date": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "exchange_rate": {
            "type": "string"
          },
          "exchange_date": {
            "type": "string"
          },
          "advance_invoice": {
            "type": "boolean"
          },
          "advance_payment_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "chargeability_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "mentions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "supply_country": {
            "type": "string"
          },
          "seller": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "cui": {
                "type": "string"
              },
              "vat_id": {
                "type": "string"
              },
              "tax_id": {
                "type": "string"
              },
              "ro_vat_status": {
                "type": "string"
              },
              "reg_com": {
                "type": "string"
              },
              "iban": {
                "type": "string"
              },
              "bank": {
                "type": "string"
              },
              "account_name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              },
              "country": {
                "type": "string"
              },
              "private": {
                "type": "boolean"
              },
              "vat_payer": {
                "type": "boolean"
              },
              "efactura_registered": {
                "type": "boolean"
              },
              "inactive": {
                "type": "boolean"
              },
              "street": {
                "type": "string"
              },
              "city": {
                "type": "string"
              },
              "county": {
                "type": "string"
              },
              "postal_code": {
                "type": "string"
              },
              "vat_on_collection": {
                "type": "boolean"
              }
            },
            "required": [],
            "additionalProperties": false
          },
          "client": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "cui": {
                "type": "string"
              },
              "vat_id": {
                "type": "string"
              },
              "tax_id": {
                "type": "string"
              },
              "ro_vat_status": {
                "type": "string"
              },
              "reg_com": {
                "type": "string"
              },
              "iban": {
                "type": "string"
              },
              "bank": {
                "type": "string"
              },
              "account_name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              },
              "country": {
                "type": "string"
              },
              "private": {
                "type": "boolean"
              },
              "vat_payer": {
                "type": "boolean"
              },
              "efactura_registered": {
                "type": "boolean"
              },
              "inactive": {
                "type": "boolean"
              },
              "street": {
                "type": "string"
              },
              "city": {
                "type": "string"
              },
              "county": {
                "type": "string"
              },
              "postal_code": {
                "type": "string"
              },
              "vat_on_collection": {
                "type": "boolean"
              }
            },
            "required": [],
            "additionalProperties": false
          },
          "totals": {
            "type": "object",
            "properties": {
              "net": {
                "type": "string",
                "pattern": "^-?[0-9]+\\.[0-9]{2}$"
              },
              "vat": {
                "type": "string",
                "pattern": "^-?[0-9]+\\.[0-9]{2}$"
              },
              "total": {
                "type": "string",
                "pattern": "^-?[0-9]+\\.[0-9]{2}$"
              },
              "taxes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "category": {
                      "type": "string"
                    },
                    "rate": {
                      "type": "string"
                    },
                    "net": {
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                    },
                    "vat": {
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                    }
                  },
                  "required": [],
                  "additionalProperties": false
                }
              }
            },
            "required": [],
            "additionalProperties": false
          },
          "issued_live": {
            "type": "boolean"
          },
          "logo_sha": {
            "type": [
              "string",
              "null"
            ]
          },
          "delivery_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "billing_ref": {
            "type": "string"
          },
          "original_issue_date": {
            "type": "string"
          }
        },
        "required": [
          "issue_date",
          "due_date",
          "currency",
          "seller",
          "client",
          "totals"
        ],
        "additionalProperties": false
      },
      "lines": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "description": {
              "type": "string"
            },
            "quantity": {
              "type": "string"
            },
            "unit": {
              "type": "string"
            },
            "unit_price": {
              "type": "string"
            },
            "vat_category": {
              "type": "string"
            },
            "vat_rate": {
              "type": "string"
            },
            "gross_unit_price": {
              "type": "string"
            },
            "net": {
              "type": "string",
              "pattern": "^-?[0-9]+\\.[0-9]{2}$"
            },
            "exemption_reason": {
              "type": "string"
            }
          },
          "required": [],
          "additionalProperties": false
        }
      }
    },
    "required": [],
    "additionalProperties": false
  },
  "Recurrence": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "company": {
        "type": "string"
      },
      "client_id": {
        "type": "string"
      },
      "series": {
        "type": "string"
      },
      "start_period": {
        "type": "string"
      },
      "backlog_policy": {
        "type": "string"
      },
      "template": {
        "type": "object"
      },
      "day": {
        "type": "integer"
      },
      "due_days": {
        "type": "integer"
      },
      "paused": {
        "type": "boolean"
      },
      "reason": {
        "type": [
          "string",
          "null"
        ],
        "enum": [
          null,
          "manual",
          "missing_client",
          "missing_series",
          "invalid_template",
          "rate_unavailable",
          "unsupported_currency"
        ]
      },
      "last_period": {
        "type": [
          "string",
          "null"
        ]
      },
      "client": {
        "type": [
          "string",
          "null"
        ]
      },
      "total": {
        "type": [
          "string",
          "null"
        ]
      },
      "next_date": {
        "type": [
          "string",
          "null"
        ]
      },
      "can_pause": {
        "type": "boolean"
      },
      "can_resume": {
        "type": "boolean"
      },
      "can_delete": {
        "type": "boolean"
      },
      "skipped_periods": {
        "type": "integer"
      },
      "last_skipped": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "recurrence": {
                "type": "string"
              },
              "company": {
                "type": "string"
              },
              "from_period": {
                "type": "string"
              },
              "through_period": {
                "type": "string"
              },
              "at": {
                "type": "string"
              },
              "count": {
                "type": "integer"
              }
            },
            "required": [],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "required": [],
    "additionalProperties": false
  },
  "Recurrences": {
    "type": "array",
    "items": {
      "$ref": "#/components/schemas/Recurrence"
    }
  },
  "InvoicingAction": {
    "type": "object",
    "properties": {
      "recurrences": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Recurrence"
        }
      },
      "ok": {
        "type": "boolean"
      },
      "message": {
        "type": "string"
      },
      "id": {
        "type": [
          "string",
          "null"
        ]
      },
      "version": {
        "type": "integer",
        "minimum": 1
      },
      "code": {
        "type": "string"
      },
      "client": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "cui": {
            "type": "string"
          },
          "vat_id": {
            "type": "string"
          },
          "tax_id": {
            "type": "string"
          },
          "ro_vat_status": {
            "type": "string"
          },
          "reg_com": {
            "type": "string"
          },
          "iban": {
            "type": "string"
          },
          "bank": {
            "type": "string"
          },
          "account_name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "private": {
            "type": "boolean"
          },
          "vat_payer": {
            "type": "boolean"
          },
          "efactura_registered": {
            "type": "boolean"
          },
          "inactive": {
            "type": "boolean"
          },
          "address": {
            "type": "object",
            "properties": {
              "street": {
                "type": "string"
              },
              "city": {
                "type": "string"
              },
              "county": {
                "type": "string"
              },
              "postal_code": {
                "type": "string"
              },
              "country": {
                "type": "string"
              }
            },
            "required": [],
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "address",
          "vat_payer"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "ok",
      "message",
      "id"
    ],
    "additionalProperties": false
  },
  "InvoicingWorkspace": {
    "type": "object",
    "properties": {
      "co": {
        "type": "string"
      },
      "live": {
        "type": "boolean"
      },
      "today": {
        "type": "string"
      },
      "seller": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "legal_name": {
                "type": "string"
              },
              "cui": {
                "type": "string"
              },
              "vat_id": {
                "type": "string"
              },
              "reg_com": {
                "type": "string"
              },
              "iban": {
                "type": "string"
              },
              "bank": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              },
              "vat_payer": {
                "type": "boolean"
              },
              "vat_on_collection": {
                "type": "boolean"
              },
              "address": {
                "type": "object",
                "properties": {
                  "street": {
                    "type": "string"
                  },
                  "city": {
                    "type": "string"
                  },
                  "county": {
                    "type": "string"
                  },
                  "postal_code": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string"
                  }
                },
                "required": [],
                "additionalProperties": false
              }
            },
            "required": [],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "auto_upload": {
        "type": "boolean"
      },
      "series": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "code": {
              "type": "string"
            },
            "next_number": {
              "type": "integer"
            },
            "issued": {
              "type": "integer"
            },
            "imported": {
              "type": [
                "integer",
                "null"
              ]
            }
          },
          "required": [],
          "additionalProperties": false
        }
      },
      "series_proposals": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "code": {
              "type": "string"
            },
            "next_number": {
              "type": "integer"
            },
            "imported": {
              "type": "integer"
            },
            "count": {
              "type": "integer"
            }
          },
          "required": [],
          "additionalProperties": false
        }
      },
      "clients": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "cui": {
              "type": "string"
            },
            "vat_id": {
              "type": "string"
            },
            "tax_id": {
              "type": "string"
            },
            "ro_vat_status": {
              "type": "string"
            },
            "reg_com": {
              "type": "string"
            },
            "iban": {
              "type": "string"
            },
            "bank": {
              "type": "string"
            },
            "account_name": {
              "type": "string"
            },
            "email": {
              "type": "string"
            },
            "phone": {
              "type": "string"
            },
            "country": {
              "type": "string"
            },
            "private": {
              "type": "boolean"
            },
            "vat_payer": {
              "type": "boolean"
            },
            "efactura_registered": {
              "type": "boolean"
            },
            "inactive": {
              "type": "boolean"
            },
            "address": {
              "type": "object",
              "properties": {
                "street": {
                  "type": "string"
                },
                "city": {
                  "type": "string"
                },
                "county": {
                  "type": "string"
                },
                "postal_code": {
                  "type": "string"
                },
                "country": {
                  "type": "string"
                }
              },
              "required": [],
              "additionalProperties": false
            },
            "id": {
              "type": "string"
            },
            "last_used": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "name",
            "address",
            "vat_payer"
          ],
          "additionalProperties": false
        }
      },
      "line_description_max": {
        "type": "integer"
      },
      "accounts": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "iban": {
              "type": "string"
            },
            "currency": {
              "type": "string"
            },
            "bank": {
              "type": "string"
            },
            "bank_name": {
              "type": "string"
            },
            "pays": {
              "type": "boolean"
            }
          },
          "required": [],
          "additionalProperties": false
        }
      },
      "recurrences": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Recurrence"
        }
      },
      "drafts": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "series": {
              "type": "string"
            },
            "issue_date": {
              "type": "string"
            },
            "due_date": {
              "type": "string"
            },
            "currency": {
              "type": "string"
            },
            "notes": {
              "type": "string"
            },
            "advance_invoice": {
              "type": "boolean"
            },
            "advance_payment_date": {
              "type": [
                "string",
                "null"
              ]
            },
            "chargeability_date": {
              "type": [
                "string",
                "null"
              ]
            },
            "mentions": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "warnings": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "supply_country": {
              "type": "string"
            },
            "order_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "order_sheet_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "sales_origin": {
              "type": "string"
            },
            "order_number": {
              "type": [
                "string",
                "null"
              ]
            },
            "awb": {
              "type": [
                "object",
                "null"
              ]
            },
            "cod_at_courier": {
              "type": "boolean"
            },
            "version": {
              "type": "integer",
              "minimum": 1
            },
            "client_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "client": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "cui": {
                  "type": "string"
                },
                "vat_id": {
                  "type": "string"
                },
                "tax_id": {
                  "type": "string"
                },
                "ro_vat_status": {
                  "type": "string"
                },
                "reg_com": {
                  "type": "string"
                },
                "iban": {
                  "type": "string"
                },
                "bank": {
                  "type": "string"
                },
                "account_name": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "phone": {
                  "type": "string"
                },
                "country": {
                  "type": "string"
                },
                "private": {
                  "type": "boolean"
                },
                "vat_payer": {
                  "type": "boolean"
                },
                "efactura_registered": {
                  "type": "boolean"
                },
                "inactive": {
                  "type": "boolean"
                },
                "address": {
                  "type": "object",
                  "properties": {
                    "street": {
                      "type": "string"
                    },
                    "city": {
                      "type": "string"
                    },
                    "county": {
                      "type": "string"
                    },
                    "postal_code": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    }
                  },
                  "required": [],
                  "additionalProperties": false
                }
              },
              "required": [
                "name",
                "address",
                "vat_payer"
              ],
              "additionalProperties": false
            },
            "lines": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "quantity": {
                    "type": "string"
                  },
                  "unit": {
                    "type": "string"
                  },
                  "unit_price": {
                    "type": "string"
                  },
                  "vat_category": {
                    "type": "string"
                  },
                  "vat_rate": {
                    "type": "string"
                  },
                  "exemption": {
                    "type": "string"
                  },
                  "gross_unit_price": {
                    "type": "string"
                  }
                },
                "required": [
                  "description",
                  "quantity",
                  "unit",
                  "unit_price",
                  "vat_category",
                  "vat_rate"
                ],
                "additionalProperties": false
              }
            },
            "delivery_date": {
              "type": [
                "string",
                "null"
              ]
            },
            "updated_at": {
              "type": [
                "string",
                "null"
              ]
            },
            "totals": {
              "type": "object",
              "properties": {
                "net": {
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                "vat": {
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                "total": {
                  "type": "string",
                  "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                },
                "by_vat": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "category": {
                        "type": "string"
                      },
                      "rate": {
                        "type": "string"
                      },
                      "base": {
                        "type": "string",
                        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                      },
                      "vat": {
                        "type": "string",
                        "pattern": "^-?[0-9]+\\.[0-9]{2}$"
                      }
                    },
                    "required": [],
                    "additionalProperties": false
                  }
                },
                "total_ron": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "vat_ron": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [],
              "additionalProperties": false
            },
            "exchange_rate": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "rate": {
                      "type": "string"
                    },
                    "date": {
                      "type": "string"
                    }
                  },
                  "required": [],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [],
          "additionalProperties": false
        }
      },
      "units": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "code": {
              "type": "string"
            },
            "label": {
              "type": "string"
            }
          },
          "required": [],
          "additionalProperties": false
        }
      },
      "vat": {
        "type": "object",
        "properties": {
          "rates": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "default": {
            "type": "string"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [],
              "additionalProperties": false
            }
          },
          "exemptions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [],
              "additionalProperties": false
            }
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "category": {
                  "type": "string"
                },
                "rate": {
                  "type": "string"
                },
                "exemption": {
                  "type": "string"
                },
                "needs_delivery_date": {
                  "type": "boolean"
                }
              },
              "required": [],
              "additionalProperties": false
            }
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "required": {
        "type": "object",
        "properties": {
          "seller": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "seller_if_ro": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "seller_if_vat_payer": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "client_identity_any_of": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "client_if_vat_payer": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "client_if_k": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "client_if_ro_vat_registered": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "draft_if_advance_payment_date": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "client": {
            "type": "object",
            "properties": {
              "RO": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "other": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [],
            "additionalProperties": false
          }
        },
        "required": [],
        "additionalProperties": false
      }
    },
    "required": [],
    "additionalProperties": false
  }
}