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

# Get a document's extraction

> Required scope: `cases:read`.

One document of the case and the fields read on it.

Choose the environment with the `X-Sahl-Environment` header or the `environment` parameter or field; the Sandbox is the default. Two values that disagree are refused (422 `environment_conflict`).



## OpenAPI

````yaml /openapi.json get /v1/partner/cases/{case_id}/documents/{document_id}
openapi: 3.1.0
info:
  title: Sahl Partner API
  version: 0.2.0
  description: >-
    Server-to-server API for lenders and banks: document reading, verification,
    risk assessment, eID checks, Moroccan company (KYB) onboarding, bank
    statements, document requests, webhooks, registry checks, cases, scoring,
    KYC policy, webhook deliveries and bank connections. Authenticate with
    `Authorization: Bearer <API key>`. Paths are relative to the server URL. New
    workspaces start in sandbox.
servers:
  - url: https://app.sahlfinancial.com/api
    description: Single API host. Send environment=sandbox (the default) for test data.
security:
  - bearerAuth: []
tags:
  - name: KYC
    description: Read documents, verify a profile, assess risk, start an eID check.
  - name: Bank connections (Growth)
    description: >-
      Growth plan, switched on per workspace by Sahl. Sandbox simulation today;
      production answers 409 until a bank data provider is live.
  - name: KYB
    description: >-
      Moroccan company file: read the Modèle J, the IF attestation and the
      manager's CIN, check an ICE. Every plan.
  - name: Statements
    description: Read a bank statement line by line and reconcile it. Every plan.
  - name: Webhooks
    description: >-
      Manage webhook endpoints with an API key (scope `webhooks:manage`). Every
      plan.
  - name: Document requests
    description: >-
      Ask an applicant for documents through a link or an embedded page, and
      follow the request.
  - name: Sandbox
    description: 'The specimen gallery: the only documents a new workspace''s Sandbox reads.'
  - name: Registry
    description: >-
      Check a SIREN, a VAT number, a LEI, an IBAN, a Moroccan RIB or ICE. Scope
      `registry:read`.
  - name: Cases
    description: >-
      Read the cases your calls filed, their documents and the fields read.
      Scope `cases:read`.
  - name: Scoring
    description: >-
      Read, re-run or simulate a case's credit score. Scopes `scoring:read`,
      `scoring:write`.
  - name: Policy
    description: >-
      Read and save the KYC policy your `/v1/kyc/*` calls run under. Scopes
      `policy:read`, `policy:write`.
  - name: Webhook deliveries
    description: >-
      See what was sent to your endpoints and send a delivery again. Scope
      `webhooks:manage`.
  - name: Account
    description: The calling key, its usage, its recent calls and the error catalogue.
