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

# Account, usage and errors

> Ask what your key can do, see your document quota and call counts, read your key's recent calls, and fetch the error catalogue.

Four read routes describe the key you call with and the workspace behind it.

| Endpoint | Scope | Does |
| - | - | - |
| `GET /v1/partner/me` | any valid key | The calling key, what it can use here, the environments, go-live state, plan and limits. |
| `GET /v1/partner/usage` | `usage:read` | Production documents this month, today's Sandbox counter, and this key's calls per endpoint. |
| `GET /v1/partner/request-logs` | `usage:read` | This key's recent calls, newest first. |
| `GET /v1/partner/errors` | any valid key | Every error code the partner routes answer with. |

All calls go to `https://app.sahlfinancial.com/api` with `Authorization: Bearer <key>`. Nothing is written, so nothing is audit-logged and nothing is metered. Each call counts against the 60-calls-a-minute limit per key on the partner routes. A key bound to a service account must also send `X-Partner-Identity`.

## Who am I: `GET /v1/partner/me`

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

```javascript JavaScript theme={"dark"}
const res = await fetch("https://app.sahlfinancial.com/api/v1/partner/me", {
  headers: { Authorization: `Bearer ${process.env.SAHL_API_KEY}` },
});
const me = await res.json();
console.log(me.plan, me.scopes.filter((s) => !s.usable));
```

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

me = requests.get(
    "https://app.sahlfinancial.com/api/v1/partner/me",
    headers={"Authorization": f"Bearer {os.environ['SAHL_API_KEY']}"},
).json()
print(me["plan"], [s["scope"] for s in me["scopes"] if not s["usable"]])
```

```json theme={"dark"}
{
  "key": {
    "id": "0e1f0000-0000-4000-8000-00000000000a",
    "name": "production-backend",
    "prefix": "sk_a1b2c3d4",
    "status": "active",
    "created_at": "2026-11-01T08:00:00Z",
    "last_used_at": "2026-11-24T10:00:00Z",
    "expires_at": null,
    "identity_bound": false
  },
  "tenant_id": "00000000-0000-4000-8000-000000000000",
  "plan": "growth",
  "subscription_status": "active",
  "scopes": [
    {"scope": "kyb:onboard", "usable": true, "reason": null},
    {"scope": "bank:read", "usable": false, "reason": "bank_scope_not_allowed"}
  ],
  "environments": [
    {"name": "sandbox", "available": true, "blocked_by": null, "specimen_only": true},
    {"name": "production", "available": false, "blocked_by": "production_api_not_approved", "specimen_only": false}
  ],
  "go_live": {"gate_enabled": true, "approved": false, "approved_at": null, "request_status": "pending", "requested_at": "2026-11-20T09:00:00Z"},
  "rate_limits": {"partner_per_key_per_minute": 60, "edge_per_key_per_minute": 300, "edge_per_ip_per_minute": 600, "window_seconds": 60}
}
```

| Field | Meaning |
| - | - |
| `key` | The key's id (as in the call log), name, public prefix (never the secret), `status` (`active`, or `expiring` when it was rotated and works until `expires_at`), `last_used_at` and whether `X-Partner-Identity` is required. |
| `scopes[]` | Every scope the key holds. `usable` says whether a call can use it now. When it cannot, `reason` is `kyc_scope_not_allowed` or `bank_scope_not_allowed` (the workspace is not enabled), `not_served` (no route for it on this API, which is the case for `bank:*` while the bank routes are not live) or `unknown_scope`. |
| `environments[]` | `sandbox` and `production`: `available`, `blocked_by` (the error code a call would get, see below) and `specimen_only` (the Sandbox reads specimen documents only for this workspace). |
| `go_live` | The Production gate: `gate_enabled`, `approved`, and your go-live request (`request_status` is `pending`, `approved` or `null`). |
| `plan`, `subscription_status` | The workspace's plan (`free`, `starter`, `growth`, `enterprise`) and subscription state. |
| `rate_limits` | The per-key limit on the partner routes (`null` if off), the per-key and per-IP limits at the edge, and the window in seconds. |

Use it as a health check of an integration: a scope that is held but not usable, or a Production environment that is not available, explains a 403 before you hit it.

## Usage: `GET /v1/partner/usage`

Takes `environment` (or `X-Sahl-Environment`): it filters the call counts. The two document meters are returned both, labelled.

```json theme={"dark"}
{
  "plan": "growth",
  "production": {
    "period_start": "2026-11-01",
    "resets_at": "2026-12-01T00:00:00Z",
    "documents_used": 212,
    "api_documents": 140,
    "document_limit": 1000,
    "remaining": 788,
    "refused": 0,
    "locked": false
  },
  "sandbox": {
    "day": "2026-11-24",
    "resets_at": "2026-11-25T00:00:00Z",
    "documents_used": 12,
    "daily_cap": 200,
    "remaining": 188,
    "refused": 0
  },
  "environment": "sandbox",
  "window_days": 7,
  "endpoints": [
    {"method": "POST", "path": "/v1/statements/extract", "calls": 31, "errors": 2}
  ]
}
```

| Field | Meaning |
| - | - |
| `production.documents_used` | Production documents this month: console uploads plus API reads. `api_documents` is the part read through the partner APIs. |
| `production.document_limit`, `remaining` | Your plan's monthly quota and what is left. `refused` counts API reads refused for the quota. `locked` is true when Production is refused (a bank's Free trial ended). |
| `sandbox.documents_used`, `daily_cap`, `remaining` | Today's (UTC) Sandbox fair-use counter. `daily_cap` and `remaining` are `null` when there is no cap. |
| `endpoints[]` | This key's calls per route template over the last `window_days` (7), most called first, with how many answered 400 or more. |

## Request log: `GET /v1/partner/request-logs`

The calling key's recent calls, the same rows as the console's call log, restricted to this key. No body and no header is kept or returned.

| Query | Rules |
| - | - |
| `limit` | 1 to 100. Default 50. |
| `cursor` | The `next_cursor` of the previous page (else 422 `invalid_cursor`). |
| `path` | Only this route template, such as `/v1/statements/extract`. |
| `status_code` | Only this HTTP status (100 to 599). |
| `status_class` | `2xx`, `4xx` or `5xx` (a digit and `xx`). |
| `environment` | `sandbox` (default) or `production`. A call that named no environment was a Sandbox call. |

```bash theme={"dark"}
curl "https://app.sahlfinancial.com/api/v1/partner/request-logs?status_class=4xx&limit=20" \
  -H "Authorization: Bearer $SAHL_API_KEY"
