Set up a client
Set the full HTTPS origin and CA file for your environment. Use a tenant principal’s key for normal integration calls. The examples use Bash, curl, and jq.
export API='https://claims.example.com'
export CA_CERT='/path/to/ca.crt'
umask 077
read -r -s -p 'Pledge API key: ' PLEDGE_API_KEY
printf '\n'
printf 'Authorization: Bearer %s\n' "$PLEDGE_API_KEY" > pledge-auth.header
unset PLEDGE_API_KEY
curl --fail-with-body --cacert "$CA_CERT" \
-H @pledge-auth.header -H 'Accept: application/json' "$API/me"
Keep pledge-auth.header outside source control and delete it when finished. GET /me returns the authenticated principal and its tenant. Use Accept: application/json on routes that also serve browser pages.
Tenant scope
A tenant principal acts in its own tenant. A platform administrator selects an acting tenant using X-Pledge-Tenant; it is not a substitute for a tenant submitter key. Claims use local IDs at the API boundary. Internally, the ID includes the tenant namespace.
An inaccessible claim may return 404 rather than reveal its existence. Do not interpret every 404 as proof that the claim was never submitted.
Submission and command idempotency
For claim admission, preserve the local claim_id across retries. Identical accepted submissions can return the existing claim; changing the terms for an existing ID is a conflict.
Commands on an existing claim, including attachment, assignment, and decisions, use an Idempotency-Key header and the current round in the body. Retain the same key and same body when retrying the same intent after an uncertain network outcome. Use a new key for a genuinely new action.
A stale round, changed body under a reused key, or conflicting state can return 409. Read the current claim and resolve the conflict before issuing a new intent. Automatically changing the key to get past a conflict can create a second action.
Acceptance and consistency
A successful write response reports its accepted operation. Background processing and replica reads can lag. A 202 batch acceptance is not a completed claim decision, and approval is not a funds transfer.
Use the returned receipt or resource location to follow asynchronous work. Read claim sequence and round when reconciling state. Use bounded retries for expected replica lag, and stop on definitive authorization or validation failures.
Pagination
Paged endpoints accept limit and an opaque before cursor. A page contains rows and may contain next. Send next back unchanged as the next request’s before. Some endpoints include additional summary fields; not every API list is paginated.
curl --fail-with-body --cacert "$CA_CERT" -H @pledge-auth.header \
-H 'Accept: application/json' --get "$API/review-queue" \
--data-urlencode 'limit=50'
Do not reuse a cursor on a different list or invent an offset. Keep the identity and filters consistent while paging.
Error handling
JSON errors include error; validation failures can also include problems with code, diagnostics, and expression. Kernel refusals may include refusal.
| Status | Meaning | Client action |
|---|---|---|
400 |
Invalid input or configuration | Correct the named fields |
401 |
Missing, expired, revoked, or otherwise invalid credentials | Reauthenticate or rotate the credential |
403 |
Authenticated but not allowed | Check principal permissions |
404 |
Absent or not visible in this scope | Check tenant, identity, and resource ID |
409 |
State, round, idempotency, or publication conflict | Refresh state; preserve intent |
429 |
Quota exceeded | Respect Retry-After |
500 |
Internal or service configuration failure | Preserve request identity; investigate persistent failures |
503 |
Dependency, publication, or recovery availability failure | Retry with backoff and a deadline |
FHIR endpoints render errors in their protocol format. Do not assume a JSON error envelope on a FHIR response.