paths:
  /v1/partner/cases/{case_id}/documents/{document_id}:
    get:
      tags:
        - Cases
      summary: Get a document's extraction
      description: >-
        Required scope: `cases:read`.


        One document of the case and the fields read on it.


        Choose the environment with the `X-Sahl-Environment` header or the
        `environment` parameter or field; the Sandbox is the default. Two values
        that disagree are refused (422 `environment_conflict`).
      operationId: cases_get_document
      parameters:
        - name: case_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Case Id
        - name: document_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Document Id
        - name: environment
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              sandbox or production (X-Sahl-Environment also works). Sandbox by
              default.
            title: Environment
          description: >-
            sandbox or production (X-Sahl-Environment also works). Sandbox by
            default.
        - name: X-Sahl-Environment
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Sahl-Environment
          description: >-
            `sandbox` (default) or `production`. Same meaning as the
            `environment` parameter; if both are sent they must agree.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartnerCaseDocumentDetail'
        '401':
          description: >-
            Missing, invalid, revoked or expired API key (plain-string
            `detail`), or `partner_identity_rejected`: The key is bound to a
            service account and X-Partner-Identity was missing or did not verify
            for it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail:
                  code: partner_identity_rejected
                  message: >-
                    The key is bound to a service account and X-Partner-Identity
                    was missing or did not verify for it.
        '403':
          description: >-
            `insufficient_scope`: The API key does not hold the scope this route
            needs. Issue a key with that scope in Settings > API. The body's
            detail is a plain string for this one.
            `production_api_not_approved`: The workspace is not yet approved for
            Production API calls. Request production access in Settings > API;
            Sandbox stays open. `production_requires_paid_plan`: The
            subscription is not active. Update billing to use Production.
            `production_trial_ended`: A Free bank workspace's Production trial
            has ended. Upgrade the plan. `work_email_required`: Production on
            the Free plan needs a verified work email on the workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail: API key lacks the required scope
        '404':
          description: >-
            `not_found`: No such object in this workspace (another workspace's
            object answers the same).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail:
                  code: not_found
                  message: >-
                    No such object in this workspace (another workspace's object
                    answers the same).
        '422':
          description: >-
            Validation error (`detail` is a list), or a coded 422:
            `invalid_environment`: environment / X-Sahl-Environment must be
            'sandbox' or 'production'. `environment_conflict`:
            X-Sahl-Environment and the environment field disagree.
            `invalid_date_range`: created_after must be before created_before.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail:
                  code: invalid_environment
                  message: >-
                    environment / X-Sahl-Environment must be 'sandbox' or
                    'production'.
        '429':
          description: >-
            `rate_limit_exceeded`: Too many calls a minute: per API key on the
            partner routes, or per key / per address at the edge. Wait for
            Retry-After.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail:
                  code: rate_limit_exceeded
                  message: >-
                    Too many calls a minute: per API key on the partner routes,
                    or per key / per address at the edge. Wait for Retry-After.
        '500':
          description: '`internal_error`: Unexpected error. Quote X-Request-ID to support.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail:
                  code: internal_error
                  message: Unexpected error. Quote X-Request-ID to support.
      security:
        - bearerAuth: []