```

```json theme={"dark"}
{
  "items": [
    {
      "id": "9a8b0000-0000-4000-8000-00000000000b",
      "method": "POST",
      "path": "/v1/statements/extract",
      "status_code": 422,
      "latency_ms": 340,
      "request_id": "req_7f3a",
      "reference": "releve-2026-07",
      "environment": "sandbox",
      "error_code": "sandbox_specimen_required",
      "created_at": "2026-11-24T10:02:00Z"
    }
  ],
  "next_cursor": null,
  "limit": 20
}
```

`status_code` 499 means the client went away. `request_id` is the `X-Request-ID` of the response: quote it to Sahl. `error_code` is a code from the catalogue below.

## Error catalogue: `GET /v1/partner/errors`

```json theme={"dark"}
{
  "format": "{\"detail\": {\"code\": \"...\", \"message\": \"...\"}}",
  "notes": ["..."],
  "errors": [
    {
      "code": "production_api_not_approved",
      "http_status": 403,
      "meaning": "...",
      "retry": false,
      "where": "Production calls"
    }
  ]
}
```

`errors[]` lists every code the partner routes answer with: `code` (in `detail.code`), `http_status`, `meaning` (what it means and what to do), `retry` (whether the same call later can succeed) and `where` (which routes). `notes` lists the errors that come without a code (a missing, invalid or expired key answers 401 with a plain-string `detail`). Fetch it instead of hard-coding the list: it is the authoritative table, and the [errors page](https://docs.sahlfinancial.com/errors.md) groups the same codes by status.


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