openapi: 3.0.0
paths:
  /v1/me:
    get:
      operationId: MeController_me
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        The calling key's client, key name, scopes and environment; plus the
        user for web sessions
      tags:
        - Meta
    patch:
      operationId: MeController_update
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateMeDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Updates the client's settings: its own tax numbers, used to warn about
        invoices filed in the wrong direction
      tags:
        - Meta
  /v1/usage/balance:
    get:
      operationId: UsageController_balance
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Credit balance, open reservations, expiring grants and plan limits
      tags:
        - Usage
  /v1/usage:
    get:
      operationId: UsageController_usage
      parameters:
        - name: from
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
        - name: to
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
        - name: group_by
          required: false
          in: query
          schema:
            default: DAY
            type: string
            enum:
              - DAY
              - DOCUMENT_TYPE
              - SCHEMA
        - name: environment
          required: false
          in: query
          schema:
            default: LIVE
            type: string
            enum:
              - LIVE
              - TEST
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Documents, pages and credits over a period, grouped by day, type or
        schema
      tags:
        - Usage
  /v1/usage/ledger:
    get:
      operationId: UsageController_ledger
      parameters:
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Paginated credit ledger, newest first
      tags:
        - Usage
  /v1/usage/pricing:
    get:
      operationId: UsageController_pricing
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: 'Credits per page: a digital page, a scanned page, a blank page'
      tags:
        - Usage
  /v1/auth/config:
    get:
      operationId: AccountController_authConfig
      parameters: []
      responses:
        '200':
          description: ''
      summary: >-
        Web UI settings: whether self-serve registration is open and whether
        workflows can run on this server
      tags:
        - Account
  /v1/auth/invites/{token}:
    get:
      operationId: AccountController_invite
      parameters:
        - name: token
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      summary: >-
        What a team invitation link is for: the company, the invited email and
        whether it can still be accepted
      tags:
        - Account
  /v1/auth/provision:
    post:
      operationId: AccountController_provision
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProvisionDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Creates the signed-in user's account (client, profile, signup credits)
        on first call; returns it afterwards
      tags:
        - Account
  /v1/auth/password/code:
    post:
      operationId: PasswordController_sendCode
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Emails the signed-in person a code that lets them change their password
        without the current one
      tags:
        - Account
  /v1/auth/password:
    post:
      operationId: PasswordController_change
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChangePasswordDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Changes the signed-in person's password after checking their current
        password or emailed code; signs out every other session
      tags:
        - Account
  /v1/team/members:
    get:
      operationId: TeamController_members
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: The company's team members with their roles
      tags:
        - Account
  /v1/team/members/{profileId}:
    patch:
      operationId: TeamController_updateMember
      parameters:
        - name: profileId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateMemberDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Changes a team member's role (admin or member); owner or admin only
      tags:
        - Account
    delete:
      operationId: TeamController_removeMember
      parameters:
        - name: profileId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: >-
        Removes a person from the team; their sign-in stops working for this
        company at once
      tags:
        - Account
  /v1/team/invites:
    get:
      operationId: TeamController_invites
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Invitations nobody has accepted yet
      tags:
        - Account
    post:
      operationId: TeamController_invite
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInviteDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: >-
        Invites someone by email. The link is emailed when email is configured
        and is always returned, so it can be passed on by hand
      tags:
        - Account
  /v1/team/invites/{inviteId}:
    delete:
      operationId: TeamController_revokeInvite
      parameters:
        - name: inviteId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Withdraws an invitation; its link stops working
      tags:
        - Account
  /v1/me/profile:
    patch:
      operationId: ProfileController_update
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateProfileDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Changes your name, email language or email notifications; owners and
        admins can also rename the company
      tags:
        - Account
  /v1/me/mfa:
    post:
      operationId: ProfileController_mfa
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateMfaDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Turns two-factor sign-in on or off for you; the session must have passed
        the authenticator code
      tags:
        - Account
  /v1/account/api-keys:
    get:
      operationId: ApiKeysController_list
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        The company's API keys (never the key itself, which is shown once at
        creation)
      tags:
        - Account
    post:
      operationId: ApiKeysController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAccountApiKeyDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: >-
        Creates an API key; the response carries the key once and it cannot be
        shown again
      tags:
        - Account
  /v1/account/api-keys/{apiKeyId}/revoke:
    post:
      operationId: ApiKeysController_revoke
      parameters:
        - name: apiKeyId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Revokes an API key at once; integrations using it stop working
      tags:
        - Account
  /v1/billing:
    get:
      operationId: BillingController_overview
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        The plan, trial and subscription, the plans and packs on sale, and the
        recent purchases
      tags:
        - Billing
  /v1/billing/checkout:
    post:
      operationId: BillingController_checkout
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckoutDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Opens a Stripe payment page for one credit pack; owner or admin. Credits
        arrive when Stripe confirms the payment
      tags:
        - Billing
  /v1/billing/subscribe:
    post:
      operationId: BillingController_subscribe
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlanDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Opens a Stripe payment page that starts a plan; owner or admin
      tags:
        - Billing
  /v1/billing/plan:
    post:
      operationId: BillingController_changePlan
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlanDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Changes the plan: a bigger one at once (prorated, credits granted now),
        a smaller one at the end of the period
      tags:
        - Billing
  /v1/billing/cancel:
    post:
      operationId: BillingController_cancel
      parameters: []
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Ends the plan at the end of the paid period
      tags:
        - Billing
  /v1/billing/resume:
    post:
      operationId: BillingController_resume
      parameters: []
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Keeps a plan that was set to end
      tags:
        - Billing
  /v1/billing/portal:
    post:
      operationId: BillingController_portal
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Opens Stripe's page for the card on file and past invoices
      tags:
        - Billing
  /v1/me/table-settings:
    get:
      operationId: TableSettingsController_list
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: The signed-in user's saved web UI table settings, one entry per table
      tags:
        - Account
  /v1/me/table-settings/{table_id}:
    put:
      operationId: TableSettingsController_save
      parameters:
        - name: table_id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TableSettingsDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Saves the signed-in user's column order, visibility and widths for one
        web UI table, replacing what was saved
      tags:
        - Account
  /v1/schemas:
    get:
      operationId: SchemasController_list
      parameters:
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: document_type
          required: false
          in: query
          schema:
            type: string
            enum:
              - BANK_STATEMENT
              - INCOMING_INVOICE
              - OUTGOING_INVOICE
              - RECEIPT
              - CONTRACT
              - OTHER
        - name: include_system
          required: false
          in: query
          schema:
            default: 'true'
            type: string
            enum:
              - 'true'
              - 'false'
        - name: status
          required: false
          in: query
          schema:
            type: string
            enum:
              - ACTIVE
              - ARCHIVED
              - DRAFT
        - name: source_document_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: List system and client schemas
      tags:
        - Schemas
    post:
      operationId: SchemasController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSchemaDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: Create a schema
      tags:
        - Schemas
  /v1/schemas/validate:
    post:
      operationId: SchemasController_validate
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ValidateSchemaDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Dry-run validate a schema definition
      tags:
        - Schemas
  /v1/schemas/settings:
    get:
      operationId: SchemasController_getSettings
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Schema settings of the client: whether proposing new schemas for unknown
        documents is locked
      tags:
        - Schemas
    put:
      operationId: SchemasController_putSettings
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SchemaSettingsDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Lock or unlock model-proposed schemas; when locked, documents of unknown
        types go to review
      tags:
        - Schemas
  /v1/schemas/{schemaId}:
    get:
      operationId: SchemasController_get
      parameters:
        - name: schemaId
          required: true
          in: path
          schema:
            type: string
        - name: version
          required: false
          in: query
          schema:
            maximum: 9007199254740991
            exclusiveMinimum: true
            type: integer
            minimum: 0
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Get a schema, optionally at an older version
      tags:
        - Schemas
    put:
      operationId: SchemasController_update
      parameters:
        - name: schemaId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSchemaDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Update a schema (creates a new version)
      tags:
        - Schemas
    delete:
      operationId: SchemasController_archive
      parameters:
        - name: schemaId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Archive a schema
      tags:
        - Schemas
  /v1/schemas/{schemaId}/versions:
    get:
      operationId: SchemasController_versions
      parameters:
        - name: schemaId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        The saved versions of a schema, newest first, with who saved them and
        why
      tags:
        - Schemas
  /v1/schemas/{schemaId}/copy:
    post:
      operationId: SchemasController_copy
      parameters:
        - name: schemaId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CopySchemaDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: >-
        Copy a schema (a system schema too) into a draft client schema that can
        be edited
      tags:
        - Schemas
  /v1/schemas/{schemaId}/activate:
    post:
      operationId: SchemasController_activate
      parameters:
        - name: schemaId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActivateSchemaDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Activate a draft schema (proposed or copied) so jobs can use it;
        optionally make it the default for its type
      tags:
        - Schemas
  /v1/schemas/{schemaId}/set-default:
    post:
      operationId: SchemasController_setDefault
      parameters:
        - name: schemaId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Make the schema the default for its document type
      tags:
        - Schemas
  /v1/document-types:
    get:
      operationId: DocumentTypesController_list
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Supported document types and their system schemas
      tags:
        - Meta
  /v1/uploads:
    post:
      operationId: UploadsController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUploadDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: Request a presigned upload URL
      tags:
        - Uploads
  /v1/uploads/batch:
    post:
      operationId: UploadsController_createBatch
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUploadBatchDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: Request presigned upload URLs for up to 500 files
      tags:
        - Uploads
  /v1/jobs:
    post:
      operationId: JobsController_create
      parameters:
        - name: Idempotency-Key
          in: header
          description: Unique per client; replays return the original job
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateJobDto'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CreateJobDto'
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: Create a job from uploads (JSON) or attached files (multipart)
      tags:
        - Jobs
    get:
      operationId: JobsController_list
      parameters:
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: status
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - QUEUED
                - PROCESSING
                - COMPLETED
                - PARTIALLY_FAILED
                - FAILED
                - CANCELLED
        - name: document_type
          required: false
          in: query
          schema:
            type: string
            enum:
              - BANK_STATEMENT
              - INCOMING_INVOICE
              - OUTGOING_INVOICE
              - RECEIPT
              - CONTRACT
              - OTHER
        - name: mode
          required: false
          in: query
          schema:
            type: string
            enum:
              - TYPED
              - AUTO
        - name: created_after
          required: false
          in: query
          schema:
            format: date-time
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
            type: string
        - name: created_before
          required: false
          in: query
          schema:
            format: date-time
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
            type: string
        - name: sort
          required: false
          in: query
          schema:
            default: -created_at
            type: string
            enum:
              - created_at
              - -created_at
              - name
              - -name
              - document_type
              - -document_type
              - status
              - -status
              - document_count
              - -document_count
              - progress
              - -progress
              - needs_review_count
              - -needs_review_count
              - failed_count
              - -failed_count
              - credits_charged
              - -credits_charged
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: List jobs, newest first
      tags:
        - Jobs
  /v1/jobs/{jobId}:
    get:
      operationId: JobsController_get
      parameters:
        - name: jobId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Get a job (supports ETag / If-None-Match for cheap polling)
      tags:
        - Jobs
    delete:
      operationId: JobsController_remove
      parameters:
        - name: jobId
          required: true
          in: path
          schema:
            type: string
        - name: purge
          required: false
          in: query
          schema:
            default: 'false'
            type: string
            enum:
              - 'true'
              - 'false'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Cancel a running job (200) or delete a finished one (204); ?purge=true
        deletes regardless
      tags:
        - Jobs
  /v1/jobs/{jobId}/documents:
    get:
      operationId: JobsController_listDocuments
      parameters:
        - name: jobId
          required: true
          in: path
          schema:
            type: string
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: status
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - PENDING
                - PROCESSING
                - COMPLETED
                - NEEDS_REVIEW
                - FAILED
                - SKIPPED
                - TRIAGING
                - SPLIT
        - name: document_type
          required: false
          in: query
          schema:
            type: string
            enum:
              - BANK_STATEMENT
              - INCOMING_INVOICE
              - OUTGOING_INVOICE
              - RECEIPT
              - CONTRACT
              - OTHER
        - name: parent_document_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: sort
          required: false
          in: query
          schema:
            default: position
            type: string
            enum:
              - position
              - -position
              - original_filename
              - -original_filename
              - page_count
              - -page_count
              - extraction_method
              - -extraction_method
              - status
              - -status
              - bank_name
              - -bank_name
              - account_iban
              - -account_iban
              - account_number
              - -account_number
              - statement_date
              - -statement_date
              - extracted_rows
              - -extracted_rows
              - balance_check
              - -balance_check
              - invoice_number
              - -invoice_number
              - issue_date
              - -issue_date
              - counterparty_name
              - -counterparty_name
              - total
              - -total
              - currency
              - -currency
              - line_count
              - -line_count
              - totals_check
              - -totals_check
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: List the documents of a job in creation order
      tags:
        - Jobs
  /v1/jobs/{jobId}/results:
    get:
      operationId: JobsController_listResults
      parameters:
        - name: jobId
          required: true
          in: path
          schema:
            type: string
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: status
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - COMPLETED
                - NEEDS_REVIEW
        - name: include_failed
          required: false
          in: query
          schema:
            default: 'false'
            type: string
            enum:
              - 'true'
              - 'false'
        - name: apply_corrections
          required: false
          in: query
          schema:
            default: 'false'
            type: string
            enum:
              - 'true'
              - 'false'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Bulk results for finished documents
      tags:
        - Jobs
  /v1/jobs/{jobId}/rerun:
    post:
      operationId: JobsController_rerun
      parameters:
        - name: jobId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RerunDto'
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: >-
        Read every finished document of the job again with another schema
        version (batch form of the document re-run)
      tags:
        - Jobs
  /v1/jobs/{jobId}/document-type:
    post:
      operationId: JobsController_changeType
      parameters:
        - name: jobId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClassifyDto'
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: >-
        Change the declared type of a typed job; every finished document of
        another type is read again as it
      tags:
        - Jobs
  /v1/schemas/{schemaId}/test:
    post:
      operationId: SchemaTestController_test
      parameters:
        - name: schemaId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestSchemaDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Run the schema against one upload synchronously (≤ 60 s); 504 falls back
        to the async job
      tags:
        - Schemas
  /v1/documents/{documentId}:
    get:
      operationId: DocumentsController_get
      parameters:
        - name: documentId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Get a document
      tags:
        - Documents
    delete:
      operationId: DocumentsController_remove
      parameters:
        - name: documentId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Delete a finished document, its file, result and corrections
      tags:
        - Documents
  /v1/documents/{documentId}/result:
    get:
      operationId: DocumentsController_getResult
      parameters:
        - name: documentId
          required: true
          in: path
          schema:
            type: string
        - name: apply_corrections
          required: false
          in: query
          schema:
            default: 'false'
            type: string
            enum:
              - 'true'
              - 'false'
        - name: include
          required: false
          in: query
          schema:
            default: ''
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Get the extraction result (COMPLETED and NEEDS_REVIEW only);
        ?apply_corrections=true overlays corrections, ?include=citations adds
        where each value was read
      tags:
        - Documents
  /v1/documents/{documentId}/source:
    get:
      operationId: DocumentsController_getSource
      parameters:
        - name: documentId
          required: true
          in: path
          schema:
            type: string
        - name: redirect
          required: false
          in: query
          schema:
            default: 'true'
            type: string
            enum:
              - 'true'
              - 'false'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Redirects to a 5-minute signed URL for the original file
        (?redirect=false returns it); 410 after retention
      tags:
        - Documents
  /v1/documents/{documentId}/corrections:
    get:
      operationId: DocumentsController_listCorrections
      parameters:
        - name: documentId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Corrections reported for a document, oldest first
      tags:
        - Documents
    post:
      operationId: DocumentsController_corrections
      parameters:
        - name: documentId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CorrectionsDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Report human corrections; resolved=true moves NEEDS_REVIEW to COMPLETED
      tags:
        - Documents
  /v1/documents/{documentId}/warnings/solve:
    post:
      operationId: DocumentsController_solveWarnings
      parameters:
        - name: documentId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WarningsDto'
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: >-
        Mark warnings of a document's result as solved: the values they are
        about were checked and are right
      tags:
        - Documents
  /v1/documents/{documentId}/warnings/reopen:
    post:
      operationId: DocumentsController_reopenWarnings
      parameters:
        - name: documentId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WarningsDto'
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Mark solved warnings of a document's result as open again
      tags:
        - Documents
  /v1/documents/{documentId}/retry:
    post:
      operationId: DocumentsController_retry
      parameters:
        - name: documentId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RetryDto'
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: Retry a failed document (retryable failures only)
      tags:
        - Documents
  /v1/documents/{documentId}/classify:
    post:
      operationId: DocumentsController_classify
      parameters:
        - name: documentId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClassifyDto'
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: >-
        Settle or override the type of a document (also in a typed job, when it
        was uploaded as the wrong type); the document is read again with the
        type's default schema
      tags:
        - Documents
  /v1/documents/{documentId}/rerun:
    post:
      operationId: DocumentsController_rerun
      parameters:
        - name: documentId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RerunDto'
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: >-
        Read a finished document again with another schema version; corrections
        whose path still exists are kept, the rest are listed as dropped
      tags:
        - Documents
  /v1/jobs/{jobId}/export:
    get:
      operationId: ExportsController_exportJob
      parameters:
        - name: jobId
          required: true
          in: path
          schema:
            type: string
        - name: format
          required: false
          in: query
          schema:
            default: xlsx
            type: string
            enum:
              - xlsx
              - csv
              - json
              - XLSX
              - CSV
              - JSON
        - name: layout
          required: false
          in: query
          schema:
            type: string
            enum:
              - transactions
              - statements
              - invoices
              - invoice_lines
        - name: dialect
          required: false
          in: query
          schema:
            default: excel_bs
            type: string
            enum:
              - excel_bs
              - standard
        - name: header
          required: false
          in: query
          schema:
            default: label
            type: string
            enum:
              - label
              - key
        - name: status
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - COMPLETED
                - NEEDS_REVIEW
        - name: document_type
          required: false
          in: query
          schema:
            type: string
            enum:
              - BANK_STATEMENT
              - INCOMING_INVOICE
              - OUTGOING_INVOICE
              - RECEIPT
              - CONTRACT
              - OTHER
        - name: account
          required: false
          in: query
          schema:
            maxLength: 64
            type: string
        - name: date_from
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
        - name: date_to
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
        - name: q
          required: false
          in: query
          schema:
            maxLength: 200
            type: string
        - name: mapping_tables
          required: false
          in: query
          schema:
            minItems: 1
            maxItems: 10
            type: array
            items:
              type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        - name: client_companies
          required: false
          in: query
          schema:
            minItems: 1
            maxItems: 1000
            type: array
            items:
              anyOf:
                - type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                - type: string
                  enum:
                    - none
        - name: template
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: template_version
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 9007199254740991
            type: integer
        - name: import_format
          required: false
          in: query
          schema:
            type: string
            enum:
              - mt940
              - camt053
              - fixed_width_transactions
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Download a job's results as XLSX, CSV or JSON with corrections applied,
        filtered like the web preview
      tags:
        - Exports
  /v1/documents/{documentId}/export:
    get:
      operationId: ExportsController_exportDocument
      parameters:
        - name: documentId
          required: true
          in: path
          schema:
            type: string
        - name: format
          required: false
          in: query
          schema:
            default: xlsx
            type: string
            enum:
              - xlsx
              - csv
              - json
              - XLSX
              - CSV
              - JSON
        - name: layout
          required: false
          in: query
          schema:
            type: string
            enum:
              - transactions
              - statements
              - invoices
              - invoice_lines
        - name: dialect
          required: false
          in: query
          schema:
            default: excel_bs
            type: string
            enum:
              - excel_bs
              - standard
        - name: header
          required: false
          in: query
          schema:
            default: label
            type: string
            enum:
              - label
              - key
        - name: status
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - COMPLETED
                - NEEDS_REVIEW
        - name: document_type
          required: false
          in: query
          schema:
            type: string
            enum:
              - BANK_STATEMENT
              - INCOMING_INVOICE
              - OUTGOING_INVOICE
              - RECEIPT
              - CONTRACT
              - OTHER
        - name: account
          required: false
          in: query
          schema:
            maxLength: 64
            type: string
        - name: date_from
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
        - name: date_to
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
        - name: q
          required: false
          in: query
          schema:
            maxLength: 200
            type: string
        - name: mapping_tables
          required: false
          in: query
          schema:
            minItems: 1
            maxItems: 10
            type: array
            items:
              type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        - name: client_companies
          required: false
          in: query
          schema:
            minItems: 1
            maxItems: 1000
            type: array
            items:
              anyOf:
                - type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                - type: string
                  enum:
                    - none
        - name: template
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: template_version
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 9007199254740991
            type: integer
        - name: import_format
          required: false
          in: query
          schema:
            type: string
            enum:
              - mt940
              - camt053
              - fixed_width_transactions
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Download one document's result as XLSX, CSV or JSON with corrections
        applied
      tags:
        - Exports
  /v1/export-links:
    post:
      operationId: ExportLinksController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateExportLinkDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        A short-lived signed URL for an export of a job or document (same
        options as the export endpoints); the file is fetched from the URL
        without the API key
      tags:
        - Exports
  /v1/exports/download:
    get:
      operationId: ExportLinksController_download
      parameters:
        - name: token
          required: true
          in: query
          schema:
            minLength: 10
            maxLength: 4096
            type: string
      responses:
        '200':
          description: ''
      summary: >-
        Downloads an export from a signed link made by POST /export-links;
        authorised by the token alone
      tags:
        - Exports
  /v1/export-templates/drafts:
    post:
      operationId: ExportTemplatesController_createDraft
      parameters: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - source
                - sample
              properties:
                source:
                  type: string
                  enum:
                    - transactions
                    - statements
                    - invoices
                    - invoice_lines
                sample:
                  type: string
                  format: binary
                  description: >-
                    An example of the file the template should produce: .xlsx or
                    .csv, at most 5 MB and 5,000 rows
                name:
                  type: string
                document_id:
                  type: string
                  format: uuid
                  description: >-
                    A processed document the sample was made from; the proposal
                    is verified against it
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: >-
        Start a template from a sample file: a model proposes the mapping
        (proposal.status PENDING → READY)
      tags:
        - Export templates
  /v1/export-templates:
    post:
      operationId: ExportTemplatesController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTemplateDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: >-
        Create a template by hand (a draft; defaults to every column of the
        built-in layout)
      tags:
        - Export templates
    get:
      operationId: ExportTemplatesController_list
      parameters:
        - name: status
          required: false
          in: query
          schema:
            type: string
            enum:
              - DRAFT
              - ACTIVE
              - ARCHIVED
        - name: source
          required: false
          in: query
          schema:
            type: string
            enum:
              - transactions
              - statements
              - invoices
              - invoice_lines
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        List export templates with their current spec (archived ones only with
        status=ARCHIVED)
      tags:
        - Export templates
  /v1/export-templates/{templateId}:
    get:
      operationId: ExportTemplatesController_get
      parameters:
        - name: templateId
          required: true
          in: path
          schema:
            type: string
        - name: version
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 9007199254740991
            type: integer
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Get a template: its spec, verification result and unmapped columns;
        ?version=N for an older version
      tags:
        - Export templates
    put:
      operationId: ExportTemplatesController_update
      parameters:
        - name: templateId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTemplateDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Save an edited spec as a new version (422 INVALID_TEMPLATE lists every
        problem)
      tags:
        - Export templates
  /v1/export-templates/{templateId}/clients:
    put:
      operationId: ExportTemplatesController_setClients
      parameters:
        - name: templateId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetTemplateClientsDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Set who the template is for: all clients, or some (R21). Refused while a
        workflow or delivery rule for other clients uses it
      tags:
        - Export templates
  /v1/export-templates/{templateId}/preview:
    post:
      operationId: ExportTemplatesController_preview
      parameters:
        - name: templateId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreviewBodyDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        The first 50 rows the template produces for a job or document, as JSON,
        with warnings
      tags:
        - Export templates
  /v1/export-templates/{templateId}/activate:
    post:
      operationId: ExportTemplatesController_activate
      parameters:
        - name: templateId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Make the template available in export dialogs (also restores an archived
        one)
      tags:
        - Export templates
  /v1/export-templates/{templateId}/archive:
    post:
      operationId: ExportTemplatesController_archive
      parameters:
        - name: templateId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Archive the template; its versions stay exportable by naming
        template_version
      tags:
        - Export templates
  /v1/schemas/propose:
    post:
      operationId: SchemaTasksController_propose
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProposeSchemaDto'
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: >-
        Propose a draft schema for a processed document; the draft is a client
        schema with status DRAFT
      tags:
        - Schemas
  /v1/schemas/field-hint:
    post:
      operationId: SchemaTasksController_fieldHint
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FieldHintDto'
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: >-
        Turn a plain-language description of a field into a hint, type and enum
        values
      tags:
        - Schemas
  /v1/schemas/preview:
    post:
      operationId: SchemaTasksController_preview
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreviewSchemaDto'
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: >-
        Dry-run a draft definition on a processed document; nothing is stored,
        only a model reading is billed
      tags:
        - Schemas
  /v1/schema-tasks:
    get:
      operationId: SchemaTasksController_list
      parameters:
        - name: document_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: kind
          required: false
          in: query
          schema:
            type: string
            enum:
              - PROPOSE
              - FIELD_HINT
              - PREVIEW
        - name: status
          required: false
          in: query
          schema:
            type: string
            enum:
              - PENDING
              - READY
              - FAILED
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 100
            default: 20
            type: integer
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Recent schema tasks, newest first; filter by document, kind or status
      tags:
        - Schemas
  /v1/schema-tasks/{taskId}:
    get:
      operationId: SchemaTasksController_get
      parameters:
        - name: taskId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: 'Get a schema task: pending, ready with its output, or failed'
      tags:
        - Schemas
  /v1/statements:
    get:
      operationId: StatementsController_list
      parameters:
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: period_from
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
        - name: period_to
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
        - name: account_key
          required: false
          in: query
          schema:
            maxLength: 64
            type: string
        - name: account
          required: false
          in: query
          schema:
            maxLength: 64
            type: string
        - name: bank
          required: false
          in: query
          schema:
            maxLength: 200
            type: string
        - name: status
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - COMPLETED
                - NEEDS_REVIEW
        - name: job_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: client_company_id
          required: false
          in: query
          schema:
            anyOf:
              - type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
              - type: string
                enum:
                  - none
        - name: currency
          required: false
          in: query
          schema:
            maxLength: 10
            type: string
        - name: q
          required: false
          in: query
          schema:
            maxLength: 200
            type: string
        - name: sort
          required: false
          in: query
          schema:
            default: -date
            type: string
            enum:
              - date
              - -date
              - period_start
              - -period_start
              - account_holder
              - -account_holder
              - client_company
              - -client_company
              - bank_name
              - -bank_name
              - account_iban
              - -account_iban
              - account_number
              - -account_number
              - statement_number
              - -statement_number
              - currency
              - -currency
              - opening_balance
              - -opening_balance
              - closing_balance
              - -closing_balance
              - sum_debits
              - -sum_debits
              - sum_credits
              - -sum_credits
              - extracted_rows
              - -extracted_rows
              - status
              - -status
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Bank statements across all batches, newest period first unless sorted,
        with corrections applied
      tags:
        - Statements
  /v1/statements/delete:
    post:
      operationId: StatementsController_delete
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StatementSelectionDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Delete several statements with their files, results and corrections;
        lists the ones that could not be deleted
      tags:
        - Statements
  /v1/statements/resolve:
    post:
      operationId: StatementsController_resolve
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StatementSelectionDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Mark several statements waiting for review as checked (NEEDS_REVIEW to
        COMPLETED); checked ones are left as they are
      tags:
        - Statements
  /v1/bank-accounts:
    get:
      operationId: StatementsController_bankAccounts
      parameters:
        - name: client_company_id
          required: false
          in: query
          schema:
            anyOf:
              - type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
              - type: string
                enum:
                  - none
        - name: sort
          required: false
          in: query
          schema:
            default: account_holder
            type: string
            enum:
              - account_holder
              - -account_holder
              - account_iban
              - -account_iban
              - account_number
              - -account_number
              - bank_name
              - -bank_name
              - currencies
              - -currencies
              - statement_count
              - -statement_count
              - needs_review_count
              - -needs_review_count
              - first_period_start
              - -first_period_start
              - last_period_end
              - -last_period_end
              - latest_closing_balance
              - -latest_closing_balance
              - last_uploaded_at
              - -last_uploaded_at
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Bank accounts found on the bank statements, one per account however it
        was printed
      tags:
        - Statements
  /v1/banks:
    get:
      operationId: StatementsController_banks
      parameters:
        - name: sort
          required: false
          in: query
          schema:
            default: name
            type: string
            enum:
              - name
              - -name
              - code
              - -code
              - account_count
              - -account_count
              - statement_count
              - -statement_count
              - needs_review_count
              - -needs_review_count
              - last_period_end
              - -last_period_end
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Banks found on the bank statements, one per BiH bank code or bank name
      tags:
        - Statements
  /v1/transactions:
    get:
      operationId: StatementsController_transactions
      parameters:
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: date_from
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
        - name: date_to
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
        - name: account_key
          required: false
          in: query
          schema:
            maxLength: 64
            type: string
        - name: account
          required: false
          in: query
          schema:
            maxLength: 64
            type: string
        - name: bank
          required: false
          in: query
          schema:
            maxLength: 200
            type: string
        - name: status
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - COMPLETED
                - NEEDS_REVIEW
        - name: job_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: client_company_id
          required: false
          in: query
          schema:
            anyOf:
              - type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
              - type: string
                enum:
                  - none
        - name: q
          required: false
          in: query
          schema:
            maxLength: 200
            type: string
        - name: counterparty
          required: false
          in: query
          schema:
            maxLength: 200
            type: string
        - name: amount_min
          required: false
          in: query
          schema:
            type: number
        - name: amount_max
          required: false
          in: query
          schema:
            type: number
        - name: match_status
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - UNMATCHED
                - PROPOSED
                - PARTIAL
                - MATCHED
                - CLASSIFIED
        - name: sort
          required: false
          in: query
          schema:
            default: -booking_date
            type: string
            enum:
              - booking_date
              - -booking_date
              - value_date
              - -value_date
              - description
              - -description
              - counterparty_name
              - -counterparty_name
              - counterparty_iban
              - -counterparty_iban
              - reference
              - -reference
              - amount
              - -amount
              - balance_after
              - -balance_after
              - statement_number
              - -statement_number
              - statement_date
              - -statement_date
              - matched_amount
              - -matched_amount
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Transactions of the bank statements across all batches, newest booking
        date first unless sorted, with corrections applied
      tags:
        - Statements
  /v1/statement-duplicates:
    get:
      operationId: StatementDuplicatesController_list
      parameters:
        - name: status
          required: false
          in: query
          schema:
            default: open
            type: string
            enum:
              - open
              - resolved
              - dismissed
              - all
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Pairs of bank statements that carry the same transactions, with the
        copies it is safe to remove
      tags:
        - Statements
  /v1/statement-duplicates/remove:
    post:
      operationId: StatementDuplicatesController_remove
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RemoveStatementDuplicatesDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Delete duplicate statement documents: the ones given, or every suggested
        removal; one copy of each pair always stays
      tags:
        - Statements
  /v1/statement-duplicates/{duplicateId}/count-once:
    post:
      operationId: StatementDuplicatesController_countOnce
      parameters:
        - name: duplicateId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        For an overlap: count the transactions both statements share once, on
        the richer statement; exports and matching skip the other copy of them
      tags:
        - Statements
  /v1/statement-duplicates/{duplicateId}/count-twice:
    post:
      operationId: StatementDuplicatesController_countTwice
      parameters:
        - name: duplicateId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: 'Undo count-once: both statements count the shared transactions again'
      tags:
        - Statements
  /v1/statement-duplicates/{duplicateId}/dismiss:
    post:
      operationId: StatementDuplicatesController_dismiss
      parameters:
        - name: duplicateId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Mark a pair as not a duplicate; it stays dismissed when the statements
        are refreshed
      tags:
        - Statements
  /v1/statement-duplicates/{duplicateId}/restore:
    post:
      operationId: StatementDuplicatesController_restore
      parameters:
        - name: duplicateId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Undo a dismissal
      tags:
        - Statements
  /v1/overview:
    get:
      operationId: OverviewController_get
      parameters:
        - name: from
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
        - name: to
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        What was read over a period: documents, pages, statements, transactions,
        invoices and confirmed payment matches, with a count per day
      tags:
        - Overview
  /v1/invoices:
    get:
      operationId: InvoicesController_list
      parameters:
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: direction
          required: true
          in: query
          schema:
            type: string
            enum:
              - INCOMING
              - OUTGOING
        - name: status
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - COMPLETED
                - NEEDS_REVIEW
        - name: date_from
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
        - name: date_to
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
        - name: counterparty_key
          required: false
          in: query
          schema:
            maxLength: 300
            type: string
        - name: currency
          required: false
          in: query
          schema:
            maxLength: 10
            type: string
        - name: job_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: document_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: client_company_id
          required: false
          in: query
          schema:
            anyOf:
              - type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
              - type: string
                enum:
                  - none
        - name: match_status
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - UNMATCHED
                - PROPOSED
                - PARTIAL
                - MATCHED
                - CLASSIFIED
        - name: q
          required: false
          in: query
          schema:
            maxLength: 200
            type: string
        - name: sort
          required: false
          in: query
          schema:
            default: -issue_date
            type: string
            enum:
              - issue_date
              - -issue_date
              - due_date
              - -due_date
              - invoice_number
              - -invoice_number
              - counterparty_name
              - -counterparty_name
              - client_company
              - -client_company
              - currency
              - -currency
              - subtotal
              - -subtotal
              - tax_total
              - -tax_total
              - total
              - -total
              - amount_due
              - -amount_due
              - status
              - -status
              - created_at
              - -created_at
              - invoice_type
              - -invoice_type
              - delivery_date
              - -delivery_date
              - counterparty_tax_id
              - -counterparty_tax_id
              - counterparty_vat_id
              - -counterparty_vat_id
              - discount_total
              - -discount_total
              - other_charges
              - -other_charges
              - payment_reference
              - -payment_reference
              - customer_number
              - -customer_number
              - line_count
              - -line_count
              - totals_check
              - -totals_check
              - warning_count
              - -warning_count
              - open_amount
              - -open_amount
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Incoming or outgoing invoices across all batches, newest issue date
        first unless sorted, with corrections applied
      tags:
        - Invoices
  /v1/invoice-line-items:
    get:
      operationId: InvoicesController_lines
      parameters:
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: direction
          required: true
          in: query
          schema:
            type: string
            enum:
              - INCOMING
              - OUTGOING
        - name: status
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - COMPLETED
                - NEEDS_REVIEW
        - name: date_from
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
        - name: date_to
          required: false
          in: query
          schema:
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
            type: string
        - name: counterparty_key
          required: false
          in: query
          schema:
            maxLength: 300
            type: string
        - name: currency
          required: false
          in: query
          schema:
            maxLength: 10
            type: string
        - name: job_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: document_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: client_company_id
          required: false
          in: query
          schema:
            anyOf:
              - type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
              - type: string
                enum:
                  - none
        - name: match_status
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - UNMATCHED
                - PROPOSED
                - PARTIAL
                - MATCHED
                - CLASSIFIED
        - name: q
          required: false
          in: query
          schema:
            maxLength: 200
            type: string
        - name: sort
          required: false
          in: query
          schema:
            default: -issue_date
            type: string
            enum:
              - issue_date
              - -issue_date
              - invoice_number
              - -invoice_number
              - counterparty_name
              - -counterparty_name
              - description
              - -description
              - quantity
              - -quantity
              - unit_price
              - -unit_price
              - net_amount
              - -net_amount
              - tax_amount
              - -tax_amount
              - gross_amount
              - -gross_amount
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Line items of incoming or outgoing invoices across all batches, with
        corrections applied
      tags:
        - Invoices
  /v1/counterparties:
    get:
      operationId: InvoicesController_counterparties
      parameters:
        - name: direction
          required: true
          in: query
          schema:
            type: string
            enum:
              - INCOMING
              - OUTGOING
        - name: sort
          required: false
          in: query
          schema:
            default: name
            type: string
            enum:
              - name
              - -name
              - tax_id
              - -tax_id
              - invoice_count
              - -invoice_count
              - needs_review_count
              - -needs_review_count
              - first_issue_date
              - -first_issue_date
              - last_issue_date
              - -last_issue_date
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Suppliers (direction=INCOMING) or customers (direction=OUTGOING) found
        on the invoices, one per tax number or name
      tags:
        - Invoices
  /v1/mapping-tables:
    get:
      operationId: MappingTablesController_list
      parameters:
        - name: sort
          required: false
          in: query
          schema:
            default: name
            type: string
            enum:
              - name
              - -name
              - key_kind
              - -key_kind
              - value_label
              - -value_label
              - entry_count
              - -entry_count
              - open_suggestion_count
              - -open_suggestion_count
              - updated_at
              - -updated_at
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: The client's mapping tables, with their entry and open suggestion counts
      tags:
        - Mappings
    post:
      operationId: MappingTablesController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMappingTableDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: Create a mapping table
      tags:
        - Mappings
  /v1/mapping-tables/{tableId}:
    get:
      operationId: MappingTablesController_get
      parameters:
        - name: tableId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: One mapping table
      tags:
        - Mappings
    put:
      operationId: MappingTablesController_update
      parameters:
        - name: tableId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateMappingTableDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Change the name, value label, default value or description of a table;
        the key kind only while it has no entries
      tags:
        - Mappings
    delete:
      operationId: MappingTablesController_remove
      parameters:
        - name: tableId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Delete a table with its entries, history and suggestions
      tags:
        - Mappings
  /v1/mapping-tables/{tableId}/entries:
    get:
      operationId: MappingTablesController_entries
      parameters:
        - name: tableId
          required: true
          in: path
          schema:
            type: string
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: q
          required: false
          in: query
          schema:
            maxLength: 200
            type: string
        - name: sort
          required: false
          in: query
          schema:
            default: key
            type: string
            enum:
              - key
              - -key
              - key_normalized
              - -key_normalized
              - value
              - -value
              - source
              - -source
              - updated_at
              - -updated_at
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Entries of a table, searchable by key or value
      tags:
        - Mappings
    put:
      operationId: MappingTablesController_upsert
      parameters:
        - name: tableId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertEntriesDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Create or change up to 1,000 entries by key; every change is kept in the
        entry history
      tags:
        - Mappings
  /v1/mapping-tables/{tableId}/entries/delete:
    post:
      operationId: MappingTablesController_removeMany
      parameters:
        - name: tableId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeleteEntriesDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Delete several entries at once
      tags:
        - Mappings
  /v1/mapping-tables/{tableId}/entries/{entryId}:
    delete:
      operationId: MappingTablesController_removeEntry
      parameters:
        - name: tableId
          required: true
          in: path
          schema:
            type: string
        - name: entryId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Delete an entry (its history stays)
      tags:
        - Mappings
  /v1/mapping-tables/{tableId}/entries/{entryId}/history:
    get:
      operationId: MappingTablesController_history
      parameters:
        - name: tableId
          required: true
          in: path
          schema:
            type: string
        - name: entryId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: 'Every change of an entry: old and new value, who, and when'
      tags:
        - Mappings
  /v1/mapping-tables/{tableId}/lookup:
    post:
      operationId: MappingTablesController_lookup
      parameters:
        - name: tableId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LookupDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        The value of up to 500 keys, normalised by the key kind of the table;
        the lists that show a mapped column use this
      tags:
        - Mappings
  /v1/mapping-tables/{tableId}/import/preview:
    post:
      operationId: MappingTablesController_previewImport
      parameters:
        - name: tableId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImportPreviewDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        The first rows of an uploaded CSV or XLSX and the columns that look like
        the key and the value
      tags:
        - Mappings
  /v1/mapping-tables/{tableId}/import:
    post:
      operationId: MappingTablesController_import
      parameters:
        - name: tableId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImportDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Read an uploaded CSV or XLSX into the table: as suggestions with
        evidence (recommended) or as entries
      tags:
        - Mappings
  /v1/mapping-tables/{tableId}/suggestions:
    get:
      operationId: MappingTablesController_suggestions
      parameters:
        - name: tableId
          required: true
          in: path
          schema:
            type: string
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: status
          required: false
          in: query
          schema:
            default: open
            type: string
            enum:
              - open
              - accepted
              - rejected
              - all
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Suggested entries with their evidence, strongest first
      tags:
        - Mappings
  /v1/mapping-tables/{tableId}/suggestions/bulk:
    post:
      operationId: MappingTablesController_bulk
      parameters:
        - name: tableId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkSuggestionsDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Accept or reject a selection of open suggestions
      tags:
        - Mappings
  /v1/mapping-tables/{tableId}/export:
    get:
      operationId: MappingTablesController_export
      parameters:
        - name: tableId
          required: true
          in: path
          schema:
            type: string
        - name: format
          required: false
          in: query
          schema:
            default: csv
            type: string
            enum:
              - csv
              - xlsx
              - json
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: The entries of a table as CSV, XLSX or JSON
      tags:
        - Mappings
  /v1/mapping-suggestions/{suggestionId}/accept:
    post:
      operationId: MappingSuggestionsController_accept
      parameters:
        - name: suggestionId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AcceptSuggestionDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: 'Accept a suggestion: its key gets the suggested value, or the edited one'
      tags:
        - Mappings
  /v1/mapping-suggestions/{suggestionId}/reject:
    post:
      operationId: MappingSuggestionsController_reject
      parameters:
        - name: suggestionId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Reject a suggestion; it is not suggested again
      tags:
        - Mappings
  /v1/client-companies:
    get:
      operationId: ClientCompaniesController_list
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        The firm's clients with their accounts and how many statements and
        invoices each has
      tags:
        - Client companies
    post:
      operationId: ClientCompaniesController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateClientCompanyDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: Add a client; its past statements and invoices are linked to it at once
      tags:
        - Client companies
  /v1/client-companies/unassigned-accounts:
    get:
      operationId: ClientCompaniesController_unassigned
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Bank accounts of imported statements that belong to no client yet, with
        the printed account holder
      tags:
        - Client companies
  /v1/client-companies/rows:
    post:
      operationId: ClientCompaniesController_rows
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClientRowsDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Add clients and accounts from rows of name, account and currency; with
        dry_run, only report what would change
      tags:
        - Client companies
  /v1/client-companies/import/preview:
    post:
      operationId: ClientCompaniesController_previewImport
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClientImportPreviewDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        The first rows of an uploaded client list (CSV or XLSX) and the column
        that looks like each field
      tags:
        - Client companies
  /v1/client-companies/import:
    post:
      operationId: ClientCompaniesController_import
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClientImportDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Read an uploaded client list; with dry_run, only report what would
        change
      tags:
        - Client companies
  /v1/client-companies/delete:
    post:
      operationId: ClientCompaniesController_removeMany
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeleteClientCompaniesDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Delete several clients; their statements and invoices stay, without a
        client
      tags:
        - Client companies
  /v1/client-companies/{id}:
    get:
      operationId: ClientCompaniesController_get
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: One client with its accounts
      tags:
        - Client companies
    patch:
      operationId: ClientCompaniesController_update
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateClientCompanyDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Change a client's name, tax ID or accounts (the list given replaces the
        accounts)
      tags:
        - Client companies
    delete:
      operationId: ClientCompaniesController_remove
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Delete a client; its statements and invoices stay, without a client
      tags:
        - Client companies
  /v1/email-inboxes:
    get:
      operationId: EmailInboxesController_list
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: The company's email addresses, with who may send to each
      tags:
        - Email intake
    post:
      operationId: EmailInboxesController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInboxDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: >-
        Create a private email address for a client, with the senders whose
        documents are read automatically
      tags:
        - Email intake
  /v1/email-inboxes/{id}:
    get:
      operationId: EmailInboxesController_get
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: One email address with its approved senders
      tags:
        - Email intake
    patch:
      operationId: EmailInboxesController_update
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateInboxDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Rename, change what arrives, what happens to unknown senders, or pause
        and resume
      tags:
        - Email intake
    delete:
      operationId: EmailInboxesController_remove
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: >-
        Delete the address: mail to it is ignored from now on and its held
        emails are deleted
      tags:
        - Email intake
  /v1/email-inboxes/{id}/replace-address:
    post:
      operationId: EmailInboxesController_replace
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Give the address a new secret part; the old address stops working at
        once
      tags:
        - Email intake
  /v1/email-inboxes/{id}/senders:
    post:
      operationId: EmailInboxesController_addSender
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddSenderDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: Let an email address or a company domain send documents to this address
      tags:
        - Email intake
  /v1/email-inboxes/{id}/senders/{senderId}:
    delete:
      operationId: EmailInboxesController_removeSender
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
        - name: senderId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Stop reading documents from this sender automatically
      tags:
        - Email intake
  /v1/email-messages:
    get:
      operationId: EmailMessagesController_list
      parameters:
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: inbox_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: status
          required: false
          in: query
          schema:
            type: string
            enum:
              - RECEIVED
              - APPROVED
              - IMPORTED
              - HELD
              - REJECTED
              - DISCARDED
              - FAILED
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Received emails, newest first: who sent them, what was imported and why
        anything was not
      tags:
        - Email intake
  /v1/email-messages/{id}/import:
    post:
      operationId: EmailMessagesController_importOnce
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Import a held email once
      tags:
        - Email intake
  /v1/email-messages/{id}/allow-sender:
    post:
      operationId: EmailMessagesController_allowSender
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Approve the held email's sender for this address and import the email
      tags:
        - Email intake
  /v1/email-messages/{id}/block:
    post:
      operationId: EmailMessagesController_block
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Throw a held email away with its files
      tags:
        - Email intake
  /v1/payment-matches:
    get:
      operationId: PaymentMatchesController_list
      parameters:
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: status
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - PROPOSED
                - CONFIRMED
                - REJECTED
        - name: method
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - EXACT
                - RULE
                - SCORED
                - MODEL
                - MANUAL
        - name: kind
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - ONE_TO_ONE
                - ONE_TO_MANY
                - MANY_TO_ONE
                - PARTIAL
        - name: flagged
          required: false
          in: query
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
        - name: transaction_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: invoice_document_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: min_score
          required: false
          in: query
          schema:
            minimum: 0
            maximum: 1
            type: number
        - name: sort
          required: false
          in: query
          schema:
            default: -created_at
            type: string
            enum:
              - created_at
              - -created_at
              - score
              - -score
              - decided_at
              - -decided_at
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Proposed, confirmed and rejected matches with their allocations, reasons
        and score
      tags:
        - Payment matching
    post:
      operationId: PaymentMatchesController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMatchDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: 'Match by hand: allocate transactions to invoices, confirmed at once'
      tags:
        - Payment matching
  /v1/payment-matches/{matchId}:
    get:
      operationId: PaymentMatchesController_get
      parameters:
        - name: matchId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Get a match
      tags:
        - Payment matching
    delete:
      operationId: PaymentMatchesController_undo
      parameters:
        - name: matchId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: >-
        Undo: delete a match, so its transactions and invoices are open again
        (also undoes a rejection or an automatic confirmation)
      tags:
        - Payment matching
  /v1/payment-matches/{matchId}/confirm:
    post:
      operationId: PaymentMatchesController_confirm
      parameters:
        - name: matchId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConfirmMatchDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Confirm a proposed match, optionally with edited allocations (a split or
        a partial amount)
      tags:
        - Payment matching
  /v1/payment-matches/{matchId}/reject:
    post:
      operationId: PaymentMatchesController_reject
      parameters:
        - name: matchId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Reject a proposed match; the same transactions and invoices are not
        proposed together again
      tags:
        - Payment matching
  /v1/payment-match-candidates:
    get:
      operationId: PaymentMatchCandidatesController_candidates
      parameters:
        - name: transaction_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: invoice_document_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Scored candidate invoices for a transaction, or candidate payments for
        an invoice, best first, with the evidence for each; nothing is stored
      tags:
        - Payment matching
  /v1/match-rules:
    get:
      operationId: MatchRulesController_list
      parameters:
        - name: status
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - ACTIVE
                - SUGGESTED
                - RETIRED
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Rules learned from confirmed matches, with their measured precision
      tags:
        - Payment matching
  /v1/match-rules/{ruleId}:
    put:
      operationId: MatchRulesController_update
      parameters:
        - name: ruleId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateRuleDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Activate, retire or edit the params of a rule
      tags:
        - Payment matching
  /v1/payment-match-runs:
    get:
      operationId: PaymentMatchRunsController_list
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: The latest matching runs with their statistics
      tags:
        - Payment matching
    post:
      operationId: PaymentMatchRunsController_create
      parameters: []
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: >-
        Queue a matching run for the client now (a run already queued is brought
        forward)
      tags:
        - Payment matching
  /v1/match-settings:
    get:
      operationId: MatchSettingsController_get
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Auto-confirm settings and the threshold the last decisions justify
      tags:
        - Payment matching
    put:
      operationId: MatchSettingsController_update
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSettingsDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Switch auto-confirm for exact matches on or off, or set the score
        threshold for the rest (refused below what the decisions justify)
      tags:
        - Payment matching
  /v1/transaction-classifications:
    put:
      operationId: TransactionClassificationsController_classify
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClassifyDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Mark a transaction as not an invoice payment (own transfer, fee, salary,
        tax, other), or as "not classified"; optionally remember the
        counterparty
      tags:
        - Payment matching
  /v1/transaction-classifications/{transactionId}:
    delete:
      operationId: TransactionClassificationsController_remove
      parameters:
        - name: transactionId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Remove a transaction's classification so the next run looks at it again
      tags:
        - Payment matching
  /v1/events:
    get:
      operationId: EventsController_list
      parameters:
        - name: after
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: types
          required: false
          in: query
          schema:
            minItems: 1
            type: array
            items:
              type: string
              enum:
                - document.finished
                - job.finalized
                - document.corrected
                - statement.refreshed
                - invoice.refreshed
                - statement_duplicate.changed
                - credits.low
                - folder.changed
                - payment_match.proposed
                - payment_match.decided
                - email_intake.held
                - email_intake.imported
                - email_intake.paused
                - email_intake.settings_changed
        - name: subject_type
          required: false
          in: query
          schema:
            type: string
            enum:
              - document
              - job
              - bank_statement
              - invoice
              - statement_duplicate
              - client
              - folder
              - payment_match
              - email_inbox
              - email_message
        - name: subject_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 100
            type: integer
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Change feed: the client's events in order, oldest first; read on with
        after={next_cursor}
      tags:
        - Events
  /v1/folders:
    get:
      operationId: FoldersController_list
      parameters:
        - name: parent_id
          required: false
          in: query
          schema:
            anyOf:
              - type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
              - type: string
                enum:
                  - none
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Folders of the client with their document counts and checklist status
        (PASS, FAIL, or NONE without a checklist)
      tags:
        - Folders
    post:
      operationId: FoldersController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFolderDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: >-
        Create a folder, optionally under a parent folder (two levels at most),
        with a period, checklists and an auto-filing rule
      tags:
        - Folders
  /v1/folders/{folderId}:
    get:
      operationId: FoldersController_get
      parameters:
        - name: folderId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Get a folder
      tags:
        - Folders
    patch:
      operationId: FoldersController_update
      parameters:
        - name: folderId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateFolderDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Rename a folder, change its parent, period, auto-filing rule or attached
        checklists
      tags:
        - Folders
    delete:
      operationId: FoldersController_remove
      parameters:
        - name: folderId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Delete a folder and its sub-folders; the documents stay
      tags:
        - Folders
  /v1/folders/{folderId}/documents:
    get:
      operationId: FoldersController_documents
      parameters:
        - name: folderId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Documents in a folder
      tags:
        - Folders
    post:
      operationId: FoldersController_addDocuments
      parameters:
        - name: folderId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddFolderDocumentsDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Add documents to a folder by id, or every document of a batch; documents
        already in it stay
      tags:
        - Folders
  /v1/folders/{folderId}/documents/remove:
    post:
      operationId: FoldersController_removeDocuments
      parameters:
        - name: folderId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RemoveFolderDocumentsDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Remove documents from a folder (the documents themselves are not
        deleted)
      tags:
        - Folders
  /v1/folders/{folderId}/checklists:
    put:
      operationId: FoldersController_setChecklists
      parameters:
        - name: folderId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetFolderChecklistsDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Set the checklists attached to a folder (checklists that apply to all
        folders always count)
      tags:
        - Folders
  /v1/folders/{folderId}/checklist-results:
    get:
      operationId: FoldersController_results
      parameters:
        - name: folderId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Result of every checklist that applies to the folder: per requirement,
        the documents or gaps that make it fail
      tags:
        - Folders
  /v1/documents/{documentId}/folders:
    get:
      operationId: DocumentFoldersController_list
      parameters:
        - name: documentId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Folders a document is in
      tags:
        - Folders
  /v1/checklists:
    get:
      operationId: ChecklistsController_list
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Checklists of the client
      tags:
        - Checklists
    post:
      operationId: ChecklistsController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateChecklistDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: 'Create a checklist: structured requirements a folder must satisfy'
      tags:
        - Checklists
  /v1/checklists/{checklistId}:
    get:
      operationId: ChecklistsController_get
      parameters:
        - name: checklistId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Get a checklist
      tags:
        - Checklists
    patch:
      operationId: ChecklistsController_update
      parameters:
        - name: checklistId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateChecklistDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Change a checklist; the folders it applies to are evaluated again
      tags:
        - Checklists
    delete:
      operationId: ChecklistsController_remove
      parameters:
        - name: checklistId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Delete a checklist and its results
      tags:
        - Checklists
  /v1/statement-layouts:
    get:
      operationId: LayoutsController_list
      parameters:
        - name: bank
          required: false
          in: query
          schema:
            maxLength: 200
            type: string
        - name: status
          required: false
          in: query
          schema:
            type: string
            enum:
              - CANDIDATE
              - SHADOW
              - ACTIVE
              - DEMOTED
              - RETIRED
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Bank statement layouts learned for the client, with their status,
        samples and shadow matches
      tags:
        - Statement layouts
  /v1/statement-layouts/{layoutId}:
    get:
      operationId: LayoutsController_get
      parameters:
        - name: layoutId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        A learned statement layout: sample documents, the induced header fields
        and column bands, and where they sit on a sample page
      tags:
        - Statement layouts
  /v1/statement-layouts/{layoutId}/disable:
    post:
      operationId: LayoutsController_disable
      parameters:
        - name: layoutId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Stop using a layout: it is retired by the user and statements of that
        layout go to the model again
      tags:
        - Statement layouts
  /v1/statement-layouts/{layoutId}/relearn:
    post:
      operationId: LayoutsController_relearn
      parameters:
        - name: layoutId
          required: true
          in: path
          schema:
            type: string
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: >-
        Discard the layout's template and counters and induce it again from the
        latest samples
      tags:
        - Statement layouts
  /v1/pipeline-node-types:
    get:
      operationId: PipelineCatalogController_nodeTypes
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        The node types the editor offers: ports, and a JSON Schema for each
        node’s settings
      tags:
        - Pipelines
  /v1/pipeline-templates:
    get:
      operationId: PipelineCatalogController_templates
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Starter pipelines to begin from; blanks (a template to choose, an
        address to fill) are left empty
      tags:
        - Pipelines
  /v1/pipeline-graphs/validate:
    post:
      operationId: PipelineCatalogController_validate
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ValidateGraphDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Check a graph without saving it: every problem with the node or edge it
        concerns
      tags:
        - Pipelines
  /v1/pipelines:
    get:
      operationId: PipelinesController_list
      parameters:
        - name: status
          required: false
          in: query
          schema:
            type: string
            enum:
              - DRAFT
              - ACTIVE
              - ARCHIVED
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Pipelines of the client with their trigger, node count and last run
        (archived ones only with status=ARCHIVED)
      tags:
        - Pipelines
    post:
      operationId: PipelinesController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePipelineDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: >-
        Create a pipeline (a draft). A graph, when given, is validated like a
        save (422 INVALID_PIPELINE)
      tags:
        - Pipelines
  /v1/pipelines/{pipelineId}:
    get:
      operationId: PipelinesController_get
      parameters:
        - name: pipelineId
          required: true
          in: path
          schema:
            type: string
        - name: version
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 9007199254740991
            type: integer
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Get a pipeline with its current graph; ?version=N for an older version
      tags:
        - Pipelines
    patch:
      operationId: PipelinesController_update
      parameters:
        - name: pipelineId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePipelineDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Rename a pipeline or change its description
      tags:
        - Pipelines
  /v1/pipelines/{pipelineId}/graph:
    put:
      operationId: PipelinesController_saveGraph
      parameters:
        - name: pipelineId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SaveGraphDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Save an edited graph as a new version (422 INVALID_PIPELINE lists every
        problem with its node or edge)
      tags:
        - Pipelines
  /v1/pipelines/{pipelineId}/activate:
    post:
      operationId: PipelinesController_activate
      parameters:
        - name: pipelineId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Make the pipeline live: a schedule node starts its schedule, an event
        node starts listening
      tags:
        - Pipelines
  /v1/pipelines/{pipelineId}/deactivate:
    post:
      operationId: PipelinesController_deactivate
      parameters:
        - name: pipelineId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Stop the schedule and the event trigger; the pipeline goes back to a
        draft
      tags:
        - Pipelines
  /v1/pipelines/{pipelineId}/archive:
    post:
      operationId: PipelinesController_archive
      parameters:
        - name: pipelineId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Archive the pipeline; its runs stay
      tags:
        - Pipelines
  /v1/pipelines/{pipelineId}/runs:
    post:
      operationId: PipelinesController_start
      parameters:
        - name: pipelineId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StartRunDto'
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: >-
        Start a run (202). Pipelines that start from uploads take upload_ids;
        test=true skips every node that sends data out
      tags:
        - Pipelines
    get:
      operationId: PipelinesController_runsOf
      parameters:
        - name: pipelineId
          required: true
          in: path
          schema:
            type: string
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: pipeline_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: status
          required: false
          in: query
          schema:
            type: string
            enum:
              - QUEUED
              - RUNNING
              - COMPLETED
              - FAILED
              - CANCELLED
              - SKIPPED
        - name: job_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Runs of one pipeline, newest first
      tags:
        - Pipelines
  /v1/pipeline-runs:
    get:
      operationId: PipelineRunsController_list
      parameters:
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: pipeline_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: status
          required: false
          in: query
          schema:
            type: string
            enum:
              - QUEUED
              - RUNNING
              - COMPLETED
              - FAILED
              - CANCELLED
              - SKIPPED
        - name: job_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Runs of every pipeline, newest first; filter by pipeline_id or status
      tags:
        - Pipelines
  /v1/pipeline-runs/{runId}:
    get:
      operationId: PipelineRunsController_get
      parameters:
        - name: runId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        A run with the graph it pinned and, per node: status, timings, cost,
        error and outputs
      tags:
        - Pipelines
  /v1/pipeline-runs/{runId}/cancel:
    post:
      operationId: PipelineRunsController_cancel
      parameters:
        - name: runId
          required: true
          in: path
          schema:
            type: string
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: 'Stop a run: nothing new starts; the run ends CANCELLED'
      tags:
        - Pipelines
  /v1/pipeline-runs/{runId}/retry:
    post:
      operationId: PipelineRunsController_retry
      parameters:
        - name: runId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RetryRunDto'
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: >-
        Run a failed or cancelled run again from a node, re-using the outputs
        upstream nodes recorded
      tags:
        - Pipelines
  /v1/pipeline-runs/{runId}/nodes/{nodeId}/decision:
    post:
      operationId: PipelineRunsController_decide
      parameters:
        - name: runId
          required: true
          in: path
          schema:
            type: string
        - name: nodeId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DecisionDto'
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: >-
        Approve or reject an approval node that is waiting; the run continues or
        that branch stops
      tags:
        - Pipelines
  /v1/pipeline-runs/{runId}/nodes/{nodeId}/outputs/{port}/preview:
    get:
      operationId: PipelineRunsController_preview
      parameters:
        - name: runId
          required: true
          in: path
          schema:
            type: string
        - name: nodeId
          required: true
          in: path
          schema:
            type: string
        - name: port
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: The first 50 rows of a dataset a node produced
      tags:
        - Pipelines
  /v1/pipeline-runs/{runId}/nodes/{nodeId}/outputs/{port}/download:
    get:
      operationId: PipelineRunsController_download
      parameters:
        - name: runId
          required: true
          in: path
          schema:
            type: string
        - name: nodeId
          required: true
          in: path
          schema:
            type: string
        - name: port
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Download a file a node produced
      tags:
        - Pipelines
  /v1/pipeline-code/test:
    post:
      operationId: PipelineCodeController_test
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CodeTestDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Run the code of a code.transform node on sample rows (at most 100, or
        the first 100 a node received in a run) in the sandbox; nothing is
        stored. A failure of the code is a 200 with ok=false and the error
      tags:
        - Pipelines
  /v1/pipeline-code/draft:
    post:
      operationId: PipelineCodeController_draft
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CodeDraftDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Draft the JavaScript of a code.transform node from a description with
        the light model. The draft is returned as text: nothing is run or saved
        (503 when the assistant is not configured)
      tags:
        - Pipelines
  /v1/webhooks:
    post:
      operationId: WebhooksController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: Create a webhook endpoint (the secret is returned only here)
      tags:
        - Webhooks
    get:
      operationId: WebhooksController_list
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: List webhook endpoints
      tags:
        - Webhooks
  /v1/webhooks/{webhookId}:
    get:
      operationId: WebhooksController_get
      parameters:
        - name: webhookId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Get a webhook endpoint
      tags:
        - Webhooks
    put:
      operationId: WebhooksController_update
      parameters:
        - name: webhookId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWebhookDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Update name, URL, events, status, default flag or authentication
      tags:
        - Webhooks
    delete:
      operationId: WebhooksController_remove
      parameters:
        - name: webhookId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Delete a webhook endpoint
      tags:
        - Webhooks
  /v1/webhooks/{webhookId}/secret:
    get:
      operationId: WebhooksController_revealSecret
      parameters:
        - name: webhookId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Reveal the signing secret
      tags:
        - Webhooks
  /v1/webhooks/{webhookId}/rotate-secret:
    post:
      operationId: WebhooksController_rotateSecret
      parameters:
        - name: webhookId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RotateSecretDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Replace the signing secret, optionally keeping the old one signing for
        up to 24 hours
      tags:
        - Webhooks
  /v1/webhooks/{webhookId}/test:
    post:
      operationId: WebhooksController_test
      parameters:
        - name: webhookId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Send a PING event and report the outcome
      tags:
        - Webhooks
  /v1/webhooks/{webhookId}/deliveries:
    get:
      operationId: WebhooksController_deliveries
      parameters:
        - name: webhookId
          required: true
          in: path
          schema:
            type: string
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: status
          required: false
          in: query
          schema:
            type: string
            enum:
              - PENDING
              - DELIVERED
              - FAILED
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Delivery log for the last 30 days, newest first
      tags:
        - Webhooks
  /v1/webhooks/{webhookId}/deliveries/{deliveryId}/resend:
    post:
      operationId: WebhooksController_resend
      parameters:
        - name: webhookId
          required: true
          in: path
          schema:
            type: string
        - name: deliveryId
          required: true
          in: path
          schema:
            type: string
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: Send a delivery again (same event id and body) as a new delivery
      tags:
        - Webhooks
  /v1/connections:
    get:
      operationId: ConnectionsController_list
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        List connections (name, kind, non-secret settings); secrets are never
        returned
      tags:
        - Integrations
    post:
      operationId: ConnectionsController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConnectionDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: >-
        Create a connection: an HTTPS header, basic auth, SFTP credentials or an
        OAuth 2 client. The secret is write-only
      tags:
        - Integrations
  /v1/connections/{connectionId}:
    get:
      operationId: ConnectionsController_get
      parameters:
        - name: connectionId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Get a connection
      tags:
        - Integrations
    patch:
      operationId: ConnectionsController_update
      parameters:
        - name: connectionId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateConnectionDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Rename a connection or change its non-secret settings
      tags:
        - Integrations
    delete:
      operationId: ConnectionsController_remove
      parameters:
        - name: connectionId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Delete a connection that no delivery target uses
      tags:
        - Integrations
  /v1/connections/{connectionId}/secret:
    put:
      operationId: ConnectionsController_setSecret
      parameters:
        - name: connectionId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetConnectionSecretDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Set or replace the secret of a connection (write-only; nothing is
        returned but the connection)
      tags:
        - Integrations
  /v1/connections/{connectionId}/test:
    post:
      operationId: ConnectionsController_test
      parameters:
        - name: connectionId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestConnectionDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        A harmless check: HTTPS HEAD to a URL, or SFTP login and a listing of a
        directory
      tags:
        - Integrations
  /v1/delivery-targets:
    get:
      operationId: DeliveryTargetsController_list
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        List delivery targets (HTTPS endpoints, SFTP directories, email
        recipients)
      tags:
        - Integrations
    post:
      operationId: DeliveryTargetsController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTargetDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: >-
        Create a delivery target; an HTTPS target also gets a signing secret,
        returned only here
      tags:
        - Integrations
  /v1/delivery-targets/preview-path:
    post:
      operationId: DeliveryTargetsController_previewPath
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreviewPathDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: 'What an SFTP path template makes for a batch (default: the newest one)'
      tags:
        - Integrations
  /v1/delivery-targets/{targetId}:
    get:
      operationId: DeliveryTargetsController_get
      parameters:
        - name: targetId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Get a delivery target
      tags:
        - Integrations
    patch:
      operationId: DeliveryTargetsController_update
      parameters:
        - name: targetId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTargetDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Change a delivery target
      tags:
        - Integrations
    delete:
      operationId: DeliveryTargetsController_remove
      parameters:
        - name: targetId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Delete a delivery target with its rules and their delivery log
      tags:
        - Integrations
  /v1/delivery-targets/{targetId}/rotate-signing-secret:
    post:
      operationId: DeliveryTargetsController_rotate
      parameters:
        - name: targetId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Replace the secret an HTTPS target signs its requests with; returned
        only here
      tags:
        - Integrations
  /v1/delivery-rules:
    get:
      operationId: DeliveryRulesController_list
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: List delivery rules with the status of their last delivery
      tags:
        - Integrations
    post:
      operationId: DeliveryRulesController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRuleDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: >-
        Create a rule: when a batch or document finishes, send this export to
        that target
      tags:
        - Integrations
  /v1/delivery-rules/{ruleId}:
    get:
      operationId: DeliveryRulesController_get
      parameters:
        - name: ruleId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Get a delivery rule
      tags:
        - Integrations
    patch:
      operationId: DeliveryRulesController_update
      parameters:
        - name: ruleId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateRuleDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Change a delivery rule, or switch it on or off
      tags:
        - Integrations
    delete:
      operationId: DeliveryRulesController_remove
      parameters:
        - name: ruleId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: Delete a delivery rule and its delivery log
      tags:
        - Integrations
  /v1/delivery-rules/{ruleId}/test:
    post:
      operationId: DeliveryRulesController_test
      parameters:
        - name: ruleId
          required: true
          in: path
          schema:
            type: string
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: >-
        Send test: queue a delivery of the newest finished batch (or document)
        the rule matches
      tags:
        - Integrations
  /v1/deliveries:
    get:
      operationId: DeliveriesController_list
      parameters:
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
        - name: status
          required: false
          in: query
          schema:
            type: string
            enum:
              - PENDING
              - DELIVERED
              - FAILED
        - name: rule_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: job_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: subject_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        The delivery log, newest first; filter by status, rule, or the batch a
        delivery belongs to
      tags:
        - Integrations
  /v1/deliveries/{deliveryId}:
    get:
      operationId: DeliveriesController_get
      parameters:
        - name: deliveryId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Get a delivery with the log of its attempts (status, duration, size;
        never the file)
      tags:
        - Integrations
  /v1/deliveries/{deliveryId}/retry:
    post:
      operationId: DeliveriesController_retry
      parameters:
        - name: deliveryId
          required: true
          in: path
          schema:
            type: string
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: Retry a failed delivery with a fresh series of attempts
      tags:
        - Integrations
  /v1/import-formats:
    get:
      operationId: IntegrationsMiscController_formats
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        The accounting import formats an export can be written in
        (`import_format` on the export endpoints)
      tags:
        - Integrations
  /v1/integrations/api-keys:
    post:
      operationId: IntegrationsMiscController_createPlatformKey
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePlatformKeyDto'
      responses:
        '201':
          description: ''
      security:
        - bearer: []
      summary: >-
        Create an API key named for n8n or Make with the scopes their nodes
        need; the key is returned once. Owner or admin, web sessions only
      tags:
        - Integrations
  /v1/integrations/google:
    get:
      operationId: GoogleController_status
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Whether Google Drive is available on this server and whether the company
        has connected an account
      tags:
        - Integrations
    delete:
      operationId: GoogleController_disconnect
      parameters: []
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: >-
        Disconnects Google Drive, with its watched folders and Drive delivery
        targets
      tags:
        - Integrations
  /v1/integrations/google/connect:
    post:
      operationId: GoogleController_connect
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Starts connecting a Google account: returns Google's consent page
        address
      tags:
        - Integrations
  /v1/integrations/google/finish:
    post:
      operationId: GoogleController_finish
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FinishDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Finishes connecting a Google account with the code Google returned, for
        the person who started connecting
      tags:
        - Integrations
  /v1/integrations/google/setup:
    post:
      operationId: GoogleController_setup
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetupDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Makes the VorxOS folders in Drive and the watches and delivery rules for
        the chosen document types
      tags:
        - Integrations
  /v1/integrations/google/folders:
    get:
      operationId: GoogleController_folders
      parameters:
        - name: parent
          required: false
          in: query
          schema:
            pattern: ^[\w-]{1,128}$
            default: root
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        The folders inside a Drive folder (My Drive by default), for choosing a
        drop or results folder
      tags:
        - Integrations
  /v1/integrations/google/locations:
    get:
      operationId: GoogleController_locations
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        The drop folder and results folder of each kind of document, or null
        where none is set
      tags:
        - Integrations
    put:
      operationId: GoogleController_choose
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChooseDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Chooses the drop folder or the results folder of a kind of document
      tags:
        - Integrations
  /v1/integrations/google/watches:
    get:
      operationId: GoogleController_watches
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Watched Drive folders with when they were last checked
      tags:
        - Integrations
  /v1/integrations/google/watches/{watchId}:
    patch:
      operationId: GoogleController_setEnabled
      parameters:
        - name: watchId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WatchDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Pauses or resumes a watched folder
      tags:
        - Integrations
    delete:
      operationId: GoogleController_remove
      parameters:
        - name: watchId
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer: []
      summary: >-
        Stops watching a folder (the folder and its files in Drive are left
        alone)
      tags:
        - Integrations
  /v1/mcp/grants:
    get:
      operationId: McpGrantsController_list
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        AI assistants connected to the workspace through the MCP server, with
        their access and last use
      tags:
        - MCP
    post:
      operationId: McpGrantsController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMcpGrantDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Records the signed-in user's consent for an assistant (read-only unless
        access=write); the consent screen calls it before approving
      tags:
        - MCP
  /v1/mcp/grants/{grantId}:
    delete:
      operationId: McpGrantsController_revoke
      parameters:
        - name: grantId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Revokes an assistant's access; its token stops working immediately
      tags:
        - MCP
  /v1/agent-runs:
    post:
      operationId: AgentRunsController_start
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAgentRunDto'
      responses:
        '202':
          description: ''
      security:
        - bearer: []
      summary: >-
        Start a run of an agent (today: reconciliation-explainer, which answers
        a question about transactions and invoices from the data, read-only).
        Returns the run at once; poll it until its status is final
      tags:
        - Agents
    get:
      operationId: AgentRunsController_list
      parameters:
        - name: agent
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 100
            type: string
        - name: status
          required: false
          in: query
          schema:
            type: string
            enum:
              - QUEUED
              - RUNNING
              - AWAITING_APPROVAL
              - COMPLETED
              - BUDGET_EXCEEDED
              - FAILED
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Agent runs of the client, newest first, without their step timelines
      tags:
        - Agents
  /v1/agent-runs/{runId}:
    get:
      operationId: AgentRunsController_get
      parameters:
        - name: runId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        One run with its step timeline (each model turn and tool call with
        truncated outputs), its result, cost and approvals
      tags:
        - Agents
  /v1/agent-approvals:
    get:
      operationId: AgentApprovalsController_list
      parameters:
        - name: status
          required: false
          in: query
          schema:
            default: PENDING
            type: string
            enum:
              - PENDING
              - APPROVED
              - REJECTED
        - name: run_id
          required: false
          in: query
          schema:
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            type: string
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: integer
        - name: cursor
          required: false
          in: query
          schema:
            minLength: 1
            maxLength: 512
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Write-tool calls of agents that wait for a person (status=PENDING, the
        default), or the decided ones; `total_count` drives the sidebar badge
      tags:
        - Agents
  /v1/agent-approvals/{approvalId}/decision:
    post:
      operationId: AgentApprovalsController_decide
      parameters:
        - name: approvalId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DecideApprovalDto'
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: >-
        Approve (optionally with edited input, for actions that allow it) or
        reject a pending action; the agent continues with the decision as the
        result. Not available to connected AI assistants
      tags:
        - Agents
info:
  title: Financial Document Extraction API
  description: Turns bank statements and other financial documents into validated JSON.
  version: v1
  contact: {}
tags: []
servers:
  - url: https://api.vorxos.com
components:
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: API key (fxk_live_…), or a Supabase access token from the web UI
  schemas:
    UpdateMeDto:
      type: object
      properties:
        tax_ids:
          maxItems: 20
          type: array
          items:
            type: string
      additionalProperties: false
    ProvisionDto:
      type: object
      properties:
        display_name:
          type: string
          minLength: 1
          maxLength: 200
        company_name:
          type: string
          minLength: 1
          maxLength: 200
        invite_token:
          type: string
          minLength: 16
          maxLength: 100
      additionalProperties: false
    ChangePasswordDto:
      type: object
      properties:
        new_password:
          type: string
          minLength: 8
          maxLength: 72
        current_password:
          type: string
          minLength: 1
          maxLength: 200
        code:
          type: string
          pattern: ^\s*\d{6}\s*$
      required:
        - new_password
      additionalProperties: false
    UpdateMemberDto:
      type: object
      properties:
        role:
          type: string
          enum:
            - OWNER
            - ADMIN
            - MEMBER
      required:
        - role
      additionalProperties: false
    CreateInviteDto:
      type: object
      properties:
        email:
          type: string
          maxLength: 320
          format: email
          pattern: >-
            ^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
        role:
          default: MEMBER
          type: string
          enum:
            - OWNER
            - ADMIN
            - MEMBER
      required:
        - email
      additionalProperties: false
    UpdateProfileDto:
      type: object
      properties:
        display_name:
          type: string
          minLength: 1
          maxLength: 200
          nullable: true
        company_name:
          type: string
          minLength: 1
          maxLength: 200
        locale:
          type: string
          enum:
            - bs
            - en
            - sr-Latn
        notifications:
          type: object
          additionalProperties:
            type: boolean
      additionalProperties: false
    UpdateMfaDto:
      type: object
      properties:
        enabled:
          type: boolean
      required:
        - enabled
      additionalProperties: false
    CreateAccountApiKeyDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
        access:
          default: full
          type: string
          enum:
            - full
            - read
      required:
        - name
      additionalProperties: false
    CheckoutDto:
      type: object
      properties:
        pack_id:
          type: string
          minLength: 1
          maxLength: 20
        currency:
          type: string
          enum:
            - bam
            - eur
      required:
        - pack_id
      additionalProperties: false
    PlanDto:
      type: object
      properties:
        plan:
          type: string
          enum:
            - STARTER
            - PRO
            - OFFICE
            - BUSINESS
            - SCALE
        interval:
          type: string
          enum:
            - month
            - year
        currency:
          type: string
          enum:
            - bam
            - eur
      required:
        - plan
        - interval
      additionalProperties: false
    TableSettingsDto:
      type: object
      properties:
        columns:
          maxItems: 200
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
                maxLength: 100
              visible:
                type: boolean
              width:
                type: integer
                minimum: 1
                maximum: 4000
            required:
              - id
              - visible
            additionalProperties: false
        frozen:
          maxItems: 3
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 100
        sortMode:
          type: string
          enum:
            - server
            - client
      required:
        - columns
      additionalProperties: false
    ValidateSchemaDto:
      type: object
      properties:
        definition: {}
        document_type: {}
      default: {}
    SchemaSettingsDto:
      type: object
      properties:
        lock_schemas:
          type: boolean
      required:
        - lock_schemas
      additionalProperties: false
    CreateSchemaDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
        document_type:
          type: string
          enum:
            - BANK_STATEMENT
            - INCOMING_INVOICE
            - OUTGOING_INVOICE
            - RECEIPT
            - CONTRACT
            - OTHER
        definition:
          type: object
          additionalProperties: {}
        instructions:
          type: string
          maxLength: 4000
          nullable: true
        is_default:
          default: false
          type: boolean
        status:
          default: ACTIVE
          type: string
          enum:
            - ACTIVE
            - DRAFT
        label:
          type: string
          minLength: 1
          maxLength: 100
          nullable: true
        change_note:
          type: string
          minLength: 1
          maxLength: 500
      required:
        - name
        - document_type
        - definition
      additionalProperties: false
    UpdateSchemaDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
        definition:
          type: object
          additionalProperties: {}
        instructions:
          type: string
          maxLength: 4000
          nullable: true
        label:
          type: string
          minLength: 1
          maxLength: 100
          nullable: true
        change_note:
          type: string
          minLength: 1
          maxLength: 500
      additionalProperties: false
    CopySchemaDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
      default: {}
      additionalProperties: false
    ActivateSchemaDto:
      type: object
      properties:
        is_default:
          default: false
          type: boolean
      default:
        is_default: false
      additionalProperties: false
    CreateUploadDto:
      type: object
      properties:
        filename:
          type: string
          minLength: 1
          maxLength: 255
        mime_type:
          type: string
          minLength: 1
          maxLength: 255
        size_bytes:
          type: integer
          exclusiveMinimum: true
          maximum: 9007199254740991
          minimum: 0
        purpose:
          default: document
          type: string
          enum:
            - document
            - mapping_import
            - client_import
      required:
        - filename
        - mime_type
        - size_bytes
      additionalProperties: false
    CreateUploadBatchDto:
      type: object
      properties:
        files:
          minItems: 1
          maxItems: 500
          type: array
          items:
            type: object
            properties:
              filename:
                type: string
                minLength: 1
                maxLength: 255
              mime_type:
                type: string
                minLength: 1
                maxLength: 255
              size_bytes:
                type: integer
                exclusiveMinimum: true
                maximum: 9007199254740991
                minimum: 0
              purpose:
                default: document
                type: string
                enum:
                  - document
                  - mapping_import
                  - client_import
            required:
              - filename
              - mime_type
              - size_bytes
            additionalProperties: false
      required:
        - files
      additionalProperties: false
    CreateJobDto:
      type: object
      properties:
        mode:
          type: string
          enum:
            - typed
            - auto
        document_type:
          type: string
          enum:
            - BANK_STATEMENT
            - INCOMING_INVOICE
            - OUTGOING_INVOICE
            - RECEIPT
            - CONTRACT
            - OTHER
        schema_id:
          type: string
          minLength: 1
          maxLength: 64
        documents:
          minItems: 1
          maxItems: 1000
          type: array
          items:
            type: object
            properties:
              upload_id:
                type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
              external_ref:
                type: string
                minLength: 1
                maxLength: 255
            required:
              - upload_id
            additionalProperties: false
        webhook_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        client_company_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        metadata:
          type: object
          additionalProperties: {}
      required:
        - documents
      additionalProperties: false
    RerunDto:
      type: object
      properties:
        schema_id:
          type: string
          minLength: 1
          maxLength: 64
        schema_version:
          type: integer
          exclusiveMinimum: true
          maximum: 9007199254740991
          minimum: 0
      default: {}
      additionalProperties: false
    ClassifyDto:
      type: object
      properties:
        transaction_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        category:
          type: string
          enum:
            - OWN_TRANSFER
            - BANK_FEE
            - PAYROLL
            - TAX
            - CONTRIBUTION
            - OTHER
            - NONE
        remember:
          type: boolean
      required:
        - transaction_id
        - category
    TestSchemaDto:
      type: object
      properties:
        upload_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - upload_id
      additionalProperties: false
    CorrectionsDto:
      type: object
      properties:
        corrections:
          maxItems: 500
          type: array
          items:
            type: object
            properties:
              path:
                type: string
                pattern: ^(\/[^/]*)+$
              extracted_value: {}
              corrected_value: {}
              citation:
                type: object
                properties:
                  page:
                    type: integer
                    minimum: 1
                    maximum: 100000
                  box:
                    type: array
                    prefixItems:
                      - type: number
                      - type: number
                      - type: number
                      - type: number
                    items: false
                    minItems: 4
                    maxItems: 4
                required:
                  - page
                  - box
                additionalProperties: false
            required:
              - path
            additionalProperties: false
        resolved:
          default: false
          type: boolean
      required:
        - corrections
      additionalProperties: false
    WarningsDto:
      type: object
      properties:
        warnings:
          minItems: 1
          maxItems: 1000
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                minLength: 1
                maxLength: 100
              path:
                type: string
                maxLength: 1000
            required:
              - code
              - path
            additionalProperties: false
      required:
        - warnings
      additionalProperties: false
    RetryDto:
      type: object
      properties:
        schema_id:
          type: string
          minLength: 1
          maxLength: 64
      default: {}
      additionalProperties: false
    CreateExportLinkDto:
      type: object
      properties:
        format:
          default: xlsx
          type: string
          enum:
            - xlsx
            - csv
            - json
            - XLSX
            - CSV
            - JSON
        layout:
          type: string
          enum:
            - transactions
            - statements
            - invoices
            - invoice_lines
        dialect:
          default: excel_bs
          type: string
          enum:
            - excel_bs
            - standard
        header:
          default: label
          type: string
          enum:
            - label
            - key
        status:
          minItems: 1
          type: array
          items:
            type: string
            enum:
              - COMPLETED
              - NEEDS_REVIEW
        document_type:
          type: string
          enum:
            - BANK_STATEMENT
            - INCOMING_INVOICE
            - OUTGOING_INVOICE
            - RECEIPT
            - CONTRACT
            - OTHER
        account:
          type: string
          maxLength: 64
        date_from:
          type: string
          format: date
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
        date_to:
          type: string
          format: date
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
        q:
          type: string
          maxLength: 200
        mapping_tables:
          minItems: 1
          maxItems: 10
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        client_companies:
          minItems: 1
          maxItems: 1000
          type: array
          items:
            anyOf:
              - type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
              - type: string
                enum:
                  - none
        template:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        template_version:
          type: integer
          minimum: 1
          maximum: 9007199254740991
        import_format:
          type: string
          enum:
            - mt940
            - camt053
            - fixed_width_transactions
        job_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        document_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
    CreateTemplateDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 120
        source:
          type: string
          enum:
            - transactions
            - statements
            - invoices
            - invoice_lines
        spec:
          type: object
          additionalProperties: {}
        client_scope:
          type: string
          enum:
            - ALL
            - SELECTED
        client_company_ids:
          maxItems: 500
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - name
        - source
      additionalProperties: false
    UpdateTemplateDto:
      type: object
      properties:
        spec:
          type: object
          additionalProperties: {}
        name:
          type: string
          minLength: 1
          maxLength: 120
      required:
        - spec
      additionalProperties: false
    SetTemplateClientsDto:
      type: object
      properties:
        client_scope:
          type: string
          enum:
            - ALL
            - SELECTED
        client_company_ids:
          maxItems: 500
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - client_scope
      additionalProperties: false
    PreviewBodyDto:
      type: object
      properties:
        job_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        document_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        spec:
          type: object
          additionalProperties: {}
        version:
          type: integer
          minimum: 1
          maximum: 9007199254740991
        limit:
          default: 50
          type: integer
          minimum: 1
          maximum: 50
      additionalProperties: false
    ProposeSchemaDto:
      type: object
      properties:
        document_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - document_id
      additionalProperties: false
    FieldHintDto:
      type: object
      properties:
        description:
          type: string
          minLength: 1
          maxLength: 1000
        field:
          default: {}
          type: object
          properties:
            name:
              type: string
              maxLength: 200
            type:
              type: string
              enum:
                - string
                - number
                - integer
                - boolean
                - date
                - enum
            hint:
              type: string
              maxLength: 1000
            enum:
              maxItems: 100
              type: array
              items:
                type: string
                maxLength: 200
          additionalProperties: false
        document_type:
          type: string
          enum:
            - BANK_STATEMENT
            - INCOMING_INVOICE
            - OUTGOING_INVOICE
            - RECEIPT
            - CONTRACT
            - OTHER
        schema_label:
          type: string
          maxLength: 200
      required:
        - description
      additionalProperties: false
    PreviewSchemaDto:
      type: object
      properties:
        document_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        definition:
          type: object
          additionalProperties: {}
        instructions:
          type: string
          maxLength: 4000
          nullable: true
        document_type:
          type: string
          enum:
            - BANK_STATEMENT
            - INCOMING_INVOICE
            - OUTGOING_INVOICE
            - RECEIPT
            - CONTRACT
            - OTHER
      required:
        - document_id
        - definition
      additionalProperties: false
    StatementSelectionDto:
      type: object
      properties:
        document_ids:
          minItems: 1
          maxItems: 200
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - document_ids
    RemoveStatementDuplicatesDto:
      type: object
      properties:
        document_ids:
          minItems: 1
          maxItems: 500
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
    CreateMappingTableDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
        key_kind:
          type: string
          enum:
            - IBAN
            - ACCOUNT_NUMBER
            - TAX_ID
            - COUNTERPARTY_NAME
            - TEXT
        value_label:
          type: string
          minLength: 1
          maxLength: 60
        description:
          type: string
          maxLength: 500
          nullable: true
        default_value:
          type: string
          maxLength: 200
          nullable: true
      required:
        - name
        - key_kind
        - value_label
      additionalProperties: false
    UpdateMappingTableDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
        key_kind:
          type: string
          enum:
            - IBAN
            - ACCOUNT_NUMBER
            - TAX_ID
            - COUNTERPARTY_NAME
            - TEXT
        value_label:
          type: string
          minLength: 1
          maxLength: 60
        description:
          type: string
          maxLength: 500
          nullable: true
        default_value:
          type: string
          maxLength: 200
          nullable: true
      additionalProperties: false
    UpsertEntriesDto:
      type: object
      properties:
        entries:
          minItems: 1
          maxItems: 1000
          type: array
          items:
            type: object
            properties:
              key:
                type: string
                maxLength: 1000
              value:
                type: string
                maxLength: 1000
            required:
              - key
              - value
            additionalProperties: false
      required:
        - entries
      additionalProperties: false
    DeleteEntriesDto:
      type: object
      properties:
        ids:
          minItems: 1
          maxItems: 500
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - ids
      additionalProperties: false
    LookupDto:
      type: object
      properties:
        keys:
          minItems: 1
          maxItems: 500
          type: array
          items:
            type: string
            maxLength: 1000
      required:
        - keys
      additionalProperties: false
    ImportPreviewDto:
      type: object
      properties:
        upload_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - upload_id
      additionalProperties: false
    ImportDto:
      type: object
      properties:
        upload_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        key_column:
          type: string
          minLength: 1
          maxLength: 200
        value_column:
          type: string
          minLength: 1
          maxLength: 200
        mode:
          type: string
          enum:
            - entries
            - suggestions
      required:
        - upload_id
        - key_column
        - value_column
        - mode
      additionalProperties: false
    BulkSuggestionsDto:
      type: object
      properties:
        action:
          type: string
          enum:
            - accept
            - reject
        ids:
          minItems: 1
          maxItems: 500
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - action
        - ids
      additionalProperties: false
    AcceptSuggestionDto:
      type: object
      properties:
        value:
          type: string
          maxLength: 1000
      additionalProperties: false
    CreateClientCompanyDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
        tax_id:
          type: string
          maxLength: 40
          nullable: true
        accounts:
          maxItems: 200
          type: array
          items:
            type: object
            properties:
              account:
                type: string
                minLength: 1
                maxLength: 64
              currencies:
                minItems: 1
                maxItems: 10
                type: array
                items:
                  type: string
                  minLength: 2
                  maxLength: 3
            required:
              - account
              - currencies
            additionalProperties: false
      required:
        - name
      additionalProperties: false
    ClientRowsDto:
      type: object
      properties:
        rows:
          minItems: 1
          maxItems: 5000
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                maxLength: 200
              account:
                type: string
                maxLength: 64
              currency:
                type: string
                maxLength: 40
              tax_id:
                type: string
                maxLength: 40
            required:
              - name
              - account
              - currency
            additionalProperties: false
        dry_run:
          default: false
          type: boolean
      required:
        - rows
      additionalProperties: false
    ClientImportPreviewDto:
      type: object
      properties:
        upload_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - upload_id
      additionalProperties: false
    ClientImportDto:
      type: object
      properties:
        upload_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        columns:
          type: object
          properties:
            name:
              type: string
              minLength: 1
              maxLength: 200
            account:
              type: string
              minLength: 1
              maxLength: 200
            currency:
              type: string
              minLength: 1
              maxLength: 200
            tax_id:
              type: string
              minLength: 1
              maxLength: 200
              nullable: true
          required:
            - name
            - account
            - currency
          additionalProperties: false
        dry_run:
          default: false
          type: boolean
      required:
        - upload_id
        - columns
      additionalProperties: false
    DeleteClientCompaniesDto:
      type: object
      properties:
        ids:
          minItems: 1
          maxItems: 500
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - ids
      additionalProperties: false
    UpdateClientCompanyDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
        tax_id:
          type: string
          maxLength: 40
          nullable: true
        accounts:
          maxItems: 200
          type: array
          items:
            type: object
            properties:
              account:
                type: string
                minLength: 1
                maxLength: 64
              currencies:
                minItems: 1
                maxItems: 10
                type: array
                items:
                  type: string
                  minLength: 2
                  maxLength: 3
            required:
              - account
              - currencies
            additionalProperties: false
      additionalProperties: false
    CreateInboxDto:
      type: object
      properties:
        client_company_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          nullable: true
        document_type:
          type: string
          enum:
            - BANK_STATEMENT
            - INCOMING_INVOICE
            - OUTGOING_INVOICE
            - null
          default: null
          nullable: true
        unknown_sender_policy:
          default: HOLD
          type: string
          enum:
            - HOLD
            - DISCARD
        senders:
          minItems: 1
          maxItems: 50
          type: array
          items:
            type: string
            minLength: 3
            maxLength: 254
      required:
        - senders
      additionalProperties: false
    UpdateInboxDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 120
        document_type:
          type: string
          enum:
            - BANK_STATEMENT
            - INCOMING_INVOICE
            - OUTGOING_INVOICE
            - null
          nullable: true
        unknown_sender_policy:
          type: string
          enum:
            - HOLD
            - DISCARD
        status:
          type: string
          enum:
            - ACTIVE
            - PAUSED
      additionalProperties: false
    AddSenderDto:
      type: object
      properties:
        value:
          type: string
          minLength: 3
          maxLength: 254
      required:
        - value
      additionalProperties: false
    CreateMatchDto:
      type: object
      properties:
        allocations:
          minItems: 1
          maxItems: 100
          type: array
          items:
            type: object
            properties:
              transaction_id:
                type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
              invoice_document_id:
                type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
              amount:
                type: number
                exclusiveMinimum: true
                maximum: 1000000000000
                minimum: 0
            required:
              - transaction_id
              - invoice_document_id
              - amount
      required:
        - allocations
    ConfirmMatchDto:
      type: object
      properties:
        allocations:
          minItems: 1
          maxItems: 100
          type: array
          items:
            type: object
            properties:
              transaction_id:
                type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
              invoice_document_id:
                type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
              amount:
                type: number
                exclusiveMinimum: true
                maximum: 1000000000000
                minimum: 0
            required:
              - transaction_id
              - invoice_document_id
              - amount
    UpdateRuleDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
        target_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        trigger:
          type: string
          enum:
            - JOB_FINALIZED
            - DOCUMENT_FINISHED
        filter:
          type: object
          properties:
            documentTypes:
              minItems: 1
              maxItems: 6
              type: array
              items:
                type: string
                enum:
                  - BANK_STATEMENT
                  - INCOMING_INVOICE
                  - OUTGOING_INVOICE
                  - RECEIPT
                  - CONTRACT
                  - OTHER
            schemaIds:
              minItems: 1
              maxItems: 50
              type: array
              items:
                type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            statuses:
              minItems: 1
              maxItems: 2
              type: array
              items:
                type: string
                enum:
                  - COMPLETED
                  - NEEDS_REVIEW
            account:
              type: string
              minLength: 1
              maxLength: 64
          additionalProperties: false
        format:
          type: object
          additionalProperties: {}
        enabled:
          type: boolean
        client_scope:
          type: string
          enum:
            - ALL
            - SELECTED
        client_company_ids:
          maxItems: 500
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      additionalProperties: false
    UpdateSettingsDto:
      type: object
      properties:
        auto_confirm_exact:
          type: boolean
        auto_confirm_threshold:
          type: number
          minimum: 0.5
          maximum: 1
          nullable: true
    CreateFolderDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
        parent_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          nullable: true
        period_start:
          type: string
          format: date
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
          nullable: true
        period_end:
          type: string
          format: date
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
          nullable: true
        auto_rule:
          type: object
          properties:
            job_ids:
              maxItems: 100
              type: array
              items:
                type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            document_types:
              maxItems: 6
              type: array
              items:
                type: string
                enum:
                  - BANK_STATEMENT
                  - INCOMING_INVOICE
                  - OUTGOING_INVOICE
                  - RECEIPT
                  - CONTRACT
                  - OTHER
            accounts:
              maxItems: 100
              type: array
              items:
                type: string
                minLength: 1
                maxLength: 64
            within_folder_period:
              type: boolean
          nullable: true
        checklist_ids:
          maxItems: 50
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - name
    UpdateFolderDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
        parent_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          nullable: true
        period_start:
          type: string
          format: date
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
          nullable: true
        period_end:
          type: string
          format: date
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
          nullable: true
        auto_rule:
          type: object
          properties:
            job_ids:
              maxItems: 100
              type: array
              items:
                type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            document_types:
              maxItems: 6
              type: array
              items:
                type: string
                enum:
                  - BANK_STATEMENT
                  - INCOMING_INVOICE
                  - OUTGOING_INVOICE
                  - RECEIPT
                  - CONTRACT
                  - OTHER
            accounts:
              maxItems: 100
              type: array
              items:
                type: string
                minLength: 1
                maxLength: 64
            within_folder_period:
              type: boolean
          nullable: true
        checklist_ids:
          maxItems: 50
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
    AddFolderDocumentsDto:
      type: object
      properties:
        document_ids:
          minItems: 1
          maxItems: 1000
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        job_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
    RemoveFolderDocumentsDto:
      type: object
      properties:
        document_ids:
          minItems: 1
          maxItems: 1000
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - document_ids
    SetFolderChecklistsDto:
      type: object
      properties:
        checklist_ids:
          maxItems: 50
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - checklist_ids
    CreateChecklistDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
        requirements:
          maxItems: 50
          type: array
          items:
            oneOf:
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - HAS_DOCUMENT
                  label:
                    type: string
                    minLength: 1
                    maxLength: 200
                  types:
                    minItems: 1
                    maxItems: 6
                    type: array
                    items:
                      type: string
                      enum:
                        - BANK_STATEMENT
                        - INCOMING_INVOICE
                        - OUTGOING_INVOICE
                        - RECEIPT
                        - CONTRACT
                        - OTHER
                  min:
                    default: 1
                    type: integer
                    minimum: 1
                    maximum: 100000
                required:
                  - kind
                  - types
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - FIELD_FILLED
                  label:
                    type: string
                    minLength: 1
                    maxLength: 200
                  type:
                    type: string
                    enum:
                      - BANK_STATEMENT
                      - INCOMING_INVOICE
                      - OUTGOING_INVOICE
                      - RECEIPT
                      - CONTRACT
                      - OTHER
                  path:
                    type: string
                    minLength: 2
                    maxLength: 300
                    format: starts_with
                    pattern: ^\/.*
                required:
                  - kind
                  - type
                  - path
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - STATEMENT_COVERAGE
                  label:
                    type: string
                    minLength: 1
                    maxLength: 200
                  accounts:
                    default: all_known
                    anyOf:
                      - type: string
                        enum:
                          - all_known
                      - minItems: 1
                        maxItems: 100
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 64
                required:
                  - kind
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - NO_OPEN_REVIEW
                  label:
                    type: string
                    minLength: 1
                    maxLength: 200
                required:
                  - kind
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - NO_DUPLICATES
                  label:
                    type: string
                    minLength: 1
                    maxLength: 200
                required:
                  - kind
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - ALL_MATCHED
                  label:
                    type: string
                    minLength: 1
                    maxLength: 200
                  tolerance:
                    default: 0
                    type: integer
                    minimum: 0
                    maximum: 100000
                required:
                  - kind
        applies_to:
          default: TAGGED
          type: string
          enum:
            - ALL
            - TAGGED
      required:
        - name
        - requirements
    UpdateChecklistDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
        requirements:
          maxItems: 50
          type: array
          items:
            oneOf:
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - HAS_DOCUMENT
                  label:
                    type: string
                    minLength: 1
                    maxLength: 200
                  types:
                    minItems: 1
                    maxItems: 6
                    type: array
                    items:
                      type: string
                      enum:
                        - BANK_STATEMENT
                        - INCOMING_INVOICE
                        - OUTGOING_INVOICE
                        - RECEIPT
                        - CONTRACT
                        - OTHER
                  min:
                    default: 1
                    type: integer
                    minimum: 1
                    maximum: 100000
                required:
                  - kind
                  - types
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - FIELD_FILLED
                  label:
                    type: string
                    minLength: 1
                    maxLength: 200
                  type:
                    type: string
                    enum:
                      - BANK_STATEMENT
                      - INCOMING_INVOICE
                      - OUTGOING_INVOICE
                      - RECEIPT
                      - CONTRACT
                      - OTHER
                  path:
                    type: string
                    minLength: 2
                    maxLength: 300
                    format: starts_with
                    pattern: ^\/.*
                required:
                  - kind
                  - type
                  - path
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - STATEMENT_COVERAGE
                  label:
                    type: string
                    minLength: 1
                    maxLength: 200
                  accounts:
                    default: all_known
                    anyOf:
                      - type: string
                        enum:
                          - all_known
                      - minItems: 1
                        maxItems: 100
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 64
                required:
                  - kind
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - NO_OPEN_REVIEW
                  label:
                    type: string
                    minLength: 1
                    maxLength: 200
                required:
                  - kind
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - NO_DUPLICATES
                  label:
                    type: string
                    minLength: 1
                    maxLength: 200
                required:
                  - kind
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - ALL_MATCHED
                  label:
                    type: string
                    minLength: 1
                    maxLength: 200
                  tolerance:
                    default: 0
                    type: integer
                    minimum: 0
                    maximum: 100000
                required:
                  - kind
        applies_to:
          type: string
          enum:
            - ALL
            - TAGGED
    ValidateGraphDto:
      type: object
      properties:
        graph:
          type: object
          additionalProperties: {}
      required:
        - graph
      additionalProperties: false
    CreatePipelineDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 120
        description:
          type: string
          maxLength: 500
        graph:
          type: object
          additionalProperties: {}
        client_scope:
          type: string
          enum:
            - ALL
            - SELECTED
        client_company_ids:
          maxItems: 500
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        output_split:
          type: string
          enum:
            - NONE
            - CLIENT
      required:
        - name
      additionalProperties: false
    UpdatePipelineDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 120
        description:
          type: string
          maxLength: 500
          nullable: true
        client_scope:
          type: string
          enum:
            - ALL
            - SELECTED
        client_company_ids:
          maxItems: 500
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        output_split:
          type: string
          enum:
            - NONE
            - CLIENT
      additionalProperties: false
    SaveGraphDto:
      type: object
      properties:
        graph:
          type: object
          additionalProperties: {}
        base_version:
          type: integer
          minimum: 1
          maximum: 9007199254740991
      required:
        - graph
      additionalProperties: false
    StartRunDto:
      type: object
      properties:
        version:
          type: integer
          minimum: 1
          maximum: 9007199254740991
        upload_ids:
          minItems: 1
          maxItems: 100
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        test:
          default: false
          type: boolean
      additionalProperties: false
    RetryRunDto:
      type: object
      properties:
        from_node:
          type: string
          maxLength: 64
      additionalProperties: false
    DecisionDto:
      type: object
      properties:
        outcome:
          type: string
          enum:
            - approve
            - reject
        comment:
          type: string
          maxLength: 500
      required:
        - outcome
      additionalProperties: false
    CodeTestDto:
      type: object
      properties:
        config:
          type: object
          properties:
            source:
              type: string
              maxLength: 100000
            input_schema:
              maxItems: 100
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                    maxLength: 64
                  type:
                    type: string
                    enum:
                      - text
                      - number
                      - decimal
                      - integer
                      - date
                  nullable:
                    type: boolean
                required:
                  - name
                  - type
                additionalProperties: false
            output_schema:
              maxItems: 100
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                    maxLength: 64
                  type:
                    type: string
                    enum:
                      - text
                      - number
                      - decimal
                      - integer
                      - date
                  nullable:
                    type: boolean
                required:
                  - name
                  - type
                additionalProperties: false
            timeout_ms:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            params:
              type: object
              additionalProperties:
                type:
                  - string
                  - number
                  - boolean
          required:
            - source
            - input_schema
            - output_schema
          additionalProperties: false
        rows:
          maxItems: 100
          type: array
          items:
            type: object
            additionalProperties: {}
        sample:
          type: object
          properties:
            run_id:
              type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            node_id:
              type: string
              minLength: 1
              maxLength: 64
          required:
            - run_id
            - node_id
          additionalProperties: false
      required:
        - config
      additionalProperties: false
    CodeDraftDto:
      type: object
      properties:
        description:
          type: string
          minLength: 5
          maxLength: 2000
        input_schema:
          maxItems: 100
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                maxLength: 64
              type:
                type: string
                enum:
                  - text
                  - number
                  - decimal
                  - integer
                  - date
              nullable:
                type: boolean
            required:
              - name
              - type
            additionalProperties: false
        output_schema:
          maxItems: 100
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                maxLength: 64
              type:
                type: string
                enum:
                  - text
                  - number
                  - decimal
                  - integer
                  - date
              nullable:
                type: boolean
            required:
              - name
              - type
            additionalProperties: false
        params:
          maxItems: 50
          type: array
          items:
            type: string
            maxLength: 41
      required:
        - description
        - input_schema
        - output_schema
      additionalProperties: false
    CreateWebhookDto:
      type: object
      properties:
        name:
          type: string
          maxLength: 100
        url:
          type: string
          minLength: 1
          maxLength: 2048
        events:
          minItems: 1
          type: array
          items:
            type: string
            enum:
              - JOB_COMPLETED
              - JOB_FAILED
              - JOB_CANCELLED
              - DOCUMENT_COMPLETED
              - DOCUMENT_NEEDS_REVIEW
              - DOCUMENT_FAILED
              - CREDITS_LOW
              - PING
        set_as_default:
          default: false
          type: boolean
        auth:
          default:
            type: NONE
          oneOf:
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - NONE
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - BEARER
                token:
                  type: string
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - API_KEY
                header_name:
                  type: string
                value:
                  type: string
              required:
                - type
                - header_name
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - BASIC
                username:
                  type: string
                password:
                  type: string
              required:
                - type
                - username
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - OAUTH2
                token_url:
                  type: string
                client_id:
                  type: string
                scope:
                  type: string
                client_secret:
                  type: string
              required:
                - type
                - token_url
                - client_id
              additionalProperties: false
      required:
        - url
        - events
      additionalProperties: false
    UpdateWebhookDto:
      type: object
      properties:
        name:
          type: string
          maxLength: 100
          nullable: true
        url:
          type: string
          minLength: 1
          maxLength: 2048
        events:
          minItems: 1
          type: array
          items:
            type: string
            enum:
              - JOB_COMPLETED
              - JOB_FAILED
              - JOB_CANCELLED
              - DOCUMENT_COMPLETED
              - DOCUMENT_NEEDS_REVIEW
              - DOCUMENT_FAILED
              - CREDITS_LOW
              - PING
        status:
          type: string
          enum:
            - ACTIVE
            - DISABLED
        set_as_default:
          type: boolean
        auth:
          oneOf:
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - NONE
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - BEARER
                token:
                  type: string
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - API_KEY
                header_name:
                  type: string
                value:
                  type: string
              required:
                - type
                - header_name
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - BASIC
                username:
                  type: string
                password:
                  type: string
              required:
                - type
                - username
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - OAUTH2
                token_url:
                  type: string
                client_id:
                  type: string
                scope:
                  type: string
                client_secret:
                  type: string
              required:
                - type
                - token_url
                - client_id
              additionalProperties: false
      additionalProperties: false
    RotateSecretDto:
      type: object
      properties:
        expire_previous_in_hours:
          default: 0
          type: integer
          minimum: 0
          maximum: 24
      default:
        expire_previous_in_hours: 0
      additionalProperties: false
    CreateConnectionDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
        kind:
          type: string
          enum:
            - HTTPS_HEADER
            - BASIC
            - SFTP_KEY
            - OAUTH2
            - GOOGLE_DRIVE
        meta:
          type: object
          additionalProperties: {}
        secret:
          type: object
          additionalProperties: {}
      required:
        - name
        - kind
        - meta
        - secret
      additionalProperties: false
    UpdateConnectionDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
        meta:
          type: object
          additionalProperties: {}
        secret:
          type: object
          additionalProperties: {}
      additionalProperties: false
    SetConnectionSecretDto:
      type: object
      properties:
        secret:
          type: object
          additionalProperties: {}
      required:
        - secret
      additionalProperties: false
    TestConnectionDto:
      type: object
      properties:
        url:
          type: string
          maxLength: 2048
        path:
          type: string
          maxLength: 500
        target_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        secret:
          type: string
          maxLength: 4000
      additionalProperties: false
    CreateTargetDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
        kind:
          type: string
          enum:
            - HTTPS
            - SFTP
            - EMAIL
            - DRIVE
        connection_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          nullable: true
        config:
          type: object
          additionalProperties: {}
        connection_secret:
          type: string
          maxLength: 4000
      required:
        - name
        - kind
        - config
      additionalProperties: false
    PreviewPathDto:
      type: object
      properties:
        path_template:
          type: string
          minLength: 1
          maxLength: 500
        job_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - path_template
      additionalProperties: false
    UpdateTargetDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
        connection_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          nullable: true
        config:
          type: object
          additionalProperties: {}
        connection_secret:
          type: string
          maxLength: 4000
      additionalProperties: false
    CreateRuleDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
        target_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        trigger:
          type: string
          enum:
            - JOB_FINALIZED
            - DOCUMENT_FINISHED
        filter:
          default: {}
          type: object
          properties:
            documentTypes:
              minItems: 1
              maxItems: 6
              type: array
              items:
                type: string
                enum:
                  - BANK_STATEMENT
                  - INCOMING_INVOICE
                  - OUTGOING_INVOICE
                  - RECEIPT
                  - CONTRACT
                  - OTHER
            schemaIds:
              minItems: 1
              maxItems: 50
              type: array
              items:
                type: string
                format: uuid
                pattern: >-
                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            statuses:
              minItems: 1
              maxItems: 2
              type: array
              items:
                type: string
                enum:
                  - COMPLETED
                  - NEEDS_REVIEW
            account:
              type: string
              minLength: 1
              maxLength: 64
          additionalProperties: false
        format:
          type: object
          additionalProperties: {}
        enabled:
          default: true
          type: boolean
        client_scope:
          type: string
          enum:
            - ALL
            - SELECTED
        client_company_ids:
          maxItems: 500
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - name
        - target_id
        - trigger
        - format
      additionalProperties: false
    CreatePlatformKeyDto:
      type: object
      properties:
        platform:
          type: string
          enum:
            - n8n
            - make
      required:
        - platform
      additionalProperties: false
    ConnectDto:
      type: object
      properties:
        return_to:
          default: /settings/integrations/drive/setup
          type: string
          enum:
            - /settings/integrations/drive/setup
            - /settings/integrations/drive
            - /setup
            - /settings/integrations
      additionalProperties: false
    FinishDto:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          maxLength: 2048
        state:
          type: string
          minLength: 1
          maxLength: 2048
      required:
        - code
        - state
      additionalProperties: false
    SetupDto:
      type: object
      properties:
        document_types:
          minItems: 1
          maxItems: 3
          type: array
          items:
            type: string
            enum:
              - BANK_STATEMENT
              - INCOMING_INVOICE
              - OUTGOING_INVOICE
        import:
          type: boolean
        deliver:
          type: boolean
        locale:
          default: bs
          type: string
          enum:
            - bs
            - en
            - sr-Latn
      required:
        - document_types
        - import
        - deliver
      additionalProperties: false
    ChooseDto:
      type: object
      properties:
        document_type:
          type: string
          enum:
            - BANK_STATEMENT
            - INCOMING_INVOICE
            - OUTGOING_INVOICE
        kind:
          type: string
          enum:
            - inbox
            - results
        folder_id:
          type: string
          pattern: ^[\w-]{1,128}$
        locale:
          default: bs
          type: string
          enum:
            - bs
            - en
            - sr-Latn
      required:
        - document_type
        - kind
        - folder_id
      additionalProperties: false
    WatchDto:
      type: object
      properties:
        enabled:
          type: boolean
      required:
        - enabled
      additionalProperties: false
    CreateMcpGrantDto:
      type: object
      properties:
        oauth_client_id:
          type: string
          minLength: 1
          maxLength: 200
        client_name:
          type: string
          minLength: 1
          maxLength: 200
        access:
          default: read
          type: string
          enum:
            - read
            - write
      required:
        - oauth_client_id
        - client_name
      additionalProperties: false
    CreateAgentRunDto:
      type: object
      properties:
        agent:
          type: string
          enum:
            - reconciliation-explainer
        input:
          default: {}
          type: object
          additionalProperties: {}
      required:
        - agent
    DecideApprovalDto:
      type: object
      properties:
        decision:
          type: string
          enum:
            - approve
            - reject
        note:
          type: string
          minLength: 1
          maxLength: 1000
        edited_input:
          type: object
          additionalProperties: {}
      required:
        - decision