components:
  schemas:
    PartnerCaseDocumentDetail:
      properties:
        document_id:
          type: string
          format: uuid
          title: Document Id
          description: Sahl's document id.
        doc_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Doc Type
          description: Document type (final, detected, else the hint).
        status:
          type: string
          title: Status
          description: Processing status of the document.
        filename:
          type: string
          title: Filename
          description: The uploaded file's name.
        content_type:
          type: string
          title: Content Type
          description: The uploaded file's media type.
        file_size:
          type: integer
          title: File Size
          description: Size in bytes.
        page_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Page Count
          description: Pages, when known.
        source:
          type: string
          title: Source
          description: 'How it arrived: api, dashboard, partner, ...'
        confidence:
          anyOf:
            - type: number
            - type: 'null'
          title: Confidence
          description: Overall extraction confidence (0-1).
        extraction:
          anyOf:
            - $ref: '#/components/schemas/PartnerExtractionSummary'
            - type: 'null'
          description: Extraction summary; null if not read yet.
        integrity:
          anyOf:
            - $ref: '#/components/schemas/PartnerIntegrity'
            - type: 'null'
          description: Document integrity signals, when inspected.
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When it was uploaded.
        case_id:
          type: string
          format: uuid
          title: Case Id
          description: The case it is filed on.
        fields:
          items:
            $ref: '#/components/schemas/PartnerExtractedField'
          type: array
          title: Fields
          description: Extracted fields.
        checks:
          items:
            $ref: '#/components/schemas/PartnerCaseCheck'
          type: array
          title: Checks
          description: Per-document checks, when run.
        warnings:
          items:
            $ref: '#/components/schemas/PartnerDocumentWarning'
          type: array
          title: Warnings
          description: Pages or reads that did not go through.
        file_url:
          type: string
          title: File Url
          description: Path of the original file (same API key).
      type: object
      required:
        - document_id
        - status
        - filename
        - content_type
        - file_size
        - source
        - created_at
        - case_id
        - file_url
      title: PartnerCaseDocumentDetail
    Error:
      type: object
      title: Error
      description: >-
        FastAPI error body. `detail` is a string, a list (validation 422), or an
        object with `code` and `message` (extra keys possible).
      properties:
        detail:
          oneOf:
            - type: string
            - type: array
              items:
                additionalProperties: true
                type: object
              description: Validation errors (422).
            - type: object
              additionalProperties: true
              properties:
                code:
                  type: string
                message:
                  type: string
      required:
        - detail
    PartnerExtractionSummary:
      properties:
        status:
          type: string
          title: Status
          description: success | partial | failed.
        fields_total:
          type: integer
          title: Fields Total
          description: Fields the document type defines or the reader returned.
        fields_found:
          type: integer
          title: Fields Found
          description: Fields with a value.
        fields_needs_review:
          type: integer
          title: Fields Needs Review
          description: Fields with a value no one has confirmed.
      type: object
      required:
        - status
        - fields_total
        - fields_found
        - fields_needs_review
      title: PartnerExtractionSummary
    PartnerIntegrity:
      properties:
        level:
          type: string
          title: Level
          description: 'Highest signal level: clean | info | notice | review.'
        signals:
          items:
            $ref: '#/components/schemas/PartnerIntegritySignal'
          type: array
          title: Signals
          description: Reasons to look; never a refusal.
      type: object
      required:
        - level
      title: PartnerIntegrity
    PartnerExtractedField:
      properties:
        name:
          type: string
          title: Name
          description: Field key.
        value:
          anyOf:
            - type: string
            - type: 'null'
          title: Value
          description: The value (normalized when available).
        raw_value:
          anyOf:
            - type: string
            - type: 'null'
          title: Raw Value
          description: The value as read.
        confidence:
          anyOf:
            - type: number
            - type: 'null'
          title: Confidence
          description: Confidence (0-1).
        status:
          type: string
          title: Status
          description: valid | needs_review | corrected | missing.
        source_page:
          anyOf:
            - type: integer
            - type: 'null'
          title: Source Page
          description: Page it was read on, when known.
      type: object
      required:
        - name
        - status
      title: PartnerExtractedField
    PartnerCaseCheck:
      properties:
        id:
          type: string
          title: Id
          description: PartnerCaseCheck identifier.
        label:
          type: string
          title: Label
          description: What was checked.
        severity:
          type: string
          title: Severity
          description: critical | warning | info.
        passed:
          type: boolean
          title: Passed
          description: Whether the check passed.
        detail:
          type: string
          title: Detail
          description: Why it failed, when it did.
          default: ''
      type: object
      required:
        - id
        - label
        - severity
        - passed
      title: PartnerCaseCheck
    PartnerDocumentWarning:
      properties:
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: Warning code.
        page:
          anyOf:
            - type: integer
            - type: 'null'
          title: Page
          description: Page concerned, when one is.
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
          description: What happened.
      type: object
      title: PartnerDocumentWarning
    PartnerIntegritySignal:
      properties:
        code:
          type: string
          title: Code
          description: Signal code (e.g. edited_with_image_editor, duplicate_file).
        level:
          type: string
          title: Level
          description: info | notice | review.
        label:
          anyOf:
            - type: string
            - type: 'null'
          title: Label
          description: What was seen.
        detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Detail
          description: Detail.
      type: object
      required:
        - code
        - level
      title: PartnerIntegritySignal
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key created in the console. Scopes: kyc:extract, kyc:verify,
        kyc:eid; kyb:onboard, kyb:ice; statements:read; webhooks:manage;
        requests:read, requests:write; bank:read, bank:write (Growth plan,
        enabled per workspace by Sahl); registry:read; cases:read; scoring:read,
        scoring:write; policy:read, policy:write; usage:read. The Sandbox
        specimen routes, `GET /v1/partner/me` and `GET /v1/partner/errors` need
        any valid key.

````

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