Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.have-foresight.app/llms.txt

Use this file to discover all available pages before exploring further.

List endpoints use cursor-based pagination. Cursors are opaque, deterministic, and stable — the same cursor will always return the same page, even if new resources are created.

Parameters

ParameterInTypeDefaultDescription
limitqueryinteger50Items per page. Max 100.
cursorquerystringOpaque pagination cursor. Pass the nextCursor from the previous response.

Response shape

{
  "data": [
    /* array of resources */
  ],
  "meta": {
    "requestId": "req_...",
    "pagination": {
      "limit": 50,
      "nextCursor": "eyJpZCI6ImNsbV..."
    }
  }
}
When nextCursor is null, you’ve reached the end of the result set.

Example: walk every claim

let cursor = undefined;
const results = [];

do {
const url = new URL(`${process.env.FORESIGHT_BASE_URL}/claims`);
url.searchParams.set('limit', '100');
if (cursor) url.searchParams.set('cursor', cursor);

const res = await fetch(url, {
headers: { 'X-API-Key': process.env.FORESIGHT_API_KEY },
});
const body = await res.json();

results.push(...body.data);
cursor = body.meta.pagination.nextCursor;
} while (cursor);

Sorting

List endpoints accept a sort parameter that takes a field name optionally prefixed with - for descending order:
GET /v1/claims?sort=-createdAt # newest first (default)
GET /v1/claims?sort=createdAt  # oldest first
GET /v1/claims?sort=-totalCharges
Each endpoint documents the fields it supports for sorting. Sorting on unindexed fields will return 400 invalid_sort_field.

Filtering

Where supported, filtering is done with explicit query parameters listed in the endpoint reference (e.g. status, patientId, submittedAfter). We do not support a generic JSON filter language; filters are scoped to the endpoint and validated.

Total counts

We deliberately do not return a total count on list endpoints. Counting all rows in a tenant’s data set is expensive and rarely useful for client code. If you need a count for a dashboard, hit the Analytics endpoints instead, which return aggregates from a precomputed store.