> ## Documentation Index
> Fetch the complete documentation index at: https://docs.parser-app.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Parse a merchant packet (PDF / PNG / JPEG files)

> Upload one merchant's packet: one or more files (bank statements, ISO/merchant application, other documents). The packet is one submission: the result's `submission_packet` lists its typed documents, which ones the decision rests on and why the others are excluded, the merchant's details with their sources, month-by-month coverage and the checks across statements. Optional form fields describe the packet (who sent it, the merchant it is filed under, what each file is said to be); they are recorded and never replace what the documents say. Files are validated by content (PDF, PNG, JPEG) and split into documents. A bank statement with a text layer is read by the layout engine (no model); a scanned statement, or one whose layout read does not reconcile, is read by GPT-6 Luna from 300 DPI page images, which also categorizes every row in the same call. A layout ledger is categorized by one GPT-6 Luna call over its JSON. Ledgers must pass the reconciliation gate to be returned as verified, and underwriting metrics use verified ledgers only. Returns 202 with a job id, or the finished job when `wait` seconds suffice.



## OpenAPI

````yaml /openapi.json post /v1/parse
openapi: 3.1.0
info:
  title: parser_backend
  summary: >-
    MCA packet parsing with GPT-6 Luna (OpenRouter), verified ledgers and
    underwriting metrics
  description: >

    MCA document parsing: merchant packets in (upload or email), verified
    bank-statement ledgers, ISO

    applications and underwriting metrics out.


    **How a packet is read**


    1. *Intake* - files validated by content (PDF, PNG, JPEG), PDF
    safety-parsed, images converted to PDF;
       email attachments extracted from every MIME part.
    2. *Split* - each PDF is split into documents (bank statement, merchant
    application, tax return, ...) by
       per-page classification and statement boundaries.
    3. *Read* - a statement with a text layer is read by the **layout engine**:
    tables rebuilt from the text
       layer's geometry become the ledger JSON, with no model call. Pages without a text layer, and any statement
       whose layout read does not pass the gate, are rendered at 300 DPI and read by **GPT-6 Luna** through
       OpenRouter with a strict JSON schema at full image resolution (Luna's answer is the OCR): one owned page per
       call, neighbours as context, fanned out in parallel; the same answer categorizes every row. An image-read
       ledger is accepted only when a second, independent image read agrees on every amount, date and balance.
    4. *Gate* - a ledger is **verified** only when it reconciles to the cent
       (`opening + credits - debits = closing`), reproduces the bank's printed totals and keeps every running
       balance chain. If it still fails after the image read it is returned as `review_required`, never as data.
    5. *Categorize* - a category and counterparty per row: revenue, MCA funding
    / payment, loan, NSF, overdraft,
       returned item, transfers, payroll, taxes, ... or unknown. Image reads return them with the OCR; a
       layout-engine ledger goes to GPT-6 Luna once as JSON (rows grouped by description, with counts, amounts and
       dates). Deterministic rules cross-check every row.
    6. *Aggregate* - accounts and statement months (missing months flagged); MCA
    and loan positions decided by
       GPT-6 Luna over the packet's possible financing streams and checked against the rows (cadence
       cross-checks); monthly summaries, and the withhold, EBITDA and revenue math.
    7. *Packet* - the files are one submission (`result.submission_packet`): its
    typed documents in order, which
       ones the decision rests on and why the others are excluded (duplicates, failed or unreconciled reads,
       unclassified documents, another business's statement), the merchant's details with their sources,
       month-by-month coverage, whether the statements are one unbroken history, the balance chain across
       statements, undisclosed accounts and cross-document fraud signals.

    Every Luna call is metered (prompt, cached, completion and reasoning tokens;
    provider-reported cost) and

    every answer is replay-cached: a re-sent document or window costs nothing.


    **Integrating**


    * *Authentication*: `Authorization: Bearer <credential>` (or `X-API-Key`) on
    every `/v1` route. The credential
      is an API key (`pk_live_...`, created with `POST /v1/api-keys`, scoped to permissions) or a WorkOS AuthKit
      access token (a person, with the permissions of their role). Each belongs to one tenant; jobs, caches,
      webhooks and settings are tenant-scoped. Errors are `{"error": {"code", "message", "request_id"}}`.
    * *Submit*: `POST /v1/parse` (multipart) or `POST /v1/intake/email` (raw
    MIME). The answer is `202` with a
      `job_id` and `status_url`, or the finished job when `wait` seconds suffice. Send an `Idempotency-Key` to
      make a retry return the same job.
    * *Get the result*: register a webhook once (`POST /v1/webhooks`) and
    receive `job.completed`,
      `job.review_required` or `job.failed` when each job ends, signed with the endpoint's secret; then fetch
      `GET /v1/jobs/{job_id}`. Or poll that route (`?wait=` long-polls). Every job ends in one of those three
      states, and its event is stored with it: a job that runs past `JOB_TIMEOUT_SECONDS`, or that the service
      stopped during too many runs, fails with its `job.failed` event.
    * *Status*: `completed` - every check passed; `review_required` - the result
    is usable but
      `review_reasons` name what a person should look at; `failed` - nothing could be processed (`error`).
  version: 0.1.0
servers:
  - url: https://api.parser-app.com
security: []
tags:
  - name: parse
    description: Submit documents for parsing
  - name: email
    description: Submit a raw email; its attachments are parsed as one packet
  - name: jobs
    description: Poll jobs and read results
  - name: underwriting
    description: Withhold, EBITDA and capacity calculator
  - name: webhooks
    description: Signed job events pushed to your endpoint, retried until delivered
  - name: usage
    description: Token usage, cost and service metrics
  - name: identity
    description: 'Who is calling: tenant, permissions, modules'
  - name: tenant
    description: This tenant's settings
  - name: api-keys
    description: 'Scoped API keys: create, rotate, revoke'
  - name: mailboxes
    description: Forwarding addresses and Gmail mailboxes, and each message's outcome
  - name: emails
    description: 'Every inbound email tracked: its thread, raw .eml, tags and erasure'
  - name: integrations
    description: Connections to the tenant's CRM and other systems, fed by job events
  - name: audit
    description: Every change made in the tenant
  - name: platform
    description: Tenants across the platform (platform:admin)
  - name: health
    description: Liveness and readiness
paths:
  /v1/parse:
    post:
      tags:
        - parse
      summary: Parse a merchant packet (PDF / PNG / JPEG files)
      description: >-
        Upload one merchant's packet: one or more files (bank statements,
        ISO/merchant application, other documents). The packet is one
        submission: the result's `submission_packet` lists its typed documents,
        which ones the decision rests on and why the others are excluded, the
        merchant's details with their sources, month-by-month coverage and the
        checks across statements. Optional form fields describe the packet (who
        sent it, the merchant it is filed under, what each file is said to be);
        they are recorded and never replace what the documents say. Files are
        validated by content (PDF, PNG, JPEG) and split into documents. A bank
        statement with a text layer is read by the layout engine (no model); a
        scanned statement, or one whose layout read does not reconcile, is read
        by GPT-6 Luna from 300 DPI page images, which also categorizes every row
        in the same call. A layout ledger is categorized by one GPT-6 Luna call
        over its JSON. Ledgers must pass the reconciliation gate to be returned
        as verified, and underwriting metrics use verified ledgers only. Returns
        202 with a job id, or the finished job when `wait` seconds suffice.
      operationId: parse_v1_parse_post
      parameters:
        - name: wait
          in: query
          required: false
          schema:
            type: integer
            maximum: 3600
            minimum: 0
            description: Seconds to wait for the result
            default: 0
            title: Wait
          description: Seconds to wait for the result
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 200
              - type: 'null'
            description: >-
              Retry-safe submission: the same key and request returns the same
              job; the same key with different files, order, metadata or options
              is refused (409)
            title: Idempotency-Key
          description: >-
            Retry-safe submission: the same key and request returns the same
            job; the same key with different files, order, metadata or options
            is refused (409)
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_parse_v1_parse_post'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobEnvelope'
          description: OK
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobAccepted'
        '401':
          description: Missing, invalid, revoked or expired API key or token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: The caller lacks the route's permission, or the tenant is suspended
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Idempotency-Key reused for a different request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '413':
          description: Payload too large
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Invalid request
        '429':
          description: >-
            The tenant's queued and running jobs are at its cap (retry later),
            or its monthly Luna budget is spent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - APIKeyHeader: []
        - HTTPBearer: []
