> ## 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.

# Cases and documents

> Read your cases, their score summary, verdict and documents, and download the original file, with an API key.

A case is one client file in your workspace, unique per workspace, environment and `reference`. Every case your workspace has is visible here: the ones `/v1/kyc/verify` and `/v1/kyc/extract` filed with a `reference`, the ones [document requests](https://docs.sahlfinancial.com/guides/document-requests.md) opened, and the ones created in the console. These routes only read. Scope for all of them: `cases:read`.

| Endpoint | Does |
| - | - |
| `GET /v1/partner/cases` | Lists cases, newest first. |
| `GET /v1/partner/cases/by-reference/{reference}` | One case by your reference. |
| `GET /v1/partner/cases/{case_id}` | One case by Sahl's id. |
| `GET /v1/partner/cases/{case_id}/documents` | The case's documents. |
| `GET /v1/partner/cases/{case_id}/documents/{document_id}` | One document's extracted fields and checks. |
| `GET /v1/partner/cases/{case_id}/documents/{document_id}/file` | The original file. |

All calls go to `https://app.sahlfinancial.com/api` with `Authorization: Bearer <key>`. The environment is `X-Sahl-Environment` or `?environment=` (`sandbox` by default): a case of the other environment is a 404. Reads are not metered and the Production go-live gate does not apply to them. Every call counts against the 60-calls-a-minute limit per key on the partner routes. Another workspace's case answers the same 404 as a missing one.

## List cases

| Query | Rules |
| - | - |
| `reference` | Your reference, exact match, up to 64 characters of `A-Z a-z 0-9 _ . : -` (else 422 `invalid_reference`). |
| `status` | One of `new`, `docs_received`, `identity_verified`, `bank_connected`, `scoring`, `scored`, `approved`, `refused`, `manual_review`, `expired`. |
| `kind` | `individual` or `company`. |
| `created_after`, `created_before` | ISO 8601. `created_after` must be before `created_before` (else 422 `invalid_date_range`). |
| `limit` | 1 to 100. Default 20. |
| `cursor` | The `next_cursor` of the previous page. Any other value answers 422 `invalid_cursor`. |

```bash cURL theme={"dark"}
curl "https://app.sahlfinancial.com/api/v1/partner/cases?kind=company&limit=20" \
  -H "Authorization: Bearer $SAHL_API_KEY" \
  -H "X-Sahl-Environment: sandbox"
```

```javascript JavaScript theme={"dark"}
const res = await fetch("https://app.sahlfinancial.com/api/v1/partner/cases?kind=company&limit=20", {
  headers: {
    Authorization: `Bearer ${process.env.SAHL_API_KEY}`,
    "X-Sahl-Environment": "sandbox",
  },
});
const { items, next_cursor, has_more } = await res.json();
```

```python Python theme={"dark"}
import os, requests

page = requests.get(
    "https://app.sahlfinancial.com/api/v1/partner/cases",
    headers={
        "Authorization": f"Bearer {os.environ['SAHL_API_KEY']}",
        "X-Sahl-Environment": "sandbox",
    },
    params={"kind": "company", "limit": 20},
).json()
for case in page["items"]:
    print(case["case_id"], case["reference"], case["status"], case["score"])
```

```json theme={"dark"}
{
  "items": [
    {
      "case_id": "a1b2c3d4-0000-4000-8000-000000000002",
      "reference": "client-42",
      "environment": "sandbox",
      "status": "scored",
      "subject": {"name": "SPECIMEN TRADING SARL", "kind": "company"},
      "score": 612,
      "risk_level": "medium",
      "decision": null,
      "document_count": 6,
      "created_at": "2026-11-24T10:00:00Z",
      "updated_at": "2026-11-24T10:05:12Z"
    }
  ],
  "limit": 20,
  "next_cursor": null,
  "has_more": false
}
```

Pass `next_cursor` as `cursor` until `has_more` is false. `decision` is a reviewer's decision (`approved`, `refused` or `manual_review`) and is `null` until one is taken.

## Get a case

`GET /v1/partner/cases/{case_id}` and `GET /v1/partner/cases/by-reference/{reference}` return the summary above plus:

```json theme={"dark"}
{
  "case_id": "a1b2c3d4-0000-4000-8000-000000000002",
  "reference": "client-42",
  "environment": "sandbox",
  "status": "scored",
  "subject": {"name": "SPECIMEN TRADING SARL", "kind": "company"},
  "score": 612,
  "risk_level": "medium",
  "decision": null,
  "decision_at": null,
  "document_count": 6,
  "created_at": "2026-11-24T10:00:00Z",
  "updated_at": "2026-11-24T10:05:12Z",
  "score_summary": {
    "scored": true,
    "score": 612,
    "risk_level": "medium",
    "eligible_amount": null,
    "model": "sme_v1",
    "coverage": 0.78,
    "blocks": [
      {"key": "repayment_capacity", "label": "Repayment capacity", "score": 140, "max": 250, "assessable": true}
    ],
    "gates_hit": []
  },
  "verdict": {
    "source": "kyc_verify",
    "passed": false,
    "critical_failures": [
      {"id": "expiry:Government photo ID", "label": "ID not expired", "severity": "critical", "passed": false, "detail": "expired on 2024-01-01"}
    ],
    "flags": [],
    "completeness_percent": 92.0,
    "missing_data": ["Date of birth"],
    "verified_at": "2026-11-24T10:04:00Z"
  },
  "missing_documents": ["Attestation de régularité fiscale"],
  "requested_documents": [
    {"type": "bank_statement", "label": "Bank statement", "status": "readable"}
  ]
}
```

| Field | Meaning |
| - | - |
| `score_summary.scored` | Whether the case has been scored. `score` is on the 0 to 1000 scale and is `null` until scored or when the file is not assessable. |
| `score_summary.model` | `retail_v1`, `sme_v1` or `project_v1`. |
| `score_summary.coverage` | The share (0 to 1) of the score the documents could compute. A block nothing on file feeds has `assessable: false` and a `null` score: it is not computed, never a zero. |
| `score_summary.gates_hit` | Company knock-out rules that fired (SME model). |
| `verdict` | The latest verification verdict, or `null` if none. `source` is `kyc_verify` (the last `/v1/kyc/verify` or `/assess`) or `case_verification` (Sahl's case review). Checks are matched by `id`. |
| `missing_documents` | Labels of documents the case still lacks. |
| `requested_documents` | The latest document request's documents and their state. |

For the score in more depth, see [Scoring](https://docs.sahlfinancial.com/guides/partner-scoring.md).

## Documents of a case

```bash theme={"dark"}
curl https://app.sahlfinancial.com/api/v1/partner/cases/$CASE_ID/documents \
  -H "Authorization: Bearer $SAHL_API_KEY"
```

```json theme={"dark"}
{
  "case_id": "a1b2c3d4-0000-4000-8000-000000000002",
  "items": [
    {
      "document_id": "7c9e0000-0000-4000-8000-000000000007",
      "doc_type": "releve_bancaire",
      "status": "completed",
      "filename": "specimen-releve-bancaire.pdf",
      "content_type": "application/pdf",
      "file_size": 48213,
      "page_count": 1,
      "source": "api",
      "confidence": 0.91,
      "extraction": {"status": "success", "fields_total": 14, "fields_found": 13, "fields_needs_review": 2},
      "integrity": {
        "level": "notice",
        "signals": [
          {"code": "pdf_printed_from_browser", "level": "notice", "label": "PDF printed from a browser or converter", "detail": null}
        ]
      },
      "created_at": "2026-11-24T10:01:00Z"
    }
  ]
}
```

Documents come oldest first. `integrity.level` is `clean`, `info`, `notice` or `review`: the signals are reasons to look, never a refusal (see [KYC policy and document integrity](https://docs.sahlfinancial.com/guides/kyc-policy.md#signals-a-file-can-raise)). `extraction` is `null` while the document is not read yet.

## One document, with its fields

`GET /v1/partner/cases/{case_id}/documents/{document_id}` returns the summary above plus:

```json theme={"dark"}
{
  "case_id": "a1b2c3d4-0000-4000-8000-000000000002",
  "fields": [
    {"name": "iban", "value": "MA64811780999954666056425703", "raw_value": "MA64 8117 8099 9954 6660 5642 5703", "confidence": 0.97, "status": "valid", "source_page": 1}
  ],
  "checks": [
    {"id": "legible:Bank statement", "label": "Bank statement is legible", "severity": "warning", "passed": true, "detail": ""}
  ],
  "warnings": [],
  "file_url": "/api/v1/partner/cases/a1b2c3d4-0000-4000-8000-000000000002/documents/7c9e0000-0000-4000-8000-000000000007/file"
}
```

A field's `status` is `valid`, `needs_review`, `corrected` or `missing`. `warnings` lists pages or reads that did not go through (`code`, `page`, `message`). These are extracted values: treat them as personal data.

## Download the original file

```bash theme={"dark"}
curl -L https://app.sahlfinancial.com/api/v1/partner/cases/$CASE_ID/documents/$DOCUMENT_ID/file \
  -H "Authorization: Bearer $SAHL_API_KEY" -o document.pdf
```

The answer is the file as uploaded, sent as an attachment (`Content-Disposition`) with `X-Content-Type-Options: nosniff`. Each download is written to the audit log with the key that made it. A document whose original file is not available answers 404 `file_not_available`.

## Errors

| Status | `detail.code` | Cause |
| - | - | - |
| 404 | `not_found` | No such case or document in this environment, or another workspace's. |
| 404 | `file_not_available` | The original file is not available. |
| 422 | `invalid_reference`, `invalid_cursor`, `invalid_date_range` | Bad query. |
| 403 | `insufficient_scope` (plain-string `detail`) | The key lacks `cases:read`. |
| 429 | `rate_limit_exceeded` | More than 60 calls a minute with one key. |


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