components:
  schemas:
    Body_parse_v1_parse_post:
      properties:
        files:
          items:
            type: string
            contentMediaType: application/octet-stream
          type: array
          title: Files
          description: Documents of one merchant
        options:
          anyOf:
            - type: string
            - type: 'null'
          title: Options
          description: ParseOptions as JSON
        document_types:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Document Types
          description: >-
            One declared type per file, in upload order:
            bank_statement.business, bank_statement.personal,
            credit_card_statement, tax_return.1040, tax_return.1120s,
            tax_return.1065, tax_return.w2, tax_return.1099_nec,
            application.mca, application.sba, agreement.mca, voided_check,
            drivers_license, coi.acord_25, coi.acord_27, unknown. Recorded,
            never used in place of the classifier
        broker_email:
          anyOf:
            - type: string
              maxLength: 320
            - type: 'null'
          title: Broker Email
          description: The ISO / broker that sent it
        contact_email:
          anyOf:
            - type: string
              maxLength: 320
            - type: 'null'
          title: Contact Email
          description: The merchant's contact
        business_name:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Business Name
          description: The merchant's legal name
        business_ein:
          anyOf:
            - type: string
              maxLength: 32
            - type: 'null'
          title: Business Ein
          description: The merchant's EIN (9 digits)
        external_business_id:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: External Business Id
          description: 'Your id for the merchant: links its submissions'
        end_user_id:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: End User Id
          description: Your merchant record id, echoed
        requested_advance_amount:
          anyOf:
            - type: number
              minimum: 0
            - type: string
            - type: 'null'
          title: Requested Advance Amount
          description: Amount requested, USD
      type: object
      required:
        - files
      title: Body_parse_v1_parse_post
    JobEnvelope:
      properties:
        job_id:
          type: string
          title: Job Id
        status:
          type: string
          enum:
            - queued
            - running
            - completed
            - review_required
            - failed
          title: Status
        source:
          type: string
          title: Source
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        result:
          anyOf:
            - $ref: '#/components/schemas/JobResult'
            - type: 'null'
        superseded_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Superseded By
          description: >-
            A later job of the same email thread that holds this job's documents
            and more: read that one
        intake:
          $ref: '#/components/schemas/JobIntakeOut'
          description: How the packet came in and what it declared, for every status
      additionalProperties: false
      type: object
      required:
        - job_id
        - status
        - source
        - created_at
        - updated_at
        - intake
      title: JobEnvelope
    JobAccepted:
      properties:
        job_id:
          type: string
          title: Job Id
        status:
          type: string
          enum:
            - queued
            - running
            - completed
            - review_required
            - failed
          title: Status
        status_url:
          type: string
          title: Status Url
        created:
          type: boolean
          title: Created
          description: False when an existing job matched the idempotency key
      additionalProperties: false
      type: object
      required:
        - job_id
        - status
        - status_url
        - created
      title: JobAccepted
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
      additionalProperties: false
      type: object
      required:
        - error
      title: ErrorResponse
    JobResult:
      properties:
        job_id:
          type: string
          title: Job Id
        status:
          type: string
          enum:
            - queued
            - running
            - completed
            - review_required
            - failed
          title: Status
        source:
          type: string
          enum:
            - upload
            - email
          title: Source
        created_at:
          type: string
          format: date-time
          title: Created At
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
        review_reasons:
          items:
            type: string
          type: array
          title: Review Reasons
        merchant_fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          title: Merchant Fingerprint
          description: >-
            The merchant across submissions: its EIN, else its accounts and
            holder
        related_jobs:
          items:
            type: string
          type: array
          title: Related Jobs
          description: >-
            The tenant's earlier jobs for this merchant (same EIN, or a
            statement in common), oldest first
        email:
          anyOf:
            - $ref: '#/components/schemas/JobEmailOut'
            - type: 'null'
          description: The email the packet came in; null for an upload
        submission_packet:
          anyOf:
            - $ref: '#/components/schemas/SubmissionPacketOut'
            - type: 'null'
        files:
          items:
            $ref: '#/components/schemas/FileOut'
          type: array
          title: Files
        statements:
          items:
            $ref: '#/components/schemas/StatementOut'
          type: array
          title: Statements
        applications:
          items:
            $ref: '#/components/schemas/ApplicationOut'
          type: array
          title: Applications
        other_documents:
          items:
            $ref: '#/components/schemas/OtherDocumentOut'
          type: array
          title: Other Documents
        accounts:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Accounts
          description: >-
            Accepted statements grouped by account, with months covered and
            missing
        months:
          items:
            $ref: '#/components/schemas/MonthOut'
          type: array
          title: Months
        positions:
          items:
            $ref: '#/components/schemas/PositionOut'
          type: array
          title: Positions
        underwriting:
          anyOf:
            - $ref: '#/components/schemas/UnderwritingOut'
            - type: 'null'
        usage:
          $ref: '#/components/schemas/UsageSummary'
        pipeline:
          additionalProperties: true
          type: object
          title: Pipeline
        corrections:
          anyOf:
            - $ref: '#/components/schemas/CorrectionsSummary'
            - type: 'null'
          description: >-
            Present when corrections are in force: the result is the corrected
            one (`?view=computed` for the machine's), and each changed
            transaction, position and month carries `correction`
      additionalProperties: false
      type: object
      required:
        - job_id
        - status
        - source
        - created_at
      title: JobResult
    JobIntakeOut:
      properties:
        source:
          type: string
          enum:
            - upload
            - email
          title: Source
        received_at:
          type: string
          format: date-time
          title: Received At
          description: When the email was received, or the upload submitted
        broker_email:
          anyOf:
            - type: string
            - type: 'null'
          title: Broker Email
          description: 'The ISO / broker: the form field, or the email''s sender'
        business_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Business Name
        business_ein:
          anyOf:
            - type: string
            - type: 'null'
          title: Business Ein
        external_business_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Business Id
        end_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: End User Id
        contact_email:
          anyOf:
            - type: string
            - type: 'null'
          title: Contact Email
        requested_advance_amount:
          anyOf:
            - type: string
            - type: 'null'
          title: Requested Advance Amount
        email:
          anyOf:
            - $ref: '#/components/schemas/JobEmailOut'
            - type: 'null'
          description: Null for an upload
        files:
          items:
            $ref: '#/components/schemas/JobFileOut'
          type: array
          title: Files
          description: '`GET /v1/jobs/{job_id}/files/{position}` returns each one''s bytes'
      additionalProperties: false
      type: object
      required:
        - source
        - received_at
      title: JobIntakeOut
      description: >-
        How a job's packet came in and what it declared: set from submission,
        whatever the job's status.
    ErrorBody:
      properties:
        code:
          type: string
          title: Code
          description: unauthenticated, forbidden, not_found, conflict, limit_reached, ...
        message:
          type: string
          title: Message
        request_id:
          type: string
          title: Request Id
          description: Also in the X-Request-ID response header
      additionalProperties: false
      type: object
      required:
        - code
        - message
        - request_id
      title: ErrorBody
    JobEmailOut:
      properties:
        email_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Email Id
          description: >-
            The tracked email that started the job: `GET /v1/emails/{email_id}`
            (absent on jobs from before email tracking)
        provider_message_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider Message Id
          description: Its Message-ID (or the provider's id)
        mailbox_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Mailbox Id
          description: >-
            The mailbox it arrived through; null when posted to
            `/v1/intake/email` with an API key
        from:
          anyOf:
            - type: string
            - type: 'null'
          title: From
          description: Its From address
        to:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: To
          description: Its To addresses
        subject:
          anyOf:
            - type: string
            - type: 'null'
          title: Subject
        received_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Received At
          description: When it was received, ISO 8601
        attachment_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Attachment Count
          description: Attachments, processable or not
        processable_attachments:
          anyOf:
            - type: integer
            - type: 'null'
          title: Processable Attachments
          description: PDF, PNG and JPEG documents taken
        thread_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Thread Id
          description: >-
            Its thread (the mailbox and the thread's root message): `GET
            /v1/emails/threads/{thread_id}` lists every email of it
        supersedes:
          anyOf:
            - type: string
            - type: 'null'
          title: Supersedes
          description: The thread's earlier job this one replaces
        routing:
          anyOf:
            - $ref: '#/components/schemas/EmailRoutingOut'
            - type: 'null'
          description: The router's verdict; null when not routed
      additionalProperties: true
      type: object
      title: JobEmailOut
      description: 'The email a job came in (only its envelope: the body is never kept).'
    SubmissionPacketOut:
      properties:
        packet_id:
          type: string
          title: Packet Id
          description: The job id
        intake:
          $ref: '#/components/schemas/PacketIntakeOut'
        document_count:
          type: integer
          title: Document Count
        documents:
          items:
            $ref: '#/components/schemas/PacketDocumentOut'
          type: array
          title: Documents
        statement_exclusions:
          anyOf:
            - $ref: '#/components/schemas/StatementExclusionsOut'
            - type: 'null'
          description: Null when every statement is a decision input and nothing is flagged
        submission_intelligence:
          $ref: '#/components/schemas/SubmissionIntelligenceOut'
        mode_u:
          anyOf:
            - $ref: '#/components/schemas/ModeUOut'
            - type: 'null'
          description: Null with fewer than two periodic decision statements
        cross_statement:
          $ref: '#/components/schemas/CrossStatementOut'
        packet_fraud:
          anyOf:
            - $ref: '#/components/schemas/PacketFraudOut'
            - type: 'null'
          description: >-
            Cross-document fraud signals (balance-chain tampering, mismatched
            identities, reused statements): `{fraud_score, severity,
            reasons[]}`; null when fewer than two documents can be compared, or
            the fraud module is off
        review_reasons:
          items:
            type: string
          type: array
          title: Review Reasons
          description: The packet's own review reasons; also in the job's `review_reasons`
      additionalProperties: false
      type: object
      required:
        - packet_id
        - intake
        - document_count
        - documents
        - submission_intelligence
        - cross_statement
      title: SubmissionPacketOut
      description: >-
        The packet as one submission: its intake, its documents and the checks
        across them.
    FileOut:
      properties:
        filename:
          type: string
          title: Filename
        content_sha256:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Sha256
        status:
          type: string
          enum:
            - processed
            - rejected
            - skipped
            - duplicate
            - failed
          title: Status
        reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reason
        page_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Page Count
        segments:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Segments
          description: Typed documents found in this file
        page_classification:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Page Classification
          description: 'Per page: read mode, document type, classifier, boundary'
      additionalProperties: false
      type: object
      required:
        - filename
        - status
      title: FileOut
    StatementOut:
      properties:
        document_id:
          type: string
          title: Document Id
        source_file:
          type: string
          title: Source File
        content_sha256:
          type: string
          title: Content Sha256
        content_fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Fingerprint
          description: >-
            What the pages say (text layer, embedded scans), whatever file they
            arrived in; null when a page cannot be identified safely
        statement_fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          title: Statement Fingerprint
          description: >-
            Last four, period and opening/closing balances: the same statement
            in any file
        read_reused:
          type: boolean
          title: Read Reused
          description: >-
            The ledger was not read again: an earlier read of the same content
            or statement was reused
          default: false
        earlier_submission:
          anyOf:
            - $ref: '#/components/schemas/EarlierSubmissionOut'
            - type: 'null'
        image_readiness:
          anyOf:
            - $ref: '#/components/schemas/DocumentQualityAssessment'
            - type: 'null'
          description: >-
            Whether the scanned pages can be read, measured on the first image
            page with content before any image read; null when not measured in
            this job (no image read was needed, the read was reused, or the gate
            is off). reupload_required fails the statement with
            image_reupload_required: ask the merchant for a sharper, better-lit
            copy
        packet_pages:
          items:
            type: integer
          type: array
          title: Packet Pages
          description: '[first, last] page of this statement in its source file'
        page_modes:
          additionalProperties:
            type: integer
          type: object
          title: Page Modes
          description: Pages read from the text layer vs from the image
        document_type:
          type: string
          title: Document Type
        institution_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Institution Name
        account_holder_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Account Holder Name
        account_number_last4:
          anyOf:
            - type: string
            - type: 'null'
          title: Account Number Last4
        routing_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Routing Number
        period_start:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Period Start
        period_end:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Period End
        statement_kind:
          anyOf:
            - type: string
            - type: 'null'
          title: Statement Kind
        months:
          items:
            type: string
          type: array
          title: Months
          description: Calendar months (YYYY-MM) this statement covers
        opening_balance:
          anyOf:
            - type: string
            - type: 'null'
          title: Opening Balance
        closing_balance:
          anyOf:
            - type: string
            - type: 'null'
          title: Closing Balance
        summary_total_credits:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary Total Credits
        summary_total_debits:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary Total Debits
        credits_total:
          type: string
          title: Credits Total
          default: '0'
        debits_total:
          type: string
          title: Debits Total
          default: '0'
        credit_count:
          type: integer
          title: Credit Count
          default: 0
        debit_count:
          type: integer
          title: Debit Count
          default: 0
        accounts:
          items:
            $ref: '#/components/schemas/AccountSectionOut'
          type: array
          title: Accounts
        gate:
          $ref: '#/components/schemas/GateOut'
        category_counts:
          additionalProperties:
            type: integer
          type: object
          title: Category Counts
        category_conflicts:
          type: integer
          title: Category Conflicts
          default: 0
        enrichment:
          type: string
          enum:
            - luna_in_read
            - luna
            - partial
            - failed
            - rules_only
            - not_run
          title: Enrichment
          description: >-
            luna: one labelling call (high effort) categorized every row group
            of the ledger; luna_in_read: that call failed and the labels Luna
            gave while reading the page images stand; partial/failed: some/none
            of the groups, rules filled the rest; rules_only: no Luna key;
            not_run: the ledger was withheld
          default: not_run
        enrichment_groups:
          type: integer
          title: Enrichment Groups
          description: Description groups sent for enrichment
          default: 0
        transactions:
          anyOf:
            - items:
                $ref: '#/components/schemas/TransactionOut'
              type: array
            - type: 'null'
          title: Transactions
          description: Null when withheld (gate not passed and include_unverified=false)
        checks:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Checks
        attempts:
          items:
            $ref: '#/components/schemas/AttemptOut'
          type: array
          title: Attempts
        cache_hit:
          type: boolean
          title: Cache Hit
          default: false
        excluded_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Excluded Reason
          description: Why this statement is not in the aggregate
        usage:
          $ref: '#/components/schemas/UsageSummary'
      additionalProperties: false
      type: object
      required:
        - document_id
        - source_file
        - content_sha256
        - packet_pages
        - page_modes
        - document_type
        - gate
      title: StatementOut
    ApplicationOut:
      properties:
        document_id:
          type: string
          title: Document Id
        source_file:
          type: string
          title: Source File
        content_sha256:
          type: string
          title: Content Sha256
        packet_pages:
          items:
            type: integer
          type: array
          title: Packet Pages
        document_type:
          type: string
          title: Document Type
        status:
          type: string
          enum:
            - accepted
            - review_required
            - failed
          title: Status
        review_reasons:
          items:
            type: string
          type: array
          title: Review Reasons
        fields:
          $ref: '#/components/schemas/ApplicationFieldsOut'
        owners:
          items:
            $ref: '#/components/schemas/ApplicationOwnerOut'
          type: array
          title: Owners
        field_sources:
          additionalProperties:
            type: string
          type: object
          title: Field Sources
          description: acroform | luna | text_regex | layout
        cache_hit:
          type: boolean
          title: Cache Hit
          default: false
        usage:
          $ref: '#/components/schemas/UsageSummary'
      additionalProperties: false
      type: object
      required:
        - document_id
        - source_file
        - content_sha256
        - packet_pages
        - document_type
        - status
      title: ApplicationOut
    OtherDocumentOut:
      properties:
        source_file:
          type: string
          title: Source File
        document_type:
          type: string
          title: Document Type
        packet_pages:
          items:
            type: integer
          type: array
          title: Packet Pages
        confidence:
          type: number
          title: Confidence
        note:
          type: string
          title: Note
          default: classified only; not parsed
      additionalProperties: false
      type: object
      required:
        - source_file
        - document_type
        - packet_pages
        - confidence
      title: OtherDocumentOut
    MonthOut:
      properties:
        month:
          type: string
          title: Month
        accounts:
          items:
            type: string
          type: array
          title: Accounts
        partial_period:
          type: boolean
          title: Partial Period
          default: false
        is_mtd:
          type: boolean
          title: Is Mtd
          default: false
        included_in_averages:
          type: boolean
          title: Included In Averages
          default: true
        deposits_total:
          type: string
          title: Deposits Total
        deposits_count:
          type: integer
          title: Deposits Count
        true_revenue:
          type: string
          title: True Revenue
          description: >-
            Deposits less those identified as MCA funding, loan proceeds,
            transfers in, refunds/reversals, returned items or other non-sales
            credits
        true_revenue_count:
          type: integer
          title: True Revenue Count
        true_revenue_unlabelled:
          type: string
          title: True Revenue Unlabelled
          description: >-
            The part of true_revenue from deposits no category identified (e.g.
            a bare 'Regular Deposit')
          default: '0'
        total_non_revenue:
          type: string
          title: Total Non Revenue
        withdrawals_total:
          type: string
          title: Withdrawals Total
        withdrawals_count:
          type: integer
          title: Withdrawals Count
        mca_funding_total:
          type: string
          title: Mca Funding Total
        loan_proceeds_total:
          type: string
          title: Loan Proceeds Total
        transfers_in_total:
          type: string
          title: Transfers In Total
        transfers_out_total:
          type: string
          title: Transfers Out Total
        mca_debits_total:
          type: string
          title: Mca Debits Total
        mca_debits_projected_total:
          type: string
          title: Mca Debits Projected Total
        loan_payments_total:
          type: string
          title: Loan Payments Total
        taxes_total:
          type: string
          title: Taxes Total
        operating_expenses_total:
          type: string
          title: Operating Expenses Total
        ebitda:
          type: string
          title: Ebitda
        ebitda_margin_pct:
          anyOf:
            - type: string
            - type: 'null'
          title: Ebitda Margin Pct
        holdback_pct:
          anyOf:
            - type: string
            - type: 'null'
          title: Holdback Pct
          description: MCA debits (cadence-projected) / true revenue x 100
        starting_balance:
          anyOf:
            - type: string
            - type: 'null'
          title: Starting Balance
        ending_balance:
          anyOf:
            - type: string
            - type: 'null'
          title: Ending Balance
        average_balance:
          anyOf:
            - type: string
            - type: 'null'
          title: Average Balance
        negative_balance_days:
          anyOf:
            - type: integer
            - type: 'null'
          title: Negative Balance Days
        low_balance_days:
          anyOf:
            - type: integer
            - type: 'null'
          title: Low Balance Days
        nsf_count:
          type: integer
          title: Nsf Count
        overdraft_count:
          type: integer
          title: Overdraft Count
        returned_item_count:
          type: integer
          title: Returned Item Count
        unknown_category_count:
          type: integer
          title: Unknown Category Count
        by_account:
          items:
            $ref: '#/components/schemas/MonthOut'
          type: array
          title: By Account
          description: >-
            With two or more accounts in the month: each account's own figures,
            which the month sums (balances summed; negative and low-balance days
            the most of any account). Absent with one account: the month is that
            account's
        correction:
          anyOf:
            - $ref: '#/components/schemas/CorrectionProvenance'
            - type: 'null'
          description: >-
            Present only when a correction changed this item (the default,
            corrected view)
      additionalProperties: false
      type: object
      required:
        - month
        - deposits_total
        - deposits_count
        - true_revenue
        - true_revenue_count
        - total_non_revenue
        - withdrawals_total
        - withdrawals_count
        - mca_funding_total
        - loan_proceeds_total
        - transfers_in_total
        - transfers_out_total
        - mca_debits_total
        - mca_debits_projected_total
        - loan_payments_total
        - taxes_total
        - operating_expenses_total
        - ebitda
        - ebitda_margin_pct
        - holdback_pct
        - starting_balance
        - ending_balance
        - average_balance
        - negative_balance_days
        - low_balance_days
        - nsf_count
        - overdraft_count
        - returned_item_count
        - unknown_category_count
      title: MonthOut
      description: One calendar month merged across every accepted statement and account.
    PositionOut:
      properties:
        id:
          type: string
          title: Id
        key:
          type: string
          title: Key
          description: >-
            The position's stable identity, which position overrides name: `pk_`
            and the first 16 hex digits of the SHA-256 of
            `<account_key>|<counterparty_signature>|<first_date>`
          default: ''
        kind:
          type: string
          enum:
            - mca
            - loan
          title: Kind
          description: >-
            mca: counted in the MCA withhold; loan: a business loan's payments,
            reported only
          default: mca
        funder:
          anyOf:
            - type: string
            - type: 'null'
          title: Funder
          description: Funder name (Luna counterparty or seeded catalog), when known
        counterparty_signature:
          type: string
          title: Counterparty Signature
        account_key:
          type: string
          title: Account Key
        cadence:
          type: string
          title: Cadence
        payment_amount:
          type: string
          title: Payment Amount
        occurrences:
          type: integer
          title: Occurrences
        total_repaid:
          type: string
          title: Total Repaid
        first_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: First Date
        last_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Last Date
        expected_next_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Expected Next Date
        is_active:
          type: boolean
          title: Is Active
        evidence:
          type: string
          enum:
            - cadence
            - cadence+luna
            - luna_only
          title: Evidence
        evidence_strength:
          type: string
          title: Evidence Strength
        detection_reason_codes:
          items:
            type: string
          type: array
          title: Detection Reason Codes
        counted_in_withhold:
          type: boolean
          title: Counted In Withhold
        correction:
          anyOf:
            - $ref: '#/components/schemas/CorrectionProvenance'
            - type: 'null'
          description: >-
            Present only when a correction changed this item (the default,
            corrected view)
      additionalProperties: false
      type: object
      required:
        - id
        - funder
        - counterparty_signature
        - account_key
        - cadence
        - payment_amount
        - occurrences
        - total_repaid
        - first_date
        - last_date
        - expected_next_date
        - is_active
        - evidence
        - evidence_strength
        - counted_in_withhold
      title: PositionOut
    UnderwritingOut:
      properties:
        months_included:
          items:
            type: string
          type: array
          title: Months Included
        months_excluded:
          items:
            type: string
          type: array
          title: Months Excluded
        avg_monthly_revenue:
          anyOf:
            - type: number
            - type: 'null'
          title: Avg Monthly Revenue
          description: Mean true revenue over months with revenue > 0 (the scorecard's)
        avg_monthly_revenue_all_months:
          anyOf:
            - type: number
            - type: 'null'
          title: Avg Monthly Revenue All Months
        weighted_monthly_revenue:
          anyOf:
            - type: number
            - type: 'null'
          title: Weighted Monthly Revenue
          description: 0.85 decay per month back, newest weight 1
        avg_monthly_gross_deposits:
          anyOf:
            - type: number
            - type: 'null'
          title: Avg Monthly Gross Deposits
        avg_monthly_deposit_count:
          type: number
          title: Avg Monthly Deposit Count
        avg_monthly_nsf_count:
          type: number
          title: Avg Monthly Nsf Count
        avg_monthly_negative_days:
          type: number
          title: Avg Monthly Negative Days
        avg_ending_balance:
          anyOf:
            - type: number
            - type: 'null'
          title: Avg Ending Balance
        avg_daily_balance:
          anyOf:
            - type: number
            - type: 'null'
          title: Avg Daily Balance
        revenue_slope_3m:
          anyOf:
            - type: number
            - type: 'null'
          title: Revenue Slope 3M
        revenue_slope_6m:
          anyOf:
            - type: number
            - type: 'null'
          title: Revenue Slope 6M
        ebitda_margin_pct:
          anyOf:
            - type: number
            - type: 'null'
          title: Ebitda Margin Pct
          description: >-
            (sum revenue - sum operating expenses) / sum revenue x 100, IQR
            outlier months removed
        ebitda_months_used:
          items:
            type: string
          type: array
          title: Ebitda Months Used
        ebitda_months_excluded_as_outliers:
          items:
            type: string
          type: array
          title: Ebitda Months Excluded As Outliers
        existing_mca_monthly_payment:
          type: number
          title: Existing Mca Monthly Payment
          description: >-
            Monthly burden of the MCA positions counted in the withhold (daily
            x21, weekly x4, biweekly x2). Business loans are reported in
            `positions` with kind `loan` and never counted
        existing_mca_daily_payment:
          anyOf:
            - type: number
            - type: 'null'
          title: Existing Mca Daily Payment
        current_withhold_pct:
          type: number
          title: Current Withhold Pct
          description: >-
            Existing MCA monthly payments / avg monthly revenue x 100: MCA
            positions only, never loans
        holdback_pct_avg:
          anyOf:
            - type: number
            - type: 'null'
          title: Holdback Pct Avg
          description: Mean of monthly cadence-projected holdback %
        active_positions:
          type: integer
          title: Active Positions
          description: Active MCA positions (loans excluded)
        priced_positions:
          anyOf:
            - type: integer
            - type: 'null'
          title: Priced Positions
          description: >-
            Active positions counted in the withhold: the position count
            affordability pricing reads
        is_stacked:
          type: boolean
          title: Is Stacked
          description: Two or more established, active MCA positions
        ebitda_capacity_pct:
          anyOf:
            - type: number
            - type: 'null'
          title: Ebitda Capacity Pct
          description: EBITDA margin x 1.15 (the cap on total withhold)
        remaining_withhold_pct_ebitda:
          anyOf:
            - type: number
            - type: 'null'
          title: Remaining Withhold Pct Ebitda
        score_bands:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Score Bands
          description: Scorecard withhold capacity for every score band
        selected_band:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Selected Band
        affordability_pricing:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Affordability Pricing
        proposed_offer:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Proposed Offer
        stated_vs_verified:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Stated Vs Verified
          description: Application's stated monthly revenue vs verified bank revenue
      additionalProperties: false
      type: object
      required:
        - months_included
        - months_excluded
        - avg_monthly_revenue
        - avg_monthly_revenue_all_months
        - weighted_monthly_revenue
        - avg_monthly_gross_deposits
        - avg_monthly_deposit_count
        - avg_monthly_nsf_count
        - avg_monthly_negative_days
        - avg_ending_balance
        - avg_daily_balance
        - revenue_slope_3m
        - revenue_slope_6m
        - ebitda_margin_pct
        - ebitda_months_used
        - ebitda_months_excluded_as_outliers
        - existing_mca_monthly_payment
        - existing_mca_daily_payment
        - current_withhold_pct
        - holdback_pct_avg
        - active_positions
        - is_stacked
        - ebitda_capacity_pct
        - remaining_withhold_pct_ebitda
        - score_bands
      title: UnderwritingOut
      description: Withhold, EBITDA and revenue math over the gate-accepted months.
    UsageSummary:
      properties:
        calls:
          type: integer
          title: Calls
          default: 0
        paid_calls:
          type: integer
          title: Paid Calls
          default: 0
        replayed_calls:
          type: integer
          title: Replayed Calls
          default: 0
        document_cache_hits:
          type: integer
          title: Document Cache Hits
          default: 0
        prompt_tokens:
          type: integer
          title: Prompt Tokens
          default: 0
        cached_prompt_tokens:
          type: integer
          title: Cached Prompt Tokens
          default: 0
        completion_tokens:
          type: integer
          title: Completion Tokens
          default: 0
        reasoning_tokens:
          type: integer
          title: Reasoning Tokens
          default: 0
        cost_usd:
          type: string
          title: Cost Usd
          default: '0'
        prompt_cache_hit_rate:
          anyOf:
            - type: number
            - type: 'null'
          title: Prompt Cache Hit Rate
          description: cached_prompt_tokens / prompt_tokens
        by_task:
          additionalProperties:
            additionalProperties: true
            type: object
          type: object
          title: By Task
      additionalProperties: false
      type: object
      title: UsageSummary
      description: >-
        Measured Luna usage (tokens as reported by OpenRouter; cost
        provider-reported where given).
    CorrectionsSummary:
      properties:
        active:
          type: integer
          title: Active
          description: Corrections in force
        reverted:
          type: integer
          title: Reverted
        last_changed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Changed At
          description: The latest correction or revert
        correction_ids:
          items:
            type: string
          type: array
          title: Correction Ids
          description: The corrections in force, oldest first
        transactions:
          items:
            $ref: '#/components/schemas/RowRef'
          type: array
          title: Transactions
          description: Rows that carry a correction
        positions:
          items:
            type: string
          type: array
          title: Positions
          description: Keys of positions that carry a correction
        months:
          items:
            type: string
          type: array
          title: Months
          description: Months whose figures or inclusion changed
        underwriting:
          additionalProperties:
            $ref: '#/components/schemas/ChangedValue'
          type: object
          title: Underwriting
          description: Each underwriting field that changed, computed next to corrected
      additionalProperties: false
      type: object
      required:
        - active
        - reverted
      title: CorrectionsSummary
      description: >-
        What the job's corrections in force change. Gates, statuses and review
        reasons never change.
    JobFileOut:
      properties:
        position:
          type: integer
          title: Position
          description: From 0, in upload (or attachment) order
        filename:
          type: string
          title: Filename
        content_type:
          type: string
          title: Content Type
          description: As declared by the uploader or the email
        sha256:
          type: string
          title: Sha256
        bytes:
          type: integer
          title: Bytes
        from_email:
          type: boolean
          title: From Email
          description: An email attachment
      additionalProperties: false
      type: object
      required:
        - position
        - filename
        - content_type
        - sha256
        - bytes
        - from_email
      title: JobFileOut
      description: >-
        One file the job was sent, kept sealed in storage until the job is
        erased.
    EmailRoutingOut:
      properties:
        intent:
          type: string
          enum:
            - new_submission
            - more_documents
            - question_or_update
            - internal_note
            - contract_or_funding
            - not_deal_related
          title: Intent
        confidence:
          type: number
          title: Confidence
          description: >-
            The model's own confidence in that intent, 0-1 (not a measured
            probability)
        model:
          type: string
          title: Model
          description: The router asked (typesafe/jev-router)
        served_model:
          anyOf:
            - type: string
            - type: 'null'
          title: Served Model
          description: The model the router chose
      additionalProperties: false
      type: object
      required:
        - intent
        - confidence
        - model
      title: EmailRoutingOut
      description: >-
        What TypeSafe's Jev Router decided an email is for
        (``EMAIL_ROUTING_API_KEY``).
    PacketIntakeOut:
      properties:
        received_at:
          type: string
          format: date-time
          title: Received At
        source:
          type: string
          enum:
            - upload
            - email
          title: Source
        broker_email:
          anyOf:
            - type: string
            - type: 'null'
          title: Broker Email
          description: 'The ISO / broker that sent the packet (email: the sender)'
        contact_email:
          anyOf:
            - type: string
            - type: 'null'
          title: Contact Email
        end_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: End User Id
          description: The caller's merchant id, echoed
        requested_advance_amount:
          anyOf:
            - type: string
            - type: 'null'
          title: Requested Advance Amount
        business_identity:
          $ref: '#/components/schemas/BusinessIdentityOut'
        file_declarations:
          items:
            $ref: '#/components/schemas/FileDeclarationOut'
          type: array
          title: File Declarations
        request_content_sha256:
          anyOf:
            - type: string
            - type: 'null'
          title: Request Content Sha256
          description: >-
            Every file's name and bytes, in order, plus the declared metadata
            and options. An Idempotency-Key reused with a different request is
            refused (409)
      additionalProperties: false
      type: object
      required:
        - received_at
        - source
        - business_identity
      title: PacketIntakeOut
    PacketDocumentOut:
      properties:
        packet_index:
          type: integer
          title: Packet Index
        document_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Id
          description: Statement / application id; null for other documents
        kind:
          type: string
          enum:
            - bank_statement
            - application
            - other
          title: Kind
        document_type:
          type: string
          title: Document Type
        declared_document_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Declared Document Type
        source_file:
          type: string
          title: Source File
        packet_pages:
          items:
            type: integer
          type: array
          title: Packet Pages
        content_sha256:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Sha256
        content_fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Fingerprint
        statement_fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          title: Statement Fingerprint
        period_start:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Period Start
        period_end:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Period End
        status:
          type: string
          enum:
            - accepted
            - review_required
            - failed
            - classified_only
            - unclassified
          title: Status
          description: >-
            accepted / review_required / failed: the document's own gate;
            classified_only: a known document type that is listed, not parsed;
            unclassified: no type and no ledger found
        excluded_reason:
          anyOf:
            - type: string
              enum:
                - unclassified_document
                - duplicate_document
                - statement_excluded_parse_failed
                - statement_excluded_unreconciled
                - activity_printout_unverified
                - account_holder_mismatch
                - period_overlaps_another_statement
            - type: 'null'
          title: Excluded Reason
          description: Why the packet's decision is not computed from this document
      additionalProperties: false
      type: object
      required:
        - packet_index
        - kind
        - document_type
        - source_file
        - packet_pages
        - status
      title: PacketDocumentOut
      description: >-
        One typed document of the packet, in packet order (file by file, page by
        page).
    StatementExclusionsOut:
      properties:
        excluded_documents:
          items:
            $ref: '#/components/schemas/PacketExclusionOut'
          type: array
          title: Excluded Documents
        included_statement_count:
          type: integer
          title: Included Statement Count
          description: Periodic statements the decision rests on
        missing_months:
          items:
            type: string
          type: array
          title: Missing Months
          description: Months only an excluded (failed or unreconciled) statement covered
        review_reasons:
          items:
            type: string
          type: array
          title: Review Reasons
      additionalProperties: false
      type: object
      required:
        - excluded_documents
        - included_statement_count
        - missing_months
        - review_reasons
      title: StatementExclusionsOut
      description: >-
        Which documents a deal decision must not be computed from, and why (one
        reason code each).
    SubmissionIntelligenceOut:
      properties:
        company_profile:
          $ref: '#/components/schemas/CompanyProfileOut'
          description: >-
            Business, address and owner fields across the request, the
            applications and the statements, each with every source it was read
            from
        transaction_coverage:
          $ref: '#/components/schemas/TransactionCoverageOut'
        statement_count:
          type: integer
          title: Statement Count
      additionalProperties: false
      type: object
      required:
        - company_profile
        - transaction_coverage
        - statement_count
      title: SubmissionIntelligenceOut
    ModeUOut:
      properties:
        available:
          type: boolean
          title: Available
          description: >-
            True when every decision statement is the same account, the periods
            follow day after day and each closing balance is the next opening
            balance. The underwriting block is then one unbroken history
        reason:
          anyOf:
            - type: string
              enum:
                - unreconciled_statement
                - sectioned_statements
                - missing_account_identity
                - multiple_accounts
                - missing_statement_period
                - overlapping_statement_periods
                - non_contiguous_statement_periods
                - missing_balance_chain
                - discontinuous_balance_chain
            - type: 'null'
          title: Reason
        statement_count:
          type: integer
          title: Statement Count
        account_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Account Count
        gap_days:
          anyOf:
            - type: integer
            - type: 'null'
          title: Gap Days
          description: Days between two statements that do not follow on
        period_start:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Period Start
        period_end:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Period End
      additionalProperties: false
      type: object
      required:
        - available
        - statement_count
      title: ModeUOut
      description: >-
        Whether the packet's statements are one continuous history of one
        account.
    CrossStatementOut:
      properties:
        balance_chain:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Balance Chain
          description: >-
            Each account's closing balance against the next statement's opening
            balance
        missing_account_join:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Missing Account Join
          description: >-
            Accounts the merchant's own transfers mention, matched against the
            submitted ones: an undisclosed account can divert revenue
      additionalProperties: false
      type: object
      title: CrossStatementOut
      description: Checks that need every statement of the packet at once.
    PacketFraudOut:
      properties:
        fraud_score:
          type: number
          maximum: 100
          minimum: 0
          title: Fraud Score
          description: >-
            0-100: the strongest signal's weight x 100. 60: declared revenue
            overstated; 85: any other signal; 95: a critical one; 0: compared
            and consistent
        severity:
          type: string
          enum:
            - unknown
            - clean
            - low
            - medium
            - high
            - critical
          title: Severity
          description: >-
            From the score: 85 and above high, 60 and above medium, above 0 low,
            0 clean. high or critical sends the packet to review
            (`packet_cross_document_fraud`); the packet itself is never rated
            critical or unknown today (a reason can be critical)
        reasons:
          items:
            $ref: '#/components/schemas/FraudReasonOut'
          type: array
          title: Reasons
          description: Each signal found, strongest first
      additionalProperties: true
      type: object
      required:
        - fraud_score
        - severity
      title: PacketFraudOut
      description: 'Cross-document fraud: the packet''s documents checked against each other.'
    EarlierSubmissionOut:
      properties:
        job_id:
          type: string
          title: Job Id
        document_id:
          type: string
          title: Document Id
        relation:
          type: string
          enum:
            - same_statement
            - same_statement_different_read
            - replaced_unverified_read
          title: Relation
          description: >-
            same_statement: this read matches the earlier one row for row;
            same_statement_different_read: this read reconciled too but its rows
            differ, and the earlier read stands (flagged for review);
            replaced_unverified_read: this read did not pass the gate and the
            earlier verified read of the statement stands
      additionalProperties: false
      type: object
      required:
        - job_id
        - document_id
        - relation
      title: EarlierSubmissionOut
      description: >-
        The same statement in an earlier job of the tenant (another ISO's
        packet, a re-send).
    DocumentQualityAssessment:
      properties:
        readiness_score:
          type: number
          maximum: 1
          minimum: 0
          title: Readiness Score
        quality_score:
          type: number
          maximum: 1
          minimum: 0
          title: Quality Score
        quality_tier:
          $ref: '#/components/schemas/QualityTier'
        assessed_pages:
          type: integer
          minimum: 0
          title: Assessed Pages
        reupload_required:
          type: boolean
          title: Reupload Required
          default: false
        page_assessments:
          items:
            $ref: '#/components/schemas/PageQualityAssessment'
          type: array
          title: Page Assessments
        issues:
          items:
            $ref: '#/components/schemas/ImageQualityIssue'
          type: array
          title: Issues
      additionalProperties: false
      type: object
      required:
        - readiness_score
        - quality_score
        - quality_tier
        - assessed_pages
      title: DocumentQualityAssessment
    AccountSectionOut:
      properties:
        account_section_id:
          type: string
          title: Account Section Id
        account_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Account Name
        account_number_suffix:
          anyOf:
            - type: string
            - type: 'null'
          title: Account Number Suffix
        period_start:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Period Start
        period_end:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Period End
        opening_balance:
          anyOf:
            - type: string
            - type: 'null'
          title: Opening Balance
        closing_balance:
          anyOf:
            - type: string
            - type: 'null'
          title: Closing Balance
        credits_total:
          type: string
          title: Credits Total
        debits_total:
          type: string
          title: Debits Total
        transaction_count:
          type: integer
          title: Transaction Count
        reconciled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Reconciled
      additionalProperties: false
      type: object
      required:
        - account_section_id
        - credits_total
        - debits_total
        - transaction_count
      title: AccountSectionOut
    GateOut:
      properties:
        status:
          type: string
          enum:
            - accepted
            - review_required
            - failed
          title: Status
        reconciled:
          type: boolean
          title: Reconciled
        confidence:
          type: number
          title: Confidence
        reasons:
          items:
            type: string
          type: array
          title: Reasons
        reconciliation_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reconciliation Reason
        reconciliation_evidence:
          anyOf:
            - type: string
            - type: 'null'
          title: Reconciliation Evidence
        delta:
          anyOf:
            - type: string
            - type: 'null'
          title: Delta
        integrity_signals:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Integrity Signals
        priority:
          type: string
          title: Priority
          default: low
      additionalProperties: false
      type: object
      required:
        - status
        - reconciled
        - confidence
      title: GateOut
    TransactionOut:
      properties:
        index:
          type: integer
          title: Index
        date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Date
        description:
          type: string
          title: Description
        amount:
          type: string
          title: Amount
          description: 'Signed: positive credit, negative debit'
        transaction_type:
          type: string
          enum:
            - credit
            - debit
          title: Transaction Type
        running_balance:
          anyOf:
            - type: string
            - type: 'null'
          title: Running Balance
        is_pending:
          type: boolean
          title: Is Pending
          default: false
        category:
          type: string
          title: Category
        category_source:
          type: string
          title: Category Source
          description: luna | rules | none
        rule_category:
          anyOf:
            - type: string
            - type: 'null'
          title: Rule Category
        category_conflict:
          type: boolean
          title: Category Conflict
          default: false
        counterparty:
          anyOf:
            - type: string
            - type: 'null'
          title: Counterparty
        is_nsf:
          type: boolean
          title: Is Nsf
          default: false
        is_overdraft:
          type: boolean
          title: Is Overdraft
          default: false
        mca_position_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Mca Position Id
        counted_as:
          anyOf:
            - type: string
            - type: 'null'
          title: Counted As
          description: >-
            On an `mca_payment` row of a statement the figures rest on: the
            category its month counts it under. `mca_payment`, unless a position
            decision on its payment stream set another: `loan_payment` for a
            business loan, the stream's own category (e.g. `operating_expense`)
            for one decided not a position
        mca_projected:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Mca Projected
          description: >-
            On a row with `mca_position_id`: true when its month projects the
            position's burden from its cadence
            (`months[].mca_debits_projected_total`); false when the pull is not
            projected (a position only the row labels found is summed as
            observed; a business loan's payments are loan payments)
        account_section_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Account Section Id
        account_number_suffix:
          anyOf:
            - type: string
            - type: 'null'
          title: Account Number Suffix
        page:
          anyOf:
            - type: integer
            - type: 'null'
          title: Page
        read_from:
          anyOf:
            - type: string
              enum:
                - text
                - image
            - type: 'null'
          title: Read From
          description: >-
            text: the layout engine read the PDF's text layer (no model); image:
            GPT-6 Luna read the page image
        correction:
          anyOf:
            - $ref: '#/components/schemas/CorrectionProvenance'
            - type: 'null'
          description: >-
            Present only when a correction changed this item (the default,
            corrected view)
      additionalProperties: false
      type: object
      required:
        - index
        - date
        - description
        - amount
        - transaction_type
        - category
        - category_source
      title: TransactionOut
    AttemptOut:
      properties:
        attempt:
          type: integer
          title: Attempt
        read:
          type: string
          enum:
            - layout
            - image_read
            - image_reread
            - image_verification
          title: Read
          description: >-
            layout: the text layer through the layout engine, deterministic and
            free; image_read: every page as an image read by GPT-6 Luna (after a
            layout read that did not pass, with its diagnosis); image_reread:
            one more image read of a ledger that did not reconcile, told what
            failed; image_verification: an independent second image read that
            must agree on every amount, date and balance before an image-read
            ledger is accepted
        reconciled:
          type: boolean
          title: Reconciled
        gate_status:
          type: string
          enum:
            - accepted
            - review_required
            - failed
          title: Gate Status
        reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reason
        windows:
          type: integer
          title: Windows
        cost_usd:
          type: string
          title: Cost Usd
      additionalProperties: false
      type: object
      required:
        - attempt
        - read
        - reconciled
        - gate_status
        - windows
        - cost_usd
      title: AttemptOut
    ApplicationFieldsOut:
      properties:
        legal_business_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Legal Business Name
          description: The business's legal name
        dba:
          anyOf:
            - type: string
            - type: 'null'
          title: Dba
          description: Doing-business-as (trade) name
        entity_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Entity Type
          description: LLC, corporation, sole proprietorship, ...
        ein:
          anyOf:
            - type: string
            - type: 'null'
          title: Ein
          description: Federal tax id (EIN); a 9-digit EIN is written `12-3456789`
        business_start_date:
          anyOf:
            - type: string
            - type: 'null'
          title: Business Start Date
          description: When the business started (`YYYY-MM-DD` where the date is clear)
        state_of_incorporation:
          anyOf:
            - type: string
            - type: 'null'
          title: State Of Incorporation
          description: Two-letter state code where read by the text readers
        industry:
          anyOf:
            - type: string
            - type: 'null'
          title: Industry
          description: Industry or business description
        naics:
          anyOf:
            - type: string
            - type: 'null'
          title: Naics
          description: NAICS code
        business_phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Business Phone
          description: The business's phone number
        business_email:
          anyOf:
            - type: string
            - type: 'null'
          title: Business Email
          description: The business's email address
        website:
          anyOf:
            - type: string
            - type: 'null'
          title: Website
          description: The business's website
        address_line_1:
          anyOf:
            - type: string
            - type: 'null'
          title: Address Line 1
          description: Business street address
        address_line_2:
          anyOf:
            - type: string
            - type: 'null'
          title: Address Line 2
          description: Suite, unit or floor
        city:
          anyOf:
            - type: string
            - type: 'null'
          title: City
          description: Business city
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
          description: Business state (two-letter code where read by the text readers)
        zip:
          anyOf:
            - type: string
            - type: 'null'
          title: Zip
          description: Business ZIP code
        requested_amount:
          anyOf:
            - type: string
            - type: 'null'
          title: Requested Amount
          description: Funding amount requested, USD
        use_of_funds:
          anyOf:
            - type: string
            - type: 'null'
          title: Use Of Funds
          description: What the funds are for
        monthly_revenue:
          anyOf:
            - type: string
            - type: 'null'
          title: Monthly Revenue
          description: Monthly revenue the applicant states, USD
        gross_annual_revenue:
          anyOf:
            - type: string
            - type: 'null'
          title: Gross Annual Revenue
          description: Annual gross revenue the applicant states, USD
        existing_advances_disclosed:
          anyOf:
            - type: string
            - type: 'null'
          title: Existing Advances Disclosed
          description: Existing advances or loans the applicant lists
        broker_company_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Broker Company Name
          description: The ISO or broker named on the form
        home_phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Home Phone
          description: The principal owner's home phone, where the form prints one
        signed:
          anyOf:
            - type: boolean
            - type: string
            - type: 'null'
          title: Signed
          description: >-
            Whether the application is signed: true/false from GPT-6 Luna (which
            sees the signature), else the form's own text (`true`, `Yes`, `No`,
            ...) when only the text readers found it
        signed_date:
          anyOf:
            - type: string
            - type: 'null'
          title: Signed Date
          description: When it was signed (`YYYY-MM-DD` where the date is clear)
      additionalProperties: true
      type: object
      title: ApplicationFieldsOut
      description: >-
        The application's business fields, as printed (dates, amounts and phone
        numbers are strings in the form's

        own format; amounts without commas). A field the application does not
        carry is absent. Each value's reader is

        in `field_sources`.
    ApplicationOwnerOut:
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: Full name
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
          description: Title or role
        ownership_pct:
          anyOf:
            - type: number
            - type: string
            - type: 'null'
          title: Ownership Pct
          description: 'Ownership share, percent: a number from GPT-6 Luna, else as printed'
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
          description: Email address
        mobile_phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Mobile Phone
          description: Mobile phone
        home_address:
          anyOf:
            - type: string
            - type: 'null'
          title: Home Address
          description: Home street address
        city:
          anyOf:
            - type: string
            - type: 'null'
          title: City
          description: Home city
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
          description: Home state
        zip:
          anyOf:
            - type: string
            - type: 'null'
          title: Zip
          description: Home ZIP code
        date_of_birth:
          anyOf:
            - type: string
            - type: 'null'
          title: Date Of Birth
          description: Date of birth (`YYYY-MM-DD` where the date is clear)
        ssn_last4:
          anyOf:
            - type: string
            - type: 'null'
          title: Ssn Last4
          description: >-
            The SSN's last four digits; the full number is never read into a
            result
        credit_score:
          anyOf:
            - type: integer
            - type: string
            - type: 'null'
          title: Credit Score
          description: 'Credit score: a number from GPT-6 Luna, else as printed'
      additionalProperties: true
      type: object
      title: ApplicationOwnerOut
      description: >-
        One owner or guarantor, as printed. The first owner merges every reader;
        the others are GPT-6 Luna's.

        By design an SSN is read as its last four digits only: no full SSN is
        ever in a result (the

        documents themselves are kept as sent until the job is erased).
    CorrectionProvenance:
      properties:
        correction_ids:
          items:
            type: string
          type: array
          title: Correction Ids
          description: The corrections in force on this item, oldest first
        changes:
          additionalProperties:
            $ref: '#/components/schemas/ChangedValue'
          type: object
          title: Changes
      additionalProperties: false
      type: object
      required:
        - correction_ids
      title: CorrectionProvenance
      description: >-
        What a reviewer's corrections changed on this item: each field's
        computed value next to its corrected one.
    RowRef:
      properties:
        document_id:
          type: string
          title: Document Id
          description: '`statements[].document_id`'
        index:
          type: integer
          minimum: 0
          title: Index
          description: '`statements[].transactions[].index`'
      additionalProperties: false
      type: object
      required:
        - document_id
        - index
      title: RowRef
    ChangedValue:
      properties:
        computed:
          title: Computed
          description: The machine's value
        corrected:
          title: Corrected
          description: The value with the job's corrections applied
      additionalProperties: false
      type: object
      required:
        - computed
        - corrected
      title: ChangedValue
    BusinessIdentityOut:
      properties:
        business_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Business Name
        business_ein:
          anyOf:
            - type: string
            - type: 'null'
          title: Business Ein
        external_business_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Business Id
        identity_source:
          type: string
          enum:
            - declared_ein
            - declared_external_id
            - application_ein
            - statements
            - declared_business_name
            - none
          title: Identity Source
          description: >-
            What identifies the merchant across submissions, strongest first: an
            EIN the caller declared, the caller's own merchant id, the EIN on
            the application, the packet's statements, the declared name
      additionalProperties: false
      type: object
      required:
        - identity_source
      title: BusinessIdentityOut
      description: The merchant the caller filed the packet under, as sent.
    FileDeclarationOut:
      properties:
        file_index:
          type: integer
          minimum: 0
          title: File Index
          description: Position of the file in the upload, from 0
        filename:
          type: string
          title: Filename
        declared_document_type:
          type: string
          title: Declared Document Type
      additionalProperties: false
      type: object
      required:
        - file_index
        - filename
        - declared_document_type
      title: FileDeclarationOut
      description: >-
        What the caller said a file is. Recorded for review; never used in place
        of the classifier.
    PacketExclusionOut:
      properties:
        packet_index:
          type: integer
          title: Packet Index
        document_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Id
        source_file:
          type: string
          title: Source File
        document_type:
          type: string
          title: Document Type
        reason_code:
          type: string
          enum:
            - unclassified_document
            - duplicate_document
            - statement_excluded_parse_failed
            - statement_excluded_unreconciled
            - activity_printout_unverified
            - account_holder_mismatch
            - period_overlaps_another_statement
          title: Reason Code
        period_start:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Period Start
        period_end:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Period End
      additionalProperties: false
      type: object
      required:
        - packet_index
        - source_file
        - document_type
        - reason_code
      title: PacketExclusionOut
    CompanyProfileOut:
      properties:
        legal_business_name:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `legal_business_name`; statements' holder
        doing_business_as:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `dba`; statements' holder
        business_start_date:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `business_start_date`
        federal_tax_id:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Declared `business_ein`; application `ein`
        entity_type:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `entity_type`
        state_of_incorporation:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `state_of_incorporation`
        company_phone:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `business_phone`
        company_website:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `website`
        company_email:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `business_email`
        industry_type:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `industry`
        naics:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `naics`
        annual_revenue:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `gross_annual_revenue`
        monthly_revenue:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `monthly_revenue`
        amount_requested:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Declared `requested_advance_amount`; application `requested_amount`
        loan_purpose:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `use_of_funds`
        address_line_1:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `address_line_1`
        address_line_2:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `address_line_2`
        city:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `city`
        state:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `state`
        zip_code:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `zip`
        owner_name:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: First owner's `name`
        ownership_percentage:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: First owner's `ownership_pct`
        mobile_phone:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: First owner's `mobile_phone`
        owner_email:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: First owner's `email`
        ssn_last4:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: 'First owner''s `ssn_last4`: never more than the last four digits'
        date_of_birth:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: First owner's `date_of_birth`
        credit_score:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: First owner's `credit_score`
        has_signed:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `signed`, as `true` / `false` or the form's text
        signed_date:
          anyOf:
            - $ref: '#/components/schemas/ProfileFieldOut'
            - type: 'null'
          description: Application `signed_date`
      additionalProperties: true
      type: object
      title: CompanyProfileOut
      description: >-
        Every key is present, its `value` null when no source has it. Sources:
        `request` (the declared business

        name, EIN and requested amount), each `iso_application` (the application
        field named), each `bank_statement`

        (the account holder, for the two business names).
    TransactionCoverageOut:
      properties:
        accounts:
          items:
            $ref: '#/components/schemas/AccountCoverageOut'
          type: array
          title: Accounts
        coverage_pct:
          type: number
          title: Coverage Pct
          description: Months with a statement / months from the first to the last, x 100
        reconciled_pct:
          type: number
          title: Reconciled Pct
          description: Covered months whose statements passed the gate, x 100
      additionalProperties: false
      type: object
      required:
        - coverage_pct
        - reconciled_pct
      title: TransactionCoverageOut
      description: >-
        Per account, month by month: which months the packet's statements cover
        and whether they reconciled.
    FraudReasonOut:
      properties:
        signal:
          type: string
          title: Signal
          description: >-
            identity_mismatch (the application's business or owner against the
            statements' holders or an ID), account_number_mismatch (a voided
            check against the statement), declared_revenue_overstatement (the
            application's monthly revenue far above the statements'),
            cross_statement_balance_chain_break (a statement's closing balance
            is not the next one's opening), duplicate_period_divergent_content
            (one account and period sent twice with different rows),
            cross_statement_amount_divergence (one transaction, two amounts),
            duplicate_account_under_distinct_labels (one account sent twice
            under two labels)
        severity:
          type: string
          enum:
            - low
            - medium
            - high
            - critical
          title: Severity
          description: >-
            declared_revenue_overstatement is medium; a balance-chain break both
            of whose statements reconcile is critical; every other signal is
            high
        evidence:
          type: string
          title: Evidence
          description: What was compared, with the values, in one sentence
        description:
          type: string
          title: Description
          description: What the signal means, the same text for every packet
      additionalProperties: true
      type: object
      required:
        - signal
        - severity
        - evidence
        - description
      title: FraudReasonOut
    QualityTier:
      type: string
      enum:
        - clean_digital
        - clean_scan
        - low_quality_scan
        - photo
      title: QualityTier
    PageQualityAssessment:
      properties:
        page_number:
          type: integer
          minimum: 1
          title: Page Number
        readiness_score:
          type: number
          maximum: 1
          minimum: 0
          title: Readiness Score
        quality_score:
          type: number
          maximum: 1
          minimum: 0
          title: Quality Score
        blur_variance:
          type: number
          minimum: 0
          title: Blur Variance
        brightness:
          type: number
          maximum: 255
          minimum: 0
          title: Brightness
        contrast:
          type: number
          minimum: 0
          title: Contrast
        skew_angle_degrees:
          type: number
          title: Skew Angle Degrees
        lighting_variance:
          type: number
          minimum: 0
          title: Lighting Variance
        crop_box:
          anyOf:
            - prefixItems:
                - type: integer
                - type: integer
                - type: integer
                - type: integer
              type: array
              maxItems: 4
              minItems: 4
            - type: 'null'
          title: Crop Box
        photo_like:
          type: boolean
          title: Photo Like
          default: false
        blocking:
          type: boolean
          title: Blocking
          default: false
        operations_applied:
          items:
            type: string
          type: array
          title: Operations Applied
        issues:
          items:
            $ref: '#/components/schemas/ImageQualityIssue'
          type: array
          title: Issues
      additionalProperties: false
      type: object
      required:
        - page_number
        - readiness_score
        - quality_score
        - blur_variance
        - brightness
        - contrast
        - skew_angle_degrees
        - lighting_variance
      title: PageQualityAssessment
    ImageQualityIssue:
      properties:
        code:
          type: string
          minLength: 1
          title: Code
        message:
          type: string
          minLength: 1
          title: Message
        severity:
          type: string
          enum:
            - info
            - warning
            - blocking
          title: Severity
          default: warning
      additionalProperties: false
      type: object
      required:
        - code
        - message
      title: ImageQualityIssue
    ProfileFieldOut:
      properties:
        value:
          anyOf:
            - type: string
            - type: 'null'
          title: Value
          description: >-
            Resolved: the request, else the first application, else the
            statements' majority
        sources:
          items:
            $ref: '#/components/schemas/ProfileSourceOut'
          type: array
          title: Sources
      additionalProperties: false
      type: object
      required:
        - value
      title: ProfileFieldOut
    AccountCoverageOut:
      properties:
        account:
          type: string
          title: Account
          description: Last four of the account, or 'unknown'
        account_key:
          anyOf:
            - type: string
            - type: 'null'
          title: Account Key
          description: The `accounts[].account_key` it is aggregated under
        months:
          items:
            $ref: '#/components/schemas/CoverageMonthOut'
          type: array
          title: Months
      additionalProperties: false
      type: object
      required:
        - account
        - months
      title: AccountCoverageOut
    ProfileSourceOut:
      properties:
        source:
          type: string
          enum:
            - request
            - iso_application
            - bank_statement
          title: Source
        value:
          type: string
          title: Value
        document_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Id
        extracted_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Extracted By
          description: acroform | luna | text_regex | layout
      additionalProperties: false
      type: object
      required:
        - source
        - value
      title: ProfileSourceOut
    CoverageMonthOut:
      properties:
        month:
          type: string
          title: Month
        status:
          type: string
          enum:
            - reconciled
            - unreconciled
            - missing_data
          title: Status
        transaction_count:
          type: integer
          title: Transaction Count
        document_ids:
          items:
            type: string
          type: array
          title: Document Ids
      additionalProperties: false
      type: object
      required:
        - month
        - status
        - transaction_count
      title: CoverageMonthOut
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      description: API key
      in: header
      name: X-API-Key
    HTTPBearer:
      type: http
      description: API key or AuthKit access token
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.