# Ámbar API > Governance of the population a payer assigns and of its contracts: patients and their record, cohorts, programs and case finding, alerts and care cases, clinical routes, studies and workflows, and PGP, capitation and fee-for-service contracts with their billing, settlements and payer reports. > > - **Base URL:** `https://api-ambar.getarbol.com`. Ámbar answers at its own address, not at `https://api.getarbol.com`, and the Arbol SDKs, CLI and MCP don't include it. > - **Authentication:** an OAuth access token from `https://auth.getarbol.com/` for the audience `https://project-ambar-api.getarbol.com`, with your organization selected, as `Authorization: Bearer `. A person gets one by signing in; a machine, from an application the Arbol team sets up for your organization. Arbol API keys (`arb_live_…`) and tokens for `https://api.getarbol.com` aren't accepted. > - **Permissions:** each operation's description says what it requires: its scopes and, for some, a person's token. > - **OpenAPI:** [openapi.json](/api/ambar/openapi.json), to import into Postman or generate a client. The API serves its own copy at `https://api-ambar.getarbol.com/openapi.json`. > > Try it with [Get your session](/api/ambar/get-session/): > > ```bash > curl https://api-ambar.getarbol.com/v1/session/get \ > --header "Authorization: Bearer $AMBAR_ACCESS_TOKEN" > ``` ## Pages - [Ámbar API](https://docs.getarbol.com/api/ambar/index.md) — Governance of the population a payer assigns and of its contracts: patients and their record, cohorts, programs and case finding, alerts and care cases, clinical routes, studies and workflows, and PGP, capitation and fee-for-service contracts with their billing, settlements and payer reports. - **Base URL:** `https://api-ambar.getarbol.com`. Ámbar answers at its own address, not at `https://api.getarbol.com`, and the Arbol SDKs, CLI and MCP don't include it. - **Authentication:** an OAuth access token from `https://auth.getarbol.com/` for the audience `https://project-ambar-api.getarbol.com`, with your organization selected, as `Authorization: Bearer `. A person gets one by signing in; a machine, from an application the Arbol team sets up for your organization. Arbol API keys (`arb_live_…`) and tokens for `https://api.getarbol.com` aren't accepted. - **Permissions:** each operation's description says what it requires: its scopes and, for some, a person's token. - **OpenAPI:** [openapi.json](/api/ambar/openapi.json), to import into Postman or generate a client. The API serves its own copy at `https://api-ambar.getarbol.com/openapi.json`. Try it with [Get your session](/api/ambar/get-session/): ```bash curl https://api-ambar.getarbol.com/v1/session/get \ --header "Authorization: Bearer $AMBAR_ACCESS_TOKEN" ``` - [Accept a contract settlement](https://docs.getarbol.com/api/ambar/accept-contract-settlement/index.md) — Accepts a `draft` settlement with acceptance evidence; it becomes the close of its component period, replacing the close it supersedes. The acceptor must be an active person who did not create it. Needs `ambar:settlements:approve`. Send the settlement `version` (1 while draft) as `expectedVersion`. Returns the accepted `settlement` with `currentClose: true`. Idempotent by `requestKey` (scoped to you): the same key with the same input returns the settlement's current state; the same key with different input fails with `IDEMPOTENCY_CONFLICT`. Failures: `ACCESS_DENIED`: missing scope or grant, or you created the settlement; another person must accept. `CONFLICT`: not `draft`, stale `expectedVersion`, contract not active, terms superseded, the period close changed, an overlapping close exists, or an unverified document; re-read and recalculate. `CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED`: the terms no longer match an accepted close. `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend with the same `requestKey`. - [Add a version of a script or a red-flag list](https://docs.getarbol.com/api/ambar/add-agent-document/index.md) — Checks a script or a red-flag list and keeps it as the version it names, in `draft`, written by the caller. A script is the Spanish text an agent follows for one goal; a red-flag list holds the red flags of a program with their level (`emergency`, `urgent`, `normal`) and the phrases that reveal them, compared without accents, case or punctuation. A kept document never changes: to change it, add a new version. The AI may propose documents this way; people approve them. Use it before adding an agent version that names the document; then submit it with `changeAgentDocument` for clinical coordination (scripts) or the medical team (red-flag lists). `dryRun: true` returns the result without keeping it. Returns the document with the `requestKey`; read its content with `getAgentDocument`. Requires the `ambar:programs:read` and `ambar:programs:write` scopes and a write grant on the program for care operations. `INVALID_INPUT`: malformed body, a document that is not of `kind`, breaks its rules (blank or long text, a repeated code or phrase, a phrase that is not a valid pattern) or is larger than 512 KiB; fix it. `CONFLICT`: the version is taken or the program does not exist; list the documents and choose a new version. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Add a version to an agent](https://docs.getarbol.com/api/ambar/add-agent-version/index.md) — Checks a configuration ([12] section 1) and keeps it as the version its `version` names, in `draft`, written by the caller. The first version creates the agent in its `program`; every later version must name the same program. A kept configuration never changes: to change it, add a new version. An agent's proposal enters this way and follows the same path; no agent can approve it. Use `checkAgentConfig` first to learn which rule a configuration breaks. Then move the version with `changeAgentVersion`: `validate`, `record_evaluation`, `submit`. `dryRun: true` returns the result without keeping it. Returns the version with the `requestKey`. Requires the `ambar:programs:read` and `ambar:programs:write` scopes and a write grant on the program for care operations. Every call and message goes through Raíz: `provider.installation` must be the organization's Raíz installation. `INVALID_INPUT`: malformed body, a configuration that is unreadable or breaks a rule (check it with `checkAgentConfig` and fix it), or a `provider.installation` that is not an installation of the `raiz` app of the organization or was uninstalled (name the one `listInstallations` shows). `CONFLICT`: the version number is taken, the agent belongs to another program, or the program does not exist; list the versions and choose a new number. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Add a task Arbi keeps for you](https://docs.getarbol.com/api/ambar/add-assistant-task/index.md) — Adds a task Arbi keeps for you, open: what it is, what is done and what is left, and when it is due. Never a patient's clinical facts in its title or detail: Arbi reads them again from the record. Adding the same task again with its `taskId` answers with `replayed: true`; `dryRun: true` checks everything and keeps nothing. Returns the task with its `version` and the `requestKey`. Requires a person whose token has `ambar:arbi:read` and `ambar:arbi:write`. `INVALID_INPUT`: a malformed id, title, detail or key; fix it. `CONFLICT`: another task has this `taskId`; choose another id. `ACCESS_DENIED`: missing scope; do not retry. - [Add a clause to a contract version](https://docs.getarbol.com/api/ambar/add-contract-clause/index.md) — Records one clause of a contract version as the annex states it, typed by `terms.kind`, with the page and passage it comes from. The clause is shown at once (`previewContractClauseEffects` computes its effect) but moves no money until another person confirms it with `confirmContractClause`. Use `listContractVersions` first for `versionId`. A country's name for something (for example `NO PBS`) goes in `label`; the rule is the same everywhere. `dryRun: true` checks everything and keeps nothing. Returns the clause with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: terms that do not fit their kind (a percentage that is not above 0, a cure period that ends after termination, repeated indicators or procedures, invalid bands, a base population of 0 or a tolerance above 10,000), a position outside 1 to 100 or an empty `sourceRef`; fix it. `CONFLICT`: another clause holds the position, or the version is not this contract's; choose another position or re-read. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Add a site to a contract's network](https://docs.getarbol.com/api/ambar/add-contract-network-site/index.md) — Adds a care site to a contract's network from `validFrom` (and until `validTo`, included, when given), optionally requiring the payer's prior authorization. Adding the same period again changes nothing; `dryRun: true` returns the result without keeping it. Returns the site period with the `requestKey`. Requires the `ambar:contracts:read` and `ambar:contracts:write` scopes and a write grant on the contract. `INVALID_INPUT`: malformed input. `CONFLICT`: the period overlaps another period of the same site, or the site does not exist; close the other period first. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Add population rules to a contract version](https://docs.getarbol.com/api/ambar/add-contract-population-rules/index.md) — Records who counts in a contract version's paid population, as the annex states it: members assigned to some primary-care providers (`assigned_provider`, with the payer's own provider codes) and people with a complementary plan (`complementary_plan`). Rules are added once per position. Adding the same rules again changes nothing; `dryRun: true` checks everything and keeps nothing. Returns the rules with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: an empty, repeated or untrimmed provider code, repeated positions, a position outside 1 to 100 or an empty `sourceRef`; fix it. `CONFLICT`: other rules hold those positions, or the version is not this contract's; read them with `listContractPopulationRules`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Name a contracted site of a contract](https://docs.getarbol.com/api/ambar/add-contracted-site/index.md) — Names a care site a contracted site of the contract from `validFrom` (and until `validTo`, included, when given): where the contract says its care is given. Services given elsewhere under a substitution still count here. Use it when a contract names the sites of its care, for example an imaging contract given at Armenia; add substitutions with `addSiteSubstitution`. Adding the same period again changes nothing; `dryRun: true` returns the result without keeping it. Returns the period with the `requestKey`. Requires the `ambar:contracts:read` and `ambar:contracts:write` scopes and a write grant on the contract. `INVALID_INPUT`: a period that ends before it starts, or malformed input. `CONFLICT`: the period shares a day with another period of the same site (end that one first), or the contract or the site does not exist. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Bill one procedure of a routed service](https://docs.getarbol.com/api/ambar/add-invoice-line/index.md) — Adds an invoice line for one code of one routed service (an encounter) of a fee-for-service contract, priced by the fee schedule in force on the service day among those of the contract's approved versions (a schedule of a version still proposed prices nothing): the package the code opens, once at its price; else the schedule's explicit price of one unit of the code in its system (`codeSystem`: a procedure's CUPS by default, a medication's CUM, IUM or DCI, a device's code); else the price of the manual of its group, or of the schedule, moved by the group's or the schedule's adjustment, times the quantity. The manual's price comes from the catalog of the contract's jurisdiction (its payer's country), release in force on the service day, under the manual's own code when the schedule homologates the procedure; send `manualPriceMinor` only when the catalog does not price it. The line keeps where its price came from (`pricing`). The same service and code are billed once while their line counts. Adding the same line again returns it; `dryRun: true` checks and prices everything and keeps nothing. Returns the line with its pricing, the version whose schedule priced it, the unit price and where it came from, and the manual price used with its source, with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: malformed identifiers, a code out of its system's shape, a quantity outside 1 to 1,000,000, an invoice reference without its day, a negative `manualPriceMinor`, or a code priced by a manual that neither the catalog nor `manualPriceMinor` prices; fix it. `CONFLICT`: no approved fee schedule applies on the service day, the schedule prices the code by nothing, `manualPriceMinor` differs from the catalog's price (omit it), another line has this id, the service and code are already billed, the encounter does not exist, or an accepted settlement closed the period of the service day (its correction goes into a later settlement's adjustments); read `listFeeSchedules` and `listInvoiceLines`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Assign who serves a payer's members for a category](https://docs.getarbol.com/api/ambar/add-provider-assignment/index.md) — Adds a person's assignment: for a service category (for example `medication.pbs`), the members of a payer (or one of its contracts), in a territory (a department covers its municipalities), go to a provider of the directory, at one of its sites when you name it, and follow-ups go through the installation you name; from `validFrom`, until `validTo` when given. A person's assignment beats a payer list's that is just as specific. The same assignment again answers with `replayed: true`; `dryRun: true` checks everything and keeps nothing. Returns the assignment with the `requestKey`. Requires `ambar:patients:read` and `ambar:patients:write` and the registry write grant for care operations; agents cannot add assignments. `INVALID_INPUT`: a malformed id, category, territory or key, or dates out of order; fix it. `CONFLICT`: another assignment has this id, or the payer, contract, provider, site (not the provider's) or installation does not exist; read `listProviderAssignments`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Let a site serve for a contracted site](https://docs.getarbol.com/api/ambar/add-site-substitution/index.md) — Lets `servingSiteId` serve for the contracted site `contractedSiteId` of the contract from `validFrom` (and until `validTo`, included, when given): a slot search asks it only when the contracted site has no slot within `noSlotWithinDays` (1 to 62) of the search, only when both sites are in the same travel zone, and the nearest first. `requiresPatientAcceptance` says the patient must accept being seen there before booking; `payerInvolvement` says what the payer must hear: `none`, a `notice` once booked, or an `authorization` before booking. The service keeps counting at the contracted site. Use it when a contract allows a nearby site to serve, for example Pereira for Armenia when Armenia has no slot within five days. Adding the same period again changes nothing; `dryRun: true` returns the result without keeping it. Returns the period with the `requestKey`. Requires the `ambar:contracts:read` and `ambar:contracts:write` scopes and a write grant on the contract. `INVALID_INPUT`: a site that would serve for itself, a wait out of 1 to 62 days, a period that ends before it starts, or malformed input. `CONFLICT`: the period shares a day with another period of the same pair of sites (end that one first), or the contract or a site does not exist. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Put a person on a service's waitlist](https://docs.getarbol.com/api/ambar/add-to-waitlist/index.md) — Puts a person on the waitlist of a service, waiting from now, with their preferred site and part of the day, a priority score that ranks them until a cohort's priority model scores them (the model's score ranks them from then on, within a pass of the priority worker), and whether they are a clinical priority (`needsProtected`: they go ahead of the scored queue, the longest waiting first). It is the list of people to schedule with their reasons: the client's waitlist when its agenda has none, and the order Ámbar gives when it has one; whoever books (a person, the agent or the agenda's app) takes people from it in that order. Use it when the client's agenda has no slot that fits the person yet, or the person wants an earlier slot. A person waits once per service: asking again with the same preferences answers their entry with `replayed: true`. `dryRun: true` checks and keeps nothing. Returns the entry and the `requestKey`. Requires `ambar:appointments:read`, `ambar:appointments:write`, `ambar:patients:read` and `ambar:patients:write`, and the patient's write grant for care operations. `CONFLICT`: the person already waits for the service with other preferences; withdraw that entry first, or keep it. `INVALID_INPUT`: malformed body or a score above 1000; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Add a version to a workflow](https://docs.getarbol.com/api/ambar/add-workflow-version/index.md) — Validates a definition (YAML or JSON text) and stores it as the workflow's next version, in `draft`, written by the caller. An agent's proposal enters this way and follows the same path; no agent can approve it. Use `validateWorkflowDefinition` first to see every issue: this operation refuses any definition that is not valid. The version records the app versions its integration calls were checked against (`appVersions`). Then move the version with `setWorkflowVersionState` (`validated`), simulate it, and send it to review. `dryRun: true` returns the result without keeping it. Returns the version with its number and the `requestKey`. Requires the `ambar:programs:read` and `ambar:programs:write` scopes and a write grant on `workflow`. `INVALID_INPUT`: malformed input, a definition that is unreadable or invalid, or one whose `workflow` names another workflow. `CONFLICT`: the workflow does not exist; create it with `createWorkflow`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Adopt note extraction candidates](https://docs.getarbol.com/api/ambar/adopt-note-extraction/index.md) — Saves a technical note that a person reviewed against a `ready` extraction candidate, and records which candidate it came from. You send the full note (as for saveTechnicalNote); nothing from the candidate is saved automatically, and the note is not approved. Send the extraction `version` and the `candidateSha256` you reviewed; the note `source` must reference the extracted document. Use two different request keys: `requestKey` for the adoption and `note.requestKey` for the note. Returns the saved technical note. Idempotency: the same `requestKey` with the same body returns the note saved the first time; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: CONFLICT when the extraction is no longer `ready` at that version, the candidate digest or note source does not match, or the note itself conflicts (read again); EVIDENCE_NOT_READABLE when the candidate cannot be read or verified now; ACCESS_DENIED when the extraction is not yours or a scope or access is missing; INVALID_INPUT for malformed fields or `humanReviewed` not `true`. - [Append campaign recipients](https://docs.getarbol.com/api/ambar/append-campaign-recipients/index.md) — Add 1 to 100 recipients to a draft campaign (at most 5,000 per campaign). Each names a patient, their current patient and enrollment versions and an explicit contact permission; the phone number comes from the patient's profile and is stored encrypted. Use it after `saveCampaign` and before `approveCampaign`. Recipients cannot be removed. Returns a receipt with the new campaign `version`. Idempotency: the same `requestKey` with the same input returns the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `INVALID_INPUT`: malformed or duplicate recipient, patient without a phone number, campaign not a draft, or the 5,000 limit would be exceeded. `CONFLICT`: stale `expectedVersion` or `patientVersion`, patient not active, patient already in the campaign, or patient not currently enrolled in the program; re-read and retry. `NOT_FOUND`: a patient does not exist. `ACCESS_DENIED`: missing scope, unknown campaign, or no access to the campaign or a patient; do not retry. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input to learn the outcome. - [Apply a payment to the invoices it settles](https://docs.getarbol.com/api/ambar/apply-contract-payment/index.md) — Applies a payment recorded with `recordContractPayment` to invoices of its contract in its currency: each part at most what the invoice still owes (its value after notes, less what was prepaid, paid and lost to objections), all of them at most what the payment has not applied yet. All the parts are applied or none. Applying the same parts again returns them; `dryRun: true` checks everything and keeps nothing. Returns the parts applied with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: no parts, more than 200, a part that is not positive, one invoice twice, an invoice of another contract or currency, or a day before the payment arrived; fix it. `NOT_FOUND`: no such payment or invoice. `CONFLICT`: a voided payment or invoice, more than an invoice owes or the payment has left, or an invoice the payment settled already; read `listReceivables`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Apply a patient care result](https://docs.getarbol.com/api/ambar/apply-patient-care-result/index.md) — Records a care assessment of one requirement period supported by an existing accepted result, with a written justification. No result values are copied. Use it when a complete, independently accepted study record of kind `result` should count for a period whose requirement accepts `complete_result`; otherwise use `evaluatePatientCare`. Copy the period fields from `getPatientCareProgress`. The result must be readable, complete and dated inside the period, and the patient individually assigned to the contract. Requires a human caller with `ambar:patients:read`, `ambar:patients:write`, `ambar:patients:review`, `ambar:studies:read` and `ambar:contracts:read`. Returns a receipt with the assessment `id` and new `version`. Idempotency: the same `requestKey` with the same body returns the original receipt, even if the result changed later; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body, or the record is not a complete result); `ACCESS_DENIED` (not human, missing scope or grant, or record not visible); `CONFLICT` (version, sources or record changed, result outside the period or not accepted by the requirement, or no individual assignment: re-read and retry with a new key); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Approve a campaign](https://docs.getarbol.com/api/ambar/approve-campaign/index.md) — Approve a draft campaign so its recipients can be dispatched. The approver must not be its creator and needs the `ambar:patients:review` scope, program approve access and read access to every patient. Approval checks that every recipient still qualifies (current patient and enrollment versions, unexpired permission) and fixes the recipient list. Then use `dispatchCampaignRecipient`. Returns a receipt with the new `version` and `state` `approved`. Idempotency: the same `requestKey` with the same input returns the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `CONFLICT`: stale `expectedVersion`, campaign not a draft, you are its creator, it has no recipients, or a recipient no longer qualifies; check them with `listCampaignRecipients`. `ACCESS_DENIED`: missing scope or grant, or the integration binding cannot dispatch contacts; do not retry. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input to learn the outcome. - [Approve a clinical route](https://docs.getarbol.com/api/ambar/approve-clinical-route/index.md) — Approves a `proposed` route (`version` `3`) with a ready contract artifact holding the approval record. The approver must be an active person who neither saved nor proposed it. The route is in force from its `effectiveFrom` until a newer approved route takes effect. Returns the approved route. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when a version is stale, the route is not proposed, a newer route is already approved or the contract is suspended; INVALID_INPUT without `approvalEvidence`. ACCESS_DENIED without the contract approve scope and grant, when you saved or proposed the route, when an artifact is not available, or as a non-human caller; COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Approve a version of a cohort's priority model](https://docs.getarbol.com/api/ambar/approve-cohort-priority-model/index.md) — Approves one proposed version of a cohort's priority model, as a person other than whoever proposed it. From then on it orders the cohort's queue, until a newer version is approved. Use it after reviewing the proposal and its previews. Agents propose; only people approve. Returns the version approved. Requires `ambar:cohorts:read` and `ambar:cohorts:write`, a person's session, and the cohort's write grant. `NOT_FOUND`: no such version. `CONFLICT`: the caller proposed it (another person approves), or it is approved already; list the versions with `listCohortPriorityModels`. `ACCESS_DENIED`: an agent, or a missing scope or grant; do not retry. `INVALID_INPUT`: malformed body; fix it. - [Approve a contract version](https://docs.getarbol.com/api/ambar/approve-contract-version/index.md) — Approves a proposed version with approval evidence. The approver must be an active person who did not propose it. A draft contract becomes `active` (a suspended one stays suspended) and `approvedVersionId` points to this version. Keep the version you reviewed: send its `version` as `expectedVersion` and the contract `version` as `expectedContractVersion`; never switch silently after a refetch. Idempotent by `requestKey` (scoped to you): the same key with the same input returns the approved version again; the same key with different input fails with `IDEMPOTENCY_CONFLICT`. Failures: `ACCESS_DENIED`: missing `ambar:contracts:approve`, no approve grant, or you proposed it; another person must approve. `CONFLICT`: stale versions, not `proposed`, a later approved version overlaps its dates, or an evidence file is not verified; re-read and review again. `CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED`: it changes components fixed by an accepted settlement; propose terms that keep them. `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend with the same `requestKey`. - [Approve a mapping version](https://docs.getarbol.com/api/ambar/approve-installation-mapping/index.md) — Approves a proposed mapping version as the authorized caller, including its author. From then on the ingest worker translates with it; the codes it maps leave the mapping queue and the installation's deliveries that waited for a mapping are queued again. Use it after reviewing the rows with `getInstallationMapping`. `dryRun: true` checks and keeps nothing. Returns the version, now approved, with the `requestKey`. Requires `ambar:settings:read` and `ambar:settings:write`, a person, and a workspace configuration write grant. `NOT_FOUND`: no such version. `CONFLICT`: it is already approved. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Approve a version of a rule catalog](https://docs.getarbol.com/api/ambar/approve-rule-catalog-version/index.md) — Approves one proposed version, as a person other than whoever proposed it: the medical team's signature on the values the organization uses. From then on it is the organization's catalog of its kind, until a newer version is approved, and the results computed with it cite it. Use it after reviewing the draft (`listRuleCatalogVersions`) and checking it. Agents propose; only people approve. `dryRun: true` checks the approval and keeps nothing. Returns the version approved with the `requestKey`. Requires `ambar:patients:read` and `ambar:patients:write`, a person's session, and the registry-wide patient write grant for care operations. `NOT_FOUND`: no such version of that kind. `CONFLICT`: the caller proposed it (another person approves) or it is approved already; list the versions. `ACCESS_DENIED`: an agent, or a missing scope or grant; do not retry. `INVALID_INPUT`: a malformed body; fix it. - [Approve a study definition](https://docs.getarbol.com/api/ambar/approve-study-definition/index.md) — Approves the latest `proposed` revision of a study definition and makes it the `activeVersion` used by new orders. Use it after a human reviewed the revision from `getStudyDefinition`; send the definition's `version` as `expectedVersion` and the revision number as `definitionVersion`. Requires a human caller with `ambar:studies:read` and `ambar:studies:review`; the clinical owner must still be an active human. Returns `id`, the new record `version` and `definitionVersion`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (not human, missing scope or approve grant); `CONFLICT` (version changed, revision not the latest proposed one, definition retired or owner inactive: re-read); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Approve study order registration policy](https://docs.getarbol.com/api/ambar/approve-study-order-registration-policy/index.md) — Approves the latest proposed revision of a contract's registration policy; it then applies to orders authorized from that moment on. The approver must be a human other than the author of the revision. Send the policy `version` as `expectedVersion` and the revision number as `policyVersion`. Requires `ambar:contracts:read`, `ambar:contracts:write` and `ambar:contracts:approve`. Returns a receipt with the contract `id` and the new policy `version`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (not human, missing scope or grant, you authored the revision, or it is not proposed); `CONFLICT` (version changed, revision not the latest, or contract not active: re-read); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Approve a technical note](https://docs.getarbol.com/api/ambar/approve-technical-note/index.md) — Approves a `proposed` technical note with an approval document and reconciled examples (`ready` uploaded files), by an active person who neither created nor proposed it. Needs `ambar:contracts:approve`. Every requirement must name a study definition; where approved notes overlap, the highest `number` applies. The note must be complete as proposing requires, and its lines' codes must be in the national procedure catalog release in force on its first day (CUPS in Colombia, CPMS in Peru) or, for IUM, CUM and DCI, in their system's shape; an internal code only warns (`checkTechnicalNote` lists them). Send the note `version` (2) and the contract `version`; approval increments the latter. Idempotent by `requestKey` (scoped to you): the same key and input return the note's current state; the same key with other input fails with `IDEMPOTENCY_CONFLICT`. Failures: `ACCESS_DENIED`: you created or proposed it, missing scope or grant, or a linked record is not readable or active. `CONFLICT`: not `proposed`, stale versions, suspended contract, newer overlapping approved note, unverified file, a code that blocks approval, or an `agreedValue` other than the components' value. `INVALID_INPUT`: a requirement lacks `studyDefinitionId`, the note lacks what proposing needs, or malformed fields. `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend with the same `requestKey`. - [Assess a program participant](https://docs.getarbol.com/api/ambar/assess-program/index.md) — Records a human eligibility assessment of one patient for an `active` cohort program at `expectedVersion`. It does not enroll the patient. Rules: `validUntil` in the next 90 days; if the program links a cohort, `cohortSnapshotId` must be a snapshot of it listing the patient as a current member; cited evidence must be accepted evidence of this patient. Returns the assessment; `eligibleNow` tells whether it can support enrollProgram now. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when the program is not active or `expectedVersion` is stale, `validUntil` is out of range, the snapshot or evidence does not qualify, or the id exists. ACCESS_DENIED without the program approve grant, patient access or as a non-human caller; INVALID_INPUT; COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Assign a study order reviewer](https://docs.getarbol.com/api/ambar/assign-study-order-reviewer/index.md) — Takes (`assigned: true`) or releases (`assigned: false`) the follow-up reviewer role of a study order for yourself. Use it to claim an order from `listStudyOrderWorkspaces`. You cannot take an order assigned to someone else, and you can only release your own assignment. Send the order `version` as `expectedOrderVersion` and the follow-up `version` as `expectedVersion` (`0` when none). Requires a human caller with `ambar:patients:read`, `ambar:patients:review`, `ambar:studies:read` and `ambar:studies:review`. Returns a receipt with the order `id` and the new follow-up `version`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body; `reason` must be `study_order.followup_assign`); `ACCESS_DENIED` (not human, missing scope or grant, or releasing someone else's assignment); `CONFLICT` (versions changed, order cancelled, patient not active, or assigned to someone else: re-read); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Bind a study order to a contract](https://docs.getarbol.com/api/ambar/bind-study-order-contract/index.md) — Binds an existing study order to an active contract on a reviewed basis: the patient's individual care assignment, or a program with a current eligible assessment. Use it to make an order count under a contract. Send `expectedContextVersion` `0` for a new binding or the current `contextVersion` to bind again; cancelled orders cannot be bound. Requires a human caller with `ambar:patients:read`, `:write` and `:review`, `ambar:studies:read`, `:write` and `:review`, and `ambar:contracts:read` (plus `ambar:programs:read` for a program basis). Returns a receipt whose `id` is the binding id (`contextId`) and whose `version` is the new `contextVersion`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (not human, missing scope or grant); `CONFLICT` (order, patient, contract or binding version changed, or the basis does not qualify: re-read and retry with a new key); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Book an appointment in the client's agenda](https://docs.getarbol.com/api/ambar/book-appointment/index.md) — Books an appointment for a patient in the slot given. The client's agenda decides when and where: Ámbar counts no capacity of its own, keeps the booking as asked in its read-only copy of the agenda and makes sure the agenda hears of it. A booking without `externalRef` is sent to the client's agenda by its installed app, or listed for a person who books it there (`listAgendaWritesForPeople`); a clinical priority (`clinicalPriority: true`) goes out first. `programId` names the program it is booked for, whose attendance policy decides whether the person came; without it the organization's policy decides. When a contract names where its care is given, book under it with `contractId` and `contractedSiteId`: the appointment keeps where its care counts (`contractedSite`), and `siteId` may differ only where a substitution of the contract in force on the appointment's local day lets it serve for that site, with `patientAccepted` and the payer's authorization number in `payerReference` when the substitution asks for them (a `find_slots` call with `contractId` says so in `requiresPatientAcceptance` and `payerInvolvement`). A notice the payer must receive once booked is recorded with `recordPayerNotice`. Use it once the person accepted a slot of the client's agenda. To record a booking already made in the client's agenda send its `externalRef`, and `agendaInstallationId` when Ámbar has that agenda installed, so the agenda's report of it is recorded once. `dryRun: true` checks and keeps nothing. The same `requestKey` again answers the booking it made with `replayed: true`. Returns the appointment (`booked`) and the `requestKey`. Requires `ambar:appointments:read`, `ambar:appointments:write`, `ambar:patients:read` and `ambar:patients:write`, and the patient's write grant for care operations. `CONFLICT`: the site or the contract does not exist. `SITE_SUBSTITUTION_REFUSED`: the contract does not let `siteId` serve for `contractedSiteId` as booked; `details.reason` says why (`not_contracted`, `not_a_substitute`, `patient_acceptance_missing`, `payer_authorization_missing`). `IDEMPOTENCY_CONFLICT`: the `requestKey` booked another appointment; use a new key. `INVALID_INPUT`: malformed body, a duration out of 5 to 480 minutes, a reason that is not a code, a contract without its contracted site, or `patientAccepted` or `payerReference` without a contract; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Cancel a population import](https://docs.getarbol.com/api/ambar/cancel-clinical-population-import/index.md) — Cancels an import you staged that is `staged` or `completed`, deleting the stored file and reviewed profiles. Rows already published stay in the cohort. Returns a receipt with `status: cancelled`. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when `expectedVersion` is stale or the import is already cancelled or expired; ACCESS_DENIED when the import is not yours, without the cohort write scope or as a non-human caller; INVALID_INPUT. COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Cancel a study order](https://docs.getarbol.com/api/ambar/cancel-study-order/index.md) — Cancels a study order that is `proposed`, `authorized` or `registered`; cancellation is final. Use it when the study will not be done; send the order's current `version` as `expectedVersion`. Requires `ambar:studies:read`, `ambar:studies:write`, `ambar:patients:read` and `ambar:patients:write`. Returns a receipt with the order `id` and new `version`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (missing scope or grant, or order not visible); `CONFLICT` (version changed, or the order is declined or already cancelled); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Capture a registration deadline](https://docs.getarbol.com/api/ambar/capture-study-order-registration-deadline/index.md) — Captures the registration deadline of an `authorized` study order from the contract policy that was in force when the order was authorized. Requires a current binding of the order to the contract (`bindStudyOrderContract`). Send its `contextVersion` and, as `policyVersion`, the `applicableAtDecision` revision from `getStudyOrderRegistrationPolicy`. The deadline is the authorization time plus the policy's days; overdue orders then appear with `followUp=overdue` in `listStudyOrderWorkspaces`. Requires a human caller with `ambar:patients:read`, `ambar:patients:review`, `ambar:studies:read`, `ambar:studies:review` and `ambar:contracts:read`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (not human, missing scope or grant); `CONFLICT` (order not `authorized`, versions or binding changed, or the policy revision was not the one in force at the decision: re-read); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Move a script or a red-flag list along its approval path](https://docs.getarbol.com/api/ambar/change-agent-document/index.md) — Takes one step on a document: `submit` (`draft` to `in_review`), `request_changes` (`in_review` back to `draft`), `approve` (`in_review` to `approved`: clinical coordination approves scripts, the program's medical team signs red-flag lists) and `retire` (`approved` to `retired`: versions already active keep it, no version activates with it again). Use it to send a document to review, approve it, or retire it. Only a person may send back, approve or retire; an agent may only submit. The approver needs the program's approve grant and cannot be the author. `dryRun: true` returns the result without keeping it. Returns the document as changed with the `requestKey`. Requires the `ambar:programs:read` and `ambar:programs:write` scopes and a write grant on the program for care operations. `INVALID_INPUT`: malformed body or reference; fix it. `NOT_FOUND`: no such document, or the caller may not change it. `CONFLICT`: the step is not on the approval path or the caller wrote the document being approved; read it with `getAgentDocument`. `ACCESS_DENIED`: missing scope or grant, the approve grant missing to approve, or an agent asking for a person's step; do not retry. - [Move an agent version along the approval path](https://docs.getarbol.com/api/ambar/change-agent-version/index.md) — Takes one step on a version: `validate` (`draft` to `validated`), `record_evaluation` (`validated` to `evaluated`, with the result against labeled conversations: every red flag detected, privacy always respected and bookings at or above the target), `submit` (`evaluated` to `in_review`), `request_changes` (`in_review` back to `draft`), `approve` (`in_review` to `approved`), `activate` (`approved` or `superseded` to `active`: the version that was live becomes `superseded`; activating a superseded version rolls back to it), `pause` and `resume`. Use it to submit, evaluate, approve, activate, pause or roll back a version. Only a person may send back, approve, activate, pause or resume; an agent may validate, evaluate and submit. The approver needs the program's approve grant and cannot be the author. Activation needs every script of the version's goals and its red-flag list `approved` in the same program (`changeAgentDocument`); activating or resuming needs the Raíz installation the version names `active`, because every call and message goes through it. `dryRun: true` returns the result without keeping it. Returns the version as changed with the `requestKey`. Requires the `ambar:programs:read` and `ambar:programs:write` scopes and a write grant on the program for care operations. `INVALID_INPUT`: malformed body, `evaluation` missing for `record_evaluation` or sent with another action, or an evaluation that does not pass (the version stays `validated`; add a better version); fix it. `NOT_FOUND`: no such version, or the caller may not change it. `CONFLICT`: the step is not on the approval path, the caller wrote the version being approved, a script or the red-flag list is not approved, or the Raíz installation is not active; read the version with `listAgentVersions`, the documents with `listAgentDocuments` and the installation with `listInstallations`. `ACCESS_DENIED`: missing scope or grant, the approve grant missing to approve, or an agent asking for a person's step; do not retry. - [Confirm or cancel an appointment](https://docs.getarbol.com/api/ambar/change-appointment/index.md) — Changes an appointment at its `version`: `confirm` (the patient confirmed the reminder) or `cancel` (by the patient, the site or the agent; `reason` is the cancellation reason). After a cancellation the agenda worker wakes the runs waiting for this appointment's attendance; the client's agenda decides what to do with the slot it frees. Use it when the patient answers the reminder and when someone cancels. Whether the person came is recorded with `recordAttendance`; moves go through `rescheduleAppointment`. `dryRun: true` checks and keeps nothing. The same change sent again answers with `replayed: true`. Returns the appointment after the change and the `requestKey`. Requires `ambar:appointments:read`, `ambar:appointments:write`, `ambar:patients:read` and `ambar:patients:write`, and the patient's write grant for care operations. `CONFLICT`: the version is stale, or the change does not apply in the appointment's state (a final state); read it again with `getAppointment`. `NOT_FOUND`: no such appointment, or the caller may not change it. `INVALID_INPUT`: malformed body or a reason that is not a code; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Change a task Arbi keeps for you](https://docs.getarbol.com/api/ambar/change-assistant-task/index.md) — Changes one of your tasks: where it stands (`open`; `waiting` for an approval, an answer or a date; `done`; `cancelled`), its detail and its due date, each replacing the one it had. A done or cancelled task never changes. Send the `version` you read as `expectedVersion`; `dryRun: true` checks everything and keeps nothing. Returns the task with its new `version` and the `requestKey`. Requires a person whose token has `ambar:arbi:read` and `ambar:arbi:write`. `INVALID_INPUT`: a malformed id, detail, version or key; fix it. `NOT_FOUND`: you have no task with this id. `CONFLICT`: the version is stale or the task is closed; read it again with `listAssistantTasks`. `ACCESS_DENIED`: missing scope; do not retry. - [Record what happened to a chargeback](https://docs.getarbol.com/api/ambar/change-chargeback/index.md) — Applies one change to a chargeback: `identify` the person served elsewhere (once), `explain` why they went elsewhere with a reason code, `dispute` a reported chargeback with the document sent, or `accept` it, which makes the payer's discount count. An accepted chargeback never changes. Send the `version` you read with `listChargebacks`. `dryRun: true` checks everything and keeps nothing. Returns the chargeback with its new `version` and the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `NOT_FOUND`: no such chargeback. `CONFLICT`: stale `expectedVersion`, already accepted, the person absent, erased or already identified, or a dispute of one that is not `reported`; read it again. `INVALID_INPUT`: a reason that is not a reason code or an empty document reference. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Hand over, take over, hand back or resolve a conversation](https://docs.getarbol.com/api/ambar/change-conversation-handling/index.md) — Takes one step on who handles a conversation, at its `version`. `request_handoff` (only while `ai_active`): the agent stops and asks a person or a team (`to`) to take over, for `trigger` (`red_flag`, `person_requested`, `identity`, `payment`, `repeated_unresolved` or `low_confidence`), with its `summary` of the thread for whoever takes over, kept sealed; the conversation waits as `handoff_requested`. `take_over` (a person, while `ai_active` or `handoff_requested`): the caller answers from now on and the agent stays silent (`human_active`). `hand_back` (only the person who holds it): the conversation's agent answers again (`ai_active`). `resolve`: nothing is left to do (`resolved`); while a person holds it, only that person resolves it. The person's next message reopens a resolved conversation with the patient's default person or team, else with the agent. Every step is kept in the history. Use it from the agent's runtime when a handoff rule fires (the person asks for someone, a red flag, identity, payments, repeated turns without progress, low confidence), and from a person's queue to take a conversation over, hand it back or close it, with the `version` read with `getConversation` or `listConversations`. `dryRun: true` checks and keeps nothing. Returns the conversation after the step and the `requestKey`. Requires the `ambar:patients:read` and `ambar:patients:write` scopes and the patient's write grant for care operations; an agent's service account may ask for a handoff or resolve, never take over. `INVALID_INPUT`: malformed body, `trigger` or `to` missing with `request_handoff`, `trigger`, `to` or `summary` sent with another action, a handoff to the agent, or a summary blank, with control characters other than line breaks and tabs, or longer than 4,000 characters; fix it. `NOT_FOUND`: no such conversation, or the caller may not change it. `CONFLICT`: the version is stale, the step does not apply in the conversation's state, or a hand back of a conversation without an agent; read it again with `getConversation`. `BODY_TOO_LARGE`: the summary does not fit once sealed; shorten it. `ACCESS_DENIED`: missing scope or grant, an agent taking over, someone other than the person who holds it handing it back or resolving it, or clinical privacy not configured for a summary; do not retry. - [Record what happened to an electronic invoice](https://docs.getarbol.com/api/ambar/change-electronic-invoice/index.md) — Records one step of an invoice at the version you read: `validate` with the CUV MinSalud's validator returned (no payer may receive an invoice without it), `file` the day it was first filed with the payer under its receipt number, `return` the day the payer returned it with its Manual Único code (`DE` and four digits; the payer returns an invoice once, within 5 business days of its filing), `answer_return` the day the organization answered the return with the Manual Único's code (`RE9501` late, `RE9601` unjustified, `RE9701` accepted; within 5 business days, `deadlines.returnAnswerBy`), `withdraw_return` the day the payer accepted an answer that disputed it or its term to decide passed (`deadlines.returnDecisionBy`): the first filing stands; or `note` a credit or debit note the billing software issued (a credit note for its whole value voids it). `dryRun: true` checks everything and keeps nothing. Returns the invoice as changed with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: a code or note out of shape, or an answer code that is not one of a return's; fix it. `NOT_FOUND`: no such invoice. `CONFLICT`: another version, a step out of order (filing without a CUV, returning what was not filed or was returned once already, answering a return twice, withdrawing one nobody disputed, a note on a voided invoice or a note number used already); read it again with `getElectronicInvoice`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Record the invoice of a line, or void it](https://docs.getarbol.com/api/ambar/change-invoice-line/index.md) — Applies one change to an invoice line: `invoice` records the electronic invoice that includes it (once), and `void` takes it out with a reason code, after which it bills nothing and never changes; its service and procedure may be billed again by a new line. Once an accepted settlement closes the period of its service day, a line is no longer voided; its invoice is still recorded. The same change again returns the line; `dryRun: true` checks everything and keeps nothing. Returns the line with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: an invoice reference outside 1 to 64 characters or a reason that is not a reason code; fix it. `NOT_FOUND`: no such line. `CONFLICT`: the line is on another invoice or voided for another reason, or, to void it, an accepted settlement closed the period of its service day; read it with `listInvoiceLines`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Record the answer to an objection or its outcome](https://docs.getarbol.com/api/ambar/change-objection/index.md) — Applies one change to an objection: `answer` records the answer sent with its supports, between arrival and deadline, with its code where the jurisdiction codes answers (in Colombia the Manual Único: `RE9602` unjustified, `RE9702` accepted in full, `RE9801` accepted and corrected in part, `RE9901` justified but corrected, `RE9502` raised after the payer's term) and what it concedes; the payer then decides by `decideBy` (10 business days in Colombia). `accept` makes it stand for an amount: the provider concedes it before answering, or the payer upholds it after the answer, in full or in part, on `decidedOn`; `reject` records that the payer lifted it after the answer; `expire` closes an unanswered one whose deadline passed before `today`, and it stands in full; `lapse` closes an answered one the payer did not decide by `decideBy`, and it falls; `escalate` takes what the payer upheld to conciliation or to the health superintendence; `settle` records what stands after it. A decided objection never changes otherwise. Send the `version` you read. `dryRun: true` checks everything and keeps nothing. Returns the objection with its new `version` and the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: an empty or too long response reference, an answer without its code where the jurisdiction codes answers, a negative concession or an amount out of range; fix it. `NOT_FOUND`: no such objection. `CONFLICT`: stale `expectedVersion`, a change its state does not allow, an answer outside arrival and deadline, a code that is not a provider's answer to an objection or does not fit what it concedes, a decision outside the answer and `decideBy`, an amount above the objected or upheld one, or a deadline not yet passed; read it again. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Pause, resume or cancel a workflow run](https://docs.getarbol.com/api/ambar/change-workflow-run/index.md) — Pauses a running or waiting run (nothing happens to it until it is resumed), resumes a paused run (the worker advances it at once, checking its guards again), or cancels a live run for good with a reason code such as `left_cohort`. Asking for the state the run already has changes nothing. Use it after a hand-over (the run paused for a person to act), when the patient leaves the cohort, or to stop one patient's outreach; to stop a whole workflow or cohort use `setWorkflowSwitch`. `dryRun: true` returns the result without keeping it. Returns the run as changed with the `requestKey`. Requires the `ambar:programs:read`, `ambar:patients:read` and `ambar:patients:write` scopes and a write grant on the patient. `INVALID_INPUT`: malformed input, `cancel` without a `reason`, or a `reason` for `pause` or `resume`. `NOT_FOUND`: no such run, or the caller cannot see it. `CONFLICT`: the worker is advancing the run right now (retry after `leasedUntil`, within seconds), or the change does not apply: the run already ended, or a cancelled run cannot be paused or resumed. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Check an agent configuration](https://docs.getarbol.com/api/ambar/check-agent-config/index.md) — Reads a configuration as [12] section 1 writes it and runs the rules a version must pass, keeping nothing: a channel list without repeats, a voice only with the voice channel, a `provider` with the organization's Raíz installation and one Raíz profile for each channel and none other (every call and message goes through Raíz), a Spanish disclosure of 20 to 500 characters that says a virtual assistant speaks, at least one goal with its script, the tools every goal needs plus `record_outcome`, an urgent response time of at most 60 minutes and not longer than the normal one, a warm transfer only with voice, contact hours for exactly the channels used, and limits in range. With the voice channel, and only with it, the limits carry the call's length and how long a call waits for each tool ([12] section 10): `tool_wait` with `silence_seconds` (1 to 5, the design's 2) and `hold_seconds` (longer, at most 15, the design's 8). Past that wait the caller promises nothing, takes the person's preference and ends with `booking_pending`, which the workflow routes to a WhatsApp confirmation. Use it before `addAgentVersion`, which refuses a configuration that breaks a rule, to learn which rule. Returns `valid`, the first broken rule's `code` (for example `AGENT_DISCLOSURE_INVALID`) or why the JSON is `unreadable`. Requires the `ambar:programs:read` scope. `INVALID_INPUT`: `config` is not a JSON object; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [Check a TEDEF batch before sending it to the IAFAS](https://docs.getarbol.com/api/ambar/check-billing-transaction/index.md) — Checks a batch of TEDEF files (Resolución de Superintendencia N.° 043-2025-SUSALUD/S) against the rules of annexes 1 and 3 that the files and their invoice decide without SUSALUD's tables: every record of its table's length (tables 3 and 4 with or without their optional fields) and of single-byte characters; every mandatory field filled and every field in its shape (digits, dates `AAAAMMDD`, times `HHMMSS`, amounts `999999999.99`, CIE-10 at the subcategory level) and among the codes the annex lists; a DNI of eight digits, a RUC of eleven, a RENIPRESS code of eight and an IAFAS code of five; under mechanisms `02`, `04` and `06` the pre-agreed amount and the start of its period; a note's fields only with a note, and the professional's, the referral's and the hospitalization's fields only when they apply; the document issued on or before it is sent and every service on or after its prestación began; one header per document, as many prestaciones as it counts numbered from 1, every record of a document and a prestación the tables hold and no key twice; a prestación's covered total, the document's copayments, exempt amount, taxable base and total, and each service's value against its units within 0.25 soles per prestación; and, with `invoiceRef`, the invoice's number, day, mechanism, currency and total. A batch larger than one request (16 MiB, about 18,000 prestaciones; a document holds up to 99,999) is checked in parts with `part`: each part carries `dfac` whole and a slice of the other files cut between prestaciones (each prestación's records with its record of `date`, the prestaciones in their documents' order and by position), `dfac`'s own rules and the invoice are checked in the first part, and the answer's `carry`, passed with the next part, brings what runs across parts: each document's numbering, count and totals, checked once its last prestación has passed or with the part marked `last`. Nothing is kept between parts. Whether a code is in SUSALUD's registries, the RUC's check digit and the expense by accounting group are SUSALUD's to check. With `noteRef`, the note's kind, number and day against fields 25, 26 and 28. The files are read for the checks only: nothing is kept or logged. Use it after completing the files drafted with `draftBillingTransaction`, and fix every finding before zipping them and sending the batch. Returns the findings (rule, file, line, field, problem and the expected value when the rule says it, lines counted in the whole files), at most 1,000 per request, whether there were more, `passes` and, in parts, the `carry` of the next part. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: an invoice of another contract, `noteRef` without `invoiceRef`, a file name that is not one of the eight prefixes, files over 16 MB, a `carry` that is not the previous part's of the same request, or a `dfac` that changed between parts; fix it. `NOT_FOUND`: no such invoice or note on it, or you may not read it. `ACCESS_DENIED`: a missing scope; do not retry. - [Check a contract annex reading](https://docs.getarbol.com/api/ambar/check-contract-annex/index.md) — Checks the values of a contract annex reading as they stand (a person's correction in place of the model's value, rejected values left out), before the contract is configured from them ([05] section 9). The arithmetic allows exactly what rounding explains, half a unit of the last printed decimal of each rounded figure: the lines' values added up against the value per member, the population times the value per member against the monthly value, and each line's use rate × tariff ÷ 100,000 against the value it prints. It also flags lines whose national code the release in force does not carry, zero-rate lines, repeated payer codes, binding documents the annex does not include, the clauses that wait for them, and indicator weights that do not make 100. Use it after the reading is extracted and again after people correct values: explain each finding with its `citations` (page, lines and quote of the original), have people correct misread values with `decideDocumentValue`, ask for the binding documents that are missing, and only then draft the contract. Pass `contractId` so the national codes are checked against the catalog of the payer's country. Returns `figures` (lines, payer and national codes counted; `valuePerMember` and `monthlyValue` with their gap and tolerance, `null` when a figure is missing) and `findings`, each with the citations of the values it rests on. Nothing is written. Requires `ambar:patients:read` and `ambar:contracts:read`, with the registry-wide patient grant for care operations, which reads documents without a patient. `INVALID_INPUT`: a malformed `readingId` or `contractId`; fix it. `NOT_FOUND`: no such reading, or the caller may not see it. `CONFLICT`: the reading is not a contract annex or its values are not extracted yet; read it with `getDocumentReading`. `ACCESS_DENIED`: missing scope, or clinical privacy not configured; do not retry. - [Check whether a person is active with a payer](https://docs.getarbol.com/api/ambar/check-eligibility/index.md) — Answers whether the patient is active with the payer on the day. The payer's population files answer first: `active` when an affiliation with the payer covers the day, `inactive` when none does, `unknown` when the payer's newest cut does not describe the day (a cut answers for its month and the 10 days after it). When they cannot tell and the organization has an active installation that answers for the payer (`payer-eligibility-service`, or `custom-http-eligibility` for a service with its own API), the payer's own service is asked with the patient's identity document; its answer is returned with `source: payer_service`, kept in custody and queued so it loads into the patient's record as `eligibility.checked`. `payerService` says whether the service was needed, configured and answered. An answer the payer's service gave before that still holds for the day is returned without asking again (`payerService: remembered`). Each answer says until when it may be used. A payer's service that takes longer than 3 seconds is not waited for: the answer is `202` with `status: unknown` and `payerService: pending` while the question goes on. Send the same request again a few seconds later to get the service's answer as `remembered`, or wait for the patient's `eligibility.checked` event. Use it before contacting or booking under a payer's contract: only a current `active` allows it. `dryRun: true` asks but keeps nothing, and waits for the service however long it takes. Returns the answer with the `requestKey`: `200` when it is final, `202` when the payer's service is still answering. Requires `ambar:patients:read` and a read grant on the patient for care operations. `INVALID_INPUT`: malformed body; fix it. `ACCESS_DENIED`: missing scope or patient grant, or clinical privacy not configured; do not retry. - [Check a protection and early detection report file before sending it](https://docs.getarbol.com/api/ambar/check-protection-report/index.md) — Checks a part of a protection and early detection report file (Resolución 202 de 2021, Anexo Técnico 1) against the rules the annex states and the file decides by itself, without the SISPRO reference tables: the file's name (`SGD280RPED`, the quarter's last day, the entity's identification, the regime, the sequence, `.TXT`); the control record (type `1`, the entity's code, the quarter's first and last days, the name's cut-off, the number of detail records); and each detail record (119 fields, type `2`, positions from 1 by 1, each value of its type and length and one of its codes where the variable takes only those, capitals without accents, required values present). As notices: a blank value in a variable the annex does not mark required, a date after the quarter (but the expected delivery date), a date before the person's birth, and the same identity document twice in the part. A long file is checked in parts of up to 5,000 lines: the first part from line 1 with the name and the number of detail records, each next part from the line the previous one ended. The lines are read for the checks only: nothing is kept or logged. With `file=nped` it checks a novelties file (Anexo Técnico 2) instead: its name (`SGD280NPED`…), a control record of four fields without a count, and records of 11 values; as notices, a new document type or number without its value, and the same person with two document novelties or the same novelty twice (the ministry's guidelines for the novelties, which the 2021 annex does not restate). Use it after completing a file drafted with `draftProtectionReport` and fix every rejection before sending it to the payer or to PISIS. Returns the findings (severity, line, field, problem and the expected value when one says it), how many reject and how many only notify, whether the list was cut at 1,000, and `passes`. Requires `ambar:contracts:read`. `INVALID_INPUT`: a quarter before 2021 or other than 1 to 4, more than 5,000 lines or a line longer than 2,048 characters, a name longer than 64, or a body over 12 MB; fix it. `ACCESS_DENIED`: a missing scope; do not retry. - [Check a drafted rule catalog](https://docs.getarbol.com/api/ambar/check-rule-catalog/index.md) — Checks a drafted catalog with the checks a proposal meets, keeping nothing: its shape (`RULE_CATALOG_UNREADABLE`: unknown kind or field, a missing value), the ranges of the rule that reads it (`CLINICAL_RULE_THRESHOLD_INVALID`, `CLINICAL_RULE_WINDOW_INVALID`, `CLINICAL_RULE_CODES_INVALID`, `CLINICAL_RULE_SOURCE_INVALID`) and, for CAC rules, that every rule fits its field in the template (`CAC_RULE_INVALID`, with the codes of the fields to fix in `fields`). Use it while drafting a version, above all a large one such as the CAC rules, before `proposeRuleCatalogVersion`. Returns `accepted`, the stable `refusal` code (`null` when accepted) and `fields`. Requires one of `ambar:patients:read`, `ambar:cohorts:read` or `ambar:settings:read`. `INVALID_INPUT`: a body without `catalog`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [Check a RIPS file before sending it to the validator](https://docs.getarbol.com/api/ambar/check-service-record/index.md) — Checks a RIPS file (Resolución 948 de 2026) against the rules of Documento Técnico 1 (version 003) that the file and its invoice decide without the SISPRO reference tables: every key present and every required value filled; dates, codes and positions in the format's shape; every user with services and no user twice; services and egresses inside the invoice's period and not after now (a stay's admission or a birth may come before it); stay days (`tipoOS` 03) with the emergency observation or hospitalization that supports them; values above 0 for fee for service and 0 in every other modality, adding up to the invoice's value for fee for service; what users paid suiting its concept and adding up, per concept, to what the invoice credits; related diagnoses different from the main one and from each other; a newborn's measures within range; and, as notices, the advance concept in the file, a medication's value against its quantity, the prenatal visits and a stay's length (an emergency observation over 48 hours, a hospitalization under 6). A credit or debit note's file carries no payments, and a credit note's values add up to the note recorded on the invoice. The file is read for the checks only: nothing is kept or logged. Use it after completing a file drafted with `draftServiceRecord`, and fix every rejection before sending the file to the ministry's validator (MUV); then record the CUV it returns with `changeElectronicInvoice` (`validate`). Returns the findings (rule, severity, path, problem and the expected value when one says it), how many reject and how many only notify, and `passes`. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: a note without its number or the reverse, an invoice of another contract, or a file over 16 MB; fix it. `NOT_FOUND`: no such invoice, or you may not read it. `ACCESS_DENIED`: a missing scope; do not retry. - [Check a technical note before proposing or approving it](https://docs.getarbol.com/api/ambar/check-technical-note/index.md) — Checks one technical note as proposing and approving it will: what it lacks of the Decreto 441 de 2022 (the risk characterization of its population, the total value of the agreement and a monitoring periodicity shorter than its validity), its lines' codes against the national procedure catalog release in force on its first day (CUPS in Colombia, CPMS in Peru; IUM, CUM and DCI by their shape), and its total against what its lines are worth over its validity and against the PGP components it binds when they settle exactly its validity. Nothing is written. People only. Use it on a draft before `proposeTechnicalNote` and on a proposed note before `approveTechnicalNote`: fix what `missing` and the blocking `codeProblems` list by saving a new note, and review `linesDifference`. Returns `missing`, `nationalCodeSystem`, `codeProblems`, `value`, `linesDifference` and `ready`; `NOT_FOUND` when the note is not this contract's. Failures: `ACCESS_DENIED`: not a person, missing `ambar:contracts:read`, or no read grant for the contract; do not retry. `INVALID_INPUT`: fix the identifiers. `DATABASE_UNAVAILABLE`: retry later. - [Clear the report that a patient's phone reaches someone else](https://docs.getarbol.com/api/ambar/clear-wrong-phone/index.md) — Clears the report that a patient's phone reaches someone else, once a person confirmed with the patient that the number is theirs, or found the report was a mistake, with a reason code such as `confirmed_with_patient`. While a report stands (`phoneReportedWrongAt` in `getPatient`) nobody calls or writes to that number; once it is cleared, workflows, campaigns and care cases contact the patient by phone again. A workflow run that handed its call to a person stays paused until someone resumes it with `changeWorkflowRun`. When the number really is wrong, do not clear it: record the right number with `updatePatient`, which lifts the hold by itself. `dryRun: true` checks everything and keeps nothing. Clearing again changes nothing. Returns how many reports it cleared (`clearedReports`, `0` when none stood) and the `requestKey`. Requires `ambar:patients:read`, `ambar:patients:write` and a write grant on the patient. Errors: `INVALID_INPUT` (a malformed body or `reason`: fix it); `ACCESS_DENIED` (a missing scope or grant: do not retry); `DATABASE_UNAVAILABLE` (retry the same body later). - [End a site's period in a contract's network](https://docs.getarbol.com/api/ambar/close-contract-network-site/index.md) — Ends the open period of a site that started on `validFrom`: the site stays in the network until `validTo`, included. To change its terms, end it and add a new period. Ending it again on the same day changes nothing; `dryRun: true` returns the result without keeping it. Returns the site period with the `requestKey`. Requires the `ambar:contracts:read` and `ambar:contracts:write` scopes and a write grant on the contract. `INVALID_INPUT`: `validTo` before `validFrom` or malformed input. `NOT_FOUND`: no period starts on `validFrom`. `CONFLICT`: it already ended on another day. `ACCESS_DENIED`: missing scope or grant; do not retry. - [End a contracted site's period](https://docs.getarbol.com/api/ambar/close-contracted-site/index.md) — Ends the open period of a contracted site that started on `validFrom`: the site stays a contracted site of the contract until `validTo`, included. What was attributed to it before keeps counting there. Use it when the contract stops naming the site; to change its dates, end it and add a new period. Ending it again on the same day changes nothing; `dryRun: true` returns the result without keeping it. Returns the period with the `requestKey`. Requires the `ambar:contracts:read` and `ambar:contracts:write` scopes and a write grant on the contract. `INVALID_INPUT`: `validTo` before `validFrom`, or malformed input. `NOT_FOUND`: no period of the site starts on `validFrom`. `CONFLICT`: it already ended on another day. `ACCESS_DENIED`: missing scope or grant; do not retry. - [End a site substitution's period](https://docs.getarbol.com/api/ambar/close-site-substitution/index.md) — Ends the open period of the substitution of `contractedSiteId` by `servingSiteId` that started on `validFrom`: it holds until `validTo`, included. Slot searches after that day no longer ask the serving site for the contracted one. Use it when the contract stops allowing the substitution; to change its terms, end it and add a new period. Ending it again on the same day changes nothing; `dryRun: true` returns the result without keeping it. Returns the period with the `requestKey`. Requires the `ambar:contracts:read` and `ambar:contracts:write` scopes and a write grant on the contract. `INVALID_INPUT`: `validTo` before `validFrom`, or malformed input. `NOT_FOUND`: no period of that pair of sites starts on `validFrom`. `CONFLICT`: it already ended on another day. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Compare a workflow's calls by who made them](https://docs.getarbol.com/api/ambar/compare-call-handling/index.md) — Compares, over a period, the calls a workflow's `handling` shares out between its agent and people, with people's calls as the agent's baseline. Each person falls on one side by a draw fixed to them, so both sides are random samples of the same people. Each side counts the calls the draw gave it, whoever made them: a call that overflowed to the agent because people held all the calls they can take stays on the people's side (`byAgent` counts them). Only the calls the draw sides count: calls the agent could make, in versions with `handling`. Rates are shares from 0 to 1 of the reported calls: `booked`, `reached` (any outcome but `no_answer`) and `redFlags`, each as counted (`crude`) and `adjusted` to both sides' mix of clinical priority (the tens of the person's points in the workflow's cohort when the call was handed over), leaving out the strata only one side reached (`strataLeftOut`). `minutesToOutcome` runs from handover to outcome; talk time does not reach Ámbar. With prices (`agentCallMinor`, `peopleCallMinor` and `currency`), `costPerCall` and `costPerBooking` price each reported call at its maker's price. Use it to judge whether to raise or lower the agent's share (`agent_share` in the definition, changed through a new version): compare the `adjusted` rates first, and say how many calls each side reported, since a difference over few calls may be chance. Returns the period, the versions that share calls out with their `agentShare` and `peopleCapacity`, `agent`, `people`, `strataLeftOut` and the prices' `currency`. Only the calls of patients the caller has a grant on count, so without a grant on every patient of the workflow the comparison covers part of it. Requires the `ambar:programs:read` and `ambar:patients:read` scopes and a read grant on `workflow`. `INVALID_INPUT`: malformed `workflowId`, `from` or `until`; `until` not after `from` or more than 366 days later; prices without all of `agentCallMinor`, `peopleCallMinor` and `currency`; or more than 1,000 calls across the workflow's versions. `NOT_FOUND`: no such workflow, or no read grant on it; list them with `listWorkflows`. `ACCESS_DENIED`: missing scope; do not retry. - [Compute when an invoice that applies an advance is due](https://docs.getarbol.com/api/ambar/compute-advance-invoice-deadline/index.md) — Computes the last day to issue the invoice that applies a payer's advance, with the jurisdiction's legal terms and holidays: for capitation, counted from the day the advance arrived (5 business days in Colombia); for PGP, the first business days of the month after the month the advance paid (Resolución 1809 de 2026, art. 6, from 1 November 2026). Without the invoice in time the direct payment is suspended (art. 11). Use it when an advance arrives, to plan the invoice. Returns the day, the term applied and its norm to verify. Requires `ambar:contracts:read`. `INVALID_INPUT`: a modality other than capitation or PGP, or its day missing; fix it. `NOT_FOUND`: no profile for the country. `ACCESS_DENIED`: missing scope; do not retry. - [Confirm how a capitation pricing applies](https://docs.getarbol.com/api/ambar/confirm-capitation-pricing/index.md) — Confirms a capitation pricing's interpretation in the confirming person's words, which lets it price the component: from then on `proposeContractSettlement` prices each month's covered days by the tariff that matches them, on the pricing's day basis, and `createContractSettlement` requires the days each tariff prices (`inputCut.tariffDays`). A confirmed pricing never changes; to change it, propose a new contract version. Use it after reading the pricing and its passage with `listCapitationPricing`. `dryRun: true` checks everything and keeps nothing. Returns the pricing, now `applies: true`, with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:approve`, an approve grant on the contract, and that you did not record the pricing. `NOT_FOUND`: the component has no pricing. `CONFLICT`: you recorded it (another person must confirm it) or it is already confirmed with another interpretation; read it again. `INVALID_INPUT`: an interpretation that is empty or longer than 4,000 characters. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Confirm how a clause applies](https://docs.getarbol.com/api/ambar/confirm-contract-clause/index.md) — Confirms a clause's interpretation in the confirming person's words, which lets it move money: from then on its effect counts in what the clauses add to a period's payment. A confirmed clause never changes; to change it, propose a new contract version. Use it after reading the clause and its source passage with `listContractClauses`; the binding guide of the contract decides ambiguous readings (for example whether one breach keeps the whole retention). `dryRun: true` checks everything and keeps nothing. Returns the clause, now `movesMoney: true`, with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:approve`, an approve grant on the contract, and that you did not record the clause. `NOT_FOUND`: no clause at that position. `CONFLICT`: you recorded the clause (another person must confirm it) or it is already confirmed with another interpretation; read it again. `INVALID_INPUT`: an interpretation that is empty or longer than 4,000 characters. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Confirm an indicator's measure and target](https://docs.getarbol.com/api/ambar/confirm-contract-indicator-measure/index.md) — Confirms how a contract version measures one of its indicators and its target, which lets a month's result decide whether the indicator was met: from then on a met month releases its share of a pay-for-results retention and a breached one escalates under a penalty clause. A confirmed measure never changes. Use it after reading the measure and its source passage with `listContractIndicators` against the execution guide. `dryRun: true` checks everything and keeps nothing. Returns the measure, now `decidesMonths: true`, with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:approve`, an approve grant on the contract, and that you did not write the measure. `NOT_FOUND`: no measure for the indicator. `CONFLICT`: you wrote it (another person must confirm it) or someone else confirmed it. `INVALID_INPUT`: a malformed body. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Confirm the coverage recorded for a person who moved to a contract's payer](https://docs.getarbol.com/api/ambar/confirm-coverage-candidate/index.md) — Confirms a candidate of `listCoverageCandidates` with the coverage you recorded for the person with `recordContractCoverage` in one of its `contractIds`: a current, eligible coverage that still covers a day from their first day with the new payer on. The person's care goes on under that contract, and the candidate leaves the list. Use it right after recording the coverage. `dryRun: true` checks everything and keeps nothing. Confirming again the same way changes nothing. Returns the candidate, its `state` and the `requestKey`. Requires `ambar:patients:read`, `ambar:contracts:read` and `ambar:contracts:write`, a write grant on the contract and a read grant on the patient for contract finance. `INVALID_INPUT`: a malformed body, or a `contractId` that is not one of the candidate's; fix it. `NOT_FOUND`: no such candidate, or you hold no grant on its contracts. `CONFLICT`: the coverage is not a current, eligible coverage of the person in that contract from their first day with the new payer on (read it with `listContractCoverage`), or the candidate was resolved otherwise. `ACCESS_DENIED`: a missing scope or grant; do not retry. - [Confirm what a document is](https://docs.getarbol.com/api/ambar/confirm-document-kind/index.md) — Confirms or changes the kind of a reading in `kind_review`, the model having been unsure; the reading goes back to the reading worker, which extracts its values against the kind's schema. Use it from the review inbox, after looking at the original. `dryRun: true` checks and keeps nothing. Returns the reading, `queued`, with the `requestKey`. Requires `ambar:patients:read` and `ambar:patients:write`, and a write grant on the patient for care operations (the registry-wide one without a patient). `INVALID_INPUT`: malformed body; fix it. `NOT_FOUND`: no such reading, or the caller may not change it. `CONFLICT`: the reading is not in `kind_review` or the version is stale; read it again. `ACCESS_DENIED`: missing scope; do not retry. - [Confirm a version of a payer report template](https://docs.getarbol.com/api/ambar/confirm-payer-report-template/index.md) — Confirms the version of a payer report template you reviewed: from then on it is the template's version in force, the one `draftPayerReport` follows, until a newer version is confirmed. A confirmed version never changes. Name the `version` you read: a version written again since is replaced and cannot be confirmed, so what you confirm is exactly what you reviewed. Use it after reading the template's `pending` version with `listPayerReportTemplates` against the contract's annex or the payer's instruction, with a month drafted from it (`draftPayerReport` with its `version`). `dryRun: true` checks everything and keeps nothing. Returns the version, now `confirmed: true`, with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:approve`, an approve grant on the contract (or on the payer's relation for a payer's template), and that you did not write the version. `NOT_FOUND`: no such template you may read. `CONFLICT`: that version was written again since (read the template again), you wrote it (another person must confirm it) or someone else confirmed it. `INVALID_INPUT`: a malformed body. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Correct a documented appointment](https://docs.getarbol.com/api/ambar/correct-documented-appointment/index.md) — Replace the content of an active documented appointment with a new revision; earlier revisions stay in its history. `expectedVersion` must be its current `version` (not `"0"`). Use `retractDocumentedAppointment` when it should no longer stand. Returns a receipt with the new `version`. Idempotency: the same `requestKey` with the same input returns the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `CONFLICT`: stale `expectedVersion`, unknown or retracted appointment, or a care provider or care site that is missing, not linked, or inactive (unless the current selection is kept). `INVALID_INPUT`, `ACCESS_DENIED` and `COMMIT_UNCERTAIN` mean the same as for `recordDocumentedAppointment`. - [Correct who pays a routed service, with a reason](https://docs.getarbol.com/api/ambar/correct-service-route/index.md) — Routes one delivered service to a contract component, or marks it as not billable, as a person's correction with a reason code. It wins over the router's decision now and whenever the router decides again; a later correction replaces it. The component must belong to a contract that covered the person on the service's day; for a PGP bound to a technical note, name one of that note's lines in `line`: `noteNumber`, the newest approved note in force that day that binds the component (the one `listTechnicalNotes` shows for the contract), and `lineKey`, any of its lines, which is how a code two lines list is settled. `line` is `null` for any other component. `dryRun: true` checks everything and returns the result without keeping it. Use it on a service `listServiceRoutes` shows waiting for a person (`needs_person`) or routed where it should not be, with the `version` you read there: when the person holds an authorization, the payer instructed it, or the service is not billable. Returns `route`, the service as kept (its `patient` label is `null` here), and `dryRun`. Requires `ambar:patients:write` and `ambar:contracts:write`, and for care operations the patient's write grant and the write grant of the contract that pays the service now and of the one you route it to. `INVALID_INPUT`: a malformed body, a reason that is not a reason code, a note line the component does not take, or the route already in force; fix it. `NOT_FOUND`: no such service of a current encounter, or you may not correct it (the patient's or the paying contract's write grant is missing). `CONFLICT`: the service changed since `expectedVersion` (read it again with `listServiceRoutes`; after a retry of a correction that was kept, it is already in force), or the component is not one of the contracts that covered the person that day that you hold a grant on. `ACCESS_DENIED`: a missing scope, or the write grant of the contract you route it to; do not retry. - [Create a manual table row](https://docs.getarbol.com/api/ambar/create-analytical-table-row/index.md) — Adds one row to one of your active manual (`custom`) analytical tables. `cells` maps declared column keys to values: `number` (finite number), `checkbox` (boolean), `date` (`YYYY-MM-DD`), `text`, `single_select` or `url` (string up to 4000 bytes), `multi_select` (up to 50 strings of 200 bytes), `json` (up to 4000 bytes), or `null`. Undeclared keys are refused. At most 200 rows per table. Values are declared by a person (`provenance.kind` `manual`), never computed clinical facts. Use updateAnalyticalTableCell to change a row later. Returns the stored row (`kind` `row`, `parentId` = the table). Idempotency: the same `requestKey` with the same body returns the stored result; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: NOT_FOUND when the table does not exist, is not yours, is inactive or is a query table; CONFLICT when the row id already exists; RESOURCE_LIMIT_EXCEEDED at 200 rows or for a row larger than about 8 KiB; INVALID_INPUT when a value does not fit its column; ACCESS_DENIED when the table changed meanwhile (read it again), the token lacks `ambar:patients:read` or `ambar:patients:write`, or you lack clinical write access or an analytics authoring grant. - [Create a care provider](https://docs.getarbol.com/api/ambar/create-care-provider/index.md) — Create a care provider (organization) in the operational directory; `expectedVersion` must be `"0"`. It never connects to or contacts the organization. Use `updateCareProvider` to change an existing one. A payer (health insurer) is not a care provider and `kind` has no payer value: add it to the organization with `savePayer`. Requires a human caller or explicitly delegated internal operator with the `ambar:operations:write` scope. Returns a receipt with `id` and `version` `"1"`. Idempotency: the same `requestKey` with the same input returns the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `CONFLICT`: the `id` already exists (choose another) or the content failed a server check. `INVALID_INPUT`: a field is malformed, `kind` is not a care provider kind (a payer goes to `savePayer`) or `expectedVersion` is not `"0"`. `ACCESS_DENIED`: missing scope or directory write grant; do not retry. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input to learn the outcome. - [Create a care site](https://docs.getarbol.com/api/ambar/create-care-site/index.md) — Create a care site under an existing care provider; `expectedVersion` must be `"0"`. An `active` care site needs an `active` care provider. Use `updateCareSite` to change it later. Requires a human caller or explicitly delegated internal operator with the `ambar:operations:write` scope. Returns a receipt with `id` and `version` `"1"`. Idempotency: the same `requestKey` with the same input returns the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `CONFLICT`: the `id` already exists, the care provider does not exist, or it is inactive while the care site is `active`. `INVALID_INPUT`: a field is malformed. `ACCESS_DENIED`: missing scope, no write grant on the care site or no read grant on the care provider; do not retry. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input to learn the outcome. - [Create a cohort](https://docs.getarbol.com/api/ambar/create-cohort/index.md) — Creates a cohort in `draft` status at version 1. A cohort is a candidate list; it never enrolls or contacts a patient. Next steps: updateCohort to activate it (`active`), then snapshotCohort to freeze members. For a rule-based cohort with a review policy, use saveCohortWorkspace instead. Returns the saved cohort. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when the id already exists (pick another id); INVALID_INPUT for invalid fields; ACCESS_DENIED without a write grant for this cohort. COMMIT_UNCERTAIN: retry with the same `requestKey` (or call getCohort) before doing anything else. - [Create a configured record](https://docs.getarbol.com/api/ambar/create-configured-record/index.md) — Creates one configured record for a patient or cohort from a specific record template version: the raw values from one source sheet, one entry per template field (required fields not blank). Records are immutable once created and stop being readable after `retentionUntil`. Send the patient's or cohort's current version as `expectedParentVersion`. Requires a person with `ambar:patients:write` or `ambar:cohorts:write`, write access to an active patient or cohort, and `ambar:contracts:read` when `contractId` is set. Returns the record `id`, template version, `retentionUntil` and `recordedAt`. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: CONFLICT when `expectedParentVersion` is stale, the template version is no longer available, or the `id` exists; NOT_FOUND when the template version does not exist for that kind of record; CAPABILITY_NOT_CONFIGURED when the template cannot be decrypted; RESOURCE_LIMIT_EXCEEDED when no retention policy applies (cohort records need one); ACCESS_DENIED when a scope or access is missing or the contract is suspended; INVALID_INPUT when source fields do not match the template. - [Create a contract settlement](https://docs.getarbol.com/api/ambar/create-contract-settlement/index.md) — Calculates a settlement for one component's whole period from approved terms, a manual input cut and optional adjustments. No invoice or payment is made. Needs `ambar:settlements:write`. A complete cut (with `memberDays` for capitation, `invoicedMinor` and `lostObjectionsMinor` for fee for service) gives a `draft` with an exact calculation, else `not_evaluable`; another person accepts drafts with `acceptContractSettlement`. To amend an accepted close, send it as `supersedesId`. Idempotent by `requestKey` (scoped to you): the same key and input return the current state; the same key with other input fails with `IDEMPOTENCY_CONFLICT`. Failures: `CONFLICT`: contract not active, terms not current, period already closed (send `supersedesId`), denominator mismatch, cutoff in the future or too early, or unverified document; re-read and fix. `CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED`: terms change components fixed by an accepted close. `ACCESS_DENIED`: missing scope or grant. `INVALID_INPUT`: fix the input (body up to 192 KiB). `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend with the same `requestKey`. - [Create a clinical contract](https://docs.getarbol.com/api/ambar/create-contract/index.md) — Creates a contract in `draft` without terms. Add terms with `proposeContractVersion`; another person approves them with `approveContractVersion`. Returns the saved `contract` (`version` 1). Idempotent by `requestKey` (scoped to you): the same key with the same input creates nothing new and returns the contract's current state; the same key with different input fails with `IDEMPOTENCY_CONFLICT`. Failures: `INVALID_INPUT`: fix the fields. `ACCESS_DENIED`: missing `ambar:contracts:write` or no write grant; do not retry. `CONFLICT`: the `id` or the `externalNamespace` + `externalKey` pair already exists; look it up instead. `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend the identical request with the same `requestKey`. - [Register a dataset](https://docs.getarbol.com/api/ambar/create-dataset/index.md) — Registers the metadata of one dataset under identifiers you choose. It starts as `draft`, `external` and `non_personal`; nothing is uploaded and no access is granted. Use it only for a dataset id already approved for your organization; uploads go through createIngestion. Returns the stored metadata with its `version` and `createdAt`. There is no request key: after COMMIT_UNCERTAIN or a lost response, call getDataset; sending the same body again fails with CONFLICT when the first attempt was stored. Failures: CONFLICT when the `id`, or the `datasetKey` within that source, already exists or `sourceSystemId` is unknown (change the identifiers); ACCESS_DENIED when the token lacks `ambar:datasets:write` or the database refuses this registration (do not retry); INVALID_INPUT for malformed identifiers. - [Upload inventory](https://docs.getarbol.com/api/ambar/create-ingestion/index.md) — Uploads one inventory file (tuple JSON or CSV) to a dataset: the content is parsed and hashed, the exact original bytes are stored, and processing then continues in the background until the new build is published. Get `parserVersion` and `generation` from listIngestionDatasets. Returns the upload receipt, normally `admitted`; follow it with getIngestion and read the result with getInventory or getDataProduct. Idempotency: the `idempotencyKey` identifies the upload within the dataset. Sending the same key with the same content returns the original receipt (and finishes storing the bytes if a first attempt stopped half way); the same key with different content, generation or parser, or from another person, fails with CONFLICT. Never invent a new key for the same file; after COMMIT_UNCERTAIN or PIPELINE_UNAVAILABLE, retry with the same key. Failures: INVALID_INVENTORY when the content does not parse under `parserVersion` (fix the file); CONFLICT when `expectedGeneration` is not current (read it again), the parser differs from the dataset's, or the key was used differently; ACCESS_DENIED when the token lacks `ambar:ingestions:write` or you may not upload to this dataset now; PIPELINE_UNAVAILABLE when storage is unavailable (retry later with the same key); INVALID_INPUT for malformed fields. - [Create a patient](https://docs.getarbol.com/api/ambar/create-patient/index.md) — Creates a patient with status `active` and returns it with `version` `1`. Call `lookupPatients` first to avoid duplicates; to change an existing patient use `updatePatient`. Requires `ambar:patients:read` and `ambar:patients:write`, a registry-wide patient write grant and an enabled clinical policy. Idempotency: retrying with the same `idempotencyKey` and identical body saves nothing new and returns the patient's current state; the same key with a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (missing scope, grant or policy: do not retry); `IDEMPOTENCY_CONFLICT` (use a new key for a new request); `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE` (retry with the same key and body to learn the outcome). - [Create a program](https://docs.getarbol.com/api/ambar/create-program/index.md) — Creates a cohort program in `draft` status at version 1, optionally linked to a cohort. It enrolls nobody. Next step: updateProgram to activate it. For a program with an outreach configuration use saveProgramWorkspace, or instantiateProgramTemplate for the template set. Returns the saved program. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when the id already exists (pick another id); ACCESS_DENIED without a write grant for the program or read access to the linked cohort; INVALID_INPUT. COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Create a saved analytic](https://docs.getarbol.com/api/ambar/create-saved-analytic/index.md) — Creates a private saved analytic (version 1) for one inventory dataset under an `id` you choose. It is visible only to you and grants no access to the dataset. Use updateSavedAnalytic to change an existing one. At most 200 saved analytics per person and dataset. Returns the stored definition in `view`. Idempotency: the same `requestKey` with the same body returns the original result. Reusing the key with a different body fails with CONFLICT (not IDEMPOTENCY_CONFLICT). After COMMIT_UNCERTAIN, retry with the same key or call getSavedAnalytic. Failures: CONFLICT when the `id` already exists, the key was used for different input, or the 200 limit is reached; ACCESS_DENIED when the token lacks `ambar:datasets:read` or `ambar:datasets:write`, or the dataset is not readable or has no supported inventory contract; INVALID_INPUT for malformed fields or an `item` that does not fit the metric. - [Create a study order](https://docs.getarbol.com/api/ambar/create-study-order/index.md) — Creates a `proposed` study order for an `active` patient against the active approved revision of a study definition. It does not schedule or deliver anything. Use it to request a study; a human then authorizes or declines it with `decideStudyOrder`. Requires `ambar:studies:read`, `ambar:studies:write`, `ambar:patients:read` and `ambar:patients:write`, plus `ambar:programs:read` and `ambar:programs:write` when `programId` is set. Returns a receipt with the order `id` and `version` `1`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (missing scope or grant, patient not active, or program not readable); `CONFLICT` (definition version not active, program not active, or order id already used); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Create a study submission](https://docs.getarbol.com/api/ambar/create-study-submission/index.md) — Stores source content for studies (for example a received report) as an `unresolved` submission, encrypted and not linked to any patient. Use it when the source's patient is not confirmed yet; a human later links it with `linkStudySubmission`. It never creates or matches a patient. Retention follows the tenant clinical policy. Requires `ambar:studies:read` and `ambar:studies:write`. Returns a receipt with the submission `id` and `version` `1`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (missing scope or grant, or no enabled clinical policy); `CONFLICT` (submission id already used); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Subscribe an endpoint to patient events](https://docs.getarbol.com/api/ambar/create-webhook-subscription/index.md) — Subscribes an HTTPS endpoint of the organization's own system, through one of its installations, to kinds of events loaded into the patient record. From then on (never earlier events), each event of those kinds is POSTed about a minute after it is loaded, while the subscription is `active` and the installation is `active`. A delivery is a thin JSON notification (`id`, `subscriptionId`, `kind`, `patientId`, `eventSeq`, `occurredAt`, the source's `installationId`, `externalId` and `externalVersion`, and `attempt`), signed like inbound webhooks: `x-ambar-timestamp`, `x-ambar-signature` (`v1=` and the HMAC-SHA256 of `{timestamp}.{body}` with the installation's `webhook_signing_key`) and `x-ambar-delivery` (the notification id; drop repeats by it). A 2xx answer delivers it; anything else is tried again after 1, 5 and 30 minutes and 2, 6, 12 and 24 hours, then abandoned. The receiver reads the details with the patient record API under its own service account. Use `listInstallations` first for `installationId`; its credentials entry must hold `webhook_signing_key`. To change the endpoint or the kinds, create another subscription and pause this one. `dryRun: true` checks everything and keeps nothing. Returns the subscription, `active`, with the `requestKey`. Requires `ambar:settings:read` and `ambar:settings:write`, a person, and a workspace configuration write grant. `INVALID_INPUT`: malformed body, an endpoint that is not HTTPS on the public internet, or a kind outside the catalog or without a patient; fix it. `NOT_FOUND`: no such installation. `INSTALLATION_NOT_READY`: the installation's credentials entry has no `webhook_signing_key`; an operator adds it, then retry. `CONFLICT`: the `subscriptionId` is taken or the installation is uninstalled; choose another. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Create a workflow](https://docs.getarbol.com/api/ambar/create-workflow/index.md) — Creates a workflow with its title, cohort and program, before its first version. The cohort matters: switching it off pauses the workflow's runs. Use it once per workflow; then add versions with `addWorkflowVersion`. `dryRun: true` returns the result without keeping it. Returns the workflow with the `requestKey`. Requires the `ambar:programs:read` and `ambar:programs:write` scopes and a write grant on `workflow`. `INVALID_INPUT`: malformed `workflowId`, `title` or `requestKey`. `CONFLICT`: the workflow id is taken; add a version to it instead. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Deactivate an analytical table](https://docs.getarbol.com/api/ambar/deactivate-analytical-table/index.md) — Marks one of your analytical tables `inactive` by writing a new version that keeps its definition; its rows can no longer be read or changed and it leaves the SQL catalog. Send its current `version` as `expectedVersion`. A query table's SQL is validated again. Saving the table again with saveAnalyticalTable makes it active. Returns the inactive table. Idempotency: the same `requestKey` with the same body returns the stored result; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: NOT_FOUND when the id does not exist or is not visible to you; CONFLICT when it is not a table or `expectedVersion` is stale (read again); ANALYTICS_QUERY_REJECTED or ANALYTICS_QUERY_LIMIT when a query table's SQL no longer runs; EVIDENCE_NOT_READABLE when it cannot be decrypted now; ACCESS_DENIED when the token lacks `ambar:patients:read` or `ambar:patients:write`, the caller is not a person, or you lack clinical write access or an analytics authoring grant for the scope. - [Deactivate an analytics board](https://docs.getarbol.com/api/ambar/deactivate-analytics-board/index.md) — Marks one of your boards `inactive` by writing a new version that keeps its definition. Send the board's current `version` as `expectedVersion`. Saving the board again with saveAnalyticsBoard makes it active. Returns the inactive board. Idempotency: the same `requestKey` with the same body returns the stored result; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: NOT_FOUND when the id does not exist or is not visible to you; CONFLICT when it is not a board or `expectedVersion` is stale (read again); EVIDENCE_NOT_READABLE when it cannot be decrypted now; ACCESS_DENIED when the token lacks `ambar:patients:read` or `ambar:patients:write`, the caller is not a person, or you lack clinical write access or an analytics authoring grant for the scope; INVALID_INPUT for malformed fields. - [Acknowledge, dismiss or turn an alert into a case](https://docs.getarbol.com/api/ambar/decide-alert/index.md) — Decides one alert: `acknowledge` records that it was seen and keeps it in the inbox for a later decision (only from `open`); `dismiss` closes it with a `reason` (`not_clinically_relevant`, `already_managed`, `data_error`); `create_case` closes it into a case whose purpose follows the finding (a critical result's follow-up, a trend's review, an overdue control, adherence, no-shows, the follow-up of a hospitalization or of a missed red flag) and whose priority is the alert's severity. A closed alert never changes and its finding never alerts again; a later finding about the same subject opens a new alert. The `note` (what the physician asks for, or why it is dismissed) is kept sealed. Use it from the inbox after reading the alert with `getAlert`, with its `version`. `dryRun: true` checks and keeps nothing. Returns the alert with its case, its note and quoted words opened, and the `requestKey`. Identical retries under the same key return the original decision receipt, after current authority is checked, even when a later decision exists. Reusing a key for different semantic input returns `IDEMPOTENCY_CONFLICT`. A dry run consumes neither the key nor its receipt. Current reviewed-source status is reported separately from that original result. Requires the `ambar:patients:read` and `ambar:patients:write` scopes, a person (not an agent's service account), and the patient's write grant for care operations. `INVALID_INPUT`: malformed body, a `reason` without `dismiss` or missing with it, a `note` with `acknowledge`, or a note blank or longer than 2,000 characters; fix it. `NOT_FOUND`: no such alert, or the caller may not change it. `CONFLICT`: the version is stale (a newer finding refreshed it, or someone decided it), or the alert is closed or already acknowledged; read it again with `getAlert`. `BODY_TOO_LARGE`: the note does not fit once sealed; shorten it. `ACCESS_DENIED`: missing scope or grant, an agent deciding, or clinical privacy not configured for a note or for an alert with quoted words; do not retry. - [Enroll, reject or defer a case-finding candidate](https://docs.getarbol.com/api/ambar/decide-candidate/index.md) — Records the nurse's decision on one evaluation, once: `enrolled` (the person belongs to the cohort; send `enrollment` with the origin contract, which opens the enrollment in the same transaction unless the person is enrolled already), `rejected` (the suggestion was wrong) or `deferred` (not now, for example the person could not be reached). A rejection or a deferral needs a `reasonCode`. Every decision, with the tier and rule version it answers, is a label the medical team reads with `getCaseFindingLabels` to tune the rules. A later evaluation with new evidence can be decided again. Use it from the case-finding list after reading the evidence with `getCandidate`. `dryRun: true` checks and keeps nothing. Sending the same decision again answers it with `replayed: true`. Returns the evaluation with its decision, the enrollment version it opened and the `requestKey`. Requires `ambar:cohorts:read`, `ambar:cohorts:write`, `ambar:patients:read` and `ambar:patients:write`, a person (not an agent's service account), and the patient's write grant for care operations. `INVALID_INPUT`: malformed body, a reason that is not a code, a rejection or deferral without one, `enrolled` without `enrollment` or another decision with it; fix it. `NOT_FOUND`: no such evaluation, or the caller may not change it. `CONFLICT`: the evaluation was decided differently already, or the enrollment date comes before the person's current enrollment version; read it again with `getCandidate`. `ACCESS_DENIED`: missing scope or grant, or an agent deciding; do not retry. - [Decide a cohort candidate](https://docs.getarbol.com/api/ambar/decide-cohort-patient/index.md) — Records a person's decision on one evaluated candidate and publishes a new snapshot: `confirm` adds the patient (needs a current `match`), `reject` leaves the patient out. Send the latest `evaluationId` with its `policyVersion` and `baseSnapshotId`; both must still be current. The cohort must be `active`. Returns a receipt with the new `snapshotId`. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when the evaluation is not the latest, is stale or not a current match, or another member is no longer current: run reconcileCohortWorkspace, evaluate again, then decide. COHORT_ACTIVE_REQUIRED when the cohort is not active; RESOURCE_LIMIT_EXCEEDED above 10,000 members; ACCESS_DENIED without the approve grant, registry-wide patient read or as a non-human caller; INVALID_INPUT; COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Accept or withdraw a contract's liquidation acta](https://docs.getarbol.com/api/ambar/decide-contract-liquidation/index.md) — Accepts a proposed acta, with the acta the parties signed when there is one (`signedActa`: where it is kept and the SHA-256 of its bytes), or withdraws it so a new one may be proposed. Only another person than the proposer accepts it; the proposer may withdraw it. A decided acta never changes. Retrying with the same `requestKey` and body returns the acta as decided. Returns the acta with its `version` (`2`). Requires `ambar:contracts:read`, `ambar:settlements:read` and `ambar:settlements:write` (and `ambar:settlements:approve` to accept), and a write grant on the contract. `INVALID_INPUT`: malformed fields, a `signedActa` with a withdrawal, or an `expectedVersion` other than `1`; fix them. `CONFLICT`: the acta is not proposed or changed since you read it; read it again with `listContractLiquidations`. `ACCESS_DENIED`: missing scope or grant, or the proposer accepting their own acta; do not retry. - [Check whether a site may be booked for a contract](https://docs.getarbol.com/api/ambar/decide-contract-network-site/index.md) — Says whether booking at `siteId` on `day` stays inside the contract's network: `in_network` (book it), `needs_prior_authorization` (the payer must authorize it first) or `out_of_network` (a person must authorize it before booking). The patient keeps counting for the contract either way. Use it before booking outside the attributed municipality, and record the reason on the appointment. Requires the `ambar:contracts:read` scope and a read grant on the contract. `INVALID_INPUT`: malformed identifier or `day`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Accept or reject a contract's registration in SIIFA](https://docs.getarbol.com/api/ambar/decide-contract-siifa/index.md) — Records the organization's decision on the payer's registration of the contract in SIIFA: accepted, or rejected saying why, on a day not before the registration. A registration is decided once. Deciding the same again returns it; `dryRun: true` checks everything and keeps nothing. Returns the registration with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: a day before the registration or a rejection without its reason; fix it. `NOT_FOUND`: the payer has not registered it. `CONFLICT`: decided otherwise already; read `getContractSiifa`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Confirm, correct or reject a value read from a document](https://docs.getarbol.com/api/ambar/decide-document-value/index.md) — Decides one value of a reading, once: `confirm` keeps it as read, `correct` replaces it with the person's value (checked against the field's kind and, when cited, against the reading's text), and `reject` says the document does not show it. A value waiting in review or one accepted without a person can be decided; when no value waits any longer the reading is `settled`. A cited correction later teaches the sender's template where the value is printed, so its next documents read better. Use it from `getDocumentReading`, with the value's `version`. `dryRun: true` checks and keeps nothing. Returns the reading with the `requestKey`. Requires `ambar:patients:read` and `ambar:patients:write`, and a write grant on the patient for care operations (the registry-wide one without a patient). `INVALID_INPUT`: malformed body, a `correction` missing for `correct` or sent with another decision, a value that does not fit its field, or a citation not in the text; fix it. `NOT_FOUND`: no such reading or value, or the caller may not change it. `CONFLICT`: the value was decided already, its version is stale, or the reading is not in review; read it again. `ACCESS_DENIED`: missing scope, or clinical privacy not configured; do not retry. - [Approve or withdraw a data-sharing agreement](https://docs.getarbol.com/api/ambar/decide-lake-sharing-agreement/index.md) — Approves a proposed revision of a data-sharing agreement, or withdraws it. Only another person than the proposer approves it, while its validity is not over; only the proposer withdraws it. Once approved it applies within its validity and replaces the agreement's earlier revision; a decided revision never changes. Retrying with the same `requestKey` and body returns the revision as decided. Returns the revision with its `version` (`2`). Requires `ambar:settings:read` and `ambar:settings:write`, and a configuration write grant. `INVALID_INPUT`: malformed fields, an `expectedVersion` other than `1`, or approving a revision whose validity is over (propose another); fix them. `NOT_FOUND`: no such revision. `CONFLICT`: it is not proposed or changed since you read it; read it again with `listLakeSharingAgreements`. `ACCESS_DENIED`: missing scope or grant, the proposer approving their own revision, or another person withdrawing it; do not retry. - [Approve or withdraw a precedence among contract components](https://docs.getarbol.com/api/ambar/decide-routing-precedence/index.md) — Approves a proposed revision of the organization's precedence, or withdraws it. Only another person than the proposer approves it, while its first day has not passed; only the proposer withdraws it. Once approved, the router ranks by it every service from its first day on and decides again the services of those days whose payer the precedence decided and that no person corrected. A decided revision never changes. Retrying with the same `requestKey` and body returns the revision as decided. Returns the revision with its `version` (`2`). Requires `ambar:contracts:read` and `ambar:contracts:write` to withdraw, or `ambar:contracts:approve` to approve, and the matching grant (write or approve) on every contract the revision names and on every contract the revision in force on its first day names. `INVALID_INPUT`: malformed fields, an `expectedVersion` other than `1`, or approving a revision whose first day passed (propose another); fix them. `NOT_FOUND`: no such revision. `CONFLICT`: it is not proposed or changed since you read it; read it again with `listRoutingPrecedences`. `ACCESS_DENIED`: missing scope or grant, the proposer approving their own revision, or another person withdrawing it; do not retry. - [Decide a study order](https://docs.getarbol.com/api/ambar/decide-study-order/index.md) — Records a human decision on a `proposed` study order: `authorize` (optionally with a clinical `dueAt`) or `decline`, which is final. Read the order with `getStudyOrder` and send its `version` as `expectedVersion`. Authorizing requires an `active` patient. Requires a human caller with `ambar:studies:read`, `ambar:studies:review`, `ambar:patients:read` and `ambar:patients:review`. Returns a receipt with the order `id` and new `version`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body, for example `dueAt` with `decline`); `ACCESS_DENIED` (not human, missing scope or approve grant, or order not visible); `CONFLICT` (version changed or the order is not `proposed`: re-read); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Write how an indicator that moves money is measured, and its target](https://docs.getarbol.com/api/ambar/define-contract-indicator-measure/index.md) — Writes the formula of one of a contract version's weighed indicators over the quantities Ámbar counts for a contract's month, whether more or less is better, the target that decides whether a month met it, and the passage of the execution guide or annex that sets them. An indicator is configuration: a ratio of two counts (the execution rate is `services` over `expected_services`; a complaint rate, `complaints` over `people_served` per thousand), the `average` or the `share_within` some days of the `order_to_service` span, or a plain `count`, each count narrowed by note line, procedure, complaint reason or channel. With it comes the indicator's technical sheet (Res. 2335 de 2023): its definition, numerator and denominator in words and their source, periodicity, baseline, goals, thresholds and who reports it, and the population it measures (members of cohorts, enrolled of programs; an age range or a sex is a cohort's criteria), which narrows every count of people of the measure. Until another person confirms it with `confirmContractIndicatorMeasure` the result is shown and moves no money (no retention released, no penalty escalated); until then you may write it again. A confirmed measure never changes: propose a new contract version. Use it after `setContractIndicators`, with the guide at hand: an indicator the guide does not define yet is better left without a measure. `dryRun: true` checks everything and keeps nothing. Changed on 22 October 2026: `sheet` is required (Res. 2335 de 2023 and Res. 256 de 2016 ask for the technical sheet), so a body that was accepted without it now fails with `INVALID_INPUT`; send the sheet with the measure. Returns the measure, with its unit, and the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: a malformed body, a filter that does not apply to its quantity or lists a value twice, a window outside 1 to 365 days, a target out of range, a missing source, or a sheet that is incomplete, states a denominator for a measure that is no ratio (or none for a ratio), has goals out of order or thresholds that repeat a label, is evaluated less often than the version lasts, or narrows to a population a measure that counts what the lines expect or complaints, which name nobody; fix it. `NOT_FOUND`: the version does not weigh the indicator. `CONFLICT`: the measure is confirmed with other terms. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Write a payer report template](https://docs.getarbol.com/api/ambar/define-payer-report-template/index.md) — Writes a version of a report a payer asks of the organization: a payer's report is what the contract and the payer agree, so it is configuration people write, never code. A template is a payer's (`scope.kind: payer`, it serves each of the payer's contracts) or one contract's (`contract`). Each section reads one `source` of what Ámbar keeps for a contract's month, groups its records by some of the source's dimensions (`groupBy`, shown by its columns; none for one row of the whole month) and shows `columns` under the payer's headers; a column without a `field` is left for a person, who fills it in before sending. The sources, with their dimensions and then their values: `line_execution` (each technical-note line's month as the line-execution worker kept it: `note`, `line`; `expected_quantity`, `executed_quantity`, `expected_value_minor`, `executed_value_minor`, `estimated_discount_minor`, and per line `compliance_percent` and `band`), `note_execution` (each note's month: `note`; `expected_value_minor`, `executed_value_minor`, `unmatched_services`, and per note `measured_from`, `measured_through`, `compliance_percent`, `band`), `routed_services` (the services the router counts for the contract: `note`, `line`, `procedure`, `site`, `day`; `services` and `people_served`, each person once), `population_changes` (the population news, the affiliations to the contract's payer that started or ended: `change`, `regime`; `people`), `capacity` (the contract's capacity pools that meet the month: `pool`, `service`; `slots`, `minutes`, and per pool `period_start`, `period_end`), `complaints` (those that may count for the contract: `reason`, `channel`; `about_contract`, `unattributed`), `contact_attempts` (induced demand of the PGP workflows: `note`, `line`, `channel`; `attempts`, `reached`, and per activity and channel `people_contacted`) and `outside_municipality` (the people the contract covers served at a site of another municipality than the one its payer attributes them to, the case of Ibagué: `attributed_municipality`, `site_municipality`, `portability` from the payer's listing, `left_payer_in`, the month the person's affiliation to the payer ended; `people`, each once in any grouping, and `services`). Values add up over a row's records; a value kept per record (marked per line, note or pool) needs the section grouped by every dimension of its source. Money is in minor units and a compliance a percent with two decimals. Nothing names a patient. A new template takes version 1. Until another person confirms a version (`confirmPayerReportTemplate`), writing again replaces it under the next version number; a confirmed version never changes, and writing other terms makes the next version, which replaces it once confirmed. The terms of the newest version again return it. `dryRun: true` checks everything and keeps nothing. Use it with the contract's annex or the payer's instruction at hand, see what it writes with `draftPayerReport` (naming its `version`), then ask a second person to confirm it. Returns the version kept and the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write`, and a write grant on the contract, or on the payer's relation (`payer_relation`) for a payer's template. `INVALID_INPUT`: a malformed body, a title or `sourceRef` out of bounds, no sections or more than 12 or a key twice, a section key out of `^[a-z][a-z0-9_-]{0,63}$`, a grouping by a field that is not a dimension of the source, twice or not shown, no columns or more than 30, a header out of 1 to 120 characters, repeated or starting with `=`, `+`, `-` or `@`, a field the source does not have, a dimension the rows are not grouped by, or a value kept per record in a section not grouped by every dimension; fix it. `MODULE_DISABLED`: a section reads a module the organization does not use (`details.module`). `CONFLICT`: the template is another payer's or contract's (a template keeps its scope; use another `templateId`), it reached version 10000, the payer is not one the organization works with (`savePayer`) or the contract does not exist, or a template with that id exists that you may not read. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Delete a manual table row](https://docs.getarbol.com/api/ambar/delete-analytical-table-row/index.md) — Removes one row from your active manual analytical table by marking it `inactive` (a new version; earlier versions are kept until retention ends). Inactive rows are no longer returned by listAnalyticalTableRows or SQL queries. Send the row's current `version` as `expectedVersion`. Returns the inactive row. Idempotency: the same `requestKey` with the same body returns the stored result; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: NOT_FOUND when the row does not exist or is not visible to you, or its table is inactive or no longer yours; CONFLICT when the id is not a row or `expectedVersion` is stale (read again); ACCESS_DENIED when the table changed meanwhile, the token lacks `ambar:patients:read` or `ambar:patients:write`, or you lack clinical write access or an analytics authoring grant; INVALID_INPUT for malformed fields. - [Set aside a wrong statement about attendance](https://docs.getarbol.com/api/ambar/discard-attendance-statement/index.md) — Discards one statement about an appointment's attendance with a reason: it stays on record, with who discarded it and why, and counts no longer. What remains decides the appointment again: the next strongest evidence, or `unknown` when nothing that counts decides an appointment that was attended or missed. A changed decision is told to the runs waiting for the attendance. Use it to resolve a review (`listAttendanceReviews`), or to correct a statement recorded by mistake. `dryRun: true` decides as if it were discarded and keeps nothing. The same discard again (same statement and reason) answers `replayed: true`. Returns the appointment after the decision, the decision and the `requestKey`. Requires `ambar:appointments:read`, `ambar:appointments:write`, `ambar:patients:read` and `ambar:patients:write`, and the patient's write grant for care operations. `NOT_FOUND`: no such appointment or statement, or the caller may not change it; read it again with `getAttendance`. `CONFLICT`: the statement was already discarded with another reason; do not retry. `INVALID_INPUT`: malformed body or a reason that is not a code; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Dismiss a coverage candidate none of the new payer's contracts applies to](https://docs.getarbol.com/api/ambar/dismiss-coverage-candidate/index.md) — Dismisses a candidate of `listCoverageCandidates` when no coverage in the new payer's contracts applies to the person, with a reason code such as `not_eligible`. The candidate leaves the list; the person's coverages under the payer they left already ended. Use it after checking the person against each of the candidate's `contractIds`. `dryRun: true` checks everything and keeps nothing. Dismissing again with the same reason changes nothing. Returns the candidate, its `state` and the `requestKey`. Requires `ambar:patients:read`, `ambar:contracts:read` and `ambar:contracts:write`, and a write grant on one of the candidate's contracts. `INVALID_INPUT`: a malformed body or `reason`; fix it. `NOT_FOUND`: no such candidate, or you hold no grant on its contracts. `CONFLICT`: the candidate was resolved otherwise. `ACCESS_DENIED`: a missing scope or grant; do not retry. - [Dismiss one held financial event after handling its facts manually](https://docs.getarbol.com/api/ambar/dismiss-held-finance-event/index.md) — Records a reason code and stops automatic retries of the event named by seq. It changes no invoice, objection, payment or immutable source fact. Use after handling the event manually. Repeating the same reason returns the original decision; a different reason or a loaded event conflicts. Returns only decision metadata, without granting source read access. Requires a human, ambar:contracts:write, and the finance write grant of the one contract the event identifies (the rule of listHeldFinanceEvents). An event that identifies none or several requires clinical_registry contract write. INVALID_INPUT: nonpositive seq or invalid reason code; NOT_FOUND: absent or inaccessible event; ACCESS_DENIED: service caller or missing scope; CONFLICT: loaded or dismissed with another reason. COMMIT_UNCERTAIN: retry the same seq and reason before any other action. - [Dispatch a campaign recipient](https://docs.getarbol.com/api/ambar/dispatch-campaign-recipient/index.md) — Send the campaign's call or message to one `pending` recipient of an `approved` campaign inside its send window. One call makes at most one provider send. The recipient is first reserved (`leased` for 90 seconds); then permission, contact blocks, contact hours, cooldown and capacity are checked. A provider preflight refusal or a contact block is recorded as `blocked` and still returns the receipt. Returns the reservation receipt (`state` `leased`); read the result with `getCampaignRecipient`: `accepted`, `blocked` or `unknown`. Idempotency: the same `requestKey` and input return the original receipt and never send again; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. If the result is `unknown`, call `reconcileCampaignRecipient`; never dispatch again. `CONFLICT`: campaign not approved, recipient not pending, stale `expectedRecipientVersion`, recipient no longer qualified, outside the send window or contact hours, cooldown or capacity reached. A failure after the reservation leaves the recipient reserved; it reads `unknown` after 90 seconds and must be reconciled. `CAPABILITY_NOT_CONFIGURED`: no messaging provider, dispatch disabled, or no agent configured. `INVALID_CONFIGURATION`: the provider session failed before the reservation; nothing was sent. `MODULE_DISABLED`: the campaign's channel was turned off for the organization (`details.module`); nothing was sent or reserved. `ACCESS_DENIED`: missing scope or grant; do not retry. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input. - [Dispatch a bound care case](https://docs.getarbol.com/api/ambar/dispatch-care-case/index.md) — Contact the patient of an `approved` care case through the campaign recipient most recently bound to it, with the same protocol and checks as `dispatchCampaignRecipient`. Use it once the case has a binding (`bind_campaign`) and any `scheduledAt` has passed. If the result is unknown, call `reconcileCampaignRecipient` for the bound recipient; never dispatch again. Returns the campaign dispatch receipt (`state` `leased`); read the recipient with `getCampaignRecipient` for the result. Idempotency: `requestKey` is reused as the campaign dispatch key; the same key and input return the original receipt without sending again, and a different input fails with `IDEMPOTENCY_CONFLICT`. `CONFLICT`: case not approved, stale `expectedVersion`, scheduled time not reached, or any `dispatchCampaignRecipient` conflict. `INVALID_CONFIGURATION`: no campaign recipient is bound to the case; bind one with `recordCareCase` (`bind_campaign`). `ACCESS_DENIED`: missing scope or grant, unknown case, or contact blocked by current rights or participation evidence; do not retry. Other failures, including `COMMIT_UNCERTAIN`, mean the same as for `dispatchCampaignRecipient`. - [Download a contract file](https://docs.getarbol.com/api/ambar/download-contract-artifact/index.md) — Downloads the exact bytes of a `ready` contract file as `application/octet-stream`; the `x-artifact-sha256` header carries its SHA-256. Access is checked again and audited at download time. Use `getContractArtifact` when you need only the metadata. Returns the raw bytes (not the JSON envelope); failures use the JSON failure envelope. Failures: `CONFLICT`: the file is not `ready` yet, or stored bytes fail verification. `NOT_FOUND`: no such file or its retention ended. `SERVICE_BUSY`: too many transfers; retry shortly. `PIPELINE_UNAVAILABLE`: storage unreachable; retry later. `ACCESS_DENIED`: missing `ambar:contracts:read` or no read grant; do not retry. - [Download one file of a FHIR Bulk Data export](https://docs.getarbol.com/api/ambar/download-lake-fhir-export-file/index.md) — One NDJSON file of a finished FHIR Bulk Data export ([36] section 8.5), as the manifest names it: one FHIR R4 resource per line. Files are kept for a day after the export finishes, and deleted at once when it is cancelled. Only the account that started it, while the revision in force names it; requires `ambar:datasets:read`. Each download is audited. `404` with an OperationOutcome for a file the export does not have, or no longer keeps. - [Download a patient file](https://docs.getarbol.com/api/ambar/download-patient-document/index.md) — Downloads the original bytes of a `received` patient document as `application/octet-stream`, decrypted and verified. Use it to retrieve the stored original; read the file name and media type with `getPatientDocument`. Permission is checked again before and after the transfer. The success response is the raw file, not a JSON envelope; failures still use the JSON failure envelope. Requires a human caller with `ambar:patients:read` and an original-read grant. Errors: `ACCESS_DENIED` (not human, missing scope or grant, or document unavailable); `CONFLICT` (document not `received` yet, or it changed during the download); `INVENTORY_INTEGRITY_CONFLICT` (stored bytes failed verification); `CAPABILITY_NOT_CONFIGURED`; `PIPELINE_UNAVAILABLE` or `SERVICE_BUSY` (retry later). - [Draft the billing transaction of a payment document (Peru's TEDEF)](https://docs.getarbol.com/api/ambar/draft-billing-transaction/index.md) — Drafts, a page of up to 50 patients at a time, the billing an IPRESS sends an IAFAS with one of the contract's invoices, in the format the contract's jurisdiction asks for (its payer's country; `getJurisdiction` shows `billingTransactionFormat`): Peru's TEDEF-IPRESS-IAFAS, `tedef_043` (Resolución de Superintendencia N.° 043-2025-SUSALUD/S, annexes 1 and 3), eight fixed-width text files. The first page brings the header of the payment document (table 1, `dfac`): the batch, the IAFAS (the payer's code when it is SUSALUD's five digits), the RUC, the establishment (the RENIPRESS code of the site the services count at, as the directory keeps it, when they all count at one), the document's type and number (the invoice's, `F001-123` written `F00100000123`), its day, the product, the number of prestaciones, the payment mechanism (`04` capitation, `01` fee for service), under `02`, `04` and `06` the pre-agreed amount (the taxable base plus the copayments subject to IGV) and the start of its period (the invoice period's first day), the currency (soles), the exempt amount, the copayments (0.00 when the invoice credits none), the taxable base, the IGV and the invoice's total; and the names of the files and of the `.S01` archive of transaction 937. With `noteRef`, a credit or a debit note the invoice keeps travels in the same header (fields 25 to 29, as annex 1 sends a note): `C` or `D`, its number in the document's shape, its amount without IGV (its value less `noteIgvMinor`), its day and its reason, `A` (anulación) for a credit note that voided the invoice and `D` (descuento parcial) for another credit note (a debit note's reason is left for a person), with the day the document was first sent (`firstSentOn`, field 30); the batch repeats the document and the `note` notice says what SUSALUD has to confirm about it. Every page brings its prestaciones: one per encounter the contract pays services of in the invoice's period (for a fee-for-service invoice, only the services its priced lines bill), numbered on from the earlier pages (table 2, `date`), with the person's DNI or other document from their profile, the encounter's day, hour and first three diagnoses at the subcategory level (`E11.9`), and its establishment; their procedures (table 3, `dser`) with their CPMS code, the name the CPMS release in force gives it and their units; and their medications and devices (table 4, `dfar`) with their day and units; for fee for service each at its priced line. The optional tables too: a record per dental procedure of table 3, a CPMS `D` code (table 5, `dden`), whose tooth and surfaces a person writes; the additional data of each prestación (table 6, `dpre`): the person's birth date and sex from their profile, whether the services attended a booked appointment, and the head circumference (only under 5 years, `0.00` after), the waist circumference, the weight, the height and the hemoglobin the record measured that day by their LOINC codes (`9843-4`, `8280-0`, `29463-7`, `8302-2`, `718-7`), in the fields' units; a record per diagnosis of the encounter (table 7, `ddia`); and a record per vaccination or preventive procedure of table 3 (CPMS `90460` to `90474`, `90476` to `90759`, `99381` to `99429`; table 8, `dprv`), whose parameter and value a person writes from SUSALUD's catalog of additional activities. Nothing is invented: `missing` lists the values the record or the request lacks for a record, `notKept` the fields Ámbar keeps nothing for (the insured code, the affiliation type, the clinical record number, the professional, a service's tax exemption and heading, a product's GTIN or UNSPSC code, a tooth, a diagnosis's type, an activity's parameter, the outcome), which a person completes from the supports, and fields that apply only sometimes (a referral, a hospitalization, an emergency, a newborn) go blank. Nothing is written. Use it to prepare the TEDEF of an invoice: pass `ruc`, `batch`, `paymentDocumentType`, `product` and the taxes of SUSALUD's payment document (`taxableMinor`, `exemptMinor`, `igvMinor`, which Ámbar does not keep) so the header is complete; read every page passing `nextCursor` as `after`; join every page's `lines` of each file in order; have a person complete what `missing` and `notKept` list; check the files with `checkBillingTransaction`; and zip the eight files into the archive `header.names.archive` names (Ámbar does not write ZIP archives). Returns `format`, `mechanism`, `prestationsBefore`, `header` (on the first page), `lines` (this page's records by file), `rows` (each record's patient, encounter, event, site and code), `missing`, `notKept`, `missingByField`, `notices` and `nextCursor`. Requires `ambar:patients:read` and `ambar:contracts:read`, the contract's read grant and, for care operations, the registry-wide patient read grant: with grants on some patients only, the services of the others are left out. `INVALID_INPUT`: a malformed `contractId`, `invoiceRef`, `ruc` (eleven digits), `batch` (1 to 9,999,999), `product` (five letters or digits), amount (0 to 99,999,999,999 céntimos) or `after`, `noteIgvMinor` without `noteRef`, or an invoice of another contract; fix it. `NOT_FOUND`: no such contract, invoice or note on the invoice, you may not read it, or the contract has no payer yet. `CONFLICT`: the payer's country has no billing transaction Ámbar drafts (`billingTransactionFormat` is `null`). `RESOURCE_LIMIT_EXCEEDED`: the page's 50 patients have more than 10,000 services in the period or more than 40,000 measurements, or the invoice bills more than 20,000. `ACCESS_DENIED`: a missing scope, or clinical privacy not configured; do not retry. - [Draft a contract's configuration from its annex](https://docs.getarbol.com/api/ambar/draft-contract-from-annex/index.md) — Drafts, from a contract annex reading's values as they stand, the bodies of the operations that configure the contract ([05] section 9): `proposeContractVersion` (validity, payer and provider as the annex names them, and one component per calendar month paying the monthly value, or the value per member for capitation), `addContractPopulationRules` (the primary-care providers whose people count, and the exclusion of people with a complementary plan), `addContractClause` for each clause that may move money (its terms as far as the annex gives them) and `setContractIndicators` (the retention's indicators and weights). Every source reference quotes the annex's page and passage. Use it once `checkContractAnnex` has nothing left that a person must correct: show the draft to the person, fill in each item's `toFill` with them (the version's identity, time zone, party at risk and uploaded `source`; how a retention is released; the indicators a penalty escalates on; the excluded procedures; the catalog indicator of each weight), then send each body to its operation, first with `dryRun`. A clause whose `awaits` names a binding document is added but confirmed only once that document is loaded. Nothing is written here. Returns `draft` with `version`, `populationRules`, `clauses` and `indicators`, each with `toFill`, the fields still to fill in by path. Requires `ambar:patients:read` and `ambar:contracts:read`, with the registry-wide patient grant for care operations, which reads documents without a patient. `INVALID_INPUT`: a malformed `readingId`; fix it. `NOT_FOUND`: no such reading, or the caller may not see it. `CONFLICT`: the reading is not a contract annex or its values are not extracted yet; read it with `getDocumentReading`. `ACCESS_DENIED`: missing scope, or clinical privacy not configured; do not retry. - [Draft a contract's final liquidation acta](https://docs.getarbol.com/api/ambar/draft-contract-liquidation/index.md) — Drafts the acta that liquidates a contract once it ended (Decreto 780 de 2016, art. 2.5.3.4.6.2, as Decreto 441 de 2022 set it): within the term the contract agreed, or the four months after it ended. From what Ámbar keeps: every component period of its approved versions that started by `endedOn`, with the accepted settlement in force for it and what the payer's SA55 objections decided after that close take from it (`objectionsAfterCloseMinor`, which the settled total includes until the close is amended); what those settlements pay against the payments received; what its invoices still owe and what open objections dispute; each technical note's execution over the months the line-execution worker measured; and each indicator's months. `pending` lists what is still open (periods not closed, closes that miss SA55 objections, money owed either way, invoices owed, open objections, indicator months unknown); only with nothing pending may the parties declare each other paid in full (`paidInFull`). Use it before `proposeContractLiquidation`, to close what is pending first. Nothing is written except the audit of the reads. Returns the acta, when it was read and its manifest (the SHA-256 of its JSON). Requires `ambar:contracts:read` and `ambar:settlements:read` and a read grant on the contract. `INVALID_INPUT`: malformed identifier, day or term (1 to 60 months); fix them. `NOT_FOUND`: no approved version. `CONFLICT`: its components are in more than one currency, or SA55 objections adjust components whose precision is not their currency's. `RESOURCE_LIMIT_EXCEEDED`: more than 20,000 invoices or 2,000 SA55 objections. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Draft a month's payer report from its template](https://docs.getarbol.com/api/ambar/draft-payer-report/index.md) — Drafts a contract's month as a payer report template describes it, in the file it names, and keeps nothing. It follows the template's version in force (the newest a second person confirmed) or the `version` you name, an unconfirmed one being a preview for its review (`confirmed: false`). The template must be the contract's own or its payer's. Each section reads what Ámbar keeps for the contract's month: the line and note execution as the line-execution worker last measured it (`measuredNotes` says through which day), the services the router counts for the contract, the affiliations to its payer that started or ended, its capacity pools, the complaints that may count for it and the people it covers served at a site of another municipality than the one its payer attributes them to (counted by the database for every grouping, with their portability and the month they left the payer). Rows are grouped and added up as the section says, each person counted once; nothing names a patient. Nothing is invented: `missing` lists by path the values the record lacks (a service whose site is unknown, a month of a note never measured, a site or a coverage without a municipality), `notKept` the columns Ámbar keeps nothing for, which a person fills in every row, and a value that does not apply (a compliance with nothing expected, a portability the payer's listing does not state) is left empty. In a CSV, a text a spreadsheet would run as a formula is written after an apostrophe. Use it each month to prepare what the payer asks for, and before confirming a template to see what it writes. Read the templates that apply to a contract with `listPayerReportTemplates`. Returns `files` (a CSV per section or one JSON document, with name, media type and content), `sections`, `measuredNotes`, `missing`, `notKept` and `missingByField`. Requires `ambar:contracts:read` and a read grant on the contract (and on its payer's relation for a payer's template). `INVALID_INPUT`: a malformed `templateId`, `contractId`, `month` or `version`; fix it. `NOT_FOUND`: no such template or version you may read, or no version in force yet (confirm one with `confirmPayerReportTemplate`, or name a `version` to preview). `CONFLICT`: the template is another contract's or another payer's, or the contract has no payer yet (`setContractPayer`). `MODULE_DISABLED`: a section reads a module the organization does not use (`details.module`). `RESOURCE_LIMIT_EXCEEDED`: the month has more than 100,000 service rows (or rows of people served outside their municipality) to read. `ACCESS_DENIED`: a missing scope or grant; do not retry. - [Draft a contract's protection and early detection report (Res. 202)](https://docs.getarbol.com/api/ambar/draft-protection-report/index.md) — Drafts, a page of up to 200 people at a time, the per-person report of specific protection and early detection activities a provider sends its payers each quarter, in the format the contract's jurisdiction asks for (its payer's country; `getJurisdiction` shows `protectionReportFormat`): Colombia's RPED file, `rped_202` (Resolución 4505 de 2012, whose annex Resolución 202 de 2021 replaced: one record of 119 variables per person). The people are those a current, eligible coverage of one of the contract's capitation or PGP components covered at least one day of the quarter and who had a current encounter or measurement on one of those days, by patient id; only facts of their covered days count. A page reads at most 2,000 covered people, attended or not, so it may hold fewer than 200 people, or none, and still return `nextCursor`. Each variable is written by the rule of the catalog in force (`pedt_rules`: the organization's approved version, else Ámbar's reference release; `getRuleCatalogInForce`): the identity document, names, birth date and sex from the person's profile, the primary-care provider from the payer's population file, measurements (weight, height, laboratory results) by their LOINC code and unit, the days of activities (a mammography, a cytology) by their CUPS codes and, when the rule names them, their encounter's CIE-10 diagnoses (a first-time consultation that supervises a pregnancy is the first prenatal one), answers from the encounters' diagnoses (gestation, its risk) or from the procedures of one day (a cytology and an HPV test are a co-test), the day a stay that ended a delivery ended, screening results from the laboratory's text (`No reactivo`) or flag, the expected delivery date recorded as a day (LOINC 11778-8), and where a screening was done by the code in the providers' registry (REPS, 12 digits) the directory keeps for the site its encounter counts at, as the RIPS writes `codPrestador` (the contracted site of an appointment booked under the contract, else the site that delivered it; only of sites the caller may read in the directory). The variables the annex retired are written with their only value. Nothing is invented: a value the record lacks, and every variable without a rule, is written with the code its instruction gives for no data (`1800-01-01`, `999`, `21`) or left blank, and counted. Nothing is written to the record. With `file=nped` it drafts instead the novelties file (NPED, Anexo Técnico 2 of Resolución 202 de 2021): for the people the previous quarter's RPED reported (the same people over the previous quarter), a record of 11 values for each change Ámbar's record shows, with the person written as that file wrote them (their profile at the end of the previous quarter, by the identity rules of the catalog in force): a new identity document at the end of the quarter (novelty `1`, `2` or `3`, with the new type or number) and a new primary-care provider in the payer's population files (`7`). Its name starts `SGD280NPED` and its control record has no count. Novelties `4` to `6` are a person's to add. Only the people whose profiles the caller may read are drafted. Use it to prepare the quarter's file for a payer: read every page passing `nextCursor` as `after` and `rowsBefore` plus the page's rows as `rowsBefore`, write the last page's `controlRecord` and then every page's `line` in order, one per line, as ANSI text, under `fileName`; have a person complete what `missing` and `notKept` list; and check the file with `checkProtectionReport` before it is sent. Returns `format`, `period` (with the ministry's reception days), `fileName`, `controlRecord`, `rows` (each record's position, patient, line and the source of each value read from the record: the profile, an event, the payer's file or a directory site), `missing`, `notKept`, `missingByField`, `withheld` (people the caller may not read, left out), `rules` (the catalog version used) and `nextCursor`. Requires `ambar:patients:read` and `ambar:contracts:read`, the contract's read grant in contract finance and, for care operations, the patients' read grants (the registry-wide one for the whole population) and, for a site's code, the site's read grant (without it the value is left for a person); the read of who the page holds is audited. `INVALID_INPUT`: a malformed `contractId`, `after`, `reportingNit`, `rowsBefore` or `file`, a quarter before 2021 or other than 1 to 4, or the NPED of the first quarter of 2021, which has no earlier file; fix it. `NOT_FOUND`: no such contract, or it has no payer yet; set it with `setContractPayer`. `CONFLICT`: the payer's country has no report Ámbar writes (`protectionReportFormat` is `null`), or no catalog of the report's rules is in force (load the reference release with `ambar-migrate load-catalog bundled-rule-catalogs`). `RESOURCE_LIMIT_EXCEEDED`: the page's people have more than 40,000 facts the rules read. `ACCESS_DENIED`: a missing scope or grant, or clinical privacy not configured; do not retry. - [Draft a contract's record of delivered services (RIPS)](https://docs.getarbol.com/api/ambar/draft-service-record/index.md) — Drafts, a page at a time, the record of the services a contract pays that the provider sends with its electronic invoice, in the format the contract's jurisdiction asks for (its payer's country; `getJurisdiction` shows `serviceRecordFormat`): Colombia's RIPS, `rips_948` (Resolución 948 de 2026, Documento Técnico 1 version 003). A service is a procedure of an encounter the router left to the contract, delivered in the period of the contract's electronic invoice `invoiceRef` or from `from` to before `to`; for a fee-for-service invoice, only the services its priced lines bill, and for a package invoice the lines of its packages (each package's service and the services it covers, all valued 0). Each patient with services is one user, with their consultations (CUPS section 890), procedures, medications and other services in the order they started, and their stays in emergency observation or in hospital and the births their record keeps that ended in the window, when the contract pays a service of theirs during one (a stay's days are its other services, `tipoOS` 03). With `invoiceRef`, the file names the invoice, every value is 0 outside fee for service and the priced line's value in it, and what the user paid at each service is `05` with 0 when the invoice credits no copayment, moderator fee or shared payment. Every value Ámbar keeps is filled in: the person's identity document, birth date, sex and municipality from their profile, and their user type from the regime of their affiliation with the contract's payer and the affiliate type the payer's listing in force that day states (`04` subsidized, `11` a voluntary plan, `01` to `03` a contributory contributor, beneficiary or additional member, `06` and `07` a special or exception contributor or beneficiary; without that type a contributory one does not say whether they contribute) and their residence zone from the same listing (`01` rural, `02` urban); the provider's REPS code (`codPrestador`) of the site each row counts at, as the directory keeps it, when the caller may read the site; when each service started, in the organization's local time; its code and diagnoses from the encounter; a stay's admission, cause, diagnoses, condition at egress and egress, and a newborn's birth, gestational age, prenatal visits, sex and weight, and its own identity document (`CN`, `RC` or `MS`, never the mother's) when the provider's RIPS sent it, which Ámbar keeps sealed and opens only here; the positions. Nothing is invented: `missing` lists by path the values the record lacks for a row or the request did not give (a newborn whose RIPS sent no document of its own), `notKept` names the required fields Ámbar keeps nothing for (the service's modality and purpose, a medication's concentration…), which a person completes in every row from the invoice's supports, and fields that only apply sometimes (an authorization, a complication) are written `null`, as is each diagnosis's CIE-11 pair. With `noteType` and `noteNumber` the header names a note; a credit note's file keeps only the services it affects, which a person chooses. Nothing is written. Use it to prepare the RIPS of an invoice: pass `invoiceRef` and `obligatedParty` (the provider's NIT) so the header is complete, read every page passing `nextCursor` as `after`, join the pages' `document.usuarios` in order, have a person complete what `missing` and `notKept` list, and check the file with `checkServiceRecord` before it is sent with the invoice. To see where a row comes from, read its encounter with `getPatientRecordEncounter`. Returns `format`, `document` (this page's RIPS JSON: the header and up to 50 users, numbered on from `usersBefore`), `rows` (each row's path, patient, encounter and event), `missing`, `notKept`, `missingByField` (the values left on this page per field) and `nextCursor`. Requires `ambar:patients:read` and `ambar:contracts:read`, the contract's read grant and, for care operations, the registry-wide patient read grant: with grants on some patients only, the services of the others are left out of the document. `INVALID_INPUT`: a malformed `contractId`, `invoiceNumber`, `obligatedParty`, note or `after`; a window that is not 1 to 366 days long; `invoiceRef` with a window or an `invoiceNumber`, or an invoice of another contract; fix it. `NOT_FOUND`: no such contract or invoice, you may not read it, or the contract has no payer yet; set it with `setContractPayer`. `CONFLICT`: the payer's country has no record format Ámbar writes (`serviceRecordFormat` is `null`); there is nothing to draft. `RESOURCE_LIMIT_EXCEEDED`: the page's 50 patients have more than 10,000 services, or 2,000 stays, births or affiliations, in the window; ask for a shorter one. `ACCESS_DENIED`: a missing scope, or clinical privacy not configured; do not retry. - [End an assignment on a day](https://docs.getarbol.com/api/ambar/end-provider-assignment/index.md) — Ends an assignment, a person's or a list's, on `lastDay` (included): from the next day it decides nothing. An end only moves earlier. Ending it on the same day again answers with `replayed: true`; `dryRun: true` checks everything and keeps nothing. Returns the assignment with the `requestKey`. Requires `ambar:patients:read` and `ambar:patients:write` and the registry write grant for care operations. `INVALID_INPUT`: a malformed id or key; fix it. `NOT_FOUND`: no such assignment. `CONFLICT`: `lastDay` is before it starts or after an earlier end; read it with `listProviderAssignments`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Enroll a patient in a program](https://docs.getarbol.com/api/ambar/enroll-program/index.md) — Enrolls a patient in a cohort program using a current eligible assessment (`eligibleNow: true`, see listProgramAssessments). Send `expectedVersion` `0` for a first enrollment. After a withdrawal, send the enrollment's current `version` and an assessment recorded after the withdrawal. Use transitionProgram to suspend, withdraw or resume an existing enrollment. Returns the enrollment. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when the assessment is not current, the enrollment already exists or `expectedVersion` is stale, or a re-enrollment reuses an old assessment: re-read with getProgram, assess again if needed. ACCESS_DENIED without program write and approve grants, patient or linked cohort access, or as a non-human caller; INVALID_INPUT; COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Erase a patient](https://docs.getarbol.com/api/ambar/erase-patient/index.md) — Irreversibly erases a patient whose retention has ended: clears its profile, identifiers and linked evidence content and sets status `erased`. There is no undo. The patient's semantic memory is then forgotten in the background, with no time bound, with nothing more to call. Use it only for a patient listed by `listPatientsDueForDisposition` with `held: false`, after a human decided to erase; send the listed `version` as `expectedVersion`. Returns a receipt with the patient `id` and new `version`. Idempotency: the same `idempotencyKey` with the same body returns the original receipt; the same key with a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `ACCESS_DENIED` (missing `ambar:patients:erase`, no erase grant or not a human: do not retry); `CONFLICT` (version changed, retention not ended, legal hold, already erased, or a related patient still blocks disposal: re-read the queue); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Erase a study submission](https://docs.getarbol.com/api/ambar/erase-study-submission/index.md) — Erases an `unresolved` submission whose retention has ended: its content and source reference are removed for good. There is no undo. Use it for items from `listStudySubmissionDispositionDue` after a human decided; send the listed `version` as `expectedVersion`. Requires a human caller with `ambar:studies:review` and an erase grant. Returns a receipt with the submission `id` and new `version`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (not human, missing scope or grant); `CONFLICT` (version changed, submission linked, or retention not ended: re-read the queue); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Evaluate a patient on a clinical route](https://docs.getarbol.com/api/ambar/evaluate-clinical-route-patient/index.md) — Evaluates one active patient against the contract's current approved care route, using accepted evidence, cohort memberships and code bindings, and stores the result. Gaps are review candidates; nothing is booked, billed or sent. The route must be the one in force (see getCurrentClinicalRoute). Returns the assessment with one gap per requirement. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when the route is no longer in force, the inputs changed during the evaluation (retry) or the patient has more than 500 evidence records. ACCESS_DENIED without contract read, patient read, write and review scopes, without patient write and approve grants, when the route is not approved or the patient is not active, or as a non-human caller; INVALID_INPUT; COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Evaluate a cohort candidate](https://docs.getarbol.com/api/ambar/evaluate-cohort-patient/index.md) — Evaluates one patient against the cohort's current review policy, using accepted and reviewed evidence, and records the result. It never changes membership. Send the current `policyVersion` and `baseSnapshotId` from getCohortPolicy. A patient with more than 500 evidence records is recorded as `unknown`. Returns a receipt (`id`, `version`); read the result with listCohortWorkspaceCandidates, then confirm or reject it with decideCohortPatient. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when the cohort has no review policy or its policy, snapshot or the patient's data changed meanwhile: re-read getCohortPolicy and retry with fresh values. ACCESS_DENIED when the cohort does not exist, without cohort write or patient access (approve for `institutionalAdmission`) or as a non-human caller; INVALID_INPUT; COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Evaluate patient care progress](https://docs.getarbol.com/api/ambar/evaluate-patient-care/index.md) — Records an assessment of one requirement period for a patient from the current sources and reviewed study records. It never books care and never accepts evidence. Copy `noteId`, `noteVersion`, `requirementKey`, `period.from` and `sourceFingerprint` from an item of `getPatientCareProgress`; send `expectedVersion` `0` for a new assessment or the item's `version` to re-evaluate. To reuse a specific accepted result as support use `applyPatientCareResult`; to withdraw an assessment use `retractPatientCareAssessment`. Requires a human caller with `ambar:patients:read`, `ambar:patients:write`, `ambar:patients:review` and `ambar:studies:read`. Returns a receipt with the assessment `id` and new `version`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (not human, missing scope or grant, or patient not active); `CONFLICT` (version, note or sources changed, or `individualAssignment` is required: re-read progress and retry with a new key); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Explain a person's priority in a cohort](https://docs.getarbol.com/api/ambar/explain-patient-priority/index.md) — Explains why a person is where they are in a cohort's queue: the score the queue orders by (the clinical points, 0 to 99, times ten plus the contractual tie-break, 0 to 9), whether a recent critical value or red flag sends them a clinical priority, each factor's points with what it read (days since the admission, percent above the goal, days overdue, other risk cohorts, whole weeks waiting), the facts the model read from their record, their queue and their care routes, and the approved model version that scored them. The priority worker scores every member each night from 01:00 in the organization and again after a newer version is approved; this reads what it kept, the same score the queue uses. Use it when a person, a nurse or an agent asks why someone is seen before or after another, and to see an approved model's effect on real members. Returns the kept score with its reasons and facts, `modelVersion` and `currentVersion` (newer than `modelVersion` until the worker scores the person with it). Requires `ambar:cohorts:read` and `ambar:patients:read`, the patient's read grant for care operations and the cohort's read grant. `NOT_FOUND`: no score explains a place in the queue: the person is not enrolled in the cohort now, the cohort has no approved model, the worker has not scored them yet (retry after its next pass), or the caller lacks a grant; check the enrollment and `listCohortPriorityModels`. `INVALID_INPUT`: malformed `cohortId` or `patientId`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [Create a normal draft from a completed preparation](https://docs.getarbol.com/api/ambar/finalize-technical-note-preparation/index.md) — Atomically creates one immutable technical-note revision in draft state and marks the preparation finalized. Never proposes, approves or authorizes payment. All structural fields must be complete and the unchanged normal technical-note validation applies. Supply current preparation version, contract version and latest note number (0 when none), plus a new noteId. The contract version increments once. Source custody, readable linked resources and financial binding are rechecked by the normal save. Requires contracts read/write and the contract finance write grant, for a person or delegated internal operator. INVALID_INPUT: preparation incomplete or malformed command; CONFLICT: stale versions, existing noteId or already finalized; ACCESS_DENIED: missing authority. Idempotent by requestKey; after COMMIT_UNCERTAIN retry the identical body/key. Returns preparation and the normal draft note. - [Find who serves a patient for a category, and where to go](https://docs.getarbol.com/api/ambar/find-serving-provider/index.md) — Decides which provider serves the patient for a service category on a day: from the patient's payer that day (main affiliation), municipality of residence and the contract you name, among the assignments in force (of payer lists, only the newest list), the most specific wins: a contract over a payer, then the narrower territory, then a person's over a list's. Equally specific assignments of different providers wait for a person (`needs_review`). Use it when an agent tells a person where to go (a pharmacy, a laboratory, a site) and to send follow-ups to the right operator's installation. Returns the facts used, the decision with its reason and, when one provider was decided, its name, phone and site from the directory. Requires `ambar:patients:read` and a read grant on the patient and on the registry for care operations. `INVALID_INPUT`: a malformed patient, category or contract; fix it. `NOT_FOUND`: no such patient. `ACCESS_DENIED`: missing scope or grant, or clinical privacy not configured; do not retry. - [Forget a fact](https://docs.getarbol.com/api/ambar/forget-assistant-fact/index.md) — Forgets one fact for good, yours or the organization's, named by its `factId` and `scope` as `listAssistantMemory` returns them. Arbi stops using it from its next read. `dryRun: true` checks everything and forgets nothing. Returns the fact as it was, with the `requestKey`. Requires a person whose token has `ambar:arbi:read` and `ambar:arbi:write`; an organization's fact also needs `ambar:settings:write` and a workspace configuration write grant. `INVALID_INPUT`: a malformed id or key; fix it. `NOT_FOUND`: neither you nor the organization has a fact with this id and scope, perhaps forgotten already; read `listAssistantMemory`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Generate a month's payer report and keep it](https://docs.getarbol.com/api/ambar/generate-payer-report/index.md) — Generates a contract's month as a payer report template's version in force describes it (the newest a second person confirmed), as `draftPayerReport` drafts it, and keeps the run: its files with their SHA-256 and size, how many values were left for a person to fill in, who generated it and when. A run never changes: generating the month again keeps another run, so the history shows what was generated and sent. The same `id` with the same report answers the run again. Use it when the month's report is ready to send; then record how it went with `recordPayerReportSending` and the payer's answer with `recordPayerReportAcknowledgment`. Read the history with `listPayerReportRuns` and a run's files with `getPayerReportRun`. Returns the run. Requires `ambar:contracts:read` and `ambar:contracts:write`, and a write grant on the contract (and a read grant on its payer's relation for a payer's template). `INVALID_INPUT`: a malformed body, or a file over 8 MiB; fix it. `NOT_FOUND`: no such template you may read, or no version in force yet. `CONFLICT`: the template is another contract's or another payer's, the contract has no payer yet, or the `id` holds another report. `MODULE_DISABLED`: a section reads a module the organization does not use (`details.module`). `RESOURCE_LIMIT_EXCEEDED`: the month has more than 100,000 service rows. `ACCESS_DENIED`: a missing scope or grant; do not retry. - [Read a script or a red-flag list](https://docs.getarbol.com/api/ambar/get-agent-document/index.md) — Reads one version of a script or a red-flag list with its content as it was written: a script's Spanish text, or a list's red flags with their code, label, level and phrases. Use it to review a document before approving it, or to see what an agent version says and listens for. Returns the document with its approval and its `content`. Requires the `ambar:programs:read` scope and a read grant on the document's program for care operations. `INVALID_INPUT`: `reference` is not a document reference; fix it. `NOT_FOUND`: no such document, or the caller may not see it. `ACCESS_DENIED`: missing scope; do not retry. - [Read the organization's AI budget and spend](https://docs.getarbol.com/api/ambar/get-ai-budget/index.md) — Reads what the organization may spend on AI per day and per calendar month, the UTC offset its days start at, what it spent today and this month, and the share of the limits used. From 80 % an alert is logged; at 100 % calls that can wait (document readings, summaries) wait for the next day or month, while urgent calls (alarms, live conversations) proceed. `gatewayConfigured: false` means this deployment calls no model at all. Use it before `setAiBudget`, for its `version`. Returns the budget. Requires `ambar:settings:read` or `ambar:settings:write`, a person, and a workspace configuration read grant. `NOT_FOUND`: no budget was set, so nothing calls a model; set one with `setAiBudget`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Read an alert with its evidence](https://docs.getarbol.com/api/ambar/get-alert/index.md) — Reads one alert: its current finding with the references to the facts behind it, every finding admitted into it (a refreshed alert keeps the earlier ones), the person's words a missed red flag cites from each conversation (`quotes`, opened), the decision with its note opened, and the case created from it. Use it before deciding, to look at the evidence (read the referenced results, medications, appointments or conversations in the patient's record). Returns the alert. Requires the `ambar:patients:read` scope and the patient's read grant for care operations. `INVALID_INPUT`: malformed `alertId`; fix it. `NOT_FOUND`: no such alert, or the caller may not see it. `ACCESS_DENIED`: missing scope, or clinical privacy not configured for an alert with a note or quoted words; do not retry. - [Get an analytical table](https://docs.getarbol.com/api/ambar/get-analytical-table/index.md) — Returns one of your analytical table definitions (columns, source, settings) at its current version or at the requested `version`, after checking that you may still read every source it was saved over. Use it to get the `version` needed by saveAnalyticalTable and deactivateAnalyticalTable; read rows with listAnalyticalTableRows. Returns `item: null` when the id does not exist, is not yours, is not a table, has expired, or one of its sources is no longer admitted for you. Failures: ACCESS_DENIED when the token lacks `ambar:patients:read` or the caller is not a person; EVIDENCE_NOT_READABLE when the definition cannot be decrypted now; INVALID_INPUT for a malformed `id` or `version`. - [Get an analytics board](https://docs.getarbol.com/api/ambar/get-analytics-board/index.md) — Returns one of your analytics boards with its decrypted definition, at its current version or at the requested `version`. Use it to get the `version` needed by saveAnalyticsBoard and deactivateAnalyticsBoard. A board is a layout of charts, not computed numbers. Returns `item: null` when the id does not exist, is not yours, is not a board, has expired, or you no longer have clinical read access to its scope. Failures: ACCESS_DENIED when the token lacks `ambar:patients:read` or the caller is not a person; EVIDENCE_NOT_READABLE when the definition cannot be decrypted now; INVALID_INPUT for a malformed `id` or `version`. - [List admitted SQL projection tables](https://docs.getarbol.com/api/ambar/get-analytics-sql-catalog/index.md) — Lists the named, bounded data copies you may query with queryAnalyticsSql right now: current care documentation summaries (when you hold patient and contract read access), published non-personal inventory datasets (with the `ambar:ingestions:read` scope; only the first 50 datasets are considered) and your active manual analytical tables (first 50). Call it before writing SQL to learn each source `key` (the table name), its columns and types. There is no access to production databases or arbitrary tables. Returns `tables`, `maxRows` (200), `dialect` (`sqlite`), `truncated` and display warnings. Not paginated. Failures: ACCESS_DENIED when the token lacks `ambar:datasets:read` or the caller is not a person; EVIDENCE_NOT_READABLE when a manual table cannot be decrypted now. - [Read an appointment with its log](https://docs.getarbol.com/api/ambar/get-appointment/index.md) — Reads one appointment: where and when, its state, whether it is a clinical priority, why it was cancelled or moved, the evidence that decided its attendance, every change, oldest first, with who made it and why, and what the client's agenda was asked to book or cancel for it (`agendaWrites`): sent by the installed agenda app, or waiting for a person (`listAgendaWritesForPeople`). Use it to get the `version` for `changeAppointment` or `rescheduleAppointment`, and to see why an appointment is where it is. Returns the appointment and its `history`. Requires `ambar:appointments:read` and `ambar:patients:read`, and the patient's read grant for care operations. `INVALID_INPUT`: malformed `appointmentId`; fix it. `NOT_FOUND`: no such appointment, or the caller may not read it. `ACCESS_DENIED`: missing scope; do not retry. - [Read an appointment's attendance: its statements and what they decide](https://docs.getarbol.com/api/ambar/get-attendance/index.md) — Reads every statement kept about whether the person came to an appointment, oldest first (the discarded ones too, with who discarded them and why), the policy that decides it and what the statements that count decide: `attended`, `no_show`, `review` (the strongest kind disagrees: a person resolves it by discarding a statement) or `undecided`. Use it before resolving a review, or to explain to a person or the patient why the appointment shows as attended, missed or unknown. Returns the appointment, its statements, the policy and the decision. Requires `ambar:appointments:read` and `ambar:patients:read`, and the patient's read grant for care operations. `INVALID_INPUT`: malformed `appointmentId`; fix it. `NOT_FOUND`: no such appointment, or the caller may not read it. `ACCESS_DENIED`: missing scope; do not retry. - [Get a campaign recipient](https://docs.getarbol.com/api/ambar/get-campaign-recipient/index.md) — Read one campaign recipient: dispatch state, `reasonCode`, provider references and patient label. Use it after `dispatchCampaignRecipient` to see the provider result, and to get the current `version` before `reconcileCampaignRecipient`. Query: `id` and `recipientId` are required. `INVALID_INPUT`: `recipientId` is missing or a parameter is malformed. `NOT_FOUND`: the campaign has no such recipient (or its patient was disposed). `ACCESS_DENIED`: missing scope, unknown campaign, or no access to the campaign or patient; do not retry. `CONFLICT`: the recipient changed while it was read; repeat the request. - [Get a campaign](https://docs.getarbol.com/api/ambar/get-campaign/index.md) — Read one campaign: definition, state, creator, approver and dispatch metrics. Use it to get the current `version` before `saveCampaign`, `appendCampaignRecipients`, `approveCampaign` or `transitionCampaign`; use `listCampaigns` to browse. Query: `id` is required; `after` is ignored. `contacted` and `careConfirmed` are always `null`; the other counts are `null` unless you can read every patient. `INVALID_INPUT`: `id` is missing or malformed. `NOT_FOUND`: no campaign has that `id`. `ACCESS_DENIED`: missing scope, or no access to the campaign's program or contract; do not retry. - [Read one case-finding evaluation](https://docs.getarbol.com/api/ambar/get-candidate/index.md) — Reads one evaluation of one person against one cohort: its tier, the rule version that produced it, the evidence references, what is missing and the decision. Use it before deciding, with the `evaluatedAt` exactly as listed, to look at the evidence (read the referenced results, diagnoses or medications in the patient's record). Returns the evaluation. Requires `ambar:cohorts:read` and `ambar:patients:read` and the patient's read grant for care operations. `INVALID_INPUT`: malformed ids or time; fix them. `NOT_FOUND`: no such evaluation, or the caller may not see it; list the patient's evaluations again. `ACCESS_DENIED`: missing scope; do not retry. - [Read a capacity pool](https://docs.getarbol.com/api/ambar/get-capacity-pool/index.md) — Reads one capacity pool: the units a service has at some care sites over a period, the figure the capacity-versus-demand board compares with demand. No booking counts against it: the client's agenda decides when and where, so a pool says nothing about whether a slot is free. Use it to check the figure the organization declared or mirrored from its agenda. Returns the pool. Requires `ambar:appointments:read` and the registry read grant on care sites for care operations. `INVALID_INPUT`: malformed `poolId`; fix it. `NOT_FOUND`: no such pool, or the caller may not read it. `ACCESS_DENIED`: missing scope; do not retry. - [Read the actual management case history](https://docs.getarbol.com/api/ambar/get-care-case-history/index.md) — Read up to 50 retained encrypted events of one visible case, ordered by version. after is the previous nextCursor. Every read rechecks current patient and contract authority; a missing or unavailable case is refused, not reported as an empty complete history. Includes human opening reason/source and subsequent management notes, each with the actual actor subject. Requires patients read and contracts read for a person or delegated internal operator. ACCESS_DENIED: missing grants or retained patient; NOT_FOUND: unavailable case; INVALID_INPUT: malformed id/cursor. Reading history never establishes coverage, care delivery or payment authority. - [Get care management statistics](https://docs.getarbol.com/api/ambar/get-care-dashboard/index.md) — Read counts over the care cases you can see now: active patients, open cases, approved cases, cases completed with access confirmed, cases per status and open cases by days past due. Cases are counted most overdue first for about a second and a half: on a large board `complete` is `false` and the case counts are lower bounds; `summarizeCareCases` counts a filtered board. Requires read access to every patient. Fields from unavailable analytical sources are `null` and named in `unavailableSources`; `careConfirmed` is always `null` because management evidence is not care delivered. `ACCESS_DENIED`: missing scope, a non-human caller, or no read access to every patient; do not retry. - [Get a care provider](https://docs.getarbol.com/api/ambar/get-care-provider/index.md) — Read one care provider of the operational directory by `id`. Use it to get the current `version` before `updateCareProvider`. Returns the care provider, or `data` `null` when it does not exist or is an entry stored with the retired payer kind: a payer already moved to `listPayers`. `INVALID_INPUT`: `id` is malformed. `ACCESS_DENIED`: missing scope or no read grant on it; do not retry. - [Get a care site](https://docs.getarbol.com/api/ambar/get-care-site/index.md) — Read one care site of the operational directory by `id`, with the current label of its care provider. Use it to get the current `version` before `updateCareSite`. Returns the care site, or `data` `null` when it does not exist or you cannot read its care provider. `INVALID_INPUT`: `id` is malformed. `ACCESS_DENIED`: missing scope or no read grant on the care site; do not retry. - [Get your care workspace](https://docs.getarbol.com/api/ambar/get-care-workspace/index.md) — Read your care workload in one call: the first page of visible cases (as `listCareCases` without filters), up to 100 care opportunities with their history, the visible active population, programs, teammates and, with the `ambar:patients:review` scope, up to 50 open clinical alerts. Use it to start a work session; page cases with `listCareCases` and act with `recordCareCase` or `recordCareOpportunity`. Without the review scope `alerts` is `null` and `unavailableSources` lists `clinical_alerts`. It does not certify that the whole population received care. Times are epoch milliseconds except `asOf` (RFC 3339). `ACCESS_DENIED`: missing scope or a non-human caller; do not retry. - [Read a cohort's case-finding board](https://docs.getarbol.com/api/ambar/get-case-finding-board/index.md) — Reads the cohort's case-finding board on a day ([09] section 5): how many people the technical notes in force say are eligible, added over contracts with the note behind each; how many are identified (enrolled, or whose newest evaluation is `confirmed` or `probable` and not rejected), enrolled, in case-finding work (suggested and undecided or deferred), data tasks (`unknown`), ruled out and rejected; the eligible people still to identify and the share identified, in basis points. No patient is named. Use it to see whether the people found fill the contract's eligible population and how big the gap is, and to plan the work: a large `toIdentify` with few `inCaseFinding` asks for broader rules or more data, many `dataTasks` ask for the tests that are missing. Returns `cohortId`, `on` and `board`; `eligible`, `toIdentify` and `identifiedShare` are `null` when no technical note in force names the cohort. Only patients the caller may read for care operations are counted. Requires `ambar:cohorts:read` and `ambar:patients:read` and a read grant on the cohort. `INVALID_INPUT`: malformed `cohortId` or `on`; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Read what the nurse's decisions say about a cohort's rules](https://docs.getarbol.com/api/ambar/get-case-finding-labels/index.md) — Reads the cohort's labels by rule version, newest first: for each tier, how many evaluations the nurse enrolled, rejected and deferred, how many people wait with a suggestion, and how often the tier was right (enrolled ÷ enrolled and rejected, in basis points; deferrals count neither way); the reason codes given, most frequent first; and, of the people enrolled in the cohort today, how many the version suggests (its sensitivity). No patient is named. Use it with the medical team to validate a rule version and to decide the next one ([09] section 2): a tier rarely right needs stricter rules, a low sensitivity misses people. Returns the labels; `versions` is empty before any evaluation. Requires `ambar:cohorts:read` and `ambar:patients:read`; only the evaluations of patients the caller may read for care operations are counted. `INVALID_INPUT`: malformed `cohortId`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [Get population import upload tracking](https://docs.getarbol.com/api/ambar/get-clinical-population-import-custody/index.md) — Reads the custody metadata of one import you staged: status, version, creation time and expiry time. It shows no rows, cohort, patients or file content. Use it to check whether the stored file still exists; use getClinicalPopulationImport for the rows. Returns `null` when you staged no import with this id. Errors: ACCESS_DENIED without the cohort read scope or as a non-human caller; INVALID_INPUT for a malformed id. - [Get a population import](https://docs.getarbol.com/api/ambar/get-clinical-population-import/index.md) — Reads one import you staged: summary, mapping, header row, every parsed row with its cells and warning count, and the decision recorded for each row. Use it before reviewClinicalPopulationImportRow and publishClinicalPopulationImportRow; use listClinicalPopulationImports to find imports. Cell values are reported, not verified. Returns `null` when the import is cancelled or expired. Errors: ACCESS_DENIED when you did not stage an import with this id, without cohort read access or read access to every linked patient, or as a non-human caller; INVALID_INPUT. - [Get a clinical route assessment](https://docs.getarbol.com/api/ambar/get-clinical-route-assessment/index.md) — Reads the latest stored assessment of one patient against one care route, with the patient's compliance with it ([09] section 6): the requirements whose current cycle accepted evidence closed (`done`) over those due by the evaluation (`done` plus `missing`) as `share` in basis points, the requirements the data cannot decide apart (`unknown`, data tasks, never missing care), and the missing ones, the one due longest first, each with its position in the route's `requirements` and since when it is due. Use it to see who falls behind on their route; read it next to the patient's clinical priority (explainPatientPriority), never instead of it: a person can keep up with their route and have a critical result. Check `currentness`: `sources_changed` means `gaps` and `compliance` are `null`; evaluate again with evaluateClinicalRoutePatient. Returns `assessment: null` and `compliance: null` when the patient has no assessment for this route. Errors: ACCESS_DENIED without contract and patient read access, when the patient is not retained, or as a non-human caller; INVALID_INPUT for malformed ids. - [Get a clinical route](https://docs.getarbol.com/api/ambar/get-clinical-route/index.md) — Reads one care route version of a contract with its definition, state and approval trail. Use getCurrentClinicalRoute to know which route is in force. Returns `route: null` when the contract has no route with this id. Errors: ACCESS_DENIED without the contract read scope or grant or as a non-human caller; INVALID_INPUT for malformed ids. - [Get your clinical session](https://docs.getarbol.com/api/ambar/get-clinical-session/index.md) — Returns the clinical-module view of your identity: whether the clinical module is enabled, which care capabilities you hold now (combining token scopes and database grants) and which clinical scopes the token carries. Use it to decide which clinical operations to offer; each operation still authorizes its own patient or contract. A capability is never evidence of a clinical fact. No parameters; any query parameter fails with INVALID_INPUT. Failures: ACCESS_DENIED when the token has no operations, appointments, patients, cohorts, programs, studies, contracts or settlements scope, or the database does not admit the actor; UNAUTHORIZED for a missing or invalid token. - [Get cohort workspace policy](https://docs.getarbol.com/api/ambar/get-cohort-policy/index.md) — Reads a cohort's current revision, its review policy, `policyVersion` and latest `snapshotId`, without counting members. Call it right before evaluateCohortPatient, decideCohortPatient, reconcileCohortWorkspace or stageClinicalPopulationImport to get the current `policyVersion` and `baseSnapshotId`. Returns `null` when no cohort has this id; `policy` and `policyVersion` are `null` when the current revision has no review policy. Errors: ACCESS_DENIED without a read grant on the cohort or as a non-human caller; INVALID_INPUT for a malformed id. - [Get a cohort workspace](https://docs.getarbol.com/api/ambar/get-cohort-workspace/index.md) — Reads a cohort's current revision with its review policy, latest `snapshotId` and member counts (members, still qualified, needing review). Use getCohortPolicy for the same ids without counts (cheaper) and listCohortWorkspaceCandidates for evaluated patients. Returns `null` when no cohort has this id; `policy` and `policyVersion` are `null` when the current revision has no review policy. Errors: ACCESS_DENIED without a read grant on the cohort or as a non-human caller; INVALID_INPUT for a malformed id; DATABASE_UNAVAILABLE: retry later. - [Get a cohort](https://docs.getarbol.com/api/ambar/get-cohort/index.md) — Reads a cohort's current revision and one page (up to 50) of a snapshot's current members. Omit `snapshotId` to read the latest snapshot. To page, send `snapshot.nextCursor` as `after` together with that snapshot's id as `snapshotId`. Use listCohortCoverage for the members' care facts and listCohortWorkspaceCandidates for evaluated candidates. Returns `null` when no cohort has this id; `snapshot` is `null` when the cohort has no snapshot or `snapshotId` names none of its snapshots. Errors: ACCESS_DENIED without a read grant on the cohort; INVALID_INPUT for malformed ids or `after` without `snapshotId`; DATABASE_UNAVAILABLE: retry later. - [Get a configured record](https://docs.getarbol.com/api/ambar/get-configured-record/index.md) — Returns one configured record of a patient or cohort with every template field interpreted: raw value, display value, unit and a `state` such as `recorded`, `missing` or `invalid`. Use it after listConfiguredRecords. The values are documentary captures declared by a person or a source file, not accepted clinical facts; check each field `state` before using a value. `fields` is `null` when `readState` is `key_unavailable` or `unsupported_schema`; do not treat that as an empty record. Failures: NOT_FOUND when the record does not exist for that patient or cohort or has expired; ACCESS_DENIED when the caller is not a person, `ambar:patients:read` or `ambar:cohorts:read` is missing, the patient or cohort is not readable, or the record is tied to a contract you cannot read; CONFLICT when it changed during the read (retry); INVALID_INPUT for malformed parameters. - [Get a contract artifact](https://docs.getarbol.com/api/ambar/get-contract-artifact/index.md) — Reads the metadata of one contract file: name, media type, size, SHA-256, `state` and retention. The read is audited. Use it to check whether an upload finished (`state: ready`) and to get the `source` reference to cite; use `downloadContractArtifact` for the bytes. Returns `artifact`, or `artifact: null` when the file does not exist in this contract or its retention ended. Failures: `ACCESS_DENIED`: missing `ambar:contracts:read` or no read grant; do not retry. `INVALID_INPUT`: `id` must be `art_` plus 32 lowercase hex characters. `DATABASE_UNAVAILABLE`: retry later. - [Read a contract's indicator results in a month, with the retention at risk](https://docs.getarbol.com/api/ambar/get-contract-indicator-month/index.md) — Returns each version of a contract whose indicators the indicator worker measured in a month (once a day, through the previous day, from the first of the month's days the version is in force; a month it never measured, or left before its end, is measured once through its last day in force): the days in force (`inForce`), the last day measured (`asOf`) and, for each indicator, its unit, direction and target, the result so far and projected to the month's close at the pace of the days measured (hundredths of the unit; `null` with nothing to divide by yet, never zero), the counts it came from (`facts`), whether each meets the target, and whether it `decides` money, which only a measure a second person confirmed does. Each result has its `sites` too: the result at each site its services count at (the contracted site of the appointment they attended, or where they were delivered) and its complaints name, `siteId` null for those that name none, for a formula over services, people served, order-to-service days and complaints; none for one that counts what the lines expect or the population, which belong to the whole contract. `retention` weighs the version's indicators: the share of the pay-for-results retention released if the month ends as projected (`onTrackHundredths`), kept by the payer (`atRiskHundredths`, with the indicators to act on in `atRisk`) and not decided yet (`undecidedHundredths`: unconfirmed measures or nothing to divide by), in hundredths of a percent. Use it while a month runs to see which indicators to act on before it closes, and at which site (more slots, rescheduling, a look at the complaints), and to review a closed month (its `asOf` is the last day in force). The formulas and targets are `defineContractIndicatorMeasure` and `confirmContractIndicatorMeasure`; the weights, `listContractIndicators`. The results themselves move no money: what does is each month's compliance (`listContractCompliance`). Returns `contractId`, `month` and `versions` (empty when nothing was measured that month or you may not read the contract). Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: a malformed `contractId` or a `month` that is not `YYYY-MM`; fix it. `ACCESS_DENIED`: a missing scope; do not retry. `MODULE_DISABLED`: the organization does not pay for results; do not retry. - [Read a contract's PGP execution in a month, by note and line](https://docs.getarbol.com/api/ambar/get-contract-line-execution/index.md) — Returns each technical note of a PGP contract measured in a month, as the line-execution worker last measured it (once a day, through the previous day; a month of a note in force that it never measured, or left before its end, is measured once through its last day): the days measured, the value expected and executed, the compliance and where it falls against the note's bands, and each line in the note's order with its expected and executed quantity and value, its compliance and band, the discount the month would cost below an economic-clause band if the pace held, and its alert (`below` or `above`, when it was raised and whether the line is still there). Lines alert from the middle of the month, once per side of their bands. The figures come from the services the router counted toward each note's lines (correct one with `correctServiceRoute`); they move no money. Use it to follow a PGP's month while it runs, to see which lines to push before it closes, and to review a closed month (its `asOf` is the month's last day the note was in force). For every open alert across contracts use `listLineExecutionAlerts`; `getTechnicalNoteExecution` totals the older manual attributions instead. Returns `contractId`, `month` and `notes` (empty when nothing was measured that month or you may not read the contract). Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: a malformed `contractId` or a `month` that is not `YYYY-MM`; fix it. `ACCESS_DENIED`: a missing scope; do not retry. - [Compare a contract's billed revenue with its routed service costs](https://docs.getarbol.com/api/ambar/get-contract-profitability/index.md) — Returns patient-free totals for 1 to 31 days, from included and to excluded, in one currency. Revenue is non-void invoices wholly in the service period plus debit notes minus credit notes; it is billed revenue, not collections or final settled profit. Costs use current paid routes of current encounters, their quantities and the latest catalog revision effective on each service day. Missing costs or overlapping invoices withhold marginMinor and set complete false. Amounts and unit totals are exact integer strings. Requires ambar:contracts:read and the contract read grant. INVALID_INPUT: window exceeds 31 days; NOT_FOUND: contract is not readable. No currency conversion is inferred. - [Get a contract settlement](https://docs.getarbol.com/api/ambar/get-contract-settlement/index.md) — Reads one settlement: input cut, adjustments, exact calculation and acceptance state. Needs `ambar:settlements:read`. Use it to review a draft before `acceptContractSettlement` and to get its `version` for `expectedVersion`. Returns `settlement`, or `settlement: null` when the id does not exist in this contract. Failures: `ACCESS_DENIED`: no read grant for the contract or the settlement; do not retry. `INVALID_INPUT`: fix the identifiers. `DATABASE_UNAVAILABLE`: retry later. - [Read a contract's registration in SIIFA](https://docs.getarbol.com/api/ambar/get-contract-siifa/index.md) — Reads the payer's registration of the contract in SIIFA: its CUCON, the day it was registered, the organization's decision and the last day to take it. Use it before issuing the contract's invoices, which carry its CUCON. Returns the registration, or `null` until the payer registers it. Requires `ambar:contracts:read` and a read grant on the contract. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Show where a contract's care was given, by pair of sites](https://docs.getarbol.com/api/ambar/get-contract-site-indicators/index.md) — For the appointments booked under a contract's sites that start from `from` (included) to `to` (excluded), the organization's local days: for each contracted site, how many held their slot (not cancelled nor moved) and how many were attended, how many of those another site served and their share (`substitutionHundredths`, in hundredths of a percent); and for each site that served for it (the site itself first, then its substitutes), the same counts, the average wait from booking to the appointment (`waitDaysHundredths`, in hundredths of a day) and the reasons the bookings stated for serving away from the contracted site (`offsiteReason`). A booking under no contract's sites counts where it is served and is not here. No person is named. Use it to see how often a contracted site lacks slots in time, which sites serve for it and how long people wait at each, before negotiating capacity or changing the contract's substitutions (`listContractSites`). Returns the contract, the window and its `sites`. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: `to` not 1 to 366 days after `from`, or a malformed `contractId`; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Get a contract version](https://docs.getarbol.com/api/ambar/get-contract-version/index.md) — Reads one contract version: dates, payer and care provider references, priced components and approval state. Use it to review terms before `approveContractVersion` and to get the version's `version` for `expectedVersion`. Returns `version`, or `version: null` when the id does not exist in this contract. Failures: `ACCESS_DENIED`: no read grant for the contract; do not retry. `INVALID_INPUT`: fix the identifiers. `DATABASE_UNAVAILABLE`: retry later. - [Get contract workspace policy](https://docs.getarbol.com/api/ambar/get-contract-workspace-policy/index.md) — Reads the latest operating policy of a contract: the post-discharge follow-up preference. It never changes contract terms or starts outreach. People only; service accounts get `ACCESS_DENIED`. Use it before `saveContractWorkspacePolicy` to get `version` (`expectedPolicyVersion`). The policy names no payer: read the contract's payer with `listContractPayers`. Returns `policy`, or `policy: null` when none has been saved yet. Requires the `ambar:contracts:read` scope and a read grant on the contract. Failures: `ACCESS_DENIED`: not a person, missing scope, or no read grant for the contract; do not retry. `CONFLICT`: the policy changed during the read; retry. `INVALID_INPUT`: fix `contractId`. `DATABASE_UNAVAILABLE`: retry later. - [Get a clinical contract](https://docs.getarbol.com/api/ambar/get-contract/index.md) — Reads one contract: status, current `version` and `approvedVersionId` (`null` until a version is approved). Use it before a contract write to get the `version` to send as `expectedVersion` or `expectedContractVersion`; use `listContracts` to discover ids. Returns `contract`, or `contract: null` when the id does not exist. Failures: `ACCESS_DENIED`: no read grant for this contract (an unknown id can also give this); treat it as not visible and do not retry. `INVALID_INPUT`: fix `id`. `DATABASE_UNAVAILABLE`: retry later. - [Read a conversation with its handling history](https://docs.getarbol.com/api/ambar/get-conversation/index.md) — Reads one conversation: who handles it and how it stands, why the agent handed it over, the agent's summary of the thread at its last handoff (opened), and every change of who handled it, oldest first, with who took each step and when. Use it before taking a conversation over, to read why it was handed over and the summary, and to get the `version` for `changeConversationHandling`. Returns the conversation with `handoffSummary` and `history`. Requires the `ambar:patients:read` scope and the patient's read grant for care operations. `INVALID_INPUT`: malformed `conversationId`; fix it. `NOT_FOUND`: no such conversation, or the caller may not see it. `ACCESS_DENIED`: missing scope, or clinical privacy not configured for a conversation with a summary; do not retry. - [Get the current clinical route](https://docs.getarbol.com/api/ambar/get-current-clinical-route/index.md) — Reads the care route in force for a contract: the newest approved route whose `effectiveFrom` has been reached in its own time zone, at server time. Use it before evaluateClinicalRoutePatient; use listClinicalRoutes for every version. Returns `asOf` (the server time used) and `route`, which is `null` when no approved route is in force. Errors: ACCESS_DENIED without the contract read scope or grant, when the contract is missing or suspended, when a route artifact is no longer available, or as a non-human caller; INVALID_INPUT for a malformed `contractId`. - [Get a data product](https://docs.getarbol.com/api/ambar/get-data-product/index.md) — Returns the data product of one inventory dataset: the rows of its currently published build, read from the warehouse and verified against the recorded hashes and row counts, with full lineage (source, dataset, original upload, publication, quality) and a per-item summary. Use it to read the current inventory of a dataset; use getInventory to read what one specific upload published, and queryAnalyticsSql for custom aggregations. Returns `product: null` when the dataset has no verified published build yet. Failures: ACCESS_DENIED when the token lacks `ambar:datasets:read` or `ambar:ingestions:read`, or you cannot read the dataset; CONFLICT when the publication changed during the read (retry); INVENTORY_INTEGRITY_CONFLICT when the build fails verification (do not use the data; report it); PIPELINE_UNAVAILABLE when the warehouse is unavailable (retry later); INVALID_INPUT for a malformed `datasetId`. - [Get your data session](https://docs.getarbol.com/api/ambar/get-data-session/index.md) — Returns the data-module view of your identity: organization, actor, whether any non-personal dataset is readable now (`hasReadableDatasets`) and which data scopes the token carries. Use it before catalog and inventory work; use getSession for the full scope list. Each later operation checks permissions again, so a `true` flag is not a guarantee. No parameters; any query parameter fails with INVALID_INPUT. Failures: ACCESS_DENIED when the token lacks `ambar:datasets:read` or the database does not admit the actor; UNAUTHORIZED for a missing or invalid token (get a new token). - [Get a dataset](https://docs.getarbol.com/api/ambar/get-dataset/index.md) — Returns the catalog metadata of one non-personal dataset: source, data contract, parser, publication `generation` and `published`, and whether you may upload to it now (`canCreate`). Use `generation` as `expectedGeneration` in createIngestion, and getDataProduct to read the published content. Returns `dataset: null` when the dataset does not exist or you cannot read it. Treat it as unavailable and do not invent a status. Failures: ACCESS_DENIED when the token lacks `ambar:datasets:read`; INVALID_INPUT for a malformed `id`. - [Read the organization's detector rules](https://docs.getarbol.com/api/ambar/get-detector-rules/index.md) — Reads the rules the detectors use: the critical limits per LOINC code and unit and how recent a result must be to page (`critical`), the measurements whose worsening is watched (`trends`), the days without dispensed coverage or a dispensation may stay pending (`adherence`), and the missed appointments that make a pattern (`noShow`); with who set them. A critical result pages at once when it arrives; everything else is found by the nightly sweep from 01:00 of the organization's day. Use it before `setDetectorRules`, for its `version`. Returns the rules. Requires the `ambar:patients:read` scope and the registry-wide patient read grant for care operations. `NOT_FOUND`: no rules were set, so nothing is detected; set them with `setDetectorRules`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Read a document reading with its text and citations](https://docs.getarbol.com/api/ambar/get-document-reading/index.md) — Reads one reading: the document's text as read (each page after a `[page N]` line; citations count its lines from 1), every value in the document's order with the lines and quote it came from, its confidence, its status and any person's decision, the paths the document does not show, the model's notes and the prompt versions used. Use it to review a reading next to the original: highlight each value's quote, then decide it with `decideDocumentValue` (send the value's `version`). Returns the reading. Requires `ambar:patients:read` and a read grant on the patient for care operations (the registry-wide one without a patient). `INVALID_INPUT`: a malformed `readingId`; fix it. `NOT_FOUND`: no such reading, or the caller may not see it. `ACCESS_DENIED`: missing scope, or clinical privacy not configured; do not retry. - [Get a documented appointment](https://docs.getarbol.com/api/ambar/get-documented-appointment/index.md) — Read one documented appointment of a patient with its current revision and one page of its revision history (20 revisions after `afterRevision`, oldest first). Use it to get the current `version` before `correctDocumentedAppointment`, `retractDocumentedAppointment` or `recordAppointmentOutcome`. Returns the appointment, or `data` `null` when it does not exist for this patient. Page the history by passing `history.nextCursor` as `afterRevision`. `INVALID_INPUT`: a parameter is malformed. `ACCESS_DENIED`: missing scope, or no grant on the patient or the appointment; do not retry. - [Read an electronic invoice with its receivable](https://docs.getarbol.com/api/ambar/get-electronic-invoice/index.md) — Reads one invoice: as issued, its notes, its CUV, filing and return, its status, what it misses before it can be filed, its deadlines (to issue it after the payer's advance, to file it, for the payer to object, to pay the advance, the balance and the maximum term) and its receivable on `asOf`: its value after notes, what was prepaid, paid and lost to objections, its balance, the part no open objection disputes, its age since filing and the late-payment interest at the DIAN's rates recorded. Use it to follow one invoice, before `changeElectronicInvoice`. Returns the invoice and its receivable. Requires `ambar:contracts:read` and a read grant on the contract. `NOT_FOUND`: no such invoice, or not readable. `ACCESS_DENIED`: missing scope; do not retry. - [Read an identity case with the person the source described](https://docs.getarbol.com/api/ambar/get-identity-case/index.md) — Reads one open case with the subject the source sent (document, names and birth date, as sent) and the phone the person was reached at, when sent, opened with the organization's clinical keys. Use it before deciding: compare the subject with each candidate (`getPatient`), or search the registry for the right patient when the case is `unknown`. Returns the case and its subject (`null` for a case opened before the queue kept subjects: the inbox item's original has it). Requires `ambar:patients:read` and the registry-wide patient read grant for care operations. `INVALID_INPUT`: a malformed `caseId`; fix it. `NOT_FOUND`: no such open case (it may have been decided: see `listIdentityDecisions`), or the caller may not see it. `ACCESS_DENIED`: missing scope, or clinical privacy not configured; do not retry. - [Get indicator baseline](https://docs.getarbol.com/api/ambar/get-indicator-baseline/index.md) — Returns your indicator baseline for the scope: the pointer (`linkedId`, `definition.publicationId`) to the publication later cuts are compared against. Each person has at most one baseline per scope. Use it before setIndicatorBaseline to get its `id` and `version`; read the publication itself with getIndicatorPublication. Returns `item: null` when you have no baseline in the scope or its publication is no longer readable. Failures: ACCESS_DENIED when the token lacks `ambar:patients:read`, the caller is not a person, or you have no clinical read access to the scope; EVIDENCE_NOT_READABLE when it cannot be decrypted now; INVALID_INPUT for a malformed scope. - [Get an indicator publication](https://docs.getarbol.com/api/ambar/get-indicator-publication/index.md) — Returns one of your indicator publications with its decrypted definition: period, population, declared source file and hashes, and the indicator values exactly as a person declared them. Use it to show or compare a known publication; use getLatestIndicatorPublication for the newest one. The values are a declared cut, not proof of care delivered. Returns `item: null` when the id does not exist, is not yours, is not a publication, has expired, or you no longer have clinical read access to its scope. Failures: ACCESS_DENIED when the token lacks `ambar:patients:read` or the caller is not a person; EVIDENCE_NOT_READABLE when the definition cannot be decrypted now; INVALID_INPUT for a malformed `id` or `version`. - [Get upload status](https://docs.getarbol.com/api/ambar/get-ingestion/index.md) — Returns the receipt of the upload created in a dataset with a given `idempotencyKey`: status, error code, row count, hashes and whether its build is the published one (`active`). Use it to follow an upload after createIngestion (processing continues in the background: poll until `status` is `published`, `superseded` or `review`) and to reconcile an unclear createIngestion before retrying. Returns `ingestion: null` when no upload uses that key in the dataset. Failures: ACCESS_DENIED when the token lacks `ambar:ingestions:read` or you cannot read the dataset; INVALID_INPUT for malformed parameters. - [Read a mapping version](https://docs.getarbol.com/api/ambar/get-installation-mapping/index.md) — Reads one version of an installation's mapping with all its rows, or the latest approved one when `version` is omitted. Use it to review a proposal before `approveInstallationMapping`, or to start the next proposal from the current rows. Returns the version with its author, its approver (`null` for a proposal) and its rows. Requires `ambar:settings:read` or `ambar:settings:write`, a person, and a workspace configuration read grant. `INVALID_INPUT`: malformed query. `NOT_FOUND`: no such version, or no approved version yet. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Get original upload details](https://docs.getarbol.com/api/ambar/get-inventory-original/index.md) — Returns the exact original file of one inventory ingestion after checking its size and SHA-256 against the stored receipt. It does not parse the content. Use it to show or re-download what was uploaded; identify the ingestion by `datasetId` and the `idempotencyKey` used when it was created. Returns the content as UTF-8 text with its byte count, hash, suggested file name and media type. Each successful read is recorded as an audited access. Errors: `INVALID_INPUT` (fix the query); `ACCESS_DENIED` (missing `ambar:ingestions:read` or dataset not readable: do not retry); `CONFLICT` (no stored original for this key yet, or it failed integrity checks); `PIPELINE_UNAVAILABLE` (object storage unavailable: retry later). - [Read ready inventory](https://docs.getarbol.com/api/ambar/get-inventory/index.md) — Returns the inventory rows of one upload, but only while that upload is the dataset's currently published build (`status` `published` and `active`). Rows are read from the warehouse and checked against the published build before they are returned. Use it to read what an upload published; use getDataProduct to read whatever is currently published for a dataset, with lineage and a summary. Returns the upload receipt and its `[sku, site, quantity]` rows. Failures: CONFLICT when the upload is not (or no longer) the active published build, or the publication changed during the read (check getIngestion, or use getDataProduct); INVENTORY_INTEGRITY_CONFLICT when the stored build fails verification; PIPELINE_UNAVAILABLE when the warehouse is unavailable (retry later); ACCESS_DENIED when the token lacks `ambar:ingestions:read` or you cannot read the dataset; INVALID_INPUT for malformed parameters. - [Read a jurisdiction's profile and the holidays of a year](https://docs.getarbol.com/api/ambar/get-jurisdiction/index.md) — Reads what one country names or codes its own way: the identity documents it issues with the length and characters of their numbers, its territory code levels, its holiday rules and the holidays they give in `year`, the deadlines its law sets (`terms`: hours, calendar days or business days, with the norm to verify), and the words its screens and agents use (`EPS` or `IAFAS`, `contrato` or `convenio`, `CUPS` or `CPMS`). The content is cited from memory and says what to verify in `sources`. Use it to show a country's words, to check a document number before saving it, to count business days, and to find the term a workflow's `wait_for_event` can wait by (`timeout: { term: }`). Returns the profile with the year's holidays. Requires one of `ambar:patients:read`, `ambar:contracts:read`, `ambar:cohorts:read` or `ambar:settings:read`. `INVALID_INPUT`: a malformed country or a year outside 2000 to 2100; fix it. `NOT_FOUND`: Ámbar has no profile for the country; see `listJurisdictions`. `ACCESS_DENIED`: none of those scopes; do not retry. - [Read where a FHIR Bulk Data export stands](https://docs.getarbol.com/api/ambar/get-lake-fhir-export-status/index.md) — The status URL of a FHIR Bulk Data export ([36] section 8.5). While it runs: `202` with `X-Progress` (people written) and `Retry-After`. Once complete: `200` with the manifest, whose files are kept for a day. A failed export answers `500` with an OperationOutcome naming why (`BULK_AGREEMENT_NOT_IN_FORCE` when the agreement was revoked or changed meanwhile); a cancelled one, or one whose files were deleted, `404`. Only the account that started it, while the revision in force names it; requires `ambar:datasets:read`. Each read is audited. - [Read where the linkage of the agreements stands](https://docs.getarbol.com/api/ambar/get-lake-linkage-status/index.md) — For the people who configure sharing: the agreements the deployment holds a linkage key for, and for each agreement in force that allows linkage tokens, how many people have a token, when the worker's current round over the organization's people started and when the last one ended ([36] section 8.3). Requires `ambar:settings:read` or `ambar:settings:write`, and a configuration grant; the read is audited. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Read what Ámbar can write of an outpatient RDA](https://docs.getarbol.com/api/ambar/get-lake-rda-conformance/index.md) — Lists every element the Ministry's RDA implementation guide (1.0.3) requires of the outpatient Resumen Digital de Atención (Res. 1888 de 2025) and where Ámbar takes it from: the record, the person's profile, the organization's configuration, or nowhere (`missing`, with why). Ámbar writes a preliminary draft; the provider's system completes it, signs it and sends it ([36] section 8.6). Requires `ambar:settings:read` or `ambar:settings:write`. `ACCESS_DENIED`: missing scope; do not retry. - [Read what the lake can share](https://docs.getarbol.com/api/ambar/get-lake-sharing-catalog/index.md) — Returns the lake's data contract as a person choosing what to share reads it: every table with its grain, the day its products filter by and whether payer and site filters apply, and every column with its type, its privacy class, the standard its codes follow, its FHIR R4 element and what a share does with it under the protective rules (months, departments, no demographics, money or professionals, cells of five), which a draft starts from. Use it to build the products of `proposeLakeSharingAgreement`. Requires `ambar:settings:read` or `ambar:settings:write`. `ACCESS_DENIED`: missing scope; do not retry. - [Get latest indicator publication](https://docs.getarbol.com/api/ambar/get-latest-indicator-publication/index.md) — Returns your most recently created active indicator publication in the scope, with its decrypted definition. Use its `id` as `expectedLatestPublicationId` when publishing the next cut, and as `publicationId` in setIndicatorBaseline. Returns `item: null` when you have no active, readable publication in the scope; then publish with `expectedLatestPublicationId: null`. Failures: ACCESS_DENIED when the token lacks `ambar:patients:read`, the caller is not a person, or you have no clinical read access to the scope; EVIDENCE_NOT_READABLE when the definition cannot be decrypted now; INVALID_INPUT for a malformed scope. - [Get a note extraction](https://docs.getarbol.com/api/ambar/get-note-extraction/index.md) — Returns one of your note extractions with its progress and, when `state` is `ready`, the extracted candidate: field values with quoted evidence lines, missing fields and reviewer notes. The candidate is an untrusted draft, not an approved technical note. Poll it after startNoteExtraction or runNoteExtraction; adopt a reviewed candidate with adoptNoteExtraction, sending `version` and `candidateSha256`. Requires a person whose token has `ambar:contracts:read` and `ambar:arbi:read` and is not expired, plus contract finance read access. Failures: ACCESS_DENIED when the extraction is not yours, has expired, its document is no longer readable, or a scope or access is missing; EVIDENCE_NOT_READABLE when the candidate no longer matches its converted text; CONFLICT when it changed during the read (retry); UNAUTHORIZED when the token has expired; INVALID_INPUT for malformed parameters. - [Read the modules the organization uses](https://docs.getarbol.com/api/ambar/get-organization-modules/index.md) — Reads the organization's modules: what it contracted with Árbol (`contracted`), what its administrator turned on (`active`) and what it uses now (`effective`: contracted, turned on, and with one of the modules it requires, as `requirements` lists). Operations of a module outside `effective` answer `MODULE_DISABLED`, and the app does not show it. An organization nobody configured uses every module. The modules: `pgp` (technical notes, each line's execution, the people pending on them), `capitation`, `fee_for_service` (fee schedules, invoices, objections), `results_payment` (indicators that move money), `service_record` (RIPS), `cac`, `cohorts` (cohorts, case finding, programs, care routes), `studies`, `agenda` (capacity, waitlist, appointments, attendance), `voice`, `whatsapp`, `sms`, `email`, `arbi`, `ai_documents` (reading documents, extracting annexes and notes), `ai_care` (patient summaries and memory) and `analytics`. Use it before `setOrganizationModules`, for its `version`; `getSession` gives everyone the modules in use. Returns the modules. Requires `ambar:settings:read` or `ambar:settings:write`. `ACCESS_DENIED`: missing scope; do not retry. - [Get patient care assessment history](https://docs.getarbol.com/api/ambar/get-patient-care-assessment-history/index.md) — Lists the immutable revisions of one care assessment, oldest first, 20 per page. Use it to audit how a period was evaluated or retracted over time; for the current state use `getPatientCareProgress`. Revisions whose sources or supporting record you can no longer read are left out; an unknown assessment id returns an empty list. Pass `nextCursor` as `afterRevision` for the next page; `null` means done. Requires a human caller or explicitly delegated internal operator with `ambar:patients:read` and `ambar:studies:read`. Errors: `INVALID_INPUT` (bad ids or cursor); `ACCESS_DENIED` (not workforce, missing scope, or patient erased or past retention); `DATABASE_UNAVAILABLE` (retry later). - [Get patient care progress](https://docs.getarbol.com/api/ambar/get-patient-care-progress/index.md) — Reads the pending-care panel of one patient: requirements of approved technical notes you can see, their qualification periods and the stored assessments. Use it to decide what care is open or satisfied; record an assessment with `evaluatePatientCare` and see past revisions with `getPatientCareAssessmentHistory`. Each item has a `currency` (does the stored assessment still match its sources?) and a `status`. `globalCareState` is always `unknown`: never infer that all care is complete. Discovery is bounded (see `discovery`). A page may be empty yet carry `nextCursor`; keep passing it as `after` until `nextCursor` is `null`. Requires a human caller with `ambar:patients:read` and `ambar:studies:read`. Errors: `INVALID_INPUT` (bad id or cursor); `ACCESS_DENIED` (not human, missing scope or grant, or patient erased or past retention); `DATABASE_UNAVAILABLE` (retry later). - [List patient clinical contracts](https://docs.getarbol.com/api/ambar/get-patient-clinical-contracts/index.md) — Lists active clinical contracts you may read that currently hold an explicit individual care assignment of the patient, with the number of assignments. Use it to know which contracts apply to a patient's care. It is not insurance or financial enrollment and not a list of completed services. Each page scans 50 visible contracts and returns only those with assignments, so `items` can be empty while `nextCursor` is set; pass `nextCursor` as `after` until it is `null`. `qualificationState: unknown` (patient not `active`, or coverage not evaluable) means a missing contract is not proof of no coverage. Requires `ambar:patients:read` and `ambar:contracts:read`. Errors: `INVALID_INPUT` (bad id or cursor); `ACCESS_DENIED` (missing scope or grant, or patient erased or past retention); `CONFLICT` (patient or a contract changed during the read: read the page again); `DATABASE_UNAVAILABLE` (retry later). - [Get a patient document](https://docs.getarbol.com/api/ambar/get-patient-document/index.md) — Reads the declared metadata and custody state of one patient document. Use it to check whether an upload finished (`state`) or to read the file name and media type; to get the bytes use `downloadPatientDocument`. Requires a human caller with `ambar:patients:read`. Errors: `INVALID_INPUT` (bad ids); `ACCESS_DENIED` (not human, missing scope or grant, or the document is unknown, restricted or past retention); `CAPABILITY_NOT_CONFIGURED` (document custody is not set up); `DATABASE_UNAVAILABLE` (retry later). - [Read who handles a patient's conversations](https://docs.getarbol.com/api/ambar/get-patient-handler/index.md) — Reads who handles a patient's conversations by default: a named person or a team of the organization, or `null` when the program's agent does. A new conversation about the patient starts with that person (`human_active`) or waits for that team (`handoff_requested`), and a resolved one reopens with them. Use it from the patient's record, and before `setPatientHandler` to get the `version`. Returns the handler with its `version`; both `null` when none is set. Requires the `ambar:patients:read` scope and the patient's read grant for care operations; without the grant no handler shows. `INVALID_INPUT`: malformed `patientId`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [Get a documented patient interaction](https://docs.getarbol.com/api/ambar/get-patient-interaction/index.md) — Read the latest version of one documented interaction by `id`, together with `patientId` and `family` (`contractId` is optional). Use it to get the current `version` of an alert before deciding on it with `recordPatientInteraction`. Returns the interaction with its decrypted `content`. `INVALID_INPUT`: `id` is missing or `after` was given. `NOT_FOUND`: no visible interaction with that `id`, `family` and patient (also when its contract no longer covers the patient). `ACCESS_DENIED`: missing scope or grant, or patient not covered by `contractId`; do not retry. - [Get patient population page](https://docs.getarbol.com/api/ambar/get-patient-population-page/index.md) — Lists the cohorts whose latest snapshot includes the patient and the programs the patient participates in, limited to those you may read. Use it for a patient's population context, or to page past the first page returned by `getPatientWorkspace`. Cohort `status` is always `candidate`, not an enrollment decision. Cohorts and programs page independently, 50 each, ordered by id: pass `cohortsNextCursor` as `cohortAfter` and `programsNextCursor` as `programAfter`; `null` means done. Requires `ambar:patients:read`. Errors: `INVALID_INPUT` (bad id or cursor); `ACCESS_DENIED` (missing scope or grant, or patient erased or past retention); `DATABASE_UNAVAILABLE` (retry later). - [Read one encounter by its id](https://docs.getarbol.com/api/ambar/get-patient-record-encounter/index.md) — Returns one service delivered to a patient: the patient, the day, the site, the national procedure codes, the ICD-10 diagnoses and the contract component that pays it, whatever its version, so the one an invoice line bills is found even after a correction. Use it to answer an objection: `listObjectionsDue` gives each one's `encounterId`, and the encounter names the patient whose record around that day holds the answer's supports (`listPatientRecordEvents`: the note, the order, the attendance and the documents). Draft the answer from them for a person, who sends it with `changeObjection`. Returns the encounter. Requires `ambar:patients:read` and a read grant on the patient for care operations. `INVALID_INPUT`: malformed `encounterId`; fix it. `NOT_FOUND`: no such encounter, or you may not read its patient. `ACCESS_DENIED`: missing scope; do not retry. - [Get a patient's summary](https://docs.getarbol.com/api/ambar/get-patient-summary/index.md) — Returns the patient's summary by section (conditions, pending, recent conversations, preferences and alerts), written by the summary worker from the record; every line cites the record events it comes from. Use it before contacting or attending the patient, instead of reading the whole record; follow a citation with `listPatientRecordEvents` when a line needs its evidence. Pass `version` to read what an earlier version said. Returns the version with its kind, model and prompt. Requires the `ambar:patients:read` scope and a read grant on the patient. `INVALID_INPUT`: malformed `patientId` or a `version` of 0. `NOT_FOUND`: the patient has no summary yet, or not that version; read the record instead. `ACCESS_DENIED`: missing scope or patient grant, or clinical keys not configured; do not retry. - [Get a patient workspace](https://docs.getarbol.com/api/ambar/get-patient-workspace/index.md) — Reads the patient workspace header: the current profile in a flat shape plus the first page of cohorts and programs. Use it to open a patient view; for the plain patient record use `getPatient`. Placeholder fields are never loaded here: read observations with `listPatientObservations`, contracts with `getPatientClinicalContracts` and care with `getPatientCareProgress`. Requires `ambar:patients:read`. Errors: `INVALID_INPUT` (bad id); `ACCESS_DENIED` (missing scope or grant); `NOT_FOUND` (patient does not exist, was erased or its retention ended); `CONFLICT` (the patient changed during the read: read again); `DATABASE_UNAVAILABLE` (retry later). - [Get a patient](https://docs.getarbol.com/api/ambar/get-patient/index.md) — Reads one patient with its current decrypted profile. Use it when you already know the patient id (from `listPatients`, `lookupPatients` or another resource that references the patient). Returns `patient`, or `patient: null` when it does not exist, was erased or its retention ended. Treat `null` as unavailable and do not invent a profile. `phoneReportedWrongAt` says when a contact reported that the patient's phone reaches someone else: nobody calls or writes to that number until it changes (`updatePatient`) or a person clears the report (`clearWrongPhone`). Errors: `INVALID_INPUT` (id is not a lowercase UUID); `ACCESS_DENIED` (missing `ambar:patients:read` or no read grant for this patient: do not retry); `DATABASE_UNAVAILABLE` (retry later). - [Read a payer report generated, with its files](https://docs.getarbol.com/api/ambar/get-payer-report-run/index.md) — Reads one run of a payer report with the content of its files, exactly as generated: the SHA-256 of each file's content is the one the run keeps. Ten years after a run was generated its files' contents are purged (Ley 962 de 2005, art. 28): it then answers `run.filesPurgedAt` and no `files`, and `run.files` keeps each one's name, size and SHA-256 to check a copy against. Use it to download the files sent, or to show the payer what it received. Returns `run` and `files`. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: a malformed `id`; fix it. `NOT_FOUND`: no such run you may read. `ACCESS_DENIED`: a missing scope; do not retry. - [Get a program workspace](https://docs.getarbol.com/api/ambar/get-program-workspace/index.md) — Reads a cohort program's current revision with its operational configuration and enrollment counts (enrolled, still qualified, needing review). Use getProgram for the enrollment list and listProgramProgress for counts across programs. `executionEnabled` is always `false`. Returns `null` when no program has this id; `configuration` is `null` when the current revision has none. Errors: ACCESS_DENIED without a read grant on the program or as a non-human caller; INVALID_INPUT for a malformed id. - [Get a program](https://docs.getarbol.com/api/ambar/get-program/index.md) — Reads a cohort program's current revision and one page (up to 50) of its enrollments, ordered by patient id. Pass `nextCursor` as `after` to read the next page; `null` means the last page. Erased patients and patients past retention are left out. Returns `null` when no program has this id. Errors: ACCESS_DENIED without a read grant on the program; INVALID_INPUT for a malformed `id` or `after`; DATABASE_UNAVAILABLE: retry later. - [Get a record template](https://docs.getarbol.com/api/ambar/get-record-template/index.md) — Returns one record template with its full definition (fields, value rules, absence codes), at its latest version or at `version`. Use it before createConfiguredRecord to know which fields to send, and before saveRecordTemplate to get the latest `version`. Access works as in listRecordTemplates: through workspace settings without `entity`/`entityId`, or through that patient or cohort with them. `definition` is `null` when `readState` is `key_unavailable` or `unsupported_schema`; do not treat that as an empty form. Failures: NOT_FOUND when the template or version does not exist, has expired, or is for another kind of record; ACCESS_DENIED when the caller is not a person, the scope or grant is missing, or the patient or cohort is not readable; CONFLICT when the template changed during the read (retry); INVALID_INPUT for malformed parameters. - [Read the rule catalog in force](https://docs.getarbol.com/api/ambar/get-rule-catalog-in-force/index.md) — Reads the catalog of one kind the organization uses on a day in a jurisdiction: its newest approved version (`origin.kind = organization_version`), else the reference release Ámbar maintains for the jurisdiction in force that day (`reference_release`). Kinds: `kidney_rule` (eGFR formula, thresholds, spacing, lookback and LOINC codes of kidney case finding), `risk_tier_defaults` (what a cohort's risk tiers use when the cohort does not say), `risk_scales` (the LOINC codes Framingham and FINDRISC read, the calibrations a country recommends and the one in force, the waist cut-offs) and `cac_rules` (the rule of each CAC field and the code it writes for each answer). Use it to see the values a rule reads, and as the start of a new version: edit `catalog`, check it with `checkRuleCatalog`, then `proposeRuleCatalogVersion`. Returns `origin` and `catalog`. Requires one of `ambar:patients:read`, `ambar:cohorts:read` or `ambar:settings:read`. `NOT_FOUND`: no approved version and no reference release in force that day in the jurisdiction, so the rule does not run; ask the platform operator to load the releases. `INVALID_INPUT`: unknown kind, or a malformed country or day; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [Get a saved analytic](https://docs.getarbol.com/api/ambar/get-saved-analytic/index.md) — Returns one of your saved analytics at its current version: dataset, title, metric, item and the `version` needed to update it. Use it before updateSavedAnalytic or to reconcile an unclear write. It returns a definition, not computed numbers. Returns `view: null` when the analytic does not exist, belongs to someone else, or its dataset is no longer readable or supported; treat it as unavailable. Failures: ACCESS_DENIED when the token lacks `ambar:datasets:read`; INVALID_INPUT when `id` is not `sav_` + 32 lowercase hex. - [Get your session](https://docs.getarbol.com/api/ambar/get-session/index.md) — Returns who you are signed in as: organization, actor, token subject, actor kind (`user` or `service`), the token scopes, the modules your organization uses (`organizationModules`; operations of any other module answer MODULE_DISABLED, and the app shows only these) and the country of its jurisdiction (`jurisdiction`; getJurisdiction reads that country's documents, currency, territory codes and words). Call it first to learn the organization context and which scope families you hold; use getDataSession or getClinicalSession for module-specific capabilities. Every later operation still checks its own permissions. No parameters; any query parameter fails with INVALID_INPUT. Failures: UNAUTHORIZED when the token is missing or invalid (get a new token); ACCESS_DENIED when the token has no Ambar data, clinical, assistant or settings scope, or the database does not admit the actor; DATABASE_UNAVAILABLE: retry later. - [Get a data source](https://docs.getarbol.com/api/ambar/get-source/index.md) — Returns the metadata of one data source: technical key, system kind, display name, creation time and registration state. Use it when a dataset names a `sourceSystemId`; use listSources to browse. Returns `source: null` when the source does not exist or you cannot see it (you need a readable dataset of that source). Treat it as unavailable and do not guess its details. Failures: ACCESS_DENIED when the token lacks `ambar:datasets:read`; INVALID_INPUT for a malformed `id`. - [Get a study definition](https://docs.getarbol.com/api/ambar/get-study-definition/index.md) — Reads one study definition with the requested revision, or with its latest revision when `definitionVersion` is omitted. Use it to get the components, value types and units a result must use before `reportStudyRecord`, or to check a proposed revision before `approveStudyDefinition`. Returns `data: null` when the definition or the revision does not exist. Requires `ambar:studies:read`. Errors: `INVALID_INPUT` (bad id or version); `ACCESS_DENIED` (missing scope or no read grant on the definition); `DATABASE_UNAVAILABLE` (retry later). - [Get study order registration policy](https://docs.getarbol.com/api/ambar/get-study-order-registration-policy/index.md) — Reads the registration follow-up policy of a contract: the latest revision, the active one and, with `orderId`, the revision in force when that order was decided. Use it before `captureStudyOrderRegistrationDeadline` (take `applicableAtDecision.version`) or before saving or approving a revision (take `version`). `version` is `0` and every revision is `null` when the contract has no policy. Requires a human caller with `ambar:contracts:read`, plus `ambar:patients:read` and `ambar:studies:read` when `orderId` is given. Errors: `INVALID_INPUT` (bad ids); `ACCESS_DENIED` (not human, missing scope, or contract or order not readable); `CONFLICT` (the policy changed during the read: read again); `DATABASE_UNAVAILABLE` (retry later). - [Get a study order](https://docs.getarbol.com/api/ambar/get-study-order/index.md) — Reads one study order with its decision, cancellation and decrypted registration. Use it before `decideStudyOrder`, `registerStudyOrder` or `cancelStudyOrder` to get the current `version`. Returns `data: null` when the order does not exist or is not visible to you. Requires `ambar:studies:read` and `ambar:patients:read`. Errors: `INVALID_INPUT` (bad id); `ACCESS_DENIED` (missing scope); `DATABASE_UNAVAILABLE` (retry later). - [Get study progress](https://docs.getarbol.com/api/ambar/get-study-progress/index.md) — Summarizes, for one program, one approved study definition revision and one calendar window, the best study progress of each currently enrolled patient you may read. Use it for operational follow-up: each patient gets one `category` (from an accepted complete result down to no qualifying event) and the next pending human action. `counts` and `denominator` cover every classified patient; `items` lists 20 per page, optionally for one `category` only. The cursor is bound to the exact selection and caller: pass `nextCursor` as `after` with the same parameters; `null` means done. Requires `ambar:studies:read`, `ambar:patients:read` and `ambar:programs:read`. Errors: `INVALID_INPUT` (bad window, time zone or cursor); `ACCESS_DENIED` (missing scope or grant, unknown program or unapproved revision); `RESOURCE_LIMIT_EXCEEDED` (more than 5000 patients: narrow the program); `DATABASE_UNAVAILABLE` (retry later). - [Get a study record](https://docs.getarbol.com/api/ambar/get-study-record/index.md) — Reads one study record with its decrypted payload and review state. Use it before `reviewStudyRecord` to check the content and the current `version`. Only `accepted` records are reviewed facts. Returns `data: null` when the record does not exist or is not visible to you. Requires `ambar:studies:read` and `ambar:patients:read`. Errors: `INVALID_INPUT` (bad id); `ACCESS_DENIED` (missing scope); `DATABASE_UNAVAILABLE` (retry later). - [Get a study submission](https://docs.getarbol.com/api/ambar/get-study-submission/index.md) — Reads one study submission with its decrypted source content. Use it to review unresolved source content before linking it to a patient with `linkStudySubmission`. Returns `data: null` when the submission does not exist or is not visible to you. Requires `ambar:studies:read` and `ambar:patients:read`. Errors: `INVALID_INPUT` (bad id); `ACCESS_DENIED` (missing scope); `DATABASE_UNAVAILABLE` (retry later). - [Get your team change receipt](https://docs.getarbol.com/api/ambar/get-team-command/index.md) — Read one team command that you prepared, by `id`. Use it to follow a command after `prepareTeamCommand` or `runTeamCommand`. A `sending` or `unknown` command is resolved with `runTeamCommand`; never prepare a new one for the same change. Returns `command`, which is `null` when you have no command with that `id`. `INVALID_INPUT`: `id` is malformed. `ACCESS_DENIED`: missing `ambar:settings:read` scope or configuration read access; do not retry. - [Get the organization team](https://docs.getarbol.com/api/ambar/get-team/index.md) — Read your organization's team from the identity provider: members with their managed roles, pending invitations, and the managed roles you can assign. Use it before `prepareTeamCommand` to choose a member (`userId`, `editable`), an invitation or an assignable role. Global or group-derived permissions are not listed and cannot be changed here. Requires a human caller with the `ambar:settings:read` scope, confirmed with the identity provider before and after the read. `CAPABILITY_NOT_CONFIGURED`: team management is not set up. `SERVICE_BUSY`: the provider took longer than 45 seconds; retry later. `PIPELINE_UNAVAILABLE`: the provider is unreachable; retry later. `ACCESS_DENIED`: missing scope, or your permissions changed during the read; do not retry. `INVENTORY_INTEGRITY_CONFLICT`: unexpected provider data. - [Get technical note demand](https://docs.getarbol.com/api/ambar/get-technical-note-demand/index.md) — Projects demand for each line of the contract's technical note in force today from the current approved care pathway, its cohorts' latest cuts and each member's current evaluation, and compares it with the offer authored in the note. Read-only. People only; needs `ambar:patients:read`, `ambar:contracts:read`, `ambar:studies:read` and `ambar:cohorts:read`. Use it for capacity planning; use `getTechnicalNoteExecution` for attributed execution. Returns `state: ready` with `lines` and `activities`, or another `state` with `reasons` (e.g. no current note or pathway, stale cohort cut, members without a current evaluation, more than 5000 patients) and no numbers. Fix the cause or retry. Failures: `ACCESS_DENIED`: not a person, missing scopes or grants, contract not active, or `selectedCohortId` is not a pathway cohort; do not retry. `CONFLICT`: sources changed during the read; retry. `INVALID_INPUT`: fix the dates or ids. `DATABASE_UNAVAILABLE`: retry later. - [Get technical note execution](https://docs.getarbol.com/api/ambar/get-technical-note-execution/index.md) — Totals, for each line of an approved technical note, the attributed quantity, patients and attributions with event dates in [`from`, `to`] (inclusive), next to the authored forecast for those dates. Monitoring only, not financial recognition. People only; needs `ambar:contracts:read`, `ambar:patients:read` and `ambar:studies:read`. Use it to follow execution; use `listTechnicalNoteAttributions` for the individual attributions. Returns `lines`, one per note line. `staleAttributions` counts attributions whose sources changed; `selectionTruncated: true` means only 1000 were counted, so narrow the dates. Failures: `ACCESS_DENIED`: not a person, missing scopes or contract grant, or the note is not approved; do not retry. `INVALID_INPUT`: fix the ids or dates (at most 3660 days apart). `DATABASE_UNAVAILABLE`: retry later. - [Read an incomplete technical-note preparation](https://docs.getarbol.com/api/ambar/get-technical-note-preparation/index.md) — Reads one preparation, or preparation:null when absent from this contract. pendingFields are server-computed JSON pointers relative to definition identifying structural facts still needed for an ordinary draft. Approval-only fields are checked later by checkTechnicalNote. Requires ambar:contracts:read, contract finance read access and a person or delegated internal operator. ACCESS_DENIED: missing authority; INVALID_INPUT: malformed identifiers; DATABASE_UNAVAILABLE: retry later. - [Get a technical note](https://docs.getarbol.com/api/ambar/get-technical-note/index.md) — Reads one technical note revision: definition, source document and approval state. People only. Use it before `proposeTechnicalNote` or `approveTechnicalNote` to review the note and get its `version`; use `listTechnicalNotes` to discover ids. Returns `note`, or `note: null` when the id does not exist in this contract. Failures: `ACCESS_DENIED`: not a person, missing `ambar:contracts:read`, or no read grant for the contract; do not retry. `INVALID_INPUT`: fix the identifiers. `DATABASE_UNAVAILABLE`: retry later. - [Read a workflow run with its steps](https://docs.getarbol.com/api/ambar/get-workflow-run/index.md) — Returns one run and every step attempt it made, oldest first: which step, who performed it, when, the outcome taken and its evidence. It is the patient's timeline in that workflow. Use it to explain what a workflow did for a patient, or to find the open attempt whose outcome to report (`reportWorkflowStepOutcome`). Returns the run and its `steps`. Requires the `ambar:programs:read` and `ambar:patients:read` scopes and a read grant on the patient. `INVALID_INPUT`: malformed `runId`. `NOT_FOUND`: no such run, or the caller cannot see it. `ACCESS_DENIED`: missing scope; do not retry. - [Get workspace preferences](https://docs.getarbol.com/api/ambar/get-workspace-preferences/index.md) — Returns the organization's workspace preferences (name, locale, time zone, default country, agent reference) and its decrypted workspace settings, with the `version` needed to save changes. Use it before saveWorkspacePreferences and whenever you need configured labels, reasons or observation vocabularies. Only people can call it; service tokens get ACCESS_DENIED. `settings` is `null` when `settingsState` says the stored settings cannot be read; do not treat that as empty settings. No parameters; any query parameter fails with INVALID_INPUT. Failures: ACCESS_DENIED when the token has neither `ambar:settings:read` nor `ambar:settings:write`, you hold no configuration read grant, or clinical encryption is not configured; CONFLICT when the organization has no workspace configuration installed (ask an operator). - [Import a payer's list of who serves its members](https://docs.getarbol.com/api/ambar/import-provider-assignment-list/index.md) — Imports a payer's assignment list (which pharmacy operator, laboratory or site serves its members, by service category and territory) as a new version that takes effect on `effectiveFrom`: from then, for the payer (and contract) and the list's categories, it replaces the earlier lists, even where it says nothing. Provider and site codes are the directory's `externalCode`s of active entries; `installations` names, per provider code, the installation follow-ups go through. Run it first with `dryRun: true`: it resolves every code and compares the list with the lists in force the day before it takes effect (`changes`), listing in `unresolved` the codes that name no active entry of the directory, or more than one (give those entries distinct codes). The same list again with the same `requestKey` answers with `replayed: true`. Returns the list (`null` while codes are unresolved), the changes and the unresolved codes, with the `requestKey`. Requires `ambar:patients:read` and `ambar:patients:write` and the registry write grant for care operations. `INVALID_INPUT`: an empty or oversized file, a malformed header, row, category or territory, a repeated category and territory, or more than 20,000 rows; fix the file. `CONFLICT`: codes are unresolved (a dry run lists them), or the payer is not one of the organization's; fix the directory or the file. `IDEMPOTENCY_CONFLICT`: the `requestKey` was used for another list; use a new one. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Send a custom integration's document](https://docs.getarbol.com/api/ambar/ingest-events/index.md) — Takes one JSON document for a `custom-push` or `billing-push` installation: a canonical event v1, a list of them, or the client's own shape that the installation's rules map. The document is kept exactly as sent and queued; the ingest worker reads it, maps its codes and loads the events, and a code without an approved mapping waits in the mapping queue. Use it from a client's own system, with the installation's service account. Send `Content-Type: application/json`, at most 1 MiB. Retrying the same document is safe: it is kept once and queued once. `dryRun=true` checks the installation and the document type without keeping anything. Returns 202 with where the original is kept and whether it was queued now. Requires the `ambar:ingestions:write` scope. `INVALID_INPUT`: malformed `installationId`, a body that is not JSON, or an installation of another app (send files with `ingestFile`). `NOT_FOUND`: no active installation with that id the caller may send to (its service account is another); check the id and the installation's state. `CONFLICT`: the installation's app version is not served by this build. `BODY_TOO_LARGE`: over 1 MiB. `ACCESS_DENIED`: missing scope; do not retry. - [Upload a file for an installation](https://docs.getarbol.com/api/ambar/ingest-file/index.md) — Takes one file for an installation of an app fed by files: a payer's population file, a HIS export, laboratory results (HL7 v2, FHIR, CSV), RIPS or a custom integration's document. The file is kept exactly as uploaded, with its name and media type, and queued on the bulk lane, so a large load never delays critical results; the ingest worker reads it with the installation's app. Use it to load a file a source dropped, from a person's screen or a client's system. A contact center uploads each recording or transcript here as a file of a media type its installation declares (`recordings.attachmentTypes`) and names it in the call's record by the `originalRef` answered. Send the file as the body with its `Content-Type` (`text/csv`, `application/json`, …), at most 128 MiB, and its name in `fileName`. Retrying the same file is safe. `dryRun=true` checks without keeping anything. Returns 202 with where the original is kept and whether it was queued now. Requires the `ambar:ingestions:write` scope. `INVALID_INPUT`: malformed `installationId` or `fileName`, no media type, or an installation whose app takes no files. `NOT_FOUND`: no active installation with that id the caller may send to. `CONFLICT`: the installation's app version is not served by this build. `BODY_TOO_LARGE`: over 128 MiB. `ACCESS_DENIED`: missing scope; do not retry. - [See how each installation is doing](https://docs.getarbol.com/api/ambar/installation-health/index.md) — Lists every installation of the organization with what its inbox holds (waiting, in process, set aside, done in the last day), its last delivery, the failure its newest unprocessed delivery carries, and how many codes and source records wait for a person. Use it to notice a provider that stopped sending (`lastReceivedAt`), ingest falling behind (`oldestQueuedAt`) or work waiting for people (`mappingGaps`, `identityCases`). Codes only: no delivery content is shown. Returns the complete list, by installation id. Requires `ambar:settings:read` or `ambar:settings:write`, a person, and a workspace configuration read grant. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Instantiate a program template](https://docs.getarbol.com/api/ambar/instantiate-program-template/index.md) — Creates the template's three cohort programs in `draft` status, each configured with your cohorts, contract and provider, in one transaction. Nobody is enrolled or contacted. Send one binding per slot key from listProgramTemplates. Program ids are derived from `requestKey`. Review and activate the programs with saveProgramWorkspace. Returns the created programs; `executionEnabled` is always `false`. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: INVALID_INPUT for a wrong template or revision or incomplete bindings; CONFLICT when a program with a derived id already exists or the provider or facility is not active. ACCESS_DENIED without the program, cohort, contract and operations scopes, program write and approve grants, or read access to the contract and cohorts; COMMIT_UNCERTAIN: retry with the same `requestKey`. - [Link study order performance](https://docs.getarbol.com/api/ambar/link-study-order-performance/index.md) — Links an accepted performance study record to a `registered` study order, so its follow-up status becomes `performed`; the order's own state does not change. The record must be an accepted, independently reviewed performance from a source system for the same patient and definition version, timed as an instant after the authorization. Send `expectedOrderVersion` and the follow-up `expectedVersion` (`0` when none). Requires a human caller with `ambar:patients:read`, `ambar:patients:review`, `ambar:studies:read` and `ambar:studies:review`. Idempotency: the same `requestKey` with the same body returns the original receipt, even if the record changed later; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (not human, missing scope or grant); `EVIDENCE_NOT_READABLE` (the record content cannot be read or is not a performance); `CONFLICT` (versions changed, or the record does not qualify the order: re-read); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Link a study submission](https://docs.getarbol.com/api/ambar/link-study-submission/index.md) — Links an `unresolved` submission to a patient after a human confirmed the identity; study records can then cite it as `submissionId`. Send the submission `version` and the patient `version` the human saw. It fails while records derived from the submission are not retracted, or after its retention ended. Requires `ambar:studies:read`, `ambar:studies:write`, `ambar:patients:read` and `ambar:patients:write`. Returns a receipt with the submission `id` and new `version`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (missing scope or grant); `CONFLICT` (versions changed, submission not unresolved, retention ended or derived records exist: re-read); `COMMIT_UNCERTAIN` (retry with the same key and body). - [List population cuts waiting for review and their decisions](https://docs.getarbol.com/api/ambar/list-affiliation-reviews/index.md) — Lists late population reports with their source event id, reported facts and the conflicting affiliation. Open reviews come first, then dismissed history; each group is ordered by oldest cut, patient id and source event id. Returns up to 100 rows; pass nextCursor as after. Refresh the list after resolving work, because a dismissal changes its position. Use resolveAffiliationReview to dismiss a report while keeping the newer affiliation; manual correction of affiliation history is not supported. The report stays in the patient's event history. Requires a human caller, ambar:patients:read and each listed patient's care-operations read grant. Inaccessible patients are absent. INVALID_INPUT: malformed cursor; ACCESS_DENIED: service caller or missing scope. - [List what people have to book or cancel in the client's agenda](https://docs.getarbol.com/api/ambar/list-agenda-writes-for-people/index.md) — Lists the bookings and cancellations Ámbar made that no installed agenda app may or can send, so a person has to do them in the client's agenda: no installation serves the site and service, it lacks the `agenda.write` permission, its app cannot book or cancel, the patient cannot be named to it, or the app failed too many times (`failure` says which). Oldest first, 50 per page, for the patients the caller may read, each with its appointment: the slot to book, or the booking to cancel (`appointment.externalRef`). Use it as the coordinator's to-do list; after doing each one in the agenda, record it with `recordAgendaWrite`. A booking the agenda reports for the same slot also ends it. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires `ambar:appointments:read` and `ambar:patients:read`, and the patients' read grants for care operations. `INVALID_INPUT`: malformed `after`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List scripts and red-flag lists](https://docs.getarbol.com/api/ambar/list-agent-documents/index.md) — Lists the versions of the organization's scripts and red-flag lists, ordered by kind (scripts first), key and version, 50 per page, with their program, state (draft, in_review, approved, retired), author and approver; without their content. Use it to see which documents an agent version may use (only `approved` ones activate it) and what waits for review. Returns `items` and `nextCursor` (pass it as `after` with the same `kind`; `null` on the last page). Requires the `ambar:programs:read` scope and a read grant on each document's program for care operations; documents of other programs are not listed. `INVALID_INPUT`: `after` is not a document reference, or names another kind than `kind`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List the versions of an agent](https://docs.getarbol.com/api/ambar/list-agent-versions/index.md) — Lists the versions of one agent, oldest first, 50 per page, with their state on the approval path (draft, validated, evaluated, in_review, approved, active, paused, superseded), configuration, last evaluation, author and approver. Use it to review a proposal, compare versions or find the one to activate or roll back to. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires the `ambar:programs:read` scope and a read grant on the agent's program for care operations; without it the list is empty. `INVALID_INPUT`: malformed `agentId` or `after`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List agents](https://docs.getarbol.com/api/ambar/list-agents/index.md) — Lists the organization's voice and WhatsApp agents ordered by `agentId`, 50 per page, with their program, the version that talks to patients and the newest version. Use it to find an agent before reading its versions (`listAgentVersions`) or adding one (`addAgentVersion`). Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires the `ambar:programs:read` scope and a read grant on each agent's program for care operations; agents of other programs are not listed. `INVALID_INPUT`: `after` is not an agent id; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List the alert inbox](https://docs.getarbol.com/api/ambar/list-alert-inbox/index.md) — Lists the open and acknowledged alerts across the patients the caller may see, most severe first (`immediate`, `priority`, `follow_up`), then the oldest, 50 per page. Each alert shows what a detector found: a critical result, a worsening trend, an overdue control, a prescription without coverage, a dispensation pending or out of stock, missed appointments not booked again or one explained by a hospitalization, or a red flag of the person's signed list said in a conversation that nobody escalated (`missed_red_flag`, Ámbar's second check on every arrived transcript); with references to the facts behind it. The same finding never alerts twice; a newer finding about the same subject refreshes the open alert. Use it as the physician's worklist; filter by `findingType`. Read one alert with `getAlert` and decide it with `decideAlert`. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires the `ambar:patients:read` scope and the patient's read grant for care operations; alerts about other patients are not listed. `INVALID_INPUT`: malformed `findingType` or `after`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [Read analytical table rows](https://docs.getarbol.com/api/ambar/list-analytical-table-rows/index.md) — Reads the rows of one of your active analytical tables, then applies your `filters`, `sort`, `offset` and `limit`. Manual (`custom`) tables return their active rows with each row `version`; `query` tables run their saved SQL now over currently admitted data, so results can change between calls. It is a POST only to carry filters; it changes nothing. Use it instead of queryAnalyticsSql when you want a saved table's rows. Paging is by offset: pass `nextOffset` as `offset` (`null` on the last page; offsets stop at 200). Returns declared columns, the page of rows, `total` after filters, `truncated`, the cut time and sources. Failures: NOT_FOUND when the table does not exist, is not yours or is inactive; CONFLICT when the table or a source changed while reading (retry); ANALYTICS_QUERY_LIMIT when a manual table holds more than 200 rows or a query exceeds its budget; ANALYTICS_QUERY_REJECTED when a saved query no longer runs; SERVICE_BUSY when all query slots are in use (retry shortly); ACCESS_DENIED when the token lacks `ambar:patients:read` or the caller is not a person; INVALID_INPUT for an unknown column or bad filter, sort or paging values. - [List analytical tables](https://docs.getarbol.com/api/ambar/list-analytical-tables/index.md) — Lists your own analytical table definitions in one scope, ordered by `id`, active and inactive. `tableMode` `custom` tables hold rows entered by hand; `query` tables compute their rows with saved SQL. Use getAnalyticalTable for one definition and listAnalyticalTableRows for the rows. Other people's tables are never listed. Returns up to 50 items with decrypted definitions; pass `nextCursor` as `after` for the next page (`null` on the last page). Expired tables and tables whose sources you can no longer read are left out. Failures: ACCESS_DENIED when the token lacks `ambar:patients:read`, the caller is not a person, you have no clinical read access to the scope, or `after` is not one of your tables there (restart from the first page); EVIDENCE_NOT_READABLE when a definition cannot be decrypted now; INVALID_INPUT for malformed parameters. - [List analytics boards](https://docs.getarbol.com/api/ambar/list-analytics-boards/index.md) — Lists your own analytics boards in one scope, ordered by `id`, active and inactive, each with its decrypted definition. Boards are private: other people's boards are never listed. Boards only exist in the `care_registry` / `patient` scope. Use getAnalyticsBoard for one known id and saveAnalyticsBoard to create or change one. Returns up to 50 items; pass `nextCursor` as `after` for the next page (`null` on the last page). Expired items and items whose sources you can no longer read are left out. Failures: ACCESS_DENIED when the token lacks `ambar:patients:read`, the caller is not a person, you have no clinical read access to the scope, or `after` is not one of your boards there (restart from the first page); EVIDENCE_NOT_READABLE when a definition cannot be decrypted now; INVALID_INPUT for malformed parameters. - [List a patient's appointments](https://docs.getarbol.com/api/ambar/list-appointments/index.md) — Lists a patient's appointments (those of records merged into it too), the latest start first, 50 per page, in every state: booked, confirmed, cancelled, moved, attended, missed and unknown. Use it to see whether the person already has an appointment for an activity, or their history of attendance. Read one with `getAppointment`. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires `ambar:appointments:read` and `ambar:patients:read`, and the patient's read grant for care operations. `INVALID_INPUT`: malformed `patientId` or `after`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List what Arbi remembers](https://docs.getarbol.com/api/ambar/list-assistant-memory/index.md) — Lists what Arbi remembers for you, by id, only what still holds: your own facts (`scope: person`: your preferences, what you asked it to keep in mind) and the organization's (`scope: organization`: its vocabulary, sites, programs and rules), each with where it was learned, who taught it and when. Nothing about patients is here: that is each patient's memory. Use it when a conversation starts, to know what Arbi knows, and to show a person what Arbi remembers of them before `forgetAssistantFact`. Returns a page of up to 50; pass `nextCursor` as `after` for the next. Requires a person (not a service account) whose token has `ambar:arbi:read`. `INVALID_INPUT`: a malformed cursor; fix it. `ACCESS_DENIED`: missing scope, or a service account; do not retry. - [List the tasks Arbi keeps for you](https://docs.getarbol.com/api/ambar/list-assistant-tasks/index.md) — Lists the tasks Arbi keeps for you, by id: work in progress across conversations (configuring a contract, loading an annex, building a workflow) and what it prepares or watches for you, each with its state, detail, due date and `version`. Only yours; filter by `state`. Use it to resume a task where it was left and before `changeAssistantTask`. Returns a page of up to 50; pass `nextCursor` as `after` for the next. Requires a person (not a service account) whose token has `ambar:arbi:read`. `INVALID_INPUT`: a malformed state or cursor; fix it. `ACCESS_DENIED`: missing scope, or a service account; do not retry. - [List how each program weighs attendance evidence](https://docs.getarbol.com/api/ambar/list-attendance-policies/index.md) — Reads the organization's attendance policies: its default (absent while it keeps the documented order) and each program's. A policy orders the kinds of evidence that decide whether a person came, the strongest first (a kind left out is kept on record but never decides), and sets the days from an appointment's start without deciding evidence before it is `unknown`. An appointment follows its program's policy, else the organization's, else the documented order: clinical record, RIPS or invoice, result, agenda mark, a person's record, the patient's word, and `unknown` after three days. Use it before changing a policy, or to explain why a statement did or did not decide. Returns the policies, with who set each one and when. Requires `ambar:appointments:read`. `ACCESS_DENIED`: missing scope; do not retry. - [List the appointments whose attendance needs a person](https://docs.getarbol.com/api/ambar/list-attendance-reviews/index.md) — Lists the appointments whose statements of the strongest kind of evidence disagree (`attendanceReview: true`), among the patients the caller may read, the earliest first, 50 per page. Each keeps the state decided before the contradiction. Use it as the review inbox: read each one with `getAttendance` and set the wrong statement aside with `discardAttendanceStatement`. Returns a page of appointments and `nextCursor`. Requires `ambar:appointments:read` and `ambar:patients:read`, and the patients' read grants for care operations. `INVALID_INPUT`: malformed `after`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List campaign recipients](https://docs.getarbol.com/api/ambar/list-campaign-recipients/index.md) — List the recipients of one campaign with their dispatch state and patient label, ordered by recipient `id`, 50 per page. Use `getCampaignRecipient` for one recipient. Recipients of disposed patients are left out; a `leased` or `sending` recipient past its 90-second lease reads `unknown`. Returns `items` and `nextCursor`: pass `nextCursor` as `after` for the next page; `null` means the last page. `INVALID_INPUT`: `id`, `recipientId` or `after` is malformed. `ACCESS_DENIED`: missing scope, unknown campaign, or no access to the campaign or to a listed patient; do not retry. `CONFLICT`: recipients or patient labels changed while the page was read; repeat the request. - [List campaigns](https://docs.getarbol.com/api/ambar/list-campaigns/index.md) — List outreach campaigns with their definition, state and dispatch metrics, ordered by `id`, 50 per page. Use `getCampaign` for one campaign and `listCampaignRecipients` for its audience. Returns `items` and `nextCursor`: pass `nextCursor` as `after` for the next page; `null` means the last page. Metric counts are `null` unless you can read every patient. Requires a human caller with the programs, contracts and patients read scopes. `INVALID_INPUT`: `id` or `after` is malformed; fix the query. `ACCESS_DENIED`: missing scope, or the page includes a campaign whose program or contract you cannot read; do not retry without new access. - [List capacity pools](https://docs.getarbol.com/api/ambar/list-capacity-pools/index.md) — Lists capacity pools by identifier, 50 per page. `serviceCode` keeps the pools of a service and `on` those whose period includes a day. Use it to find the pools of a service or of a day, then read one with `getCapacityPool`. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires `ambar:appointments:read` and the registry read grant on care sites for care operations; pools the caller may not read are not listed. `INVALID_INPUT`: malformed `serviceCode`, `on` or `after`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List the capitation pricing of a contract version](https://docs.getarbol.com/api/ambar/list-capitation-pricing/index.md) — Lists the pricing of every capitation component of a contract version that has one: its day basis (`calendar_days`, or `thirty_day_months`, where every month of the period weighs the same and a partial month its share of its own days), its differential tariffs in the order they are tried, the passage of the annex, who recorded and who confirmed it, and `applies`: a pricing prices the component only once someone other than its author confirmed it. Use it before `confirmCapitationPricing`, and to explain how `proposeContractSettlement` priced a capitation period. Returns the version and the pricing of its components. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: malformed `versionId`; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List care management cases](https://docs.getarbol.com/api/ambar/list-care-cases/index.md) — List care cases: explicitly human-initiated management and documentary care requirements from evaluated assessments that you can see now, with their management state, ordered by `id`, or with `order=due` by `dueAt` with the most overdue first; 50 per page, up to 1,000 with `limit`. A page reads only its own cases: page through a work queue with `order=due` and `open=true` instead of reading every case. Filter with `id`, `patientId`, `portfolioId` (contract), `cohortKey`, `status` (one, or several separated by commas), `open=true`, `scheduled=true`, `assigned=me`, `dueBefore`, or `nextAttemptFrom` and `nextAttemptBefore` for the contact attempts due in a window (all epoch milliseconds). Count cases with `summarizeCareCases`, use `getCareWorkspace` for a combined first view and `recordCareCase` to act on a case. Each case carries its patient's `priority` from the cohorts' priority models: work the highest scores first and call `explainPatientPriority` for the reasons. Returns `items`, `nextCursor` (pass it as `after`; `null` on the last page), `scope` and `asOf`. Missing cases never prove that care is complete. Contact fields are `null` without the `ambar:programs:read` scope. Requires a human caller with the patients read and contracts read scopes. `INVALID_INPUT`: a filter is malformed, or `limit` is not 1 to 1,000. `ACCESS_DENIED`: missing scope, or no access to the given `patientId`; do not retry. - [List care providers](https://docs.getarbol.com/api/ambar/list-care-providers/index.md) — List the care providers (organizations) of the operational directory that you can read, ordered by `id`, 50 per page; `status` filters by `active` or `inactive`. Use `getCareProvider` for one entry and `listCareSites` for its care sites. The directory never connects to or contacts these organizations. Payers (health insurers) are not care providers: read the organization's payers with `listPayers`. An entry stored with the retired payer kind is a payer already moved there and is never listed. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires a human caller or explicitly delegated internal operator with the `ambar:operations:read` scope. `INVALID_INPUT`: `after` is malformed. `ACCESS_DENIED`: missing scope or no directory access; do not retry. - [List care sites](https://docs.getarbol.com/api/ambar/list-care-sites/index.md) — List the care sites of one care provider (`providerId`) that you can read, ordered by `id`, 50 per page; `status` filters by `active` or `inactive`. Use `getCareSite` for one entry. Returns `items` (each with the current label of its care provider) and `nextCursor` (pass it as `after`; `null` on the last page). `INVALID_INPUT`: `providerId` or `after` is malformed. `ACCESS_DENIED`: missing `ambar:operations:read` scope or no read grant on the care provider; do not retry. - [List a cohort's case-finding suggestions to work](https://docs.getarbol.com/api/ambar/list-case-finding-worklist/index.md) — Lists the cohort's case-finding suggestions, best first, 50 per page: the newest evaluation of each person when it is `confirmed`, `probable` or `possible`, still current and undecided, ranked by tier, then by how much evidence backs it, then the oldest evaluation first. The case-finding worker evaluates the whole population each night and anyone whose record changes, from what ingest loaded into the record, so its tiers are suggestions a nurse confirms, never membership. Use it as the nurses' case-finding queue ([09] section 5): look at each person's evidence (`getCandidate`, then the referenced record) and decide with `decideCandidate`; a `possible` one first needs what is missing. Returns `items` (evaluations with their tier, evidence references, what is missing and until when they hold) and `nextCursor` (pass it unchanged as `after`; `null` on the last page). Only patients the caller may read for care operations are listed. Requires `ambar:cohorts:read` and `ambar:patients:read`. `INVALID_INPUT`: malformed `cohortId`, or an `after` the list did not write; start again without it. `ACCESS_DENIED`: missing scope; do not retry. - [List a contract's chargebacks and their leakage](https://docs.getarbol.com/api/ambar/list-chargebacks/index.md) — Lists the chargebacks of a contract whose services were performed from `from` (included) to `to` (excluded), by day performed, with each one's `version`, what the organization's own record holds of its service (`deliveredHere`: one of its sites delivered it, so it is no leakage but a report to dispute, often a substitution the contract allows) and whether it is avoidable leakage (no site of the organization delivered it and the order had reached this provider first). The summary adds up what the payer discounts (accepted ones), what is still open, what the organization's sites delivered, and the leakage, avoidable, by procedure and by reason. Use it to see where people go elsewhere and why, to find the reports to dispute, and before `changeChargeback`. Returns the chargebacks and their summary. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: `to` not 1 to 366 days after `from`; fix it. `CONFLICT`: the chargebacks are in more than one currency; report it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List population import upload tracking](https://docs.getarbol.com/api/ambar/list-clinical-population-import-custody/index.md) — Lists the custody metadata of the imports you staged, ordered by id, 50 per page. It shows no rows, cohorts, patients or file content. Returns `items` and `nextCursor`; pass it as `after` for the next page (`null` means the last page). Errors: ACCESS_DENIED without the cohort read scope or as a non-human caller; INVALID_INPUT for a malformed `after`. - [List population imports](https://docs.getarbol.com/api/ambar/list-clinical-population-imports/index.md) — Lists summaries of the population imports for cohorts you can read, ordered by id (not by date), 50 per page. Imports linked to patients you cannot read are left out. Use getClinicalPopulationImport for rows and decisions. Returns `items` and `nextCursor`; pass it as `after` for the next page (`null` means the last page). Errors: ACCESS_DENIED without cohort and patient read scopes or as a non-human caller; INVALID_INPUT for a malformed `after`. - [List clinical route templates](https://docs.getarbol.com/api/ambar/list-clinical-route-templates/index.md) — Lists the care route templates: historical recipes that are editable starting points, not current clinical guidelines. Their cohort keys and codes are placeholders. Use it before previewClinicalRouteTemplate to see which semantic cohort keys and legacy codes need bindings. Returns the catalog `revision`, its `authority` and every template (no paging). Errors: ACCESS_DENIED without the contract read scope or as a non-human caller. - [List clinical routes](https://docs.getarbol.com/api/ambar/list-clinical-routes/index.md) — Lists the care route versions of a contract, ordered by route number, 3 per page; each item includes its full definition. Use getCurrentClinicalRoute for the route in force and getClinicalRoute for one route. Returns `items` and `nextCursor` (a route number); pass it as `after` for the next page. `null` means the last page. Errors: ACCESS_DENIED without the contract read scope or grant or as a non-human caller; INVALID_INPUT for a malformed `contractId` or `after`. - [List bounded cohort care facts](https://docs.getarbol.com/api/ambar/list-cohort-coverage/index.md) — Reads known care facts for the current members of an `active` cohort's latest snapshot: 10 members per page, up to 100 facts per member and 300 per page. It never certifies clinical completeness (`completeness` and `globalCareState` are always `unknown`). Use getPatientCareProgress for one patient and getCohort for the member list. Returns `state: no_cut` and no items when the cohort has no snapshot. Check each member's `readState`: `budget_exhausted` means more facts may exist. Paging: pass `nextCursor` as `after`; `null` means the last page. A cursor works only for the snapshot it came from. Errors: COHORT_CUT_CHANGED when the snapshot, revision or policy changed during the read or between pages: restart from the first page; COHORT_READ_REQUIRES_ACTIVE when the cohort is not active. COHORT_CUT_NEEDS_RECONCILIATION when the snapshot predates the current policy or definition: run reconcileCohortWorkspace (or snapshotCohort for cohorts without a policy). NOT_FOUND when no cohort has this id; SERVICE_BUSY when the read ran out of time: retry later; ACCESS_DENIED without cohort, patient and study read access or as a non-human caller; INVALID_INPUT for a malformed cursor. - [List the versions of a cohort's priority model](https://docs.getarbol.com/api/ambar/list-cohort-priority-models/index.md) — Lists the versions of a cohort's priority model, newest first, with who proposed and who approved each, and which one orders the queue now (`currentVersion`: the newest approved). Use it to review what decides who is seen first in a cohort, and before approving a draft. Returns `items` (at most 100) and `currentVersion`. Requires `ambar:cohorts:read` and the cohort's read grant. `INVALID_INPUT`: malformed `cohortId`; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List cohort progress](https://docs.getarbol.com/api/ambar/list-cohort-progress/index.md) — Lists aggregate progress for all cohorts of your organization, ordered by id, 20 per page: each cohort's current revision and a summary of its latest snapshot with the exact number of members still current. Use it for overviews; use getCohort or getCohortWorkspace for one cohort. Returns `asOf`, `items` and `nextCursor`; pass it as `after` for the next page (`null` means the last page). Counts are computed at read time. Errors: ACCESS_DENIED without the cohort read scope or clinical access; INVALID_INPUT for a malformed `after`; DATABASE_UNAVAILABLE: retry later. - [List cohort workspace candidates](https://docs.getarbol.com/api/ambar/list-cohort-workspace-candidates/index.md) — Lists the latest evaluation of each evaluated patient of a cohort, with any decision made on it, ordered by patient id, 50 per page. Only active patients within retention appear. Use it after evaluateCohortPatient to read results and to get the `evaluationId` for decideCohortPatient. `current: false` means: evaluate again before deciding. Returns `items` and `nextCursor` (a patient id); pass it as `after` for the next page. `null` means the last page. Errors: ACCESS_DENIED without a read grant on the cohort or as a non-human caller; INVALID_INPUT for malformed ids. - [List cohorts](https://docs.getarbol.com/api/ambar/list-cohorts/index.md) — Lists all cohorts of your organization, ordered by id, 50 per page. Use it to find a cohort id. Use getCohort for snapshot members and getCohortWorkspace for the review policy and counts. Returns `items` (the current revision of each cohort) and `nextCursor`; pass it as `after` for the next page. `null` means this is the last page. Errors: ACCESS_DENIED without the cohort read scope or clinical access; INVALID_INPUT for a malformed `after`; DATABASE_UNAVAILABLE: retry later. - [List a patient's complaints](https://docs.getarbol.com/api/ambar/list-complaints/index.md) — Returns the complaints of one patient and of the records merged with theirs, newest first, 50 per page: when each was filed and on which local day (the month it counts in), the channel, the reason, the site and the contract it is about, its number in the system that keeps the person's words, who recorded it and, for an ingested one, the installation it came through. A corrected complaint shows its latest version. Use it before talking with the patient about their care, or to review the causes of a person's complaints; record a new one with `recordComplaint`. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires `ambar:patients:read` and a read grant on the patient for care operations. `INVALID_INPUT`: malformed `patientId` or `after`; fix it. `ACCESS_DENIED`: missing scope or patient grant; do not retry. - [List configured records](https://docs.getarbol.com/api/ambar/list-configured-records/index.md) — Lists the configured records (filled organization forms) of one patient or cohort, ordered by `id`, with template, author, dates and a summary but without field values. Values are documentary captures, never accepted clinical facts. Use getConfiguredRecord for the interpreted field values of one record. Requires a person with `ambar:patients:read` (patient) or `ambar:cohorts:read` (cohort) and read access to that patient or cohort; records tied to a contract also need `ambar:contracts:read` and contract read access. Returns up to 50 items; pass `nextCursor` as `after` for the next page (`null` on the last page). Expired records are left out. Failures: ACCESS_DENIED when the caller is not a person, a scope is missing, or the patient, cohort or a linked contract is not readable; CONFLICT when records changed during the read (retry); INVALID_INPUT for a malformed `entityId` or cursor. - [List contract artifacts](https://docs.getarbol.com/api/ambar/list-contract-artifacts/index.md) — Lists the retained files of one contract, reserved and ready, ordered by `id`, up to 50 per page. The read is audited. Use it to find a file to cite or download; use `getContractArtifact` for one known id. Returns `items` and `nextCursor`: send `nextCursor` as `after` for the next page; `null` means there are no more pages. Failures: `ACCESS_DENIED`: missing `ambar:contracts:read` or no read grant for the contract; do not retry. `INVALID_INPUT`: fix `contractId` or `after`. `DATABASE_UNAVAILABLE`: retry later. - [List the clauses of a contract version](https://docs.getarbol.com/api/ambar/list-contract-clauses/index.md) — Lists every clause of a contract version by position, typed by kind (`pay_for_results_retention`, `penalty_escalation`, `chargeback`, `excluded_technologies`, `band_adjustment`, `population_adjustment`), with its source passage, who recorded and who confirmed it, and `movesMoney`: a clause moves money only once someone other than its author confirmed its interpretation. Use it before `confirmContractClause`, and to explain a settlement's adjustments. Returns the version and its clauses. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: malformed `versionId`; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List an indicator's monthly compliance](https://docs.getarbol.com/api/ambar/list-contract-compliance/index.md) — Lists the recorded months of one indicator of a contract, oldest first: the result, whether the target was met (`null` while open or unconfirmed) and the escalation after the month (`compliant`, `breached`, `improvement_plan`, `cure_period`, `penalty` or `termination_risk`) with the consecutive breaches. Use it to follow a penalty escalation and its history. Returns the months. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: malformed identifier; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List contract coverage](https://docs.getarbol.com/api/ambar/list-contract-coverage/index.md) — Lists one patient's coverage rows in a contract, current and retracted, ordered by `id`, up to 50 per page. Needs `ambar:patients:read` too; reads are audited. Use it before recording or correcting coverage. `evidenceCurrent: false` marks a row whose cited evidence changed or no longer qualifies. Returns `items` and `nextCursor`: send `nextCursor` as `after` for the next page; `null` means there are no more pages. Failures: `ACCESS_DENIED`: no read grant for the contract or the patient, or the patient record is no longer retained; do not retry. `INVALID_INPUT`: `patientId` must be a canonical lowercase UUID. `DATABASE_UNAVAILABLE`: retry later. - [List contract evidence](https://docs.getarbol.com/api/ambar/list-contract-evidence/index.md) — Lists evidence filed under one patient for contract work (purpose `contract_finance`), ordered by id, 50 per page. Use it in contract workflows; care evidence is listed by `listEvidence` and never appears here. Same filtering, item shape and paging as `listEvidence`; pass `nextCursor` as `after`, `null` means done. Errors: `INVALID_INPUT` (ids must be lowercase UUIDs); `ACCESS_DENIED` (missing `ambar:contracts:read`, no contract-purpose grant, or patient erased or past retention: do not retry); `DATABASE_UNAVAILABLE` (retry later). - [List the indicators that move money in a contract version](https://docs.getarbol.com/api/ambar/list-contract-indicators/index.md) — Lists the indicators of a contract version whose results release a pay-for-results retention, with each one's weight (the weights add up to 100 %), and how each is measured: the formula people wrote over the month's quantities, its unit, direction and target, and whether another person confirmed it (`decidesMonths`; until then a month's result moves no money). Use it before `recordContractComplianceMonth`, for the indicator identifiers, and before writing or confirming a measure (`defineContractIndicatorMeasure`, `confirmContractIndicatorMeasure`). Returns the version, its indicators by identifier (empty when none are set) and their measures. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: malformed `versionId`; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List a contract's liquidation actas](https://docs.getarbol.com/api/ambar/list-contract-liquidations/index.md) — Lists the liquidation actas of a contract, the latest proposed first, each with the acta as proposed, where it stands, who proposed and decided it, and the acta the parties signed. Use it to find the acta to decide, or the one that liquidated the contract. Requires `ambar:contracts:read` and `ambar:settlements:read` and a read grant on the contract; the read is audited. `INVALID_INPUT`: malformed identifier; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List the components whose money is not in their currency's units](https://docs.getarbol.com/api/ambar/list-contract-money-scale-mismatches/index.md) — Lists the components, of the contracts you may read, whose money was recorded in another scale than their currency's minor unit (ISO 4217: 2 decimals for COP, PEN, MXN and BRL, 0 for CLP). Payments, invoices and fee schedules are entered in those units, so such a component compares 100 times off; Ámbar no longer lets a version propose one (`MINOR_UNIT_SCALE_MISMATCH`), and never rewrites the money of one recorded before. Each item says its version's status and how many settlements of its period were accepted in that scale, by contract, version and component, 50 a page. Use it to find what to correct: propose a new version with the amounts in the currency's minor units, approve it with another person, and settle again with its terms. Returns `items` and `nextCursor`: send `nextCursor` as `after` for the next page; `null` means there are no more pages. Requires `ambar:contracts:read`; only contracts with a read grant are listed. `INVALID_INPUT`: an `after` that is not `contract/version/component`; fix it. `ACCESS_DENIED`: missing scope; do not retry. `DATABASE_UNAVAILABLE`: retry later. - [List the sites of a contract's network](https://docs.getarbol.com/api/ambar/list-contract-network/index.md) — Lists every period of every care site in a contract's network, ordered by site and start, with whether the site needs the payer's prior authorization. Use `decideContractNetworkSite` to ask about one booking. Returns the contract and its `sites`. Requires the `ambar:contracts:read` scope and a read grant on the contract. `INVALID_INPUT`: malformed `contractId`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List contracts whose payer needs a person](https://docs.getarbol.com/api/ambar/list-contract-payer-reviews/index.md) — Lists the contracts the payer backfill could not settle, ordered by `contractId`, 50 per page: `no_match` when no old source points to a catalog payer, `conflict` when the sources disagree. Each review shows the code of the directory payer the latest workspace policy named before payers left the directory, the payer references written in the contract versions and the catalog payers they point to. Settle a review with `setContractPayer`; the payer need not be one of the candidates. Settled reviews are listed only with `includeResolved: true`. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires the `ambar:contracts:read` scope. `INVALID_INPUT`: `after` is not a contract id. `ACCESS_DENIED`: missing scope; do not retry. - [List contract payers](https://docs.getarbol.com/api/ambar/list-contract-payers/index.md) — Lists the payer of every contract you may read, ordered by `contractId`, 50 per page; `payerId` is `null` until the payer backfill or a person sets it. Use `listContractPayerReviews` to see why a contract has no payer yet. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires the `ambar:contracts:read` scope. `INVALID_INPUT`: `after` is not a contract id. `ACCESS_DENIED`: missing scope; do not retry. - [List the payments a contract received](https://docs.getarbol.com/api/ambar/list-contract-payments/index.md) — Lists the payments of a contract whose paid period starts from `from` (included) to `to` (excluded), by period start, voided ones included with their reason. A payment counts for the settlement of the component period it names, whatever its own dates within it; one that names none counts for the period whose dates are exactly its own. Use it to see what the payer transferred, and before `voidContractPayment`. Returns the payments. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: `to` not 1 to 366 days after `from`; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List who counts in a contract version's paid population](https://docs.getarbol.com/api/ambar/list-contract-population-rules/index.md) — Lists the population rules of a contract version in order. A member of the payer's population counts when no `include` rule exists or one matches them, and no `exclude` rule does; a complementary-plan exclusion may keep the authorizations issued before the plan started owed by this provider, without extra pay. Use it to explain a per-member payment's population. Returns the version and its rules. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: malformed `versionId`; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List who a capitation component covers in a month](https://docs.getarbol.com/api/ambar/list-contract-population/index.md) — Lists the people a capitation component covers in a month, by patient id, 500 per page, each with the calendar days of the month their current, eligible coverages hold, counted once: the member-days the settlement of the period counts. Only days of the component's period count (`from` and `to`); a coverage counts whatever version of the contract it was recorded under, so a version that amends the component under the same key counts what the one it replaced covered. Use it to export the population behind a capitation payment, or to answer an objection about the population (FA52); use `reconcileContractPopulation` to compare it with the payer's paid list. Returns `items` and `nextCursor`: send `nextCursor` as `after` for the next page; `null` means there are no more pages. Patient ids only: read a person with the patient grants of contract work. Requires `ambar:contracts:read` and `ambar:settlements:read` and a read grant on the contract; the read is audited. Failures: `INVALID_INPUT`: malformed identifiers or month; fix them. `NOT_FOUND`: the version or the component is not this contract's. `CONFLICT`: the component is not a capitation. `ACCESS_DENIED`: missing scope or grant; do not retry. `DATABASE_UNAVAILABLE`: retry later. - [List contract progress](https://docs.getarbol.com/api/ambar/list-contract-progress/index.md) — Finance overview: for each component period of approved contract versions you can read that overlaps [`from`, `to`) and starts at most 365 days before `from`, shows the terms, the close in force and the latest settlement you can read. Needs `ambar:settlements:read` too. Use it to find periods that still need a settlement; use `getContractSettlement` or `listContractSettlements` for the details of one contract. Returns `summary` (counts over every matching period, not only this page), up to 20 `items` and `nextCursor`: send it as `after` with the same `from` and `to`; `null` means the last page. A close in state `unknown` may exist but be hidden from you. Failures: `INVALID_INPUT`: fix the window or cursor. `RESOURCE_LIMIT_EXCEEDED`: more than 1000 periods match; narrow the window. `ACCESS_DENIED`: missing scope or no active clinical policy; do not retry. `DATABASE_UNAVAILABLE`: retry later. - [List contract settlements](https://docs.getarbol.com/api/ambar/list-contract-settlements/index.md) — Lists the settlements of one contract that you can read, ordered by `id`, up to 5 per page because each carries its full input cut. Needs `ambar:settlements:read`; settlements without a read grant are left out. Use it to find a draft to accept or the close in force (`currentClose: true`); use `getContractSettlement` for one known id, or `listContractProgress` for an overview. Returns `items` and `nextCursor`: send `nextCursor` as `after` for the next page; `null` means there are no more pages. Failures: `ACCESS_DENIED`: missing scope or no read grant for the contract; do not retry. `INVALID_INPUT`: fix `contractId` or `after`. `DATABASE_UNAVAILABLE`: retry later. - [List where a contract's care is given](https://docs.getarbol.com/api/ambar/list-contract-sites/index.md) — Lists every period of a contract's contracted sites (the sites the contract names for its care, for example Armenia) and of its site substitutions (which site may serve for a contracted site, for example Pereira for Armenia: only when the contracted site has no slot within `noSlotWithinDays` of the search, with or without the patient's acceptance, and with the payer's notice or authorization when the contract asks for them). The service keeps counting at the contracted site wherever it is given. Use it before adding or ending a period, or to explain why a slot search asked a site. Returns the contract, its `contractedSites` and its `substitutions`. Requires the `ambar:contracts:read` scope and a read grant on the contract. `INVALID_INPUT`: malformed `contractId`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List contract versions](https://docs.getarbol.com/api/ambar/list-contract-versions/index.md) — Lists the proposed and approved versions of one contract with their full terms, ordered by version `id`, up to 5 per page because each version can be large. Use it to find the version to approve or to settle against; use `getContractVersion` for one known version. Returns `items` and `nextCursor`: send `nextCursor` as `after` for the next page; `null` means there are no more pages. Failures: `ACCESS_DENIED`: no read grant for the contract; do not retry. `INVALID_INPUT`: fix `contractId` or `after`. `DATABASE_UNAVAILABLE`: retry later. - [List clinical contracts](https://docs.getarbol.com/api/ambar/list-contracts/index.md) — Lists the contracts you can read (PGP, capitation and fee for service), ordered by `id`, up to 50 per page. Contracts without a read grant are left out. Use it to discover contracts; use `getContract` when you already know the `id`. Returns `items` and `nextCursor`: send `nextCursor` as `after` for the next page; `null` means there are no more pages. Failures: `INVALID_INPUT`: malformed `after`; restart without it. `ACCESS_DENIED`: the token lacks `ambar:contracts:read`; do not retry. `DATABASE_UNAVAILABLE` or `COMMIT_UNCERTAIN`: retry the same read later. - [List conversations by who handles them](https://docs.getarbol.com/api/ambar/list-conversations/index.md) — Lists conversations with who handles each one, oldest first, 50 per page: the agent while `ai_active`, the person or team asked while `handoff_requested`, the person while `human_active`, the last one once `resolved`. Every parameter narrows the list: `mine` (what the caller holds), `person`, `team`, `agentId` (what the agent holds), `state` and `patientId`. Use it as a queue: `team` with `state=handoff_requested` lists the handoffs waiting for a team, `mine=true` with `state=human_active` what the caller is answering, `patientId` a patient's conversations. Read one with `getConversation` and take it over with `changeConversationHandling`. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Each item says whether the agent may reply and, on WhatsApp, until when free-form messages may go out (`templateOnly` once the 24-hour window closed). Requires the `ambar:patients:read` scope and the patient's read grant for care operations; conversations about other patients are not listed. `INVALID_INPUT`: malformed `person`, `team`, `agentId`, `state`, `patientId` or `after`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List the people who moved to a contract's payer and need their coverage](https://docs.getarbol.com/api/ambar/list-coverage-candidates/index.md) — Returns the people who moved to the payer of a contract from another payer, as the payer's population file reported it, whose coverage a person confirms: their coverages under the payer they left ended on their last day with it, and their care goes on once a coverage is recorded in one of the new payer's contracts. By the day the coverage would start and the person, 50 per page, each with the person's name label, the payer left, the payer moved to and their first day with it, and the new payer's active contracts when the move was applied. Use it to record each person's coverage in the contract that applies with `recordContractCoverage` (`validFrom` the first day with the new payer), citing the evidence its component asks for, then confirm the candidate with it (`confirmCoverageCandidate`); dismiss it with `dismissCoverageCandidate` when no contract applies. A resolved candidate leaves the list. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires `ambar:patients:read` and `ambar:contracts:read`, and for care operations a read grant on each patient and a grant on the contract: people you may not read are left out, and a contract you hold no grant on lists nobody. `INVALID_INPUT`: a malformed `contractId` or `after`; fix it. `ACCESS_DENIED`: a missing scope, or clinical privacy not configured; do not retry. - [List datasets](https://docs.getarbol.com/api/ambar/list-datasets/index.md) — Lists the non-personal datasets you can read, ordered by `id`, optionally only those of one `sourceSystemId`. Use getDataset for one known id and listIngestionDatasets to find upload destinations. Each item carries its publication `generation`, `published` and `canCreate` (`true` only when you may upload inventory now, which also needs the `ambar:ingestions:write` scope). Returns up to 50 items; pass `nextCursor` as `after` with the same filter for the next page (`null` on the last page). Failures: ACCESS_DENIED when the token lacks `ambar:datasets:read` or `after` is not a dataset you can read under that filter (restart from the first page); INVALID_INPUT for malformed parameters. - [List the document readings that wait for a person](https://docs.getarbol.com/api/ambar/list-document-reading-inbox/index.md) — Lists the readings that wait for a person, oldest first: `kind_review` (the model was not sure what the document is; confirm it with `confirmDocumentKind`) and `in_review` (`waiting` values to confirm, correct or reject with `decideDocumentValue`). Only readings the caller may see are listed. Documents that arrive for a person (by e-mail, from a laboratory, or the photos and files a person sends on WhatsApp) are read on arrival and wait here like uploads; every value of a document the person sent waits, with the review reason `from_patient`. Use it as the review inbox, then `getDocumentReading` for one reading's text and citations. Returns a page of up to 50; pass `nextCursor` as `after` for the next. Requires `ambar:patients:read` and read grants for care operations. `INVALID_INPUT`: a malformed `after`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List documented appointments](https://docs.getarbol.com/api/ambar/list-documented-appointments/index.md) — List a patient's documented appointments, ordered by `id`, 50 per page, each with its current revision decrypted. They are local records of a preference or of a confirmed appointment reported by a source, never bookings. Use `getDocumentedAppointment` for one appointment with its revision history; book with `bookAppointment` instead, which reaches the client's agenda through its installed app or a person. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Care provider and care site labels need the `ambar:operations:read` scope; without it a selection reads `unavailable`. Requires a human caller or explicitly delegated internal operator with the appointments read and patients read scopes. `INVALID_INPUT`: `patientId` or `after` is malformed. `ACCESS_DENIED`: missing scope, or no grant on the patient or on documented appointments; do not retry. - [List patients that may be the same person](https://docs.getarbol.com/api/ambar/list-duplicate-patients/index.md) — Lists pairs of patients that share a document, their own or another document a person taught through the identity queue, and that are not merged. Records that waited as `ambiguous` in the identity queue come from such pairs. Use it to find duplicates to review: read both with `getPatient`, then merge them with `mergePatients`. Returns a page of up to 50 pairs in id order; pass `nextCursor` as `after` for the next. Callers without the registry-wide patient read grant see none. Requires `ambar:patients:read`. `INVALID_INPUT`: a malformed `after`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List electronic invoices](https://docs.getarbol.com/api/ambar/list-electronic-invoices/index.md) — Lists invoices newest issue first, optionally of one contract, in one status (`issued`, `validated`, `filed`, `returned`, `voided`) or issued in a window of days, each with its gaps and deadlines and whether it is overdue to file. Use it as the billing work list: what still waits for its CUV, what must be filed before its deadline, what the payer returned. Returns a page and the `nextCursor` of the next one. Requires `ambar:contracts:read`; only invoices of contracts you hold a read grant on are listed. `INVALID_INPUT`: a malformed cursor, a limit outside 1 to 200 or an empty window; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List evidence](https://docs.getarbol.com/api/ambar/list-evidence/index.md) — Lists evidence filed under one patient for care work (purpose `care_operations`), ordered by id, 50 per page. Use it to see what has been reported and reviewed for a patient; for contract evidence use `listContractEvidence`. Items about or from a related patient you cannot read are left out. Only `accepted` items are reviewed facts; `reported` items are unconfirmed claims. Returns `items` and `nextCursor`; pass `nextCursor` as `after` for the next page, `null` means no more. Errors: `INVALID_INPUT` (ids must be lowercase UUIDs); `ACCESS_DENIED` (missing `ambar:patients:read`, no read grant, or the patient is erased or past retention: do not retry); `DATABASE_UNAVAILABLE` (retry later). - [List what Ámbar learned about each sender's documents](https://docs.getarbol.com/api/ambar/list-extraction-templates/index.md) — Lists every sender's extraction template: for each kind of document, the label the sender prints before each value, learned from people's cited corrections and given to the model as hints. Labels only, never values. Use it to see why a sender's documents read as they do, and before `resetExtractionTemplate`. Returns the complete list, by sender and kind, not paginated. Requires `ambar:patients:read` and the registry-wide patient read grant for care operations (templates come from many patients' documents). `ACCESS_DENIED`: missing scope, or clinical privacy not configured; do not retry. - [List the fee schedules of a contract](https://docs.getarbol.com/api/ambar/list-fee-schedules/index.md) — Lists the fee schedule of each version of a contract, by first day: the reference tariff manual (named as its jurisdiction's catalog names it, for example `SOAT`) with its adjustment, the explicit prices of one unit of each code in its system (procedures, medications by CUM, IUM or DCI, devices) that override it, the group rules that price whole CUPS sections, chapters or groups by a manual and a percentage, the manual's own codes of the procedures the contract homologates, the packages billed at one price with what they cover, the days the prices apply and the window to answer objections. Use it to see how a fee-for-service service is priced, before `addInvoiceLine`. Returns the schedules. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: malformed contract id; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List financial source events waiting for billing facts or review](https://docs.getarbol.com/api/ambar/list-held-finance-events/index.md) — Returns at most 100 held money events (an invoice, its filing, return, credit or debit note, an objection, a payment or a chargeback), in source-event sequence order. Pass nextCursor as after for the next page. Each row includes immutable source facts, custody provenance, holdCode, holdDetail and heldAt (the last failed attempt). Supply missing priced lines or billing facts; the worker retries stored payloads once a day. holdDetail is a typed object of at most 16 KiB. INGEST_INVOICE_UNMATCHED: unmatchedRefs and ambiguousRefs each keep the whole prefix in payload order, at most 25 references and 6,144 compact JSON bytes per list (including quotes, commas and escaping). Each list stops at its first non-fitting reference; it never truncates or skips one. unmatchedCount and ambiguousCount count all such references in the payload. The original in custody keeps every reference. contracts lists the first at most 10 disagreeing or multiple line contracts in id order, and contractCount counts them all. A sampled list may therefore be shorter than its count. expectedMinor, foundMinor and currency explain the total. INGEST_OBJECTION_LINE_UNKNOWN: matchingLines is zero or the candidate count. INGEST_OBJECTION_INVALID: objectedMinor and lineLiveMinor compare the source and item (for an objection to a whole PGP, capitation or package invoice, the item is the invoice and lineLiveMinor its value after notes). INGEST_PAYMENT_PERIOD_UNKNOWN: empty object. INGEST_CONTRACT_UNKNOWN: contracts is the first at most 10 candidates in id order, with contractCount for all candidates; the list is empty and the count is zero when none is known; an event whose payerId is not the configured payer of the contract it lands on (including an unset contract payer), or a filing, return or note whose payerId is not the invoice's, is also held so, naming that contract, and its money never lands on it. INGEST_PAYMENT_REFERENCE_CONFLICT: paymentId identifies the recorded transfer and fields names its differing amountMinor, currency, receivedOn, periodStart or periodEnd. Inspect it, then void the recorded payment for a retry or dismiss this event; money is never rewritten automatically. INGEST_OBJECTION_REFERENCE_CONFLICT: the contract keeps an objection with this objectionRef (the payer's record number) and other facts; objectionId identifies it and fields names the differing target, reasonCode, amountMinor or receivedOn. The same objectionRef with the same facts loads without adding a second objection. INGEST_INVOICE_UNKNOWN: step names what the event reports (filed, returned, credit_note or debit_note) of an invoice Ámbar does not keep yet; it arrives with invoice.issued and its health fields, or recordElectronicInvoice, and the worker retries. INGEST_INVOICE_STEP_REFUSED: step, status (where the invoice stands) and problem: state (filed without its CUV, filed already, returned once already, or voided), currency (a note of another currency) or amount (a credit above what the invoice is worth now, a debit its value cannot hold, or a note dated before the invoice). Record what is missing, such as the CUV, for a retry, or record the step with changeElectronicInvoice and dismiss this event. INGEST_NOTE_REFERENCE_CONFLICT: noteFields names the invoice, kind, issuedOn or amountMinor in which the note kept with this noteRef differs; the kept note is not named, since it may be another contract's. The same noteRef with the same facts loads without adding a note. INGEST_CHARGEBACK_REFERENCE_CONFLICT: the contract keeps a chargeback with this chargebackRef and other facts; chargebackId identifies it and fields names the differing procedureCode, performedBy, performedOn, amountMinor, currency or reportedOn. Diagnostics contain no patient or resolved encounter ids. Retry replaces the detail, successful loading clears it, and dismissal preserves it. Refresh after load or dismissal. Requires a human, ambar:contracts:read, and the finance read grant of the one contract the event identifies: the existing contract it names, the contract of the electronic invoice it names and the contract of every line it references must be the same one. When it identifies none, or several (an invoice naming one contract whose lines belong to another), it requires the clinical_registry contract write grant, so no reader of one contract receives another contract's ids or amounts. Inaccessible events are absent. INVALID_INPUT: malformed cursor; ACCESS_DENIED: service caller or missing scope. - [List what people decided about identity cases](https://docs.getarbol.com/api/ambar/list-identity-decisions/index.md) — Lists the decisions, newest first: the case each decided, its resolution, the patient the record is about and who decided when. Use it to audit the queue or to find what became of a case that left it. Returns a page of up to 50; pass `nextCursor` as `before` for older ones. Callers without the registry-wide patient read grant see none. Requires `ambar:patients:read`. `INVALID_INPUT`: a malformed `before`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List whether each payer's population file creates the people it lists](https://docs.getarbol.com/api/ambar/list-identity-onboarding/index.md) — Lists every payer population installation of the organization (app `payer-population-csv`) with its onboarding: whether the ingest worker creates the people its files list and nobody has the document of, the rule it follows (`payer_population_v1`), the most people one file creates, who changed it last and how many people its files created. The rule links a record to the one patient with its document, creates the person only when nobody has it, the country issues the document, no patient has its number under another document of its numbering (the NUIP of the registro civil, the tarjeta de identidad and the cédula) and the file gives the names and the birth date; every other record waits in the identity queue (`listIdentityQueue`), with the reasons `possible_duplicate` and `document_not_issued` besides the usual ones. Use it before `setIdentityOnboarding` (its `version` is `expectedVersion`) and to audit what a source created (`listOnboardedPatients`). Returns the complete list, by installation, not paginated. Requires `ambar:patients:read` and the registry-wide patient read grant for care operations; the read is audited. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List the source records that wait for a person to identify them](https://docs.getarbol.com/api/ambar/list-identity-queue/index.md) — Lists the identity queue, oldest first: records no patient has the document of (`unknown`), several patients have (`ambiguous`) or one has under other names or birth date (`mismatch`, already loaded for that patient); from a payer's file that creates people (`listIdentityOnboarding`), also the people it did not create because a patient may be them (`possible_duplicate`) or the country does not issue their document (`document_not_issued`). A contact the source named only by the number the person was reached at is looked up by that phone instead (`identifiedBy`: `phone`). Every installation's cases are listed; nothing about the person is shown here. Use it as the identity inbox, then `getIdentityCase` for the subject the source sent and `getPatient` for each candidate, and decide with `resolveIdentityCase`. Returns a page of up to 50; pass `nextCursor` as `after` for the next. Callers without the registry-wide patient read grant see an empty queue. Requires `ambar:patients:read`. `INVALID_INPUT`: a malformed `after`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List indicator publications](https://docs.getarbol.com/api/ambar/list-indicator-publications/index.md) — Lists your own indicator publications in one scope, ordered by `id`. A publication is an immutable cut of indicator values declared by a person for a period (`provenance.kind` `manual`), not a computed result. Use getLatestIndicatorPublication for the newest active one and getIndicatorPublication for one known id. Returns up to 50 items with decrypted definitions; pass `nextCursor` as `after` for the next page (`null` on the last page). Expired items are left out. Failures: ACCESS_DENIED when the token lacks `ambar:patients:read`, the caller is not a person, you have no clinical read access to the scope, or `after` is not one of your publications there (restart from the first page); EVIDENCE_NOT_READABLE when a definition cannot be decrypted now; INVALID_INPUT for malformed parameters. - [List ingestion destinations](https://docs.getarbol.com/api/ambar/list-ingestion-datasets/index.md) — Lists the non-personal datasets you can read that have a supported inventory parser, ordered by `id`, with the parser to use, the current publication `generation` and `canCreate` (whether you may upload to it now; it also needs the `ambar:ingestions:write` scope). Use it to choose the `datasetId`, `parserVersion` and `expectedGeneration` for createIngestion; use listDatasets for the full catalog. Returns up to 50 items; pass `nextCursor` as `after` for the next page (`null` on the last page). Failures: ACCESS_DENIED when the token lacks `ambar:ingestions:read`; INVALID_INPUT for a malformed cursor. - [List uploads](https://docs.getarbol.com/api/ambar/list-ingestions/index.md) — Lists the upload receipts of one dataset, newest first, by every uploader (`ownedByCaller` marks yours), each with its `idempotencyKey` and processing `status`. Use getIngestion to follow one upload and getDataProduct or getInventory to read published content. A receipt in this list does not mean the published inventory is ready: check `status` and `active`. Returns up to 50 items; pass `nextCursor` as `after` for the next page (`null` on the last page). Failures: ACCESS_DENIED when the token lacks `ambar:ingestions:read`, you cannot read the dataset, or `after` is not an upload of this dataset (restart from the first page); INVALID_INPUT for malformed parameters. - [List the codes waiting for a mapping](https://docs.getarbol.com/api/ambar/list-installation-mapping-gaps/index.md) — Lists the codes an installation sent without an approved mapping, the most frequent first, with when they first and last arrived. The deliveries that carried them wait in quarantine (`INGEST_MAPPING_MISSING`). Use it to write the next mapping version with `proposeInstallationMapping`; approving a version that maps them clears them and queues those deliveries again. Returns up to 1,000 codes. Requires `ambar:settings:read` or `ambar:settings:write`, a person, and a workspace configuration read grant. `INVALID_INPUT`: malformed `installationId`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List integration bindings](https://docs.getarbol.com/api/ambar/list-integration-bindings/index.md) — Lists the organization's integrations bound to deployment profiles, ordered by `id`, with their status, site and delegated capabilities. Pass `id` to read a single binding (an empty page when it does not exist). Use it before saveIntegrationBinding to get the current `version`. A binding never grants patient access, and using it needs a separate use grant. Returns up to 50 items; pass `nextCursor` as `after` for the next page (`null` on the last page). Failures: INVALID_INPUT when both `after` and `id` are sent or either is malformed; ACCESS_DENIED when the token has neither `ambar:settings:read` nor `ambar:settings:write`, the caller is not a person, or you hold no configuration read grant. - [List what installed apps can be asked to do](https://docs.getarbol.com/api/ambar/list-integration-operations/index.md) — Lists every operation each app of this build offers: its app and version, class, input and result fields, whether it writes at the provider, its default time budget, how a workflow run may pick among the organization's installations of the app (`selectors`: by payer, site or territory), and the workflow steps, guards and agent tools that use it. `configurable: true` marks the operations a workflow may call by configuration with a `call_integration` step or the `integration_check` guard; they only read. Use it before writing a `call_integration` step: name `app` and `operation` as listed, fill each required `input` field from a run fact or a constant, and read `result` fields in the outcome rules; then check the definition with `validateWorkflowDefinition`. Returns the complete list in app order, not paginated; it changes only with a new build of Ámbar. Requires `ambar:programs:read` or `ambar:settings:read`. `ACCESS_DENIED`: missing scope; do not retry. - [List integration profiles](https://docs.getarbol.com/api/ambar/list-integration-profiles/index.md) — Lists the integration profiles this deployment offers your organization: provider, external reference, the capabilities it can delegate and the sites it can be bound to. Profiles hold no credentials and are fixed by the deployment. Use it to choose `profileId`, `siteId` and `capabilities` before saveIntegrationBinding; use listIntegrationBindings for what is already bound. Returns the complete list (not paginated); an empty list means no integration is offered. No parameters; any query parameter fails with INVALID_INPUT. Failures: ACCESS_DENIED when the token has neither `ambar:settings:read` nor `ambar:settings:write`, the caller is not a person, or you hold no configuration read grant. - [List a contract's invoice lines and what they are owed](https://docs.getarbol.com/api/ambar/list-invoice-lines/index.md) — Lists the invoice lines of a contract's services provided from `from` (included) to `to` (excluded), voided ones included, with the objections against them and the window's totals: what the lines on an invoice bill, what the lines not yet invoiced would bill, what the objections take (accepted amounts, and expired ones in full), what open objections put at risk, how many still wait for an answer, and the expected payment (invoiced minus what objections take). Use it to follow a fee-for-service period before settling it. Returns the lines, the objections and the totals. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: `to` not 1 to 366 days after `from`; fix it. `CONFLICT`: the lines that bill are in more than one currency; report it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List the jurisdictions Ámbar ships](https://docs.getarbol.com/api/ambar/list-jurisdictions/index.md) — Lists every country Ámbar has a profile for, with its language tag, currency, national procedure code system and territory code system. What changes between countries is data: the same operations serve every one of them. Use it to learn which countries an organization can operate in, then `getJurisdiction` for one profile. Returns the summaries, by country. Requires one of `ambar:patients:read`, `ambar:contracts:read`, `ambar:cohorts:read` or `ambar:settings:read`. `ACCESS_DENIED`: none of those scopes; do not retry. `INTERNAL`: a bundled profile is unreadable; report it. - [List the linkage tokens of an agreement](https://docs.getarbol.com/api/ambar/list-lake-linkage-tokens/index.md) — The linkage tokens of the organization's people under a data-sharing agreement ([36] section 8.3), ordered by token, each paired with the person's pseudonym under the agreement's key: the `patient_key` its share and its exports carry. Join them with the tokens you compute from your own people's documents to link your records with the agreement's data without exchanging a document. Two people with the same document share a token. Erased people, and people whose record changed since their token was computed, are left out until the worker computes it again. Pass `nextAfter` as `after` for the next page. Only the service account the revision in force names, while it allows linkage tokens; requires `ambar:datasets:read`. Each page is audited. `INVALID_INPUT`: malformed agreement key, `after` or `limit`; fix them. `ACCESS_DENIED`: missing scope, not the agreement's service account, no revision in force that allows tokens, or no linkage key or lake key in the deployment; do not retry. - [List the data-sharing agreements](https://docs.getarbol.com/api/ambar/list-lake-sharing-agreements/index.md) — Lists the latest 500 revisions of the organization's data-sharing agreements, the newest first: their terms, where each stands and who proposed, decided and revoked it. `inForce` names each agreement's revision in force today (approved, not revoked, within its validity); an agreement absent there shares nothing today. Use it before `decideLakeSharingAgreement` and `revokeLakeSharingAgreement`. Requires `ambar:settings:read` or `ambar:settings:write`, and a configuration grant; the read is audited. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List the late-payment rates recorded](https://docs.getarbol.com/api/ambar/list-late-interest-rates/index.md) — Lists the annual late-payment rate recorded for each month, by month. Use it to see which months still need a rate before reading interest. Returns the rates. Requires `ambar:contracts:read`. `ACCESS_DENIED`: missing scope; do not retry. - [List a month's open PGP line alerts](https://docs.getarbol.com/api/ambar/list-line-execution-alerts/index.md) — Returns the PGP technical-note lines whose alert is still open in a month: lines that fell below or above their note's bands (from the middle of the month, once per side) and are still there at the last measure, grouped by contract and note, each note with only those lines. Below the band a line may cost the discount shown if the pace holds (an economic clause), and the people still pending on it can be invited (`listLinePendingPeople`); above it, the services are worth reviewing for pertinence before negotiating. Use it each day of a running month to decide where to act (induced demand for a line below its band, a review for one above), then read the whole note with `getContractLineExecution`. Returns `month` and `notes`, at most 200, among the contracts you may read. Requires `ambar:contracts:read`. `INVALID_INPUT`: a `month` that is not `YYYY-MM`; fix it. `ACCESS_DENIED`: a missing scope; do not retry. - [List the people pending on a PGP contract's lines below their bands](https://docs.getarbol.com/api/ambar/list-line-pending-people/index.md) — Returns the people still pending on the technical-note lines of a PGP contract that are below their bands in a month, as the line-execution worker last found them (once a day, through the previous day, from the middle of the month while it runs): the current members of the cohorts each note's requirements bind to the line, covered by one of the note's components that day, with no service counted toward the line so far. By note, line and person, 50 per page, each with the person's name label, the cohorts through which the line applies to them and the day measured that found them. A person served since, or a line back within its band, leaves the list at the next measure; the month's list empties once it is over. Use it after `listLineExecutionAlerts` shows a line below its band, to invite the people it still lacks (an appointment offer, a call) before the month closes. The configured workflows with a `pgp_line_below_band` trigger already start one run per person, line and month about the line (`listWorkflowRuns`). Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires `ambar:patients:read` and `ambar:contracts:read`, and for care operations a read grant on each patient and a grant on the contract: people you may not read are left out. `INVALID_INPUT`: a malformed `contractId`, `month`, `noteId`, `lineKey` or `after`; fix it. `ACCESS_DENIED`: a missing scope, or clinical privacy not configured; do not retry. - [List note extractions](https://docs.getarbol.com/api/ambar/list-note-extractions/index.md) — Lists your own note extractions for one contract, ordered by `id`, with progress and attempt counts but without candidates. Extractions of other people, expired ones and ones whose document is no longer retained are left out. Use getNoteExtraction to read a candidate and startNoteExtraction to begin a new one. Returns up to 25 items; pass `nextCursor` as `after` for the next page (`null` on the last page). Requires a person whose token has `ambar:contracts:read` and `ambar:arbi:read` and is not expired, plus contract finance read access. Failures: ACCESS_DENIED when a scope or access is missing; UNAUTHORIZED when the token has expired; INVALID_INPUT for a malformed contract id or cursor. - [List your workspace notices](https://docs.getarbol.com/api/ambar/list-notifications/index.md) — List your own workspace notices, ordered by `id`, `limit` per page (default 50, at most 200); `unread=true` returns only unread ones. Notices are not clinical alerts: they report confirmed team changes; from 01:00 of the organization's day, the tasks Arbi keeps for you that reached their day (`assistant_task_due`, the task's title as `body`); and, when a month closes, each indicator of a contract you manage (a write grant on it) whose escalation changed, and of one you approve when it reaches termination risk (`contract_escalation`: the contract, the indicator, the state and what comes next as `body`; read the month with `getContractIndicatorMonth` and the history with `listContractCompliance`). Use `markNotifications` to mark notices as read. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). A page is not a complete unread total. `INVALID_INPUT`: `after` longer than 128 characters or `limit` out of range. `ACCESS_DENIED`: a non-human caller or no care operations access; do not retry. - [List the coded causes and answers of returns and objections](https://docs.getarbol.com/api/ambar/list-objection-codes/index.md) — Lists the codes a jurisdiction's law sets for returning an invoice, objecting to it and answering both, as the law writes them: in Colombia the Manual Único de Devoluciones, Glosas y Respuestas (Resolución 2284 de 2023, Anexo Técnico 3), whose 200 causes are exhaustive. Each code says its kind (`return`, `objection`, `response`), its group, what it means, the payment modalities its notes keep it for (`scope`) and whether it affects the whole invoice. Filter by `kind`, and by `modality` to see only the codes an invoice of that modality can carry. Use it to read a payer's code, to choose an answer's code for `changeObjection` and a return's answer for `changeElectronicInvoice`. Returns the list with its source. Requires `ambar:contracts:read`. `NOT_FOUND`: the country's law sets no such codes in Ámbar (the payers' own codes apply). `ACCESS_DENIED`: missing scope; do not retry. - [List the objections due by a day](https://docs.getarbol.com/api/ambar/list-objections-due/index.md) — Lists the objections of every contract you can read that still wait for an answer and are due on or before `by`, earliest deadline first, and in `decisionsDue` the answered ones whose payer's term to decide ends by then. An objection left unanswered past its deadline stands in full; one the payer does not decide in its term falls. The finance pipeline closes both by itself each day. Use it every day to answer in time, and to close the late ones with `changeObjection` (`expire`, `lapse`). Each objection's `encounterId` leads, with `getPatientRecordEncounter`, to the patient's record and the answer's supports (the note, the order, the attendance and the documents of that service): draft the answer from them for a person, who sends it with `changeObjection` (`answer`). Returns the objections. Requires `ambar:contracts:read` and read grants on the contracts. `INVALID_INPUT`: malformed `by`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List the objections against a contract's services](https://docs.getarbol.com/api/ambar/list-objections/index.md) — Lists the objections the payer raised against the invoice lines of a contract's services provided from `from` (included) to `to` (excluded), and against its whole invoices whose period starts in that window, by arrival: the payer's code and record, the amount, the deadline to answer, the state (`received`, `answered`, `accepted`, `rejected`, `expired`, `lapsed`, `escalated` or `settled`), the answer with its code and concession, the payer's decision and its term, the conciliation, what each one takes and still disputes, whether it came after the payer's term (`extemporaneous`), what is wrong with its code (`codeProblem`) and the terms after the decision (`followUp`). Use it to review the objections of a period, by reason and by state, and before `changeObjection`. Returns the objections. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: `to` not 1 to 366 days after `from`; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List the people a payer's population file created](https://docs.getarbol.com/api/ambar/list-onboarded-patients/index.md) — Lists the people the files of one payer population installation created, newest first: the patient, the file (inbox item) and the record that created them, the rule, the identity decision of the person who asked for it when one did, and when. Use it to audit a source's creations and to undo one: read the patient with `getPatient`, join a duplicate with `mergePatients`, or erase them once their retention ends with `erasePatient` (erasing removes this entry with the rest of their records). Returns a page of up to 50; pass `nextCursor` as `before` for older ones. Requires `ambar:patients:read` and the registry-wide patient read grant for care operations; the read is audited. `INVALID_INPUT`: a malformed `installationId` or `before`; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List the workflow steps waiting for their outcome](https://docs.getarbol.com/api/ambar/list-open-workflow-steps/index.md) — Lists the step attempts the worker handed over and nobody has reported yet, oldest first, 50 per page: the run, the patient, the workflow and version, the step, who performs it (`agent`, `human` or `system`) and its `attemptKey`. Steps of paused, cancelled or failed runs are left out: a paused run (held by a person, a guard or a switch turned off) does nothing until a person resumes it. Use it as a work queue: agents take the calls (`actor=agent`) and people the tasks and the calls the workflow's `handling` gives them (`actor=human`), which they make through Raíz too. Read the step's definition in the run's version with `listWorkflowVersions`, do the step, then report its outcome with `reportWorkflowStepOutcome`. A step opens only after the guards that cover it passed, so a conversation does not wait for what they checked: with `eligibility_active` the person was active with their payer by its newest population cut. The slots are the client agenda's: a call or a message that books asks the agenda for them. A call follows its agent version's policy (`listAgentVersions`), whose `limits.tool_wait` says how long it waits for each tool. A `call_integration` attempt (`actor=system`) is listed while Ámbar's integration worker makes its call: its outcome arrives with the call, so do not perform or report it. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Only steps of patients the caller has a grant on are listed. Requires the `ambar:programs:read` and `ambar:patients:read` scopes. `INVALID_INPUT`: malformed `actor`, `workflowId`, `patientId` or `after`. `ACCESS_DENIED`: missing scope; do not retry. - [List a patient's alerts](https://docs.getarbol.com/api/ambar/list-patient-alerts/index.md) — Lists one patient's alerts in every state, newest first, 50 per page: what is open, what was acknowledged, dismissed (with its reason) or turned into a case. Use it from the patient's record to see what the detectors found and what was done about it. Returns `items` and `nextCursor` (pass it as `before`; `null` on the last page). Requires the `ambar:patients:read` scope and the patient's read grant for care operations; without it the list is empty. `INVALID_INPUT`: malformed `patientId` or `before`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List a patient's case-finding evaluations](https://docs.getarbol.com/api/ambar/list-patient-candidates/index.md) — Lists the newest evaluation of one patient in each cohort, by cohort: the tier (`confirmed`, `probable`, `possible`, `ruled_out` or `unknown`), the evidence behind it as references to the record, what is missing to raise it (or, for `unknown`, the data needed to decide), until when it holds, and the nurse's decision when there is one. Missing data is never a no: `unknown` is a data task. Use it from the patient's record to show the case-finding table of [09] section 3 and to pick the evaluation to decide with `decideCandidate`. Returns the patient's evaluations, at most 1,000. Requires `ambar:cohorts:read` and `ambar:patients:read` and the patient's read grant for care operations; without it the list is empty. `INVALID_INPUT`: malformed `patientId`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List a patient's document readings](https://docs.getarbol.com/api/ambar/list-patient-document-readings/index.md) — Lists the readings of the patient's documents, newest first, in any state. Use it in the patient's record, then `getDocumentReading` for one of them. Returns a page of up to 50; pass `nextCursor` as `before` for older ones. Requires `ambar:patients:read` and a read grant on the patient for care operations. `INVALID_INPUT`: a malformed `patientId` or `before`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List patient documents](https://docs.getarbol.com/api/ambar/list-patient-documents/index.md) — Lists the documents of one patient: original files held in custody, ordered by id, 50 per page. Use it to find documents; `getPatientDocument` reads one and `downloadPatientDocument` returns its bytes. Content is never extracted, so `processing` is always `unavailable`. Restricted documents and documents past retention are not listed. Pass `nextCursor` as `after` for the next page; `null` means done. Requires a human caller with `ambar:patients:read`. Errors: `INVALID_INPUT` (bad ids); `ACCESS_DENIED` (not human, missing scope or grant, or patient erased or past retention); `CAPABILITY_NOT_CONFIGURED` (document custody is not set up for this organization); `DATABASE_UNAVAILABLE` (retry later). - [List patient history events](https://docs.getarbol.com/api/ambar/list-patient-history-events/index.md) — Lists the documented history timeline of one patient in recording order, 50 entries per page. Use it to show what was documented: history events, terminal exits and reported appointment outcomes. These are statements, not verified clinical facts; evidence and studies are not included. Entries whose content cannot be shown appear with `kind: unsupported` and a `contentState`; appointment outcomes also need `ambar:appointments:read`. Times are Unix epoch milliseconds. Pass `nextCursor` as `after` for the next page; `null` means no more entries. Requires `ambar:patients:read`. Errors: `INVALID_INPUT` (bad id or cursor); `ACCESS_DENIED` (missing scope or grant, patient erased or past retention, or entries disposed during the read); `DATABASE_UNAVAILABLE` (retry later). - [List documented patient interactions](https://docs.getarbol.com/api/ambar/list-patient-interactions/index.md) — List the latest version of a patient's documented interactions of one `family` (`alert`, `message`, `call`, `rights` or `participation`), ordered by `id`, 50 per page; `contractId` narrows to one contract. Use `getPatientInteraction` for one record (do not send `id` here). Records tied to a contract are left out when the patient is not active or no longer covered by it. Recorded messages and calls are evidence, not proof that a provider sent anything. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires a human caller; `alert` and `call` need the `ambar:patients:review` scope, and `contractId` needs `ambar:contracts:read`. `INVALID_INPUT`: a parameter is malformed or `id` was given. `ACCESS_DENIED`: missing scope or grant, patient not retained, or patient not covered by `contractId`; do not retry. - [List the merges of a patient](https://docs.getarbol.com/api/ambar/list-patient-merges/index.md) — Lists the merges either side of which is the patient, newest first, reverted ones too (`revertedAt`). Use it from a patient's record to see whom it was merged with, or to find the merge to revert. Returns up to 50 merges. Requires `ambar:patients:read` and a read grant on either patient of each merge for care operations. `INVALID_INPUT`: a malformed `patientId`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List patient observations](https://docs.getarbol.com/api/ambar/list-patient-observations/index.md) — Lists observations (lab results and measurements) of one patient, taken from accepted study records of kind `result` that came from a source system. Use it for a patient's result history. Values are exact (decimal strings with their original unit) and never converted; a missing value is not a negative result. Each page covers up to 20 study records ordered by record id; records whose values cannot be shown are listed in `unavailable` with a reason. Pass `nextCursor` as `after` for the next page; `null` means no more records. Requires `ambar:patients:read` and `ambar:studies:read`. Errors: `INVALID_INPUT` (bad id or cursor); `ACCESS_DENIED` (missing scope or grant, or patient erased or past retention); `DATABASE_UNAVAILABLE` (retry later). - [List patient population rows](https://docs.getarbol.com/api/ambar/list-patient-population/index.md) — Lists active patients you may read that match every given filter (contract, site, cohort program, cohorts, and the place they live in: `municipalityCountry` with `municipalityCode`), ordered by patient id. Filters never create membership. Each page scans up to 100 patients and returns at most 50 matches, so a page can be empty while `nextCursor` is set. Pass `nextCursor` as `after` with the same filters; `null` means the end. Returns patient records plus `scanned` and `asOf` (Unix epoch milliseconds). Errors: INVALID_INPUT for malformed filters or a cursor from other filters or another user; ACCESS_DENIED without the scopes a filter needs or a grant on a filtered resource. CONFLICT when a filter source cannot be used (an inactive cohort, program, site or contract, an outdated snapshot, or a matched membership or enrollment that is no longer current): reconcile or re-assess, then retry. RESOURCE_LIMIT_EXCEEDED when a patient has more than 25 matching enrollments or the contract's current technical note has more than 200 requirements. - [List a patient's encounters](https://docs.getarbol.com/api/ambar/list-patient-record-encounters/index.md) — Returns the services delivered to one patient, newest first, 50 per page: day, site, national procedure codes, ICD-10 diagnoses (the first is the main one), where its care counts when it was booked under a contract's sites (`attributed`) and the order it performed (`orderRef`, as `listPatientRecordOrders` names it). Use it to see what care the patient received; who pays each service is in `listServiceRoutes`. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). `INVALID_INPUT`: malformed `patientId` or `after`. `ACCESS_DENIED`: missing scope or patient grant; do not retry. - [Read a patient's event log](https://docs.getarbol.com/api/ambar/list-patient-record-events/index.md) — Returns the canonical events loaded for one patient, oldest first, 50 per page: kind, payload contract version, when it happened and was received, the source that sent it, and the event it corrects (`supersedesSeq`). The log never changes; corrections are new events. Use it to audit where a fact came from; for clinical reading prefer the derived lists (`listPatientRecordEncounters`, `listPatientRecordObservations`, `listPatientRecordMedications`). Returns `items` and `nextCursor` (a sequence number; pass it as `after`). `INVALID_INPUT`: malformed `patientId` or `after`. `ACCESS_DENIED`: missing scope or patient grant; do not retry. - [List a patient's medication events](https://docs.getarbol.com/api/ambar/list-patient-record-medications/index.md) — Returns one patient's prescriptions, dispensations, pending and out-of-stock items and discontinuations, newest first, 50 per page, with the medication code (CUM, IUM, ATC or the organization's own), quantity in UCUM units and days of supply. Use it to check adherence or what the pharmacy still owes the patient. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). `INVALID_INPUT`: malformed `patientId` or `after`. `ACCESS_DENIED`: missing scope or patient grant; do not retry. - [List a patient's results](https://docs.getarbol.com/api/ambar/list-patient-record-observations/index.md) — Returns one patient's results from the canonical record, newest first, 50 per page: standard code, the laboratory's own code, value with UCUM unit (or text), reference range and flag (`critical_low` and `critical_high` need a person now). Pass `codeSystem` and `code` together to follow one analyte over time, for example `LOINC` `2160-0` for creatinine. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). `INVALID_INPUT`: malformed input, or only one of `codeSystem` and `code`. `ACCESS_DENIED`: missing scope or patient grant; do not retry. - [List a patient's orders](https://docs.getarbol.com/api/ambar/list-patient-record-orders/index.md) — Returns one patient's order events, newest first, 50 per page: each `created` (a clinician ordered it) and `performed` (its source reported it done) with the source's `orderRef`, the organization's day, the national procedure codes ordered, the ICD-10 diagnoses that justify it and the site. The encounter that performed an order names it (`orderRef` in `listPatientRecordEncounters`), which gives the days from the order to the service a contract's timeliness indicators count. Use it to see what was ordered for the patient and what is still pending. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). `INVALID_INPUT`: malformed `patientId` or `after`. `ACCESS_DENIED`: missing scope or patient grant; do not retry. - [List patients due for disposition](https://docs.getarbol.com/api/ambar/list-patients-due-for-disposition/index.md) — Lists patients whose retention period has ended and that you may erase, for a human operator. Use it to choose candidates for `erasePatient`. Items carry only id, version, retention end and legal-hold flag; no profile or clinical content. Requires `ambar:patients:erase` and an active human actor. Ordered by id, 50 per page; pass `nextCursor` as `after`, `null` means done. Errors: `INVALID_INPUT` (cursor is not a lowercase UUID); `ACCESS_DENIED` (missing scope or not an active human: do not retry); `DATABASE_UNAVAILABLE` (retry later). - [List patients](https://docs.getarbol.com/api/ambar/list-patients/index.md) — Lists patients you may read for care work, ordered by id, 50 per page. Use it to browse; to find a person by identity document use `lookupPatients`, and to read one known patient use `getPatient`. Optional `status` keeps only `active` or `inactive` patients. Erased patients and patients past retention are never listed. Never invent patients that are not returned. Returns `items` and `nextCursor`; pass `nextCursor` as `after` to read the next page. `null` means there are no more pages. Errors: `INVALID_INPUT` (cursor is not a lowercase UUID or status is unknown: fix the query); `ACCESS_DENIED` (missing `ambar:patients:read` or clinical privacy not configured: do not retry); `DATABASE_UNAVAILABLE` (retry later). - [List the payer reports generated for a contract](https://docs.getarbol.com/api/ambar/list-payer-report-runs/index.md) — Lists the runs of a contract's payer reports, newest month first and, within a month, newest first: what was generated (template version, files with their SHA-256), by whom and when, and how it went (the sending and the payer's acknowledgment, when recorded). A run generated ten years ago or more says when its files' contents were purged (`filesPurgedAt`) and keeps their SHA-256. Use it to see which months were sent and which still wait, before generating a month again. Returns `items` and `nextCursor` (send it as `after`; `null` means no more). Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: a malformed `contractId` or `after`; fix it. `ACCESS_DENIED`: a missing scope; do not retry. - [List payer report templates](https://docs.getarbol.com/api/ambar/list-payer-report-templates/index.md) — Lists the payer report templates you may read, by `templateId`, 50 per page, each with its version in force (`inForce`: the newest a second person confirmed, which reports follow) and its version waiting for a second person (`pending`), with their sections, scope and who wrote and confirmed them. With `contractId`, only the templates that apply to that contract: its own and its payer's. Use it to find the reports a payer asks for before drafting a month (`draftPayerReport`), and to review a pending version before confirming it (`confirmPayerReportTemplate`). Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires `ambar:contracts:read` and a read grant on each template's contract, or on its payer's relation. `INVALID_INPUT`: a malformed `contractId` or `after`; fix it. `ACCESS_DENIED`: a missing scope; do not retry. - [List the organization's payers](https://docs.getarbol.com/api/ambar/list-payers/index.md) — Lists the payers (health insurers) the organization works with, ordered by `payerId`, 50 per page, with the catalog name, country, regimes and whether the catalog still lists the payer as operating. Use it to choose the payer of a contract (`setContractPayer`) or to filter contracts by payer. Add payers with `savePayer`. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires the `ambar:contracts:read` scope and a read grant on `payer_relation`. `INVALID_INPUT`: `after` is not a payer code. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List program assessments](https://docs.getarbol.com/api/ambar/list-program-assessments/index.md) — Lists every eligibility assessment recorded for one patient in one cohort program, ordered by assessment id, 50 per page. Use it to find a current eligible assessment (`eligibleNow: true`) before enrollProgram or a `resume` with transitionProgram. Returns `items` and `nextCursor`; pass it as `after` for the next page. `null` means the last page. Errors: ACCESS_DENIED without a read grant on the program or when the patient is not readable or not retained; INVALID_INPUT for malformed ids. - [List program progress](https://docs.getarbol.com/api/ambar/list-program-progress/index.md) — Lists aggregate enrollment counts for all cohort programs of your organization, ordered by id, 20 per page: enrollments by state and, for enrolled patients, eligibility split into current, expired, not current and unknown. Use it for overviews; use getProgram or getProgramWorkspace for one program. Returns `asOf`, `items` and `nextCursor`; pass it as `after` for the next page (`null` means the last page). Counts are computed at read time. Errors: ACCESS_DENIED without the program read scope or clinical access; INVALID_INPUT for a malformed `after`; DATABASE_UNAVAILABLE: retry later. - [List program templates](https://docs.getarbol.com/api/ambar/list-program-templates/index.md) — Lists the program templates you can instantiate (currently `critical_levels`, revision `1`) with the programs each creates and the cohort slots to fill. No paging. Use it before instantiateProgramTemplate to learn the slot keys. Templates are configuration starters, not clinical guidance; numbers in slot names are labels. Errors: ACCESS_DENIED without the program read scope. - [List programs](https://docs.getarbol.com/api/ambar/list-programs/index.md) — Lists all cohort programs of your organization, ordered by id, 50 per page. Use it to find a program id. Use getProgram for enrollments, getProgramWorkspace for the outreach configuration and listProgramProgress for aggregate counts. Returns `items` (the current revision of each program) and `nextCursor`; pass it as `after` for the next page. `null` means this is the last page. Errors: ACCESS_DENIED without the program read scope or clinical access; INVALID_INPUT for a malformed `after`; DATABASE_UNAVAILABLE: retry later. - [List who serves whom](https://docs.getarbol.com/api/ambar/list-provider-assignments/index.md) — Lists provider assignments by id: for a service category, the members of a payer or contract, in a territory, go to a provider (and one of its sites), and follow-ups go through an installation, between two dates; set by a person or imported from a payer's list (`origin`). Filter by category, payer or a day they apply on. Use it to review the network of pharmacy operators, laboratories and sites, before `endProviderAssignment` or an import. Returns a page of up to 50; pass `nextCursor` as `after` for the next. Requires `ambar:patients:read` and the registry read grant for care operations. `INVALID_INPUT`: a malformed filter or cursor; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List what each invoice still owes](https://docs.getarbol.com/api/ambar/list-receivables/index.md) — Lists the receivable of each invoice on `asOf` (default today), newest issue first, with the same selection as `listElectronicInvoices`: its value after notes, what was prepaid, paid and lost to objections, its balance and the part no open objection disputes, its age since filing (up to 30, 31 to 60, 61 to 90, 91 to 180, 181 to 360 days and more) and the late-payment interest past its balance's deadline at the DIAN's rates recorded (Ley 1438 de 2011, art. 56). A month without a recorded rate makes the interest unknown, never zero, and is listed in `missingRates`. Use it for the receivables report and to choose what a payment settles. Returns a page with its totals per currency and age, and the `nextCursor`. Requires `ambar:contracts:read`; only invoices of contracts you hold a read grant on are listed. `INVALID_INPUT`: a malformed cursor, a limit outside 1 to 200 or an empty window; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [Audit documents received before their person was known](https://docs.getarbol.com/api/ambar/list-received-documents/index.md) — Lists source receipts newest first, including unreadable formats or unknown sizes. Readable documents enter the ordinary reading queue. Use document: as a checked support reference when answering a glosa. Returns up to 50 receipts; pass nextCursor as before. Requires ambar:patients:read and the registry-wide patient read grant for care operations. The read is audited. INVALID_INPUT: malformed cursor; fix it. ACCESS_DENIED: missing scope or grant; do not retry. - [List record templates](https://docs.getarbol.com/api/ambar/list-record-templates/index.md) — Lists the organization's record templates (forms for configured records) at their latest version, ordered by `id`, with name, description and field count but without field definitions. Templates are organization configuration, not clinical facts. Without `entity`/`entityId` it reads through workspace settings (scope `ambar:settings:read` or `ambar:settings:write` plus a configuration read grant). With them it lists only templates for that kind of record, read through that patient (`ambar:patients:read`) or cohort (`ambar:cohorts:read`). Use getRecordTemplate for a full definition. Returns up to 50 items; pass `nextCursor` as `after` for the next page (`null` on the last page). `readState` tells whether each summary could be decrypted. Failures: ACCESS_DENIED when the caller is not a person, the scope or grant is missing, or the patient or cohort is not readable; CONFLICT when templates changed during the read (retry); INVALID_INPUT when only one of `entity`/`entityId` is sent or a value is malformed. - [List the precedence among contract components](https://docs.getarbol.com/api/ambar/list-routing-precedences/index.md) — Lists every revision of the organization's precedence among the contract components that cover the same service, the latest first: the components the router ranks first, in order, the orders it sets for some services only (`serviceOrders`: for a service whose code one lists, its components come first), from which day, the passage of the contracts that states it, where it stands and who proposed and decided it. `inForce` names the approved revision in force today; `null` means the default ranks every component (PGP, then capitation, then fee for service, then a scope that lists the procedure over one that covers every service). Use it before `proposeRoutingPrecedence`, and to explain why a component paid a service (`listServiceRoutes` gives each one's reason). Requires `ambar:contracts:read` and a read grant on every contract the revisions name, in their order or their orders by service; the read is audited. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List the organization's versions of a rule catalog](https://docs.getarbol.com/api/ambar/list-rule-catalog-versions/index.md) — Lists the organization's versions of one kind of catalog, newest first, with who proposed and who approved each, and which one is in force (`currentVersion`: the newest approved; `null` means the jurisdiction's reference release is). Use it to review a draft before approving it, and to see how a catalog changed. Returns `items` (at most 100) and `currentVersion`. Requires one of `ambar:patients:read`, `ambar:cohorts:read` or `ambar:settings:read`. `INVALID_INPUT`: unknown kind; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List saved analytics](https://docs.getarbol.com/api/ambar/list-saved-analytics/index.md) — Lists your own saved analytics (named inventory metric definitions) at their current version, ordered by `id`. Only analytics whose dataset you can still read and whose inventory contract is supported are listed; other people's analytics are never visible. Use getSavedAnalytic for one known id. A definition is not a computed result: read the numbers with getDataProduct or queryAnalyticsSql. Returns up to 50 items; pass `nextCursor` as `after` for the next page (`null` on the last page). Failures: ACCESS_DENIED when the token lacks `ambar:datasets:read` or `after` is not one of your visible analytics (restart from the first page); INVALID_INPUT for a malformed cursor. - [List the payer's authorizations of a person](https://docs.getarbol.com/api/ambar/list-service-authorizations/index.md) — Returns the authorizations recorded for a person, voided ones included with who voided them and why, the latest first day first, 50 per page: the payer's number, the contract, the procedures, the days covered (both included) and the MIPRES number. Use it in the person's file before recording one with `recordServiceAuthorization`, and to find the one to void with `voidServiceAuthorization`. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires `ambar:patients:read` and `ambar:contracts:read`, and the patient's read grant for care operations: without it the list is empty. `INVALID_INPUT`: a malformed `patientId` or `after`; fix it. `ACCESS_DENIED`: a missing scope, or clinical privacy not configured; do not retry. - [List a contract's service cost revisions](https://docs.getarbol.com/api/ambar/list-service-costs/index.md) — Returns immutable accounting cost revisions, 50 per page in stable key order. Send next as after. Requires ambar:contracts:read and the contract read grant. INVALID_INPUT: invalid cursor; ACCESS_DENIED: missing scope. Costs are separate from contractual tariffs and identify their accounting source. - [List routed services: the ones waiting for a person, the ones a contract pays](https://docs.getarbol.com/api/ambar/list-service-routes/index.md) — Returns the delivered services of current encounters in a window of days (one per encounter and procedure), by service day, 50 per page: who pays each now (`state`, and when `paid` the contract, component and, for a PGP, the technical-note line), the router's `decision` with its reasons, the person's `correction` in force, the patient's name label and the `version` to correct it. Use it with `state=needs_person` to work the services waiting for a person (a tie between components, nothing that covers the person that day, or a site to check), with `contractId` to review what the router counts for a contract, and with `contractId` of a PGP and `withoutLine=true` for the services whose note line a person still settles; then correct one with `correctServiceRoute`. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires `ambar:patients:read` and `ambar:contracts:read`, and a read grant on each patient for care operations: services of patients you may not read are left out. `INVALID_INPUT`: a window that is not 1 to 366 days long, a malformed `contractId`, `state` or `after`; fix it. `ACCESS_DENIED`: a missing scope, or clinical privacy not configured; do not retry. - [List data sources](https://docs.getarbol.com/api/ambar/list-sources/index.md) — Lists the data sources (systems that deliver datasets) you can see, ordered by `id`: those with at least one non-personal dataset you can read, plus sources registered under your own active data onboarding delegation. Use it to find the `sourceSystemId` filter for listDatasets; use getSource for one known id. A listed source is not proof of a live connection or of recent deliveries. Returns up to 50 items; pass `nextCursor` as `after` for the next page (`null` on the last page). Failures: ACCESS_DENIED when the token lacks `ambar:datasets:read` or `after` names a source you cannot see (restart from the first page); INVALID_INPUT for a malformed cursor. - [List study definitions](https://docs.getarbol.com/api/ambar/list-study-definitions/index.md) — Lists study definitions you may read, ordered by id, 20 per page; each item shows its latest revision. Use it to find what can be ordered: only definitions with an `activeVersion` that are not `retired`. Read a specific revision with `getStudyDefinition`. Pass `nextCursor` as `after` for the next page; `null` means done. Requires `ambar:studies:read`. Errors: `INVALID_INPUT` (bad cursor); `ACCESS_DENIED` (missing scope); `DATABASE_UNAVAILABLE` (retry later). - [List study order contract contexts](https://docs.getarbol.com/api/ambar/list-study-order-contract-contexts/index.md) — Lists the explicit bindings of study orders to one contract, ordered by binding id, 20 per page, with whether each basis still qualifies. Use it to see which orders count under a contract; bindings are never inferred. Create or refresh one with `bindStudyOrderContract`. Optional filters: order `state`, `orderId` and `patientId`. Pass `nextCursor` as `after` for the next page; `null` means done. Requires a human caller with `ambar:patients:read`, `ambar:studies:read` and `ambar:contracts:read`. Errors: `INVALID_INPUT` (bad filter or cursor); `ACCESS_DENIED` (not human, missing scope, or contract or order not readable); `CONFLICT` (data changed during the read: read again); `DATABASE_UNAVAILABLE` (retry later). - [List study order workspaces](https://docs.getarbol.com/api/ambar/list-study-order-workspaces/index.md) — Lists the follow-up of study orders with one follow-up `status`: reviewer assignment, linked performance and captured registration deadline. Use it as a work queue (for example `status=authorized` with `followUp=overdue`). Follow-up never changes the order's own state; change it with `assignStudyOrderReviewer`, `linkStudyOrderPerformance` and `captureStudyOrderRegistrationDeadline`. Each page scans up to 100 orders by id and returns the matching ones, so `items` may be empty while `nextCursor` is set; pass it as `after` until it is `null`. Requires a human caller with `ambar:patients:read` and `ambar:studies:read`; `contractId` and `followUp=overdue` also need `ambar:contracts:read`, without which `registrationDeadline` is `null`. Errors: `INVALID_INPUT` (bad filter or cursor); `ACCESS_DENIED` (not human, missing scope, or a filtered order, patient or contract not readable); `CONFLICT` (data changed during the read: read again); `DATABASE_UNAVAILABLE` (retry later). - [List study orders](https://docs.getarbol.com/api/ambar/list-study-orders/index.md) — Lists study orders you may read, ordered by id, 20 per page, optionally for one patient and one state. Use it to find orders and their workflow state; for follow-up work (reviewer, performance, deadlines) use `listStudyOrderWorkspaces`. Order states are workflow only: `registered` does not mean performed or resulted. Pass `nextCursor` as `after` for the next page; `null` means done. Requires `ambar:studies:read` and `ambar:patients:read`. Errors: `INVALID_INPUT` (bad filter or cursor); `ACCESS_DENIED` (missing scope, or the patient is erased or past retention); `DATABASE_UNAVAILABLE` (retry later). - [List study records](https://docs.getarbol.com/api/ambar/list-study-records/index.md) — Lists the study records of one patient (performances and results) with decrypted payloads, ordered by id, 20 per page. Use it to see what was reported and reviewed; for a flat list of accepted result values use `listPatientObservations`. Pass `nextCursor` as `after` for the next page; `null` means done. Requires `ambar:studies:read` and `ambar:patients:read`. Errors: `INVALID_INPUT` (bad id or cursor); `ACCESS_DENIED` (missing scope or grant, or patient erased or past retention); `DATABASE_UNAVAILABLE` (retry later). - [List study submissions due for disposition](https://docs.getarbol.com/api/ambar/list-study-submission-disposition-due/index.md) — Lists `unresolved` submissions whose retention has ended and that you may erase, ordered by id, 20 per page. Use it to choose candidates for `eraseStudySubmission`; items carry no content. Pass `nextCursor` as `after` for the next page; `null` means done. Requires a human caller with `ambar:studies:review`. Errors: `INVALID_INPUT` (bad cursor); `ACCESS_DENIED` (not human or missing scope); `DATABASE_UNAVAILABLE` (retry later). - [List study submissions](https://docs.getarbol.com/api/ambar/list-study-submissions/index.md) — Lists study submissions you may read, ordered by id, 20 per page, optionally only those linked to one patient. Use it to find unresolved source content to link, or the sources linked to a patient. Pass `nextCursor` as `after` for the next page; `null` means done. Requires `ambar:studies:read` and `ambar:patients:read`. Errors: `INVALID_INPUT` (bad id or cursor); `ACCESS_DENIED` (missing scope, or patient erased or past retention); `DATABASE_UNAVAILABLE` (retry later). - [List technical note attributions](https://docs.getarbol.com/api/ambar/list-technical-note-attributions/index.md) — Lists the recorded and retracted attributions of an approved technical note with event dates in [`from`, `to`] (inclusive), optionally for one line or patient, ordered by `id`, up to 50 per page, each with the patient's name label. Reads are audited. People only; needs `ambar:contracts:read`, `ambar:patients:read` and `ambar:studies:read`. Use it to review or correct attributions (`currency: sources_changed` needs review); use `getTechnicalNoteExecution` for totals. Returns `items` and `nextCursor`: send `nextCursor` as `after` for the next page; `null` means there are no more pages. Failures: `ACCESS_DENIED`: not a person, missing scopes or grants, the note is not approved, or the patient is not visible; do not retry. `INVALID_INPUT`: fix the filters or dates (at most 3660 days apart). `DATABASE_UNAVAILABLE`: retry later. - [List incomplete technical-note preparations](https://docs.getarbol.com/api/ambar/list-technical-note-preparations/index.md) — Lists five documentary preparations of a contract, ordered by id, including finalized ones. Send nextCursor as after; null means no more pages. Preparations never execute services or authorize payment. Requires ambar:contracts:read and the contract's finance read grant; admits a person or an explicitly delegated internal operator. ACCESS_DENIED means a missing scope, grant or clinical policy. INVALID_INPUT means malformed identifiers. DATABASE_UNAVAILABLE may be retried. - [List technical notes](https://docs.getarbol.com/api/ambar/list-technical-notes/index.md) — Lists the technical note revisions of a contract in every state, ordered by `number`, up to 5 per page because each carries its full definition. People only. Use it to find the highest `number` (for `expectedLatestNumber`) or a note to propose or approve; use `getTechnicalNote` for one known id. Returns `items` and `nextCursor` (a note `number`): send it as `after` for the next page; `null` means there are no more pages. Failures: `ACCESS_DENIED`: not a person, missing `ambar:contracts:read`, or no read grant for the contract; do not retry. `INVALID_INPUT`: fix `contractId` or `after`. `DATABASE_UNAVAILABLE`: retry later. - [List a jurisdiction's territory units](https://docs.getarbol.com/api/ambar/list-territories/index.md) — Lists the units of one level of a country's territory codes (DIVIPOLA in Colombia, UBIGEO in Peru) in the release in force on `on`, by code: the top level, or `level` by its name; only inside `within`, a unit of a higher level; only names starting with `name`. Use it to resolve a municipality's code or name, to fill sites, coverages and residence with official codes, and to list the municipalities of a department. Returns a page of up to 50 units with their level and release; pass `nextCursor` as `after` for the next. Requires one of `ambar:patients:read`, `ambar:contracts:read`, `ambar:cohorts:read` or `ambar:settings:read`. `INVALID_INPUT`: a malformed country or code, a level the country does not have, a `within` that is not a unit of a higher level, or a `name` outside 1 to 60 characters; fix it. `NOT_FOUND`: Ámbar has no profile for the country. `ACCESS_DENIED`: none of those scopes; do not retry. - [List the organization's travel zones](https://docs.getarbol.com/api/ambar/list-travel-zones/index.md) — Lists the travel zones: the care sites between which people reasonably travel for an appointment (for example Armenia and Pereira), each site with its coordinates, and how many sites one slot search asks the agenda about at most (`maxSitesPerSearch`, the contracted site included). A slot search for a contracted site asks only the sites of its zone that the contract's substitutions allow, the nearest first; nobody is sent to another zone. Use it to check which sites may serve for one another, or before changing a zone. Returns the zones by id (at most 500). Requires `ambar:appointments:read` and the registry read grant on care sites for care operations. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List what people paid at a contract's services](https://docs.getarbol.com/api/ambar/list-user-payments/index.md) — Lists the copayments, moderator fees and shared payments collected at the services of a contract from `from` (included) to `to` (excluded), by day and id, voided ones included with their reason. Each names its service (encounter and code) and the electronic invoice the provider issued for it, never the person. Use it to review what an invoice credits as paid by the users before its RIPS (`draftServiceRecord`). Returns the payments. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: `to` not 1 to 366 days after `from`; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Read a service's waitlist in queue order](https://docs.getarbol.com/api/ambar/list-waitlist/index.md) — Reads the waitlist of a service in queue order, the order in which its people are invited to book: clinical priorities first, the longest waiting first; then everyone else by score, ties to the longest wait. A person's score is the highest kept score of their cohorts' priority models (`modelPriority`, whose reasons `explainPatientPriority` gives), or the one given when they joined while no model scores them; a model that finds a recent critical value or red flag makes them a clinical priority. Use it to show the care team whom the agenda serves next and why, and to get an entry's `version` for `withdrawFromWaitlist`. Returns `waitingCount` and the first 200 people waiting with their `position`. Only people the caller may read are listed. Requires `ambar:appointments:read` and `ambar:patients:read`, and the patients' read grants for care operations. `INVALID_INPUT`: malformed `serviceCode`; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [List a subscription's deliveries](https://docs.getarbol.com/api/ambar/list-webhook-deliveries/index.md) — Lists a subscription's deliveries, newest first: one per event sent or being sent, with its notification id, patient, event, status, attempts and when the next attempt is due. Use it to see whether the receiving system got an event, and `listWebhookDeliveryAttempts` for each attempt's answer. Returns up to 50 items; pass `nextCursor` as `after` for older ones (`null` on the last page). A subscription without deliveries, or an unknown one, gives an empty page; check the id with `listWebhookSubscriptions`. Requires `ambar:settings:read` or `ambar:settings:write`, a person, and a workspace configuration read grant. `INVALID_INPUT`: malformed subscription id or cursor; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List a delivery's attempts](https://docs.getarbol.com/api/ambar/list-webhook-delivery-attempts/index.md) — Lists every attempt of one delivery, in order: when, the outcome (`delivered`, `refused` or `unreachable`), the HTTP status the endpoint answered and how long it took. Use it after `listWebhookDeliveries` to see why a delivery is still pending or was abandoned: a `refused` status points at the receiver, `unreachable` at the network or the endpoint's address. Returns the complete list, at most 8 attempts. A delivery not tried yet, or an unknown one, gives an empty list. Requires `ambar:settings:read` or `ambar:settings:write`, a person, and a workspace configuration read grant. `INVALID_INPUT`: `deliveryId` is not a positive decimal string; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List the organization's webhook subscriptions](https://docs.getarbol.com/api/ambar/list-webhook-subscriptions/index.md) — Lists every webhook subscription of the organization, by id, with its installation, endpoint, event kinds, status and `version`. Use it to read the `version` that `pauseWebhookSubscription` and `resumeWebhookSubscription` need as `expectedVersion`, and the ids `listWebhookDeliveries` reads. Returns the complete list, not paginated. Requires `ambar:settings:read` or `ambar:settings:write`, a person, and a workspace configuration read grant. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List workflow runs](https://docs.getarbol.com/api/ambar/list-workflow-runs/index.md) — Lists runs by run id, 50 per page, optionally only one patient's, only one workflow's, or only the live ones (running, waiting, paused), with the step each is on, its state, when the worker looks at it again and why it ended. Use it to see which workflows are working on a patient, or how a workflow's runs stand. Read one run's steps with `getWorkflowRun`. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Only runs of patients the caller has a grant on are listed. Requires the `ambar:programs:read` and `ambar:patients:read` scopes. `INVALID_INPUT`: malformed `patientId`, `workflowId` or `after`. `ACCESS_DENIED`: missing scope; do not retry. - [List the simulations of a workflow](https://docs.getarbol.com/api/ambar/list-workflow-simulations/index.md) — Lists the simulations asked for a workflow's versions, newest first, 50 per page, with their state (`queued`, `running`, `done`, `failed`), settings, who asked and why one failed. Use it to follow a simulation asked with `simulateWorkflowVersion`; the report of a `done` one is the version's `simulation` (`listWorkflowVersions`). Returns `items` and `nextCursor` (pass it as `before`; `null` on the last page). Requires the `ambar:programs:read` scope and a read grant on `workflow`. `INVALID_INPUT`: malformed `workflowId` or `before`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List workflow switches](https://docs.getarbol.com/api/ambar/list-workflow-switches/index.md) — Lists the switches of the organization's workflows, cohorts and the organization itself, ordered by scope and id, with whether each is off and why. Use it to see why runs are paused before switching something back on with `setWorkflowSwitch`. Returns `items` and `nextCursor` (`null`: every switch fits in one page). Requires the `ambar:programs:read` scope and a read grant on `workflow`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List the versions of a workflow](https://docs.getarbol.com/api/ambar/list-workflow-versions/index.md) — Lists the versions of one workflow, oldest first, 50 per page, with their state on the approval path (draft, validated, simulated, in_review, approved, active, paused, superseded), definition, last simulation, author and approver. Use it to review a proposal, compare versions or find the one to activate. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires the `ambar:programs:read` scope and a read grant on `workflow`. `INVALID_INPUT`: malformed `workflowId` or `after`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [List workflows](https://docs.getarbol.com/api/ambar/list-workflows/index.md) — Lists the organization's workflows ordered by `workflowId`, 50 per page, with their cohort, program and the version new runs use. Use it to find a workflow before reading its versions (`listWorkflowVersions`) or adding one (`addWorkflowVersion`). Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires the `ambar:programs:read` scope and a read grant on `workflow`. `INVALID_INPUT`: `after` is not a workflow id. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Find where a partner's people have records](https://docs.getarbol.com/api/ambar/locate-lake-records/index.md) — The record locator of a data-sharing agreement ([36] section 8.3). For each linkage token asked, says whether the organization holds records of that person, from which month to which month (`YYYY-MM`) and how many of each category (services, results, medications, orders, appointments, coverage, contacts, documents), never what they say. A token is the keyed hash, under the agreement's linkage key, of the person's document written one way: country, type and number in capitals, without hyphens or leading zeros (`ambar-lake-linkage-v1`). Erased people, and people whose record changed since their token was computed, are not found until the worker computes it again. Use it to learn which of your people the organization knows before asking for their records under the agreement. Only the service account the revision in force names, while it allows linkage tokens; requires `ambar:datasets:read`. Each call is audited. `INVALID_INPUT`: malformed agreement key or tokens, or more than 100; fix them. `ACCESS_DENIED`: missing scope, not the agreement's service account, no revision in force that allows tokens, or no linkage key in the deployment; do not retry. - [Look up patients for a contract](https://docs.getarbol.com/api/ambar/lookup-contract-patients/index.md) — Finds patients by exact identity document for contract (financial) work, using contract-purpose patient grants instead of care grants. Use it only in contract workflows; for care work use `lookupPatients`. There is no contract-purpose listing without an identity document. Same body, exact matching, ordering and paging as `lookupPatients` (50 per page; pass `nextCursor` as `after`). Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (missing `ambar:contracts:read`, no contract-purpose grant or clinical privacy not configured: do not retry); `DATABASE_UNAVAILABLE` (retry later). - [Look up patients](https://docs.getarbol.com/api/ambar/lookup-patients/index.md) — Finds patients whose identity document matches `country`, `documentType` and `documentNumber` exactly (no fuzzy matching, no normalization). Use it before `createPatient` to avoid duplicates. Matching never merges records, so more than one patient can be returned. Returns only matches you may read now, ordered by id, 50 per page; pass `nextCursor` as `after` for more, `null` means done. An empty list means no visible match, not that the person is unknown elsewhere. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (missing `ambar:patients:read` or clinical privacy not configured: do not retry); `DATABASE_UNAVAILABLE` (retry later). - [Mark explicit workspace notices read](https://docs.getarbol.com/api/ambar/mark-notifications/index.md) — Mark the given notices (1 to 200 of your own notice ids) as read. Nothing else is marked: not unseen pages and not other people's notices. Returns `acknowledged` (notices newly marked; already-read ones are not counted) and `hasMore` (you still have unread notices). Repeating the call is safe: an already-read notice is not changed. `INVALID_INPUT`: an empty list, more than 200 ids, duplicates or ids longer than 128 characters. `ACCESS_DENIED`: an id is not one of your notices, or a non-human caller; do not retry with that id. `COMMIT_UNCERTAIN`: repeat the same request. - [Merge two records of the same person](https://docs.getarbol.com/api/ambar/merge-patients/index.md) — Merges `mergedPatientId` into `survivingPatientId`: the merged record is kept and points to the surviving one; the encounters, results and medications of either now read as one patient's (each still under its own record's grant), and ingest finds the surviving record for either's document. The event log stays per record. Merges never chain into a cycle: the surviving record must not be merged itself, and the merged one not already. Use it after comparing both records (`listDuplicatePatients`, `getPatient`). `dryRun: true` checks and keeps nothing. Sending the same merge again answers it with `replayed: true`. Returns the merge with the `requestKey`. Requires `ambar:patients:read` and `ambar:patients:write`, and the write grant on both patients for care operations. `INVALID_INPUT`: malformed body, the same patient twice, a patient that is not kept or was erased, or a `reasonCode` that is not a code; fix it. `CONFLICT`: either record is merged already; read `listPatientMerges`. `ACCESS_DENIED`: missing scope or grant on either patient; do not retry. - [Name the component period a payment pays](https://docs.getarbol.com/api/ambar/name-contract-payment-component/index.md) — Names, once, the component whose period a live payment pays: for a payment that arrived from the payer's events, or was recorded, without one. It then counts for that period's settlement whatever its own dates within it, so a quarter the payer pays month by month is not left `not_paid`; the receivables and the final liquidation read it as before. Naming the same component again returns the payment; `dryRun: true` checks everything and keeps nothing. Returns the payment with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: malformed identifiers; fix them. `NOT_FOUND`: no such payment. `CONFLICT`: the payment is voided or already names another component, or the component is not one of its contract's or its period does not hold the paid days; read it with `listContractPayments`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Open one human-initiated management case](https://docs.getarbol.com/api/ambar/open-care-case/index.md) — Explicitly open administrative management for one real active retained patient under a non-suspended contract and an active documentary technical note. Supply the note's current version and optionally one known activity key; source custody is rechecked. reason and sourceReference describe the actual decision and are encrypted. assignedTo must be an active human with patient read/write and contract read grants. followUpAt is an explicitly chosen management deadline, not a clinical due date. Starts in_progress without an assessment, approval, clinical gap, coverage or RIPS attribution. No call, message or provider action is sent. Requires patients read/write and contracts read scopes, current patient read/write and contract read grants, for a person or delegated internal operator. Use listCareCases and recordCareCase to follow up, or getCareCaseHistory for the actual reason. CONFLICT: stale note version, duplicate id, unavailable source, non-active patient or suspended contract. ACCESS_DENIED: missing grants or unauthorized assignee. INVALID_INPUT: malformed command. After COMMIT_UNCERTAIN repeat the identical body and requestKey; its receipt is stable. - [Pause a webhook subscription](https://docs.getarbol.com/api/ambar/pause-webhook-subscription/index.md) — Stops queuing events for an `active` subscription. Deliveries already queued wait, and the events loaded while it is paused are sent on resuming. Use it when the receiving system is down for a while or should stop receiving. `dryRun: true` checks and keeps nothing. Returns the subscription, now `paused`, with its new `version` and the `requestKey`. Requires `ambar:settings:read` and `ambar:settings:write`, a person, and a workspace configuration write grant. `NOT_FOUND`: no such subscription. `CONFLICT`: `expectedVersion` is stale or it is already paused; read it again with `listWebhookSubscriptions`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Prepare a team change](https://docs.getarbol.com/api/ambar/prepare-team-command/index.md) — Prepare one durable team change (invite, change a member's role, or revoke an invitation) without touching the identity provider; carry it out with `runTeamCommand`. The command `id` is derived from your identity and `requestKey`. You cannot change your own roles. A revocation is checked against the provider while preparing. Requires a human caller with the `ambar:settings:write` scope. Returns the command in state `prepared`; `expiresAt` is the deadline to start it. Idempotency: the same `requestKey` with the same input returns the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `TEAM_PRIOR_UNRESOLVED`: one of your earlier commands is unresolved (its id is in `details.commandId`); resolve it with `runTeamCommand` first. `CONFLICT`: another administrator has an unresolved command for the same target; retry later. `ACCESS_DENIED`: missing scope, a change to your own roles, or an invitation to revoke with roles you cannot assign. `NOT_FOUND`: the invitation to revoke does not exist. `CAPABILITY_NOT_CONFIGURED`: team management is not set up. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input. - [Preview a clinical route template](https://docs.getarbol.com/api/ambar/preview-clinical-route-template/index.md) — Compiles a template into a care route definition bound to your cohorts and to codings of approved study definitions, and checks it against the contract. It saves nothing. Send one cohort binding per semantic key and one code selection per legacy code; then send the returned `definition` to saveClinicalRoute. Returns the compiled definition. Errors: NOT_FOUND for an unknown template key; INVALID_INPUT for missing or extra bindings, a wrong catalog revision, an unknown component key or an unsupported code system. CONFLICT when a selected study definition revision is not its active approved one; BODY_TOO_LARGE when the compiled definition exceeds 131,072 bytes. ACCESS_DENIED without contract read and write, cohort read and study read access, when the contract is suspended, a cohort is not active or a definition is not readable, or as a non-human caller. - [Show what a version's clauses do to a month's payment](https://docs.getarbol.com/api/ambar/preview-contract-clause-effects/index.md) — Applies every clause of a contract version to one month whose payment before clauses you give: the retention withheld and what each indicator's result releases, keeps or leaves pending; the penalty discount with each listed indicator's escalation and the month that escalates it next; the month's chargebacks with their avoidable leakage; the procedures kept out of the fixed value; the band adjustment, from what the line-execution worker measured in the month for the notes that bind the PGP component `componentKey` names, or the version's only PGP component (a month still running counts at its pace, `projected: true`; a note that binds two PGP components of the version cannot be split between them, and the band clause then moves nothing), each line against its own note's bands and at its prices; with `population`, the population adjustment against the population the value is priced for; and the risk adjustment, from the people the period of that PGP component (or of `componentKey`) covers in each group of the clause (a person counts in the first cohort of the clause that holds them on their last covered day) against the technical note's mix. Every clause is computed and shown, but only a confirmed one moves money: `appliedMinor` adds the confirmed effects and `shownMinor` the others. Use it before the month closes, to see how much is retained, what is expected to be released, and which indicator puts it at risk. It reads the indicators' recorded months (`recordContractComplianceMonth`) and the chargebacks performed in the month (`reportChargeback`); and, for a clause of excluded technologies, `servicesApart`: the month's services the router paid to a PGP or capitation component of the version with one of its procedures, which are billed apart. Returns the effects with their totals. Requires `ambar:contracts:read` and a read grant on the contract. `INVALID_INPUT`: malformed input or a payment out of range; fix it. `NOT_FOUND`: the version is not this contract's, or `componentKey` is not one of its components. `CONFLICT`: a chargeback of the month, or a technical note of the version, is in another currency; check `currency`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Preview contract money](https://docs.getarbol.com/api/ambar/preview-contract-estimate/index.md) — Calculates a draft PGP or capitation estimate from figures supplied in the request. It reads no contract, roster or settlement and saves nothing. Needs `ambar:datasets:read` or `ambar:ingestions:read`. Use it for what-if arithmetic; to settle approved terms use `createContractSettlement`. PGP total: `budgetMinor` + adjustments. Capitation total: `memberDays` × `rateMinor` / `periodDays` + adjustments. Exact integer math, rounded once at the end, halves away from zero. Returns `estimate`: the echoed assumptions, exact intermediate fractions and `totalMinor`. No `requestKey`: repeating it is harmless. Failures: `INVALID_INPUT`: fix the figures (fields depend on `mode`). `CONFLICT`: an adjustment label has leading or trailing spaces; trim it. `ACCESS_DENIED`: missing scope; do not retry. `DATABASE_UNAVAILABLE`: retry later. - [Check a data-sharing agreement before proposing it](https://docs.getarbol.com/api/ambar/preview-lake-sharing-agreement/index.md) — Checks a draft agreement without keeping anything: everything that keeps it from being proposed (each with its product, table and column) and, for each table of each product, the columns its share would hold and what it does with each one (kept, renamed under the agreement's key, a coarser day or place). Its legal basis bounds what it may carry (Ley 1581 de 2012, articles 6 and 10): direct identifiers only to a named service account and never on the statistical basis, which requires months or years, departments or no places, no professionals and cells of five or more; money only for the payer's contract or a regulatory report; the continuity of care with health data and without money (Res. 866 de 2021, article 22). Use it while drafting; `proposeLakeSharingAgreement` refuses a draft with problems. Requires `ambar:settings:read` or `ambar:settings:write`. `INVALID_INPUT`: the body is not an agreement's terms; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [Score example facts with a priority model](https://docs.getarbol.com/api/ambar/preview-priority/index.md) — Applies a priority model to one person's facts on a day, without keeping anything: the clinical points (0 to 99) with each factor's points and what it read (days since the admission, percent above the goal, days overdue, other risk cohorts, whole weeks waiting), the contractual tie-break (0 to 9), the score the queue orders by (the clinical points times ten plus the tie-break), and whether a recent critical value makes the person a clinical priority. Use it to try a model on example people before proposing it, and to explain a score. Returns the score with its reasons, the most points first. Requires `ambar:cohorts:read`. `INVALID_INPUT`: a model out of its bounds or malformed facts; fix it. `ACCESS_DENIED`: missing scope; do not retry. - [Propose a clinical route](https://docs.getarbol.com/api/ambar/propose-clinical-route/index.md) — Moves a `draft` route to `proposed` (`version` `2`) so that another person can approve it. Send no `approvalEvidence`. Returns the proposed route. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when `expectedVersion` or `expectedContractVersion` is stale, the route is not a draft or the contract is suspended: re-read with getClinicalRoute; INVALID_INPUT when `approvalEvidence` is sent. ACCESS_DENIED without contract read and write access, when the source artifact is no longer available, or as a non-human caller; COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Propose a cohort's priority model](https://docs.getarbol.com/api/ambar/propose-cohort-priority-model/index.md) — Proposes how a cohort's queue is ordered: clinical factors and their weights (`recent_admission`, `out_of_goal`, `overdue_control`, `risk_cohorts`, `waiting`, each at most once, their maximum points adding up to at most 99), the points a person whose activity counts toward a contract line under its band gets only to break ties (`underBandTiebreak`, 0 to 9), and how recent a critical value or red flag makes the person a clinical priority (`criticalWithinDays`). It is kept as the cohort's next version, a draft that orders nothing until another person approves it with `approveCohortPriorityModel`. Use it when the clinical team changes what decides who is seen first; try a model on example facts first with `previewPriority`. Returns the version kept. Requires `ambar:cohorts:read` and `ambar:cohorts:write`, and the cohort's write grant. `INVALID_INPUT`: a model out of its bounds (a factor twice, maxima above 99, a tie-break above 9, a window of 0 or above 3650 days) or a malformed cohort id; fix it. `CONFLICT`: another proposal took the version at once; propose again. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Propose a contract's final liquidation acta](https://docs.getarbol.com/api/ambar/propose-contract-liquidation/index.md) — Keeps the acta Ámbar drafts now for a contract that ended (as `draftContractLiquidation` drafts it, recomputed here so nobody types its figures), with the SHA-256 of its JSON. Another person accepts it with `decideContractLiquidation`; until then the proposer may withdraw it. A contract has at most one acta proposed or accepted. Retrying with the same `requestKey` returns what the first attempt kept, whatever the acta would say now. Returns the acta as kept, with its `version` (`1`). Requires `ambar:contracts:read`, `ambar:settlements:read` and `ambar:settlements:write`, and a write grant on the contract. `INVALID_INPUT`: malformed identifiers, day, term, reason or key; fix them. `NOT_FOUND`: no approved version. `CONFLICT`: `endedOn` has not passed, another acta is proposed or accepted, or the components are in more than one currency. `IDEMPOTENCY_CONFLICT`: the key was used for another request. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Propose the settlement of a component period](https://docs.getarbol.com/api/ambar/propose-contract-settlement/index.md) — Computes the settlement of one component's whole period of an approved contract version, in any payment mode, with the arithmetic the settlement applies. Capitation: the price per member for the period times the member-days of the component's current, eligible coverages (under any version of the contract that keeps the component's key), over the days of the period; with a pricing another person confirmed (`listCapitationPricing`), each month's covered days are priced by the tariff the payer's listing in force that day matches, on the pricing's day basis (`proposal.basis.priced`), and a pricing nobody confirmed yet is the note `pricing_unconfirmed`. PGP: the agreed value; a per-member PGP is paid its period's population times the value per member, and the difference is one adjustment. The approved technical notes that bind the component give that value when they pay per member (`paymentBasis: fixed_per_member`): what their priced lines are worth over the period, each day at the newest note in force, ÷ the people each is priced for (`valuePerMemberFromNotes`); otherwise send `valuePerMemberMinor`. Fee for service: the invoices of the period's services minus what the objections take. Each confirmed clause that moves money is one more adjustment; unconfirmed ones are only shown. A band clause reads what the line-execution worker measured over the period's months for the notes that bind the component (`execution`, when every month was measured through its end; else `executionGap` says why not), each line against its own note's bands, whatever other PGP components the version has; a note that binds two of them cannot be split between them and leaves the period unmeasured (`shared_note`): below its lower band it loses what it misses of the band and above its upper band the payer recognizes what it executes beyond it, as the clause says, at the note's prices; a line never makes up for another, and bands for monitoring move nothing. A per-member PGP is paid for the people its coverages hold in the period, which the payer's population file derives, unless `population` says otherwise. A population clause of a global PGP reads that same paid population against the population the value is priced for; a per-member PGP already pays it, so the clause moves nothing there. The payer's SA55 objections that name a PGP period as the one they adjust (`recordObjection`, `adjusts`) are one adjustment each, for what they take as their course stands; the band clause (SA5502) and the population clause that lowers the value (SA5501) of that period then move no money, so the deviation counts once, and what the objections take beyond them is flagged. The cut is complete once the period has ended in the contract's time zone. Use it at the end of each period: review the proposal and its `notes` (lines not invoiced, open objections, unconfirmed clauses, an unmeasured execution, bands for monitoring), correct what is wrong saying why in `methodology`, then send `settlement` with an `id` and a `requestKey` to `createContractSettlement`; another person accepts it with `acceptContractSettlement`. Nothing is written here except the audit of the read. Returns the proposal, the proposed total against the period's payments (those naming its component, whatever their dates in it, and those naming none with exactly its dates), the manifest it comes from (its SHA-256 is the cut's manifest and every adjustment's evidence), and the settlement body, with the close it must supersede. Requires `ambar:contracts:read` and `ambar:settlements:read` and a read grant on the contract. `INVALID_INPUT`: malformed identifiers, `population` without a value per member (the notes' or `valuePerMemberMinor`), either for a component that is not PGP, or values out of range; fix them. `NOT_FOUND`: the version or the component is not this contract's. `CONFLICT`: the version is not approved, a payment, an invoice line or a binding note of the period is in another currency, or `valuePerMemberMinor` is not the value the notes give, or an SA55 objection adjusts a component whose currency or precision is not its invoice's; read the version, the period or the notes. `RESOURCE_LIMIT_EXCEEDED`: the contract holds more than 2,000 SA55 objections. `INVOICE_COMPONENT_AMBIGUOUS` (409): lines have no routed payer and the version has several fee-for-service components. `error.details.lineIds` lists at most 100 unique line identifiers in lexical order; route them before retrying. Only the selected component's lines and their objections enter its proposal. A version's sole fee-for-service component also includes genuinely unrouted lines. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Propose a contract version](https://docs.getarbol.com/api/ambar/propose-contract-version/index.md) — Proposes the complete terms of a new contract version: dates, references and 1 to 32 priced components. A capitation component lists the services its price pays for in `serviceLines` (Decreto 441 de 2022, art. 2.5.3.4.2.3): only those route to it, so a high-complexity service is not absorbed by the capitation. It applies only after another person approves it with `approveContractVersion`. Send the contract `version` as `expectedVersion`; proposing increments it. Returns the saved `version` (`proposed`, with the next sequence `number`). Idempotent by `requestKey` (scoped to you): the same key with the same input returns the proposed version without creating another; the same key with different input fails with `IDEMPOTENCY_CONFLICT`. Failures: `INVALID_INPUT`: the terms break a documented limit (body up to 192 KiB), or a capitation component lists no services. `CONFLICT`: stale `expectedVersion`, duplicate version `id`, unknown `timeZone`, or an `artifact:` source that is not a ready upload with that hash; re-read and fix. `ACCESS_DENIED`: missing scope or write grant; do not retry. `MODULE_DISABLED`: a component's `mode` belongs to a module the organization does not use (`details.module`: `pgp`, `capitation` or `fee_for_service`); propose terms in the modes it uses. `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend the identical request with the same `requestKey`. - [Propose a mapping version](https://docs.getarbol.com/api/ambar/propose-installation-mapping/index.md) — Adds the next version of one of an installation's mappings, as the caller: the whole table of source codes and the standard codes they mean. It does nothing until an authorized person explicitly approves it, including its author. Use `listInstallationMappingGaps` for the codes to add and `getInstallationMapping` for the current rows; rows an AI suggested go with `proposedByAi: true`. `dryRun: true` checks the rows and keeps nothing. Returns the new version's number with the `requestKey`. Requires `ambar:settings:read` and `ambar:settings:write`, a person, and a workspace configuration write grant. `INVALID_INPUT`: malformed body, no rows or more than 10,000, a repeated source code or a malformed target; fix it. `NOT_FOUND`: no such installation. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Propose a data-sharing agreement](https://docs.getarbol.com/api/ambar/propose-lake-sharing-agreement/index.md) — Proposes a revision of a data-sharing agreement: its party and role (controller or processor), purpose, legal basis, validity (at most five years), whether it carries direct identifiers and to which service account, its linkage (its own key, or a group whose shares join), its key generation, its generalization rules and its data products. Another person approves it with `decideLakeSharingAgreement`; until then nothing is shared, and the proposer may withdraw it. One revision of an agreement waits for a decision at a time; the first revision of a new key creates the agreement. Retrying with the same `requestKey` and body returns what the first attempt kept. Returns the revision with its `version` (`1`). Requires `ambar:settings:read` and `ambar:settings:write`, and a configuration write grant. `INVALID_INPUT`: a draft `previewLakeSharingAgreement` finds problems in, a validity already over, a key generation lower than an approved revision's, or a malformed reason or key; fix them. `CONFLICT`: another revision of the agreement waits for a decision; decide it first. `IDEMPOTENCY_CONFLICT`: the key was used for another request. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Propose a precedence among contract components](https://docs.getarbol.com/api/ambar/propose-routing-precedence/index.md) — Proposes a revision of the organization's precedence: the components the router ranks first, from the one that wins, over any other that covers the same service, from `effectiveFrom` on, with the passage of the contracts that states it. `serviceOrders` (optional) orders the components for some services only: for a service whose code one lists, its components come first, before `componentOrder`; send it when the contracts split the services two components both cover (creatinine to the capitation, the consultation to the PGP). Another person approves it with `decideRoutingPrecedence`; until then it changes nothing, and the proposer may withdraw it. One revision waits for a decision at a time. A revision is never in force before the day it is approved, so a service of an earlier day never changes payer because of it; to change the past, correct each service with `correctServiceRoute`. An empty order replaces the one in force with the default. Retrying with the same `requestKey` and body returns what the first attempt kept. Returns the revision with its `version` (`1`). Requires `ambar:contracts:read` and `ambar:contracts:write`, and a write grant on every contract the revision names, in its order or its orders by service, and on every contract the revision in force on `effectiveFrom` names. `INVALID_INPUT`: a component twice or more than 200, orders by service out of bounds (more than 50, a code in two of them, an order without codes or components, more than 100 codes or 20 components, a component twice in one), a `sourceRef` that is empty, longer than 2,000 characters or not one line, a day before today, a component that is not one of an approved version of its contract, an empty order with none in force that day (nothing to change), or a malformed reason or key; fix them. `CONFLICT`: another revision waits for a decision; decide it first. `IDEMPOTENCY_CONFLICT`: the key was used for another request. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Propose a version of a rule catalog](https://docs.getarbol.com/api/ambar/propose-rule-catalog-version/index.md) — Proposes a complete catalog as the organization's next version of its kind, numbered 1 and up within the kind. It is a draft, never in force, until a person other than whoever proposed it approves it with `approveRuleCatalogVersion`; from then on it is the organization's catalog of its kind instead of the jurisdiction's reference release. Use it to extend or change what a rule reads without a code change: the LOINC codes the organization's laboratory reports, a country's calibration of Framingham, the rule of one more CAC field. Start from `getRuleCatalogInForce` and check the draft with `checkRuleCatalog`. `dryRun: true` checks and numbers it and keeps nothing. Returns the version with the `requestKey`. Requires `ambar:patients:read` and `ambar:patients:write` and the registry-wide patient write grant for care operations; agents may propose. `INVALID_INPUT`: a catalog the checks refuse (`checkRuleCatalog` says why) or a malformed `requestKey`; fix it. `CONFLICT`: another proposal took the same number at once; propose again. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Propose a technical note](https://docs.getarbol.com/api/ambar/propose-technical-note/index.md) — Moves a `draft` technical note to `proposed` so another person can approve it with `approveTechnicalNote`. People only; needs `ambar:contracts:write`. Send the note `version` (1 while draft) and the contract `version`; proposing increments the contract `version`. The source, binding and linked records are checked again, and the note must be complete: its population's `riskCharacterization`, the agreement's `agreedValue` and a `monitoringPeriodicity` shorter than its validity, with an `agreedValue` equal to the value of the PGP components it binds when they settle exactly its validity (`checkTechnicalNote` shows all of it first). Idempotent by `requestKey` (scoped to you): the same key with the same input returns the note's current state; the same key with different input fails with `IDEMPOTENCY_CONFLICT`. Failures: `CONFLICT`: not `draft`, stale versions, suspended contract, a source or binding that no longer qualifies, or an `agreedValue` other than the components' value; re-read and decide again. `ACCESS_DENIED`: not a person, missing scope or grant, or a linked record is not readable or not active. `INVALID_INPUT`: the note lacks what proposing needs (save a complete note), or malformed fields. `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend with the same `requestKey`. - [Publish a population import row](https://docs.getarbol.com/api/ambar/publish-clinical-population-import-row/index.md) — Publishes one `reviewed` row: creates the patient (`create`) or checks the linked one, evaluates them against the pinned policy as an institutional admission, and adds them to a new cohort snapshot. Send the import's current `version` and the row review's `version` as `reviewVersion`. When every row is published or skipped the import becomes `completed`. Returns a receipt with the `patientId` and the new `snapshotId`. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when a version is stale, the row is not `reviewed`, the patient changed, the patient does not match the policy, or the cohort snapshot changed (rebaseClinicalPopulationImport) or its policy changed (stage again). COHORT_ACTIVE_REQUIRED when the cohort is not active; ACCESS_DENIED without cohort write and approve grants or patient access; COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Publish indicator values](https://docs.getarbol.com/api/ambar/publish-indicator-publication/index.md) — Records a new immutable indicator publication: indicator values a person declares for a period, with the source file names and SHA-256 hashes. `expectedVersion` must be `0`, and `expectedLatestPublicationId` must name your current latest active publication in the scope (`null` when there is none), so a stale screen cannot publish over a newer cut. Definition: `title`, `scope`, `periodFrom` and `periodTo` (`YYYY-MM-DD`), `population`, `dataFile`, `dataSha256`, `sourceFile`, `sourceSha256`, `sourceSheet`, `manualCutDeclared: true`, `portfolioId` (equal to `scopeId` for `care_contract`, absent otherwise) and 1-200 `indicators` (`calculated` with a `result`, or `pending`/`deferred` with `result: null`). At most 500 publications per scope. Returns the stored publication. Idempotency: the same `requestKey` with the same body returns the stored result; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: CONFLICT when `expectedLatestPublicationId` is not your latest publication (call getLatestIndicatorPublication) or the id exists; INVALID_INPUT for a non-zero `expectedVersion` or an invalid definition; RESOURCE_LIMIT_EXCEEDED at the limit; ACCESS_DENIED when the token lacks `ambar:patients:read` or `ambar:patients:write`, the caller is not a person, you lack clinical write access or an analytics authoring grant for the scope, or no clinical policy is in force. - [Query admitted memory projections](https://docs.getarbol.com/api/ambar/query-analytics-sql/index.md) — Runs one read-only SQLite `SELECT` or `WITH` statement over private in-memory copies of admitted sources: the care documentation summaries you may read, plus the inventory datasets in `datasetIds` and your manual tables in `tableIds`. Use the table names (`key`) from getAnalyticsSqlCatalog. It reads, never writes. Only aggregate, text, date and conditional functions are allowed (`count`, `sum`, `avg`, `min`, `max`, `total`, `coalesce`, `round`, `substr`, `strftime`, `iif`, `like` and similar); no writes, extensions, files or system tables. Limits: 2000 source rows and 2 MiB of input, at most 500 ms of execution, 200 result rows (then `truncated: true`) and 256 KiB of output. Returns columns, rows, the exact source cuts and caveats; results over truncated sources are not population totals. It changes nothing, so it is safe to retry. Failures: ANALYTICS_QUERY_REJECTED for anything but one supported read-only statement (rewrite the SQL); ANALYTICS_QUERY_LIMIT when a budget is exceeded (narrow the query or sources); NOT_FOUND when a dataset has no published product or a table is not one of your active manual tables; CONFLICT when a source changed during the query (run it again); SERVICE_BUSY when all query slots are in use (retry shortly); ACCESS_DENIED without `ambar:datasets:read` (plus `ambar:ingestions:read` for datasets) or for non-person callers; INVALID_INPUT for an empty or oversized query or more than 8 ids. - [Rebase a population import](https://docs.getarbol.com/api/ambar/rebase-clinical-population-import/index.md) — Moves a `staged` import onto the cohort's latest snapshot after other changes published a new one. The pinned policy, the file and the recorded decisions stay the same. Use it when publishClinicalPopulationImportRow fails because the snapshot changed. If the cohort policy changed, rebasing fails: cancel and stage again. Returns a receipt with `status: rebased`, the new `version` and `snapshotId`. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when `expectedVersion` is stale, the import is not staged or has expired, or the cohort policy changed; ACCESS_DENIED without cohort write and approve grants; INVALID_INPUT. COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Receive a provider's webhook](https://docs.getarbol.com/api/ambar/receive-installation-webhook/index.md) — The endpoint a provider or a client's own system pushes to, one per installation. The delivery is verified with the installation's app (for `custom-push`: `x-ambar-timestamp` in Unix seconds and `x-ambar-signature` = `v1=` and the hexadecimal HMAC-SHA256 of `{timestamp}.{body}` with the installation's `webhook_signing_key`, within five minutes of Ámbar's clock), kept unchanged and queued for the ingest worker, which reads and maps it later. Use it from the provider's side only; people and agents never call it. Send the body with its media type (`application/json`, `application/fhir+json`, `text/csv`, …), at most 1 MiB. Retrying a delivery is safe: the same body is kept once and queued once. Returns 202 with where the original is kept and whether it was queued now. No bearer token: the signature authenticates the delivery. `UNAUTHORIZED`: the installation is unknown or not active, its app takes no webhooks, or the signature is missing, stale or wrong; check the key and the clock, do not retry unchanged. `INVALID_INPUT`: no media type. `BODY_TOO_LARGE`: over 1 MiB. `DATABASE_UNAVAILABLE` or `PIPELINE_UNAVAILABLE`: retry with backoff. - [Refresh a campaign recipient](https://docs.getarbol.com/api/ambar/reconcile-campaign-recipient/index.md) — Resolve a recipient whose send result is unknown by asking the provider for a conversation started for its send intent. Use it when the recipient reads `unknown` (or `leased`/`sending` after its 90-second lease) instead of dispatching again. If the provider has the conversation the recipient becomes `accepted`; otherwise it stays `unknown` with `reasonCode` `reconciliation_unresolved`. Returns a receipt with the recipient's new `version` and resulting `state`. Idempotency: the same `requestKey` and input return the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. For a later attempt, use a new key and the recipient's current `version`. `CONFLICT`: stale `expectedRecipientVersion`, lease still active, recipient not reconcilable, provider lookup failed, or the stored source changed; wait, re-read the recipient and retry. `INVALID_INPUT`: the recipient was never dispatched. `CAPABILITY_NOT_CONFIGURED`: no messaging provider. `INVALID_CONFIGURATION`: the provider session failed. `ACCESS_DENIED`: missing scope or grant; do not retry. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input. - [Reconcile a cohort workspace](https://docs.getarbol.com/api/ambar/reconcile-cohort-workspace/index.md) — Publishes a new snapshot that keeps only the members whose qualification is still current and drops the rest. Use it when counts show members needing review, or when decideCohortPatient fails because other members are no longer current. Send the current `policyVersion` and the latest `snapshotId` as `baseSnapshotId`. Returns a receipt with the new `snapshotId`. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when the latest snapshot or the policy changed: re-read getCohortPolicy; RESOURCE_LIMIT_EXCEEDED when the snapshot has more than 10,000 members. ACCESS_DENIED without the cohort write and approve grants, registry-wide patient read or as a non-human caller; INVALID_INPUT; COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Confirm a contract file upload](https://docs.getarbol.com/api/ambar/reconcile-contract-artifact/index.md) — Checks storage for the bytes of a reserved file and marks it `ready` when they match the declared size and SHA-256. Use it when an upload failed with `PIPELINE_UNAVAILABLE` or `COMMIT_UNCERTAIN`, or its response was lost. Returns the file: `ready` when verified, or still `reserved` when no bytes are stored yet (then upload them with `uploadContractArtifact`). Safe to repeat; it never changes stored bytes. Failures: `NOT_FOUND`: no such file or its retention ended. `CONFLICT`: stored bytes do not match, or a `ready` file lost its bytes; do not cite it. `SERVICE_BUSY`: too many transfers; retry shortly. `PIPELINE_UNAVAILABLE`: storage unreachable; retry later. `ACCESS_DENIED`: missing `ambar:contracts:write` or no write grant. - [Reconcile a capitation month with the payer's paid list](https://docs.getarbol.com/api/ambar/reconcile-contract-population/index.md) — Compares, person by person, the member-days a capitation component counts in a month (its current, eligible coverages, as `listContractPopulation` lists them) with the payer's paid list for that month, whose people come by identity document. Each document is matched exactly against the documents of the people the component covers. Use it when a capitation payment differs from what the period expects: `not_paid` lines are days to claim, `not_covered` and `days_differ` lines and the `unmatched` lines of the list are days to review. Every day is worth the component's price per member over the days of its period, as its settlement divides it; each line's value is rounded alone, and the claim once over its days. Send the whole paid list of the month (up to 50,000 lines): a person it leaves out counts as not paid. Nothing is written except the audit of the read; the answer names people by patient id and the list's lines by your `reference`, never by document. Requires `ambar:contracts:read` and `ambar:settlements:read`, a read grant on the contract and clinical privacy configured for the organization. Failures: `INVALID_INPUT`: malformed identifiers, month, country or lines, a repeated `reference`, or more than 31 paid days; fix them. `NOT_FOUND`: the version or the component is not this contract's. `CONFLICT`: the version is not approved or the component is not a capitation. `ACCESS_DENIED`: missing scope, grant or clinical privacy; do not retry. `DATABASE_UNAVAILABLE`: retry later. - [Confirm a patient file upload](https://docs.getarbol.com/api/ambar/reconcile-patient-document/index.md) — Resolves an upload whose outcome is unknown (state `sending`) by checking storage, and returns the document's current state. Safe to repeat; no request key is needed. Use it after `uploadPatientDocument` failed with `COMMIT_UNCERTAIN`, `PIPELINE_UNAVAILABLE` or a timeout. A `reserved` document is returned unchanged: upload it again. When verified bytes are found the document becomes `received`; when none are found it stays `sending` (try again later). Requires the human who reserved the slot, with `ambar:patients:read` and `ambar:patients:write`. Errors: `ACCESS_DENIED` (not the reserving human, missing scope or grant); `CONFLICT` (the document changed or storage holds nothing for a non-`sending` document); `INVENTORY_INTEGRITY_CONFLICT` (stored bytes failed verification); `PIPELINE_UNAVAILABLE` or `SERVICE_BUSY` (retry later). - [Record what a person did in the client's agenda](https://docs.getarbol.com/api/ambar/record-agenda-write/index.md) — Records what a person did in the client's agenda about a write listed by `listAgendaWritesForPeople`: `booked` with the agenda's `bookingRef` (the appointment takes it, so the agenda's reports find it and nothing is counted twice; `agendaInstallationId` names the agenda when Ámbar has it installed, by default the one the write was routed to), `cancelled`, or `refused` when the agenda would not take the booking (the appointment is cancelled `agenda_refused` and the runs waiting on it are woken: the agenda never held it). Use it right after doing the write in the agenda. Recording the same outcome again answers the write with `replayed: true`. `dryRun: true` checks and keeps nothing. Returns the write after the record. Requires `ambar:appointments:read`, `ambar:appointments:write`, `ambar:patients:read` and `ambar:patients:write`, and the patient's write grant for care operations. `NOT_FOUND`: no such write waits for a person, or the caller may not read it. `CONFLICT`: the write ended otherwise (by the app, the agenda's report or another record); read the appointment with `getAppointment`. `INVALID_INPUT`: malformed body, `bookingRef` missing for `booked` or sent for another outcome, or an outcome that does not fit the write (`cancelled` for a booking, `booked` for a cancellation); fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Record an appointment outcome](https://docs.getarbol.com/api/ambar/record-appointment-outcome/index.md) — Record that a source reported a patient attended (`attended`) or missed (`no_show`) one documented appointment. It is evidence of a statement, never proof of care or a diagnosis. Use it only for an active documented appointment whose current revision is `confirmed`; to change the appointment itself use `correctDocumentedAppointment` or `retractDocumentedAppointment`. Requires a human caller. Returns a receipt with the new record `id` and `version` (`"1"`). Idempotency: the same `requestKey` with the same input returns the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `INVALID_INPUT`: a field is malformed or `occurredAt` is in the future; fix the input. `ACCESS_DENIED`: missing scope or grant, or the patient is no longer active; do not retry. `CONFLICT`: `appointmentVersion` is stale, or the appointment is retracted or not `confirmed`; read it with `getDocumentedAppointment` and retry with its current `version`. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input to learn the outcome. - [Record whether the person came to an appointment](https://docs.getarbol.com/api/ambar/record-attendance/index.md) — Keeps a statement about whether the person came to an appointment: the patient's word (`patient_report`, with the `channel` it came through and who heard it, `handledBy`), what a person knows (`person_record`), or what a person transcribes from another source. Every statement is kept once per `requestKey` with every other one about the appointment (the clinical record, the RIPS or the invoice, results, the agenda's marks, ingested reports), and the consolidator decides by the strongest kind of evidence in the order of the appointment's program (`listAttendancePolicies`): weaker evidence never overrules stronger evidence, and statements of the strongest kind that disagree leave the appointment as it was with `attendanceReview: true` until a person discards one (`discardAttendanceStatement`). When the decision changes the appointment, the runs waiting for its attendance hear it. Use it for the answer to "did you attend?" in a call or a chat, or when a person knows whether the patient came. `dryRun: true` decides as if it were kept and keeps nothing. The same `requestKey` again answers `replayed: true`. Returns the appointment after the decision, the decision and the `requestKey`. Requires `ambar:appointments:read`, `ambar:appointments:write`, `ambar:patients:read` and `ambar:patients:write`, and the patient's write grant for care operations. `CONFLICT`: the appointment expects no one (cancelled or moved); do not retry. `NOT_FOUND`: no such appointment, or the caller may not change it. `INVALID_INPUT`: malformed body, or `statedAt` in the future; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Record the pricing of a capitation component](https://docs.getarbol.com/api/ambar/record-capitation-pricing/index.md) — Records, as the annex states it, how a capitation component of a contract version counts the days of a month and its differential tariffs: what one member pays for the component's whole period when the payer's listing in force on a covered day matches every criterion a tariff states (regimes, zones of the file, attributed municipalities), the first matching tariff in order winning; days no tariff matches pay the component's own price. That is how the UPC is set: a value per regime and premiums for municipalities of dispersed zones and cities. Tariffs by age or sex are not taken yet: they would read each member's profile. The pricing prices nothing until another person confirms it with `confirmCapitationPricing`; then `proposeContractSettlement` prices the component's periods with it. Use `listContractVersions` first for `versionId` and `componentKey`. `dryRun: true` checks everything and keeps nothing. Returns the pricing with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: a tariff out of shape (repeated key, a rate outside 0 to 15 digits, no criterion, a repeated value), more than 64 tariffs, `thirty_day_months` on a period that is not whole calendar months or is longer than two years, or an empty `sourceRef`; fix it. `NOT_FOUND`: the version or the component is not this contract's, or the component is not a capitation. `CONFLICT`: the version is not approved, or the component already has another pricing (a recorded pricing never changes: propose a new version); read it again. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Record a care case transition](https://docs.getarbol.com/api/ambar/record-care-case/index.md) — Record one management action on a care case; `action` decides which other fields are allowed. Derived candidates start as `draft`; openCareCase starts human management as `in_progress`. Actions: `close` (human-initiated management only, with `note`; administrative closure, not care delivered), `approve` (by a second person), `acknowledge`, `update`, `evidence`, `cancel`, `schedule_call` and `bind_campaign`; `approve` and `bind_campaign` need the `ambar:patients:review` scope. It never records care delivered or sends anything: use `dispatchCareCase` to contact. Returns a receipt with the new `version`, `revision`, `status`, `updatedAt`, `scheduledAt` and `executionMode`. Idempotency: the same `requestKey` with the same input returns the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `NOT_FOUND`: no visible case has that `id`. `INVALID_INPUT`: fields do not match the action, or `schedule_call` on a case that is not `approved` or outside the next 30 days. `CONFLICT`: stale `expectedVersion`; case `completed`, `cancelled` or `superseded`; self-approval or a state that does not allow the action; a campaign recipient that cannot be bound. Re-read with `listCareCases`. `ACCESS_DENIED`: missing scope or grant, an assignee without access, `bind_campaign` on a case that is not `approved`, or contact blocked by rights or participation evidence; do not retry. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input to learn the outcome. - [Record a care opportunity](https://docs.getarbol.com/api/ambar/record-care-opportunity/index.md) — Create (`expectedVersion` `"0"`) or update a care opportunity: a documentary request to give a patient access to a service under a contract (`portfolioId`). An update sets `status` to `in_progress` or `resolved` with a `resolution`; `resolved` needs `resolutionEvidence` and is final. Omitted `reason`, `context`, `receipt` and `resolutionEvidence` keep their previous values. Resolving never records a clinical result. Requires a human caller with the patients write and contracts write scopes. Returns a receipt with `id`, `version`, `revision` and `status`. Idempotency: the same `requestKey` with the same input returns the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `CONFLICT`: stale `expectedVersion`, already `resolved`, an `id` that is not `opp_` plus 32 hex characters on creation, or `patientId`/`portfolioId` differ from the stored opportunity. `NOT_FOUND`: updating an opportunity you cannot see. `INVALID_INPUT`: malformed fields, or receipt or evidence earlier than `context.requestedAt`. `ACCESS_DENIED`: missing scope or grant, patient not active, or patient not covered by the contract; do not retry. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input to learn the outcome. - [Record a patient's complaint with its reason](https://docs.getarbol.com/api/ambar/record-complaint/index.md) — Records a complaint a person or an agent took from the patient (at the site's user-service office, by phone, on WhatsApp, in the suggestion box, or forwarded by the payer or the regulator): an event of the patient's record (`complaint.filed`, the same an ingested complaint is) and the complaint derived from it, with when it was filed, the channel, the reason from Ámbar's closed list and, when known, the site and the contract it is about. The person's own words are never sent: `reference` names the record of the system that keeps them. A complaint that names a contract counts for that contract's complaint rate; one that names none counts apart, as unattributed, for the contracts that covered the person that day. The same `requestKey` again answers `replayed: true`. Use it when a patient complains in a call, a chat or in person and the organization's user-service system does not send its complaints through ingest. Returns the complaint as kept, with who recorded it, and `replayed`. Requires `ambar:patients:read` and `ambar:patients:write`, and the patient's write grant for care operations. `INVALID_INPUT`: malformed body, a `channel` or `reason` outside the lists, or `filedAt` in the future; fix it. `IDEMPOTENCY_CONFLICT`: the `requestKey` already recorded another complaint; use a new key. `CONFLICT`: no such patient, site or contract; check the ids. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Record what an indicator measured in a month](https://docs.getarbol.com/api/ambar/record-contract-compliance-month/index.md) — Records one indicator's result for a month and whether its target was met, and computes the escalation that follows from the month before under the version's penalty clause that lists the indicator: the first breach starts an improvement plan the next month, the cure months follow, then the discount, and after the clause's consecutive breaches the risk of termination, which only a person resolves. An indicator no penalty clause lists is only `breached`. A month with `met: null` (open, or a target nobody confirmed) changes nothing and moves no money. Record months in order; the latest may be recorded again while open. `dryRun: true` checks everything and keeps nothing. Returns the month, the penalty clause applied, the next escalation with the first month whose breach brings it, and the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: malformed identifiers or a result out of range; fix them. `NOT_FOUND`: the version is not this contract's. `CONFLICT`: a later month is recorded, or the version neither weights the indicator nor lists it in a penalty clause; check the identifiers. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Record contract coverage](https://docs.getarbol.com/api/ambar/record-contract-coverage/index.md) — Records one patient's eligibility for a component over dates inside its period, citing accepted evidence that meets the component's `coverageEvidence` rule. Needs `ambar:patients:read` too. To correct a current row, send `supersedesId` and `expectedPriorVersion`: the old row is retracted in the same step. To withdraw without replacement use `retractContractCoverage`. Returns the saved `coverage`. Idempotent by `requestKey` (scoped to you): the same key and input return the row's current state; the same key with other input fails with `IDEMPOTENCY_CONFLICT`. A period an accepted settlement closed keeps its coverages as they were settled: neither a new row nor a correction reaches it, and a later settlement adjusts for it. Failures: `CONFLICT`: contract not active, terms not current for the dates, dates outside the component or overlapping a current row, evidence not qualified, stale `expectedPriorVersion`, or an accepted close of the component covers the dates; re-read and fix. `ACCESS_DENIED`: no grant for the contract or patient, or patient not active; do not retry. `INVALID_INPUT`: fix the fields. `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend with the same key. - [Record a payment the payer made](https://docs.getarbol.com/api/ambar/record-contract-payment/index.md) — Records a payment received for a contract: the period it pays (the end is the day after the last day, as in contract components), the amount, the day it arrived, the payer's transfer reference and the support, and, when the payer names it, the `component` whose period it pays (a month of a quarter, for example). A transfer reference counts once per contract while its payment counts. Recording the same payment again returns it; `dryRun: true` checks everything and keeps nothing. Returns the payment with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: an empty period, an amount that is not positive, or a reference out of bounds; fix it. `CONFLICT`: another payment has this id or its transfer reference, or `component` is not one of the contract's or its period does not hold the paid days; read `listContractPayments` or the version. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Record a contract's registration in SIIFA](https://docs.getarbol.com/api/ambar/record-contract-siifa/index.md) — Records that the payer registered the contract in SIIFA (Resolución 1962 de 2025) on a day and the CUCON SIIFA assigned it, which every invoice of the contract carries in its contract number. The organization then accepts or rejects the registration within the term its jurisdiction names (5 business days in Colombia) with `decideContractSiifa`. Recording the same registration again returns it; `dryRun: true` checks everything and keeps nothing. Returns the registration with its term with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: a CUCON that is not 64 lowercase hexadecimal characters; fix it. `CONFLICT`: another registration of the contract, or its CUCON on another contract; read `getContractSiifa`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Record a documented appointment](https://docs.getarbol.com/api/ambar/record-documented-appointment/index.md) — Record a new documented appointment for a patient: a preference or a confirmed appointment reported by a source (`content.details.kind`). It never books, cancels or contacts anyone; the content is stored encrypted. `expectedVersion` must be `"0"`; change it later with `correctDocumentedAppointment`. To book in the client's agenda use `bookAppointment`. Returns a receipt with `id` and `version` `"1"`. Idempotency: the same `requestKey` with the same input returns the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `CONFLICT`: the `id` already exists, or the selected care provider or care site is missing, inactive or not linked to each other. `INVALID_INPUT`: a field is malformed. `ACCESS_DENIED`: missing scope (selecting a care provider also needs `ambar:operations:read`), no grant, or patient not active; do not retry. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input to learn the outcome. - [Record an electronic invoice the billing software issued](https://docs.getarbol.com/api/ambar/record-electronic-invoice/index.md) — Records an electronic invoice the organization issued to a payer, with the health fields of Resolución 948 de 2026: the payment modality, the benefit plan, the contract's CUCON (or why it names no contract), the period it bills, its total and what was prepaid on it (copayments, moderator fees, shared payments and the payer's advance, one entry per concept). Ámbar never issues an invoice with the DIAN; it keeps what was issued so its deadlines, its RIPS and its receivable follow from it. A contract's invoice must bill the contract's payer; a capitation invoice bills one whole calendar month. Recording the same invoice again returns it; `dryRun: true` checks everything and keeps nothing. Returns the invoice with its status, gaps (`missing_cucon`, `missing_cufe`, `missing_cuv`, `cucon_mismatch`) and deadlines, and the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract; an invoice without a contract, the contract registry's write grant. `INVALID_INPUT`: a field out of shape, a payer that is not the contract's, a capitation period that is not a whole month or prepaid amounts above the total; fix it. `CONFLICT`: another invoice has this number; read it with `getElectronicInvoice`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Record a month's late-payment rate](https://docs.getarbol.com/api/ambar/record-late-interest-rate/index.md) — Records the annual late-payment rate of one month (in hundredths of a percent: `2468` is 24.68 %), as the DIAN's rate for taxes that Ley 1438 de 2011, art. 56 applies to health invoices paid late, with where it comes from so a person can verify it. The interest of each receivable is simple and daily at each month's rate. Recording the same rate again returns it; `dryRun: true` checks everything and keeps nothing. Returns the rate with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and the contract registry's write grant. `INVALID_INPUT`: a month or rate out of bounds or an empty source; fix it. `CONFLICT`: another rate is recorded for the month; read `listLateInterestRates`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Record an objection the payer raised](https://docs.getarbol.com/api/ambar/record-objection/index.md) — Records an objection (a glosa in Colombia) against an invoice line, or against a whole invoice of a prospective modality (PGP, capitation, package), which has no lines: the payer's code and record number, the RIPS consecutives of the objected service, the amount (at most what the line bills or the invoice's value after its notes) and the day it arrived. The deadline to answer is the one the payer's notice states, when you send `respondBy`; otherwise, for a line, the fee schedule in force on the service day counts its objection window from the day after arrival, and for an invoice the law's response term; business days skip weekends and the holidays of the contract's jurisdiction (its payer's country, see `getJurisdiction`). Neither may end before the law's response term (in Colombia, 15 business days after arrival, Ley 1438 de 2011 art. 57): when the term ends later, it is the deadline (`legal_floor`). A contract without a payer has no known holidays or legal term: its computed deadline (`schedule_window_without_holidays`) can only come earlier than the legal one; send `respondBy` or set the payer with `setContractPayer`. When the invoice's filing is kept, `formulateBy` is the last day the payer could object; a later objection is `extemporaneous`. In Colombia the code is checked against the Manual Único (`listObjectionCodes`): a code it does not have, of another kind or kept for other modalities is still recorded, flagged in `codeProblem`, so you can dispute it. An SA55 objection (the deviation from the technical note) to a whole PGP invoice names in `adjusts` the PGP component period whose deviation the payer evaluated, since the payer raises it on the next period's invoice: the settlement of that period counts what it takes (`proposeContractSettlement`). Recording the same objection again returns it; `dryRun: true` checks everything and keeps nothing. Returns the objection (`received`, version 1), where its deadline came from, and the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: neither or both of `invoiceLineId` and `invoiceRef`, a code or record number out of shape, a RIPS consecutive of 0, an amount that is not positive or exceeds the line or the invoice, a deadline before arrival, arrival before the invoice, an SA55 to a PGP invoice without `adjusts` where the jurisdiction uses the Manual Único, or `adjusts` on any other objection; fix it. `NOT_FOUND`: no such line or invoice. `CONFLICT`: the line is not on an invoice or is voided; the invoice is voided, bills by line (object to its lines) or names no contract; no fee schedule applies on the line's service day, or no legal term is known for the invoice (send `respondBy`); `adjusts` names no PGP component of the invoice's contract; another objection has this id; or the contract already keeps an objection with this record number (`objectionRef`). `ACCESS_DENIED`: missing scope or grant; do not retry. - [Record a patient exit](https://docs.getarbol.com/api/ambar/record-patient-exit/index.md) — Records a terminal exit (death, discharge or transfer) asserted by a human operator and sets the patient `inactive` in the same transaction. Use it instead of `updatePatient` when care ends; the exit then appears in `listPatientHistoryEvents`. A patient with a recorded exit cannot be reactivated through the API. Send the patient's current `version` as `expectedPatientVersion`; `occurredOn` cannot be after today's UTC date. Requires `ambar:patients:read`, `:write` and `:review`. Returns a receipt with the new patient version and the history event id. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body or the date); `ACCESS_DENIED` (not human, missing scope or grant); `CONFLICT` (patient changed or not `active`: re-read); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Record a patient history event](https://docs.getarbol.com/api/ambar/record-patient-history-event/index.md) — Appends one documented event (for example a note, call, medication or hospital event) to an `active` patient's history. It is a statement, not a verified fact, and never re-evaluates care. Use `recordPatientExit` for death, discharge or transfer. Appointment kinds, `discharge`, `death`, `exclusion` and the legacy `appointment` field are refused. `input.commandId` is the idempotency key: the same key with the same content returns the original receipt without a second event; the same key with different content fails with `IDEMPOTENCY_CONFLICT`. Returns a receipt with the event `id` and `version` `1`. Requires `ambar:patients:read` and `ambar:patients:write`. Errors: `INVALID_INPUT` (fix the body, for example a future `occurredAt`); `CAPABILITY_NOT_CONFIGURED` (event kind or `appointment` not accepted for new events); `ACCESS_DENIED` (missing scope or grant, or patient not active); `COMMIT_UNCERTAIN` (retry with the same key and content). - [Record patient interaction evidence](https://docs.getarbol.com/api/ambar/record-patient-interaction/index.md) — Append documented interaction evidence for a patient: report or decide on an alert, or record a message, call, rights check or participation decision (`content.kind`). Content is stored encrypted; nothing is sent to anyone. Create with `expectedVersion` `"0"`. Only open alerts accept later versions (`alert_decision` with the alert's current `version`). Rights and participation need `expectedCurrentId`; the latest negative one blocks contact under the contract. Returns the stored interaction. Idempotency: the same `requestKey` with the same input returns the original result; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `CONFLICT`: stale `expectedVersion` or `expectedCurrentId`, an `id` already in use, a closed alert, or a decision not allowed (escalation not higher, `record_management` without topic, full history). `INVALID_INPUT`: malformed content, a time in the future, or a missing `contractId`. `ACCESS_DENIED`: missing scope (alerts and calls need `ambar:patients:review`; closing an alert also needs an approve grant) or patient not covered by `contractId`; do not retry. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input to learn the outcome. - [Record the payer's notice of a substitution](https://docs.getarbol.com/api/ambar/record-payer-notice/index.md) — Records that the payer heard that another site serves an appointment booked under a contract's sites, with the notice's number. The substitution in force asks for a notice once the appointment is booked, and the appointment's `contractedSite.payerNoticeOwed` stays `true` until it is recorded. The change is logged (`payer_notified`) and the appointment's state stays. Use it once the notice was sent to the payer, with the appointment's `version` from `getAppointment`. `dryRun: true` checks and keeps nothing. The same notice again answers with `replayed: true`. Returns the appointment after the change and the `requestKey`. Requires `ambar:appointments:read`, `ambar:appointments:write`, `ambar:patients:read` and `ambar:patients:write`, and the patient's write grant for care operations. `CONFLICT`: the version is stale (read it again with `getAppointment`), or the appointment owes no notice: it was booked under no contract's sites, its site asks the payer for none, or another notice was recorded. `NOT_FOUND`: no such appointment, or the caller may not change it. `INVALID_INPUT`: malformed body or reference; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Record the payer's acknowledgment of a payer report](https://docs.getarbol.com/api/ambar/record-payer-report-acknowledgment/index.md) — Records, once, the payer's acknowledgment of a payer report it was sent: its acknowledgment or filing number, as the payer wrote it, and the day, as the person who records it. Recording the same acknowledgment again answers the run; another one is refused. Use it when the payer confirms receipt or files the report. Returns the run. Requires `ambar:contracts:read` and `ambar:contracts:write`, and a write grant on the contract. `INVALID_INPUT`: a reference out of 1 to 120 characters, or a day before the sending or after today; fix it. `NOT_FOUND`: no such run. `CONFLICT`: the run was never sent, or another acknowledgment was recorded. `ACCESS_DENIED`: a missing scope or grant; do not retry. - [Record how a payer report was sent](https://docs.getarbol.com/api/ambar/record-payer-report-sending/index.md) — Records, once, how a generated payer report went to the payer: the channel (`email`, `payer_portal`, `sftp`, `physical`, `other`), where it went and the day, as the person who records it. Recording the same sending again answers the run; another one is refused, since a run keeps what happened. Use it right after sending the files of `getPayerReportRun`; then record the payer's acknowledgment when it answers. Returns the run. Requires `ambar:contracts:read` and `ambar:contracts:write`, and a write grant on the contract. `INVALID_INPUT`: a recipient out of 1 to 240 characters, or a day before the run was generated or after today; fix it. `NOT_FOUND`: no such run. `CONFLICT`: another sending was recorded. `ACCESS_DENIED`: a missing scope or grant; do not retry. - [Record an authorization the payer issued](https://docs.getarbol.com/api/ambar/record-service-authorization/index.md) — Records the payer's prior authorization of a person's services under a contract: its number, the procedures it authorizes, the days it covers (both included, 366 at most) and, for a technology the basic plan does not fund, its MIPRES number. From then on, a service of those procedures on those days at a network site of the contract that needs an authorization is routed to the contract instead of waiting for a person, and keeps the number for the RIPS and the invoice. The person's encounters it touches go back to the router, which decides their services again on its next pass. A payer's number counts once per contract while it is not voided. Recording the same authorization again returns it; `dryRun: true` checks everything and keeps nothing. Returns the authorization as kept with the `requestKey`. Requires `ambar:patients:write` and `ambar:contracts:write`, and for care operations the patient's write grant and the contract's. `INVALID_INPUT`: a malformed id, number or MIPRES number, no procedures or more than 50 or a repeated one, or days that end before they start or cover more than 366; fix it. `CONFLICT`: another authorization has this id, or the payer's number already counts for the contract; read `listServiceAuthorizations`. `ACCESS_DENIED`: a missing scope or grant, or the person was erased; do not retry. - [Record a dated accounting cost for a contract service](https://docs.getarbol.com/api/ambar/record-service-cost/index.md) — Records an immutable cost revision keyed by contract, code system, code, currency and first day. The latest revision on a service day prices its units. Identical replay is idempotent; different facts at the same key return CONFLICT. Requires ambar:contracts:read, ambar:contracts:write and the contract write grant. dryRun validates without keeping the revision. INVALID_INPUT: negative cost, invalid code or source; ACCESS_DENIED: missing grant. Source references must contain no patient data. - [Record technical note attribution](https://docs.getarbol.com/api/ambar/record-technical-note-attribution/index.md) — Attributes one accepted performance record of a patient to a requirement and line of the approved technical note in force on the service date: an explicit, correctable statement, not revenue recognition. People only; needs the read scopes of `getTechnicalNoteExecution` plus `ambar:contracts:write` and `ambar:patients:write`. The patient must still be selected by the requirement's cohort or program, or have a current `assignment`. To correct an attribution of the same event, name it in `supersedes`. Returns a receipt. Idempotent by `requestKey` (scoped to you): the same key and input return the original receipt; the same key with other input fails with `IDEMPOTENCY_CONFLICT`. Failures: `CONFLICT`: existing `id`, event already attributed, changed sources or assignment, newer note in force, missing or future service date, or selection needs review; re-read and fix. `ACCESS_DENIED`: missing scopes or grants, patient not active, note not approved or record not usable. `INVALID_INPUT`: fix the fields. `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend with the same key. - [Record what a person paid at a service](https://docs.getarbol.com/api/ambar/record-user-payment/index.md) — Records a copayment, a moderator fee or a shared payment a person paid at one service of a contract (an encounter and a code the router left to the contract), with the electronic invoice the provider issued for it. One payment counts per service; the RIPS of the service's invoice writes it in `conceptoRecaudo`, `valorPagoModerador` and `numFEVPagoModerador` when the payments Ámbar keeps add up to what the invoice credits. When Ámbar bundles the norm's values for the contract's country and the service's year (Colombia: Acuerdo 260 de 2004 with Circular Externa 048 de 2025 for 2026), the payment is checked against them: a moderator fee is at most the year's value for the contributor's income range and is not charged in the subsidized regime; a copayment is paid by beneficiaries and the subsidized, never by a contributor, at most its share of the service's value: the invoice line takes precedence; without one, basis.serviceValueMinor and basis.serviceValueReference must document the contractual base (also in capitation). The encounter's and the person's copayments of the year stay within the caps per event and per year; an exempt person pays nothing. The service day selects the verified annual values. Recording the same payment again returns it; `dryRun: true` checks everything and keeps nothing. Returns the payment with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: a payment out of shape, the payer's advance, a day after today, or a service the router did not leave to the contract on a current encounter; fix it. `USER_PAYMENT_REFUSED`: the norm does not let the provider collect it; `details.paymentProblem` says why. `CONFLICT`: another payment has this id or already counts for the service; read `listUserPayments`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Register a study order](https://docs.getarbol.com/api/ambar/register-study-order/index.md) — Records that an `authorized` study order was registered in an external system, with its external reference (stored encrypted). Use it once the order exists outside this system; registration never means the study was performed or resulted. Send the order's `version` as `expectedVersion`. `registeredAt` cannot be in the future and the patient must be `active`. Requires `ambar:studies:read`, `ambar:studies:write`, `ambar:patients:read` and `ambar:patients:write`. Returns a receipt with the order `id` and new `version`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (missing scope or grant, or patient not active); `CONFLICT` (version changed, order not `authorized`, or `registeredAt` in the future); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Remember a fact](https://docs.getarbol.com/api/ambar/remember-assistant-fact/index.md) — Keeps one fact in Arbi's memory: a preference of yours (`scope: person`), which only you read and forget, or the organization's vocabulary or rules (`scope: organization`), which every member reads. It holds until `expiresAt` when given. Never a fact about a patient: that goes to the patient's record. Remembering the same fact again with its `factId` answers with `replayed: true`; `dryRun: true` checks everything and keeps nothing. Returns the fact with the `requestKey`. Requires a person whose token has `ambar:arbi:read` and `ambar:arbi:write`; an organization's fact also needs `ambar:settings:write` and a workspace configuration write grant. `INVALID_INPUT`: a malformed id, fact, source or key; fix it. `CONFLICT`: another fact has this `factId`; choose another id. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Record a chargeback the payer reported](https://docs.getarbol.com/api/ambar/report-chargeback/index.md) — Records a service of the contract's model that the payer reports as performed by another provider, with the amount it recovers. Send the day the order reached this provider, when it did: on or before the day performed, the chargeback is avoidable leakage. Send the payer's number of the chargeback (`chargebackRef`) when it gives one: it counts once in the contract, so the same chargeback that later arrives as a `chargeback.reported` event loads without adding a second one. Reporting the same chargeback again returns it; `dryRun: true` checks everything and keeps nothing. Returns the chargeback (`reported`, version 1) with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: an amount that is not positive, an empty provider, or a reason that is not a reason code, or a `chargebackRef` longer than 64 characters; fix it. `CONFLICT`: another chargeback has this id or the contract keeps another with this `chargebackRef`, or the person is absent or erased; choose another id or re-read. An erased patient cannot be linked again, including on replay or dry run. Patient-less reports remain available. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Report contract evidence](https://docs.getarbol.com/api/ambar/report-contract-evidence/index.md) — Reports a new evidence item under contract purpose (`contract_finance`); it starts as `reported`. Use it for facts needed by contract workflows; for care facts use `reportEvidence`. A different human must accept it with `reviewContractEvidence`. Same body, validation and receipt as `reportEvidence`; requires `ambar:contracts:read`, `ambar:contracts:write` and contract-purpose patient grants. Idempotency: the same `idempotencyKey` with the same body returns the original receipt; the same key with a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (missing scope or grant, or patient not active: do not retry); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Report evidence](https://docs.getarbol.com/api/ambar/report-evidence/index.md) — Reports a new care evidence item for a patient; it starts as `reported`, never as a confirmed fact. Use it to record what a person, document or observation asserts; a different human must then accept it with `reviewEvidence`. For contract purposes use `reportContractEvidence`. Requires `ambar:patients:read` and `ambar:patients:write`, an `active` patient you may write, and readable related patients when `subjectPatientId` or `informantPatientId` is set. Returns a receipt with the new evidence `id` and `version` `1`. Idempotency: the same `idempotencyKey` with the same body returns the original receipt; the same key with a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (missing scope or grant, or patient not active: do not retry); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Report a population fact](https://docs.getarbol.com/api/ambar/report-population-fact/index.md) — Reports one typed clinical fact (diagnosis, observation, performed procedure or medication) about a patient as new evidence in `reported` state. The fact counts in cohort and care route evaluations only after it is accepted with reviewEvidence by an independent reviewer. Use reportEvidence for narrative evidence. Returns a receipt (`id`, `version`) of the new evidence record. Idempotency: the same `idempotencyKey` with the same body returns the original receipt; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: INVALID_INPUT when the fact does not fit its concept or a field is malformed; BODY_TOO_LARGE when the stored fact would exceed 8,192 bytes. ACCESS_DENIED without patient read and write access or when the patient is not active; COMMIT_UNCERTAIN: retry with the same `idempotencyKey`. - [Report a study record](https://docs.getarbol.com/api/ambar/report-study-record/index.md) — Reports a study record (a performance or a result of an approved study definition revision) for an `active` patient. It starts as `reported`, not as a reviewed fact. Results are checked against the definition: component keys, value types, exact units and coded answers. Set `orderId`, `submissionId` or `supersedes` when relevant. A different human must accept it with `reviewStudyRecord`. Requires `ambar:studies:read`, `ambar:studies:write`, `ambar:patients:read` and `ambar:patients:write`. Returns a receipt with the record `id` and `version` `1`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body, for example a value that does not match the definition); `ACCESS_DENIED` (missing scope or grant, patient not active, or definition or linked source not visible); `CONFLICT` (definition version not active, order or submission mismatch, future event time, or correction target changed); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Report the outcome of a workflow step](https://docs.getarbol.com/api/ambar/report-workflow-step-outcome/index.md) — Closes an open step attempt with its outcome and wakes its run: the worker takes the outcome within a minute and moves the run along the step's transition. A contact closes the steps of the person's other workflows that joined it instead of contacting them again, when they can finish with its outcome. The outcome must be one the step can finish with (for a scheduling call `booked`, `booking_pending`, `no_answer`, `red_flag` or `opted_out`; `booking_pending` when the agenda did not answer within the agent's wait: nothing was promised, the person's preference was taken and the definition routes the WhatsApp confirmation); `attempt_failed` says the attempt could not be performed, and the worker retries it as the step allows. Reporting the same outcome again returns the step as closed. Use it right after performing a step from `listOpenWorkflowSteps`, with the evidence of what was done (for example the call's transcript reference). `dryRun: true` checks the report without keeping it. Returns the step as closed with the `requestKey`. Requires the `ambar:programs:read`, `ambar:patients:read` and `ambar:patients:write` scopes, a write grant on the patient and a read grant on the workflow. `INVALID_INPUT`: malformed input, or an outcome the step cannot finish with; read the step's outcomes in its version. `NOT_FOUND`: no attempt has that key, or the caller cannot see it. `CONFLICT`: the worker is advancing the run right now (retry within seconds), the run was cancelled or failed, or the step already closed with another outcome; read the run with `getWorkflowRun`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Move an appointment to another slot](https://docs.getarbol.com/api/ambar/reschedule-appointment/index.md) — Moves an appointment at its `version` to another slot of the client's agenda: a new `booked` appointment for the same patient, service and program (a clinical priority when the moved one was), booked as `bookAppointment` books, and the old one marked `rescheduled` to it, in one step. The client's agenda is asked to cancel the old booking and to book the new one. An appointment booked under a contract's sites moves under the same contract and contracted site: the new `siteId` may serve only as the contract allows on the new day, with `patientAccepted` and `payerReference` when it asks for them. Use it when the person or the site asks for another day or site the agenda offers. `dryRun: true` checks and keeps nothing. The same `requestKey` again answers the move it made with `replayed: true`. Returns the new appointment and the `requestKey`. Requires `ambar:appointments:read`, `ambar:appointments:write`, `ambar:patients:read` and `ambar:patients:write`, and the patient's write grant for care operations. `CONFLICT`: the version is stale, the appointment cannot move in its state, or the new site does not exist; read it again with `getAppointment`. `SITE_SUBSTITUTION_REFUSED`: the contract does not let the new site serve as booked; `details.reason` says why. `NOT_FOUND`: no such appointment, or the caller may not change it. `IDEMPOTENCY_CONFLICT`: the `requestKey` made another booking; use a new key. `INVALID_INPUT`: malformed body, or `patientAccepted` or `payerReference` for an appointment booked under no contract's sites; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Reserve a contract file upload](https://docs.getarbol.com/api/ambar/reserve-contract-artifact/index.md) — Reserves an upload slot for one contract file and returns it with a new `id` and `state: reserved`. Declare the exact media type, size and SHA-256 first; the file name is stored encrypted. Next, send the bytes with `uploadContractArtifact`. Once `ready`, cite the file as `artifact:` with its `sha256` in contract terms or technical notes. Idempotent by `requestKey` (scoped to you): the same key with the same input returns the same reservation; the same key with different input fails with `IDEMPOTENCY_CONFLICT`. Failures: `INVALID_INPUT`: fix the fields (files up to 64 MiB). `ACCESS_DENIED`: missing `ambar:contracts:write`, no write grant, or no active retention policy; do not retry. `CONFLICT`: the contract does not exist. `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend the identical request with the same `requestKey`. - [Reserve a patient file upload](https://docs.getarbol.com/api/ambar/reserve-patient-document/index.md) — Reserves an upload slot for one original patient file (PDF, JPEG, PNG or plain text, up to 4 MiB) and stores its declared metadata encrypted. Step 1 of 2: then send the bytes with `uploadPatientDocument` within 15 minutes; if the upload outcome is unknown, call `reconcilePatientDocument`. Requires a human caller with `ambar:patients:read` and `ambar:patients:write`, an `active` patient, and its current `version` as `expectedPatientVersion`. Returns the document in state `reserved`. Idempotency: the same `requestKey` with the same body reserves nothing new and returns the same document in its current state; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (not human, missing scope or grant, patient not active or contract not readable); `CAPABILITY_NOT_CONFIGURED` (document custody is not set up); `CONFLICT` (patient changed: re-read and retry with a new key); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Forget what Ámbar learned about a sender's documents](https://docs.getarbol.com/api/ambar/reset-extraction-template/index.md) — Forgets a sender's template for a kind of document: its next documents are read without hints until people's corrections teach it again. Use it when a sender changed its layout and the hints mislead the model. `dryRun: true` checks and keeps nothing. Returns the sender and kind with the `requestKey`. Requires `ambar:patients:read` and `ambar:patients:write`, and the registry-wide patient write grant for care operations. `INVALID_INPUT`: malformed body; fix it. `NOT_FOUND`: the sender has no template for that kind. `CONFLICT`: the version is stale; list them again. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Dismiss a late population report and keep the newer affiliation](https://docs.getarbol.com/api/ambar/resolve-affiliation-review/index.md) — Records decision dismiss and a reason code for the review named by patientId and sourceEventSeq. The newer affiliation stands and the late report stays in event history; no affiliation dates or source facts are rewritten. Use after listAffiliationReviews. Repeating the same reason returns the stored decision; a different reason after dismissal conflicts. Returns only decision metadata: patientId, sourceEventSeq, state, resolvedBy, resolvedAt and resolutionReason. Source and affiliation facts still require the read grant; resolution does not grant it. Requires a human caller, ambar:patients:write and the patient's care-operations write grant. INVALID_INPUT: nonpositive event id, unsupported decision or invalid reason code; NOT_FOUND: no visible matching review; ACCESS_DENIED: missing scope or write grant, or service caller; CONFLICT: already dismissed with a different reason. COMMIT_UNCERTAIN: retry the same patient, event and reason before another action. - [Say who a waiting source record is about](https://docs.getarbol.com/api/ambar/resolve-identity-case/index.md) — Decides an open case and takes it out of the queue: `assigned` loads the record for `patientId` (any case; a document nobody had, in an `unknown`, `possible_duplicate` or `document_not_issued` case, becomes that patient's other document, so the next record with it finds them), `confirmed` keeps a `mismatch` loaded for its candidate without asking again, `dismissed` skips the record (nobody the organization keeps), and `created` says the record is about someone new: the ingest worker creates them from what the source sent and loads the record for them (only for a record nobody had the document of, from a payer's file whose installation creates people). The ingest worker follows the decision for every version of the record that names the same document; an assignment or a creation queues the original again so it loads now. Use it after `getIdentityCase`. `dryRun: true` checks and keeps nothing. Sending the same decision again answers it with `replayed: true`. Returns the decision with the `requestKey`. Requires `ambar:patients:read` and `ambar:patients:write`, and the registry-wide patient write grant for care operations. `INVALID_INPUT`: malformed body, `patientId` missing for `assigned` or sent with another resolution, `confirmed` for a case that is not a `mismatch`, `created` for a case somebody had the document of or whose installation does not create people, a patient the organization does not keep, or a `reasonCode` that is not a code; fix it. `NOT_FOUND`: no such open case, or the caller may not see it. `CONFLICT`: the case was decided differently already, or the document is already another patient's; read the case or the patients again. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Resume a clinical contract](https://docs.getarbol.com/api/ambar/resume-contract/index.md) — Ends a suspension: a `suspended` contract with an approved version becomes `active` again. The approver must be an active person other than the one who suspended it. Needs `ambar:contracts:approve`. Use `updateContract` to suspend. Send the contract `version` as `expectedVersion`. Returns the saved `contract`. Idempotent by `requestKey` (scoped to you): the same key with the same input returns the contract's current state; the same key with different input fails with `IDEMPOTENCY_CONFLICT`. Failures: `CONFLICT`: not suspended, no approved version, stale `expectedVersion`, or an unverified evidence file; re-read with `getContract`. `ACCESS_DENIED`: missing scope or grant, or you suspended it; another person must resume it. `INVALID_INPUT`: fix the fields. `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend with the same `requestKey`. - [Resume a webhook subscription](https://docs.getarbol.com/api/ambar/resume-webhook-subscription/index.md) — Starts a `paused` subscription again: the events of its kinds loaded while it was paused are queued and sent, then the new ones as they arrive. Use it once the receiving system is back. `dryRun: true` checks and keeps nothing. Returns the subscription, now `active`, with its new `version` and the `requestKey`. Requires `ambar:settings:read` and `ambar:settings:write`, a person, and a workspace configuration write grant. `NOT_FOUND`: no such subscription. `CONFLICT`: `expectedVersion` is stale or it is already active; read it again with `listWebhookSubscriptions`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Retire a study definition](https://docs.getarbol.com/api/ambar/retire-study-definition/index.md) — Retires a study definition: no new orders, saves or approvals. Existing orders keep the revision they pinned. There is no operation to undo it. Use it when the study must no longer be ordered; send the definition's current `version` as `expectedVersion`. Requires a human caller with `ambar:studies:read` and `ambar:studies:review`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (not human, missing scope or approve grant); `CONFLICT` (version changed or already retired: re-read); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Retract contract coverage](https://docs.getarbol.com/api/ambar/retract-contract-coverage/index.md) — Withdraws a current coverage row without replacing it; the row stays listed with `status: retracted`. To replace it, use `recordContractCoverage` with `supersedesId` instead. Needs `ambar:patients:read` too. Send the row `version` (1 while current) as `expectedVersion`. Returns the retracted `coverage`. Idempotent by `requestKey` (scoped to you): the same key with the same input returns the row's current state without retracting again; the same key with different input fails with `IDEMPOTENCY_CONFLICT`. Failures: `CONFLICT`: the row is not current, belongs to another contract or patient, `expectedVersion` is stale, or an accepted close of its component covers its dates (a closed period keeps its coverages as settled); re-read with `listContractCoverage`. `ACCESS_DENIED`: no write grant for the contract or read grant for the patient; do not retry. `INVALID_INPUT`: fix the fields. `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend with the same `requestKey`. - [Retract a documented appointment](https://docs.getarbol.com/api/ambar/retract-documented-appointment/index.md) — Retract an active documented appointment that should no longer stand. Its revisions stay readable and it accepts no further change. `expectedVersion` must be its current `version`. It never cancels a booking at a provider; cancel one with `changeAppointment`. Returns a receipt with the new `version`. Idempotency: the same `requestKey` with the same input returns the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `CONFLICT`: stale `expectedVersion`, or unknown or already retracted appointment; read it with `getDocumentedAppointment`. `INVALID_INPUT`: a field is malformed. `ACCESS_DENIED`: missing scope or grant; do not retry. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input to learn the outcome. - [Retract a patient care assessment](https://docs.getarbol.com/api/ambar/retract-patient-care-assessment/index.md) — Retracts an evaluated care assessment so it no longer counts; every revision stays in the history. Use it when an assessment should not stand; to assess the period again later, call `evaluatePatientCare` with the same `id` and the new `version`. Send the item's current `version` as `expectedVersion`. Requires the same human caller and scopes as `evaluatePatientCare`. Returns a receipt with the assessment `id` and new `version`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (not human, missing scope or grant, or assessment not visible); `CONFLICT` (version changed or already retracted: re-read and retry with a new key); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Retract technical note attribution](https://docs.getarbol.com/api/ambar/retract-technical-note-attribution/index.md) — Withdraws a `recorded` attribution; it stays listed with `state: retracted`. To replace it instead, record a new attribution with `supersedes`. People only; needs the same scopes as `recordTechnicalNoteAttribution`. Send the attribution `version` (1 while recorded) as `expectedVersion`. Returns a receipt (`id`, `version` 2). Idempotent by `requestKey` (scoped to you): the same key with the same input returns the original receipt; the same key with different input fails with `IDEMPOTENCY_CONFLICT`. Failures: `CONFLICT`: not `recorded` or stale `expectedVersion`; re-read with `listTechnicalNoteAttributions`. `ACCESS_DENIED`: missing scopes or grants, patient unavailable, or the attribution is no longer visible to you; do not retry. `INVALID_INPUT`: fix the fields. `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend with the same `requestKey`. - [Queue a failed document reading again](https://docs.getarbol.com/api/ambar/retry-document-reading/index.md) — Queues a `failed` reading again with its attempts reset; the reading worker continues from the last step it kept (a document already read is not read again). Use it after fixing what `failure` named (for example the AI Gateway's routes or the organization's budget). `dryRun: true` checks and keeps nothing. Returns the reading, `queued`, with the `requestKey`. Requires `ambar:patients:read` and `ambar:patients:write`, and a write grant on the patient for care operations (the registry-wide one without a patient). `INVALID_INPUT`: malformed body; fix it. `NOT_FOUND`: no such reading, or the caller may not change it. `CONFLICT`: the reading is not `failed` or the version is stale; read it again. `ACCESS_DENIED`: missing scope; do not retry. - [Retry note extraction](https://docs.getarbol.com/api/ambar/retry-note-extraction/index.md) — Re-arms one of your extractions whose last step was interrupted (`uncertain`), with your consent that the step may be processed twice. It returns to `pending` (or `converted` when the text is already stored) and uses one more attempt; at most 3 attempts in total. It processes nothing: call runNoteExtraction afterwards. Returns the extraction at its new version. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: CONFLICT when `expectedVersion` is stale, the extraction is not `uncertain`, or the 3 attempts are used (start a new extraction); ACCESS_DENIED when the extraction is not yours or has expired, or a scope or access is missing; INVALID_INPUT for malformed fields or `duplicateProcessingAccepted` not `true`. - [Undo a merge of two patients](https://docs.getarbol.com/api/ambar/revert-patient-merge/index.md) — Reverts a merge: both records read apart again and ingest finds each by its own document. The merge is kept with its reversal, never deleted. Use it when a merge was wrong, with the `id` from `listPatientMerges`. `dryRun: true` checks and keeps nothing. Reverting a merge that is already reverted answers it with `replayed: true`. Returns the merge with `revertedAt` and the `requestKey`. Requires `ambar:patients:read` and `ambar:patients:write`, and the write grant on both patients for care operations. `INVALID_INPUT`: a malformed body; fix it. `NOT_FOUND`: no such merge, or the caller may not see it. `ACCESS_DENIED`: missing scope or grant on either patient; do not retry. - [Review a population import row](https://docs.getarbol.com/api/ambar/review-clinical-population-import-row/index.md) — Records the decision for one staged row: `skip`, `create` (a new patient from the reviewed profile) or `link_existing` (an existing patient at `expectedPatientVersion`). A decision is final; to change it, cancel and stage the file again. Rows with warnings need `acknowledgeWarnings: true` unless skipped. `create` also needs registry-wide patient write. Returns a receipt with the new import `version`; non-skipped rows are then published with publishClinicalPopulationImportRow. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when `expectedVersion` is stale, the import is not staged, the row already has a decision or the linked patient changed: re-read the import; INVALID_INPUT for a malformed body or unacknowledged warnings. ACCESS_DENIED without cohort write and approve grants or patient access; COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Review contract evidence](https://docs.getarbol.com/api/ambar/review-contract-evidence/index.md) — Records a human review of contract-purpose evidence: `accepted` confirms a `reported` item, `retracted` withdraws it. Read the item with `listContractEvidence` and send its `version` as `expectedVersion`. For care evidence use `reviewEvidence`. Requires `ambar:contracts:approve`; the reviewer must be a human other than the reporter, the content must be readable and `subjectPatientId` must equal `patientId`. Idempotency: the same `idempotencyKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `ACCESS_DENIED` (missing scope or grant, or not a human); `EVIDENCE_NOT_READABLE` (you reported it or its content is unreadable: leave it for another reviewer); `CONFLICT` (re-read and decide again with a new key); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Review evidence](https://docs.getarbol.com/api/ambar/review-evidence/index.md) — Records a human review of care evidence: `accepted` confirms a `reported` item, `retracted` withdraws an item that is not already retracted. Read the item with `listEvidence` first and send its `version` as `expectedVersion`. For contract evidence use `reviewContractEvidence`. Acceptance needs a human reviewer other than the reporter, readable content, and `subjectPatientId` equal to `patientId`. Returns a receipt with the evidence `id` and new `version`. Idempotency: the same `idempotencyKey` with the same body returns the original receipt, even if the item changed later; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `ACCESS_DENIED` (missing `ambar:patients:review`, no approve grant or not a human); `EVIDENCE_NOT_READABLE` (you reported it or its content is unreadable: leave it pending for another reviewer); `CONFLICT` (version or state changed: re-read and decide again with a new key); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Review a study record](https://docs.getarbol.com/api/ambar/review-study-record/index.md) — Records a human review of a study record: `accept` turns a `reported` record into a reviewed fact (and retracts the record it corrects, if any); `retract` withdraws it for good. Read the record first and send its `version` as `expectedVersion`. The reviewer must be a human other than the reporter; `retract` needs reason `rejected`, `entered_in_error` or `source_withdrawn`. Requires `ambar:studies:read`, `ambar:studies:review`, `ambar:patients:read` and `ambar:patients:review`. Idempotency: the same `requestKey` with the same body returns the original receipt, even if the record changed later; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (not human, you reported the record, or missing scope or grant); `EVIDENCE_NOT_READABLE` (content unreadable or no longer matching its definition: leave it pending); `CONFLICT` (version changed, record not `reported`, or correction target changed: re-read); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Revoke a data-sharing agreement](https://docs.getarbol.com/api/ambar/revoke-lake-sharing-agreement/index.md) — Revokes an approved revision of a data-sharing agreement: from now on nothing more is shared under the agreement, its exports stop and its share must be deleted the same day. One person revokes it; stopping a flow never waits for another approval. A revoked revision stays revoked; to share again, propose a new revision. Retrying with the same `requestKey` and body returns the revision as revoked. Returns the revision with its `version` (`3`). Requires `ambar:settings:read` and `ambar:settings:write`, and a configuration write grant. `INVALID_INPUT`: malformed fields or an `expectedVersion` other than `2`; fix them. `NOT_FOUND`: no such revision. `CONFLICT`: it is not approved or changed since you read it; read it again with `listLakeSharingAgreements`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Run note extraction](https://docs.getarbol.com/api/ambar/run-note-extraction/index.md) — Starts the remaining steps of one of your extractions in the background (convert the document to text, then generate the candidate) when `expectedVersion` is current and `state` is `pending` or `converted`; otherwise it changes nothing. It returns at once with the state before processing; poll getNoteExtraction until `ready` or `uncertain`. It has no request key: calling it again is safe and only acts on a current, runnable extraction. If the document is no longer readable, the result shows `unavailable`. Requires a person whose token has the contracts and Arbi read and write scopes and remains valid for at least 45 seconds. Failures: SERVICE_BUSY when processing capacity is full (retry shortly); ASSISTANT_UNAVAILABLE when no extraction model is configured; UNAUTHORIZED when the token expires too soon (get a new token, then call again); ACCESS_DENIED when the extraction is not yours or a scope or access is missing; INVALID_INPUT for malformed fields. - [Run or reconcile a team change](https://docs.getarbol.com/api/ambar/run-team-command/index.md) — Run a `prepared` team command, or reconcile one that is `sending` or `unknown` by reading the identity provider. Each provider phase is claimed once: an invite or revocation has one phase; a role change adds the new role, then removes the old ones in a second call. Your permissions and the target's current roles are checked again right before the provider change; a mismatch before any effect ends as `refused`. Returns the command after this run. A stale `expectedVersion` or a terminal command returns the current receipt without acting. `succeeded` adds a notice to `listNotifications`. Repeating the call never repeats a claimed provider change; an `unknown` result is resolved only by provider reads in a later run, never by preparing again. `NOT_FOUND`: you have no command with that `id`. `CONFLICT`: the provider binding changed since preparation, or another unresolved command targets the same change. `EVIDENCE_NOT_READABLE`: the command's stored input was disposed. `CAPABILITY_NOT_CONFIGURED`: team management is not set up. `PIPELINE_UNAVAILABLE`: the provider is unreachable; retry later. `ACCESS_DENIED`: missing `ambar:settings:write` scope; do not retry. `COMMIT_UNCERTAIN`: read the command with `getTeamCommand` and run it again with its current `version`. - [Save an analytical table](https://docs.getarbol.com/api/ambar/save-analytical-table/index.md) — Creates (`expectedVersion` `0`) or revises (current `version`) one of your analytical tables; saving an inactive table makes it active again. `definition.source.kind` `custom` makes a manual table filled with createAnalyticalTableRow; `query` makes a table whose rows saved SQL computes (only in the `care_registry` scope, over documentary sources and your manual tables in `tableIds`, never datasets). The mode cannot change later. Definition: `name` (1-120), `description`, 1-40 `columns` (`key` a lowercase SQL name other than `row_id`, `label`, `type`: `text`, `number`, `date`, `checkbox`, `single_select`, `multi_select`, `url` or `json`), `source` (`sql` up to 6000 bytes and `rowKey` for queries) and optional `settings`. Query tables run on save: every column must be in the result, the row key unique and not null. At most 100 tables per scope. Returns the stored table. Idempotency: the same `requestKey` with the same body returns the stored result; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: CONFLICT when `expectedVersion` is stale, the id already exists or the mode changes; ANALYTICS_QUERY_REJECTED or ANALYTICS_QUERY_LIMIT for an unsupported or too large query; RESOURCE_LIMIT_EXCEEDED at the limit; INVALID_INPUT when the definition breaks these rules; ACCESS_DENIED when the token lacks `ambar:patients:read` or `ambar:patients:write`, the caller is not a person, you lack clinical write access or an analytics authoring grant for the scope, or no clinical policy is in force. - [Save an analytics board](https://docs.getarbol.com/api/ambar/save-analytics-board/index.md) — Creates (`expectedVersion` `0`) or revises (current `version`) one of your boards in the `care_registry` / `patient` scope; saving an inactive board makes it active again. A board charts only the documentary sources `native:care_case_status_current` and `native:care_gap_aging_current` as a sum of `count`, optionally grouped and filtered by `category`. Definition: `name` (1-120), `description` (at most 500), `range.preset` `all`, optional `profile` (`coordinator` or `analyst`), `filters` and at most 24 `charts` (`id`, `title`, `type`, `dataset`, `metric`, `width`, `limit` 1-50, `layout`). At most 100 boards per scope. Returns the stored board. Idempotency: the same `requestKey` with the same body returns the stored result; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: CONFLICT when `expectedVersion` is stale or the id already exists (read again); RESOURCE_LIMIT_EXCEEDED at the board limit; INVALID_INPUT when the definition breaks these rules; ACCESS_DENIED when the token lacks `ambar:patients:read` or `ambar:patients:write`, the caller is not a person, you lack clinical write access or an analytics authoring grant for the scope, or no clinical policy is in force. - [Set how a program weighs attendance evidence](https://docs.getarbol.com/api/ambar/save-attendance-policy/index.md) — Keeps the attendance policy of a program, or the organization's default with `programId: null`: the kinds of evidence that decide whether a person came, the strongest first, each once, and the days (1 to 90) from an appointment's start without deciding evidence before it is `unknown`. It applies to every decision from then on; an appointment already decided keeps its state until a new statement or a discard decides it again. Use it when an organization adjusts the order for a program (for example one that trusts the patient's word over the agenda's mark) or the wait before `unknown`. `dryRun: true` checks and keeps nothing. Saving the same policy again answers `replayed: true`. Returns the policy as kept and the `requestKey`. Requires `ambar:appointments:read`, `ambar:appointments:write` and `ambar:operations:write`, and the write grant on the program for care operations (on every program for the default). `INVALID_INPUT`: malformed body, an empty order, a kind listed twice or a wait out of 1 to 90 days; fix it. `CONFLICT`: another request created the same policy at the same moment; read it again with `listAttendancePolicies`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Save a campaign draft](https://docs.getarbol.com/api/ambar/save-campaign/index.md) — Create a campaign draft (`expectedVersion` `"0"`) or replace the definition of an existing draft. Next, add recipients with `appendCampaignRecipients`; then another person approves it with `approveCampaign`. Once recipients exist the definition cannot change. Requires a human caller with the `ambar:programs:write` scope. Returns a receipt with `id`, the new `version`, `state` `draft` and `recordedAt`. Idempotency: the same `requestKey` with the same input returns the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `INVALID_INPUT`: a field is malformed; fix the input. `MODULE_DISABLED`: the organization does not use the `channel`'s module (`details.module`: `voice` or `whatsapp`); pick a channel it uses. `ACCESS_DENIED`: missing scope, no write access to the program or contract, or the integration binding cannot dispatch contacts; do not retry. `CONFLICT`: stale `expectedVersion`, campaign not a draft, definition changed after recipients were added, program or contract changed, `programVersion` not current, or a definition the server rejects (such as an unknown `timezone`); read it with `getCampaign` and fix the input. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input to learn the outcome. - [Create or reconfigure a capacity pool](https://docs.getarbol.com/api/ambar/save-capacity-pool/index.md) — Keeps a capacity pool: a number of units (appointments, or minutes of equipment time) for one service at a set of care sites over a period, optionally for one contract, the figure the capacity-versus-demand board compares with demand. No booking counts against it: the client's agenda decides when and where. Saving an existing pool changes its total and sites; its service, period, unit, source and contract never change. Use it when the organization declares its monthly capacity ("200 general medicine appointments a month", `source: manual`), when it mirrors the client agenda's real slots (`source: client_agenda`), or to move capacity between sites. `dryRun: true` checks and keeps nothing. Saving the same pool again answers it with `replayed: true`. Returns the pool as kept and the `requestKey`. Requires `ambar:appointments:read`, `ambar:appointments:write` and `ambar:operations:write`, and the registry write grant on care sites for care operations (capacity is part of the operational directory). `INVALID_INPUT`: malformed body, a total of 0, a period that ends before it starts, or 0 or more than 50 sites, or a site twice; fix it. `CONFLICT`: the service, period, unit, source or contract of an existing pool would change, or a site or contract does not exist; create another pool. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Save a clinical route draft](https://docs.getarbol.com/api/ambar/save-clinical-route/index.md) — Saves a new draft care route version (`version` `1`) for a contract with the next route number. Existing routes are never edited; a route takes effect only after proposeClinicalRoute and approveClinicalRoute. Send the contract's current revision, its current highest route `number` (`0` when none) and a ready contract artifact with the authored document. Cohorts must be active; code bindings must match active approved study definitions (see previewClinicalRouteTemplate). Returns the saved route. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when the contract revision or latest route number is stale (re-read with listClinicalRoutes), the contract is suspended, the id exists or a code binding no longer matches its source; INVALID_INPUT for an invalid definition or source reference. ACCESS_DENIED without contract read and write access, when the artifact, a cohort or a study definition is not available, or as a non-human caller; COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Save a cohort workspace](https://docs.getarbol.com/api/ambar/save-cohort-workspace/index.md) — Creates (`expectedVersion` `0`, status `draft`) or updates a cohort together with its review policy in one step. The cohort definition becomes `curated`: patients join only through decideCohortPatient or a population import. Use createCohort or updateCohort for cohorts without a policy. Returns the saved cohort with its policy, `policyVersion` (the new `version`), latest snapshot and counts. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when the id exists on create, `expectedVersion` is stale or a retired cohort would leave `retired`: re-read with getCohortPolicy; INVALID_INPUT for an invalid policy or fields. ACCESS_DENIED without the cohort write and approve grants or as a non-human caller; COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Save contract workspace policy](https://docs.getarbol.com/api/ambar/save-contract-workspace-policy/index.md) — Saves a new revision of a contract's operating policy: the post-discharge follow-up preference. Nothing is executed; terms and coverage do not change. People only. Use it to record the preference. A contract's payer is not part of the policy: set it with `setContractPayer`. Send the contract `version` and the policy `version` (`0` before the first save) from `getContract` and `getContractWorkspacePolicy`. Returns a receipt with `policyVersion`. Idempotent by `requestKey` (scoped to you): the same key with the same input returns the original receipt; the same key with different input fails with `IDEMPOTENCY_CONFLICT`. Requires the `ambar:contracts:read` and `ambar:contracts:write` scopes and read and write grants on the contract. Failures: `CONFLICT`: stale contract or policy version, or a suspended contract; re-read and decide again. `ACCESS_DENIED`: not a person, missing scopes or grants; do not retry. `INVALID_INPUT`: fix the fields, which no longer include a payer (body up to 4 KiB). `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend with the same `requestKey`. - [Save the fee schedule of a contract version](https://docs.getarbol.com/api/ambar/save-fee-schedule/index.md) — Saves, once, the fee schedule of a proposed contract version that has a `fee_for_service` component: a reference tariff manual with an adjustment ("the manual minus 10 %"); explicit prices of one unit of a code in its system that override it (a procedure's CUPS, a medication's CUM, IUM or DCI, a device's code); group rules that price whole CUPS sections, chapters or groups (the prefixes their codes start with) or a technology's code system by a manual, the schedule's or their own, and their own percentage, the most specific prefix first; the manual's own code of each procedure the contract homologates (the SOAT manual codes its services its own way); integral packages billed at one price, which cover the services they include that the same person received from `daysBefore` days before to `daysAfter` days after the service that opens them; the days they apply and how many calendar or business days the provider has to answer an objection. A code is priced by its package, else its line, else its group, else the base manual. Another person approves the schedule with the version: whoever saves it may not approve the version, and only schedules of approved versions price invoice lines; changing an approved version's prices takes a new version. Saving the same schedule again returns it; `dryRun: true` checks everything and keeps nothing. Returns the schedule, its parts by system and code, with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: a code out of its system's shape or repeated (also between a line and a package), a negative price, more than 5,000 lines, 200 groups, 10,000 homologations or 500 packages, a group prefix out of shape or in two groups, a group or a homologation without a manual to read, a package without services, covering its own code or another package's, or with its days out of range, an adjustment without a manual, a schedule that prices nothing, dates out of order or a window outside 1 to 365 days; fix it. `NOT_FOUND`: the version is not this contract's. `CONFLICT`: the version is no longer proposed, already has another schedule, or has no `fee_for_service` component in that currency; read it with `listFeeSchedules` or `getContractVersion`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Save an integration binding](https://docs.getarbol.com/api/ambar/save-integration-binding/index.md) — Creates or updates one integration bound to a deployment profile: its site, delegated capabilities and status (`active` or `disabled`). Send `expectedVersion: null` to create, or the current `version` to update. Provider, external reference and display name always come from the profile. Use listIntegrationProfiles to see what each profile permits. Saving does not grant anyone use of the integration. Returns the stored binding with its new `version`. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: CONFLICT when `expectedVersion` does not match (null for an existing id, or stale; read again); ACCESS_DENIED when the profile is unknown or does not permit the site or a capability, the token lacks `ambar:settings:read` or `ambar:settings:write`, or you hold no configuration write grant; INVALID_INPUT for malformed fields. - [Add or change one of the organization's payers](https://docs.getarbol.com/api/ambar/save-payer/index.md) — Adds a catalog payer to the organization, or sets its `localCode` and `active` state. An inactive payer stays for history but no contract can take it. Use it before `setContractPayer`. Saving the same state again changes nothing; `dryRun: true` returns the result without keeping it. Returns the payer as saved with the `requestKey`. Requires the `ambar:contracts:read` and `ambar:contracts:write` scopes and a write grant on `payer_relation`. `INVALID_INPUT`: malformed `requestKey` or `localCode`. `NOT_FOUND`: the code is not in the payer catalog; search it with `searchPayerCatalog`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Save a program workspace](https://docs.getarbol.com/api/ambar/save-program-workspace/index.md) — Creates (`expectedVersion` `0`, status `draft`) or updates a cohort program together with its operational configuration. Saving never contacts anyone. The provider (and facility, if set) must be active; you need read access to the contract (`portfolioId`) and to every listed cohort. Returns the saved program with its configuration and counts. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when the id exists on create, `expectedVersion` is stale, the status change is not allowed or the provider or facility is not active; INVALID_INPUT for an invalid configuration or unknown time zone. ACCESS_DENIED without program write and approve grants or the contract and cohort reads or as a non-human caller; COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Save a record template](https://docs.getarbol.com/api/ambar/save-record-template/index.md) — Stores a new version of a record template: `expectedVersion` `0` creates version 1, otherwise send the latest `version`. Earlier versions stay readable, and records keep the version they were created with. Requires a person with the `ambar:settings:write` scope and configuration read and write grants. The definition is validated: 1-500 uniquely identified fields, at most 50 rules, `code` fields with options, minimum not above maximum, at most 256 KiB. Returns the template `id`, new `version` and `recordedAt`. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: CONFLICT when `expectedVersion` is not the latest version (read again); RESOURCE_LIMIT_EXCEEDED when no template retention policy is configured for the organization (ask an operator); ACCESS_DENIED when the caller is not a person or the scope or grants are missing; INVALID_INPUT when the definition breaks these rules. - [Save a study definition](https://docs.getarbol.com/api/ambar/save-study-definition/index.md) — Creates a study definition or adds a new `proposed` revision with new terms; approved revisions never change. Send `expectedVersion` `0` to create, otherwise the definition's current `version`. The revision cannot be ordered until `approveStudyDefinition` approves it. The clinical owner must be an active human actor. Requires `ambar:studies:read` and `ambar:studies:write`. Returns `id`, the new record `version` and the new revision number in `definitionVersion`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (missing scope or grant); `CONFLICT` (version changed, definition retired or owner not an active human: re-read and retry with a new key); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Save study order registration policy](https://docs.getarbol.com/api/ambar/save-study-order-registration-policy/index.md) — Proposes a new revision of a contract's registration policy (a deadline in days after authorization), or a revision that disables it with `definition: null`. The revision has no effect until a different human approves it with `approveStudyOrderRegistrationPolicy`. Send the policy `version` as `expectedVersion` (`0` when none exists). Requires a human caller with `ambar:contracts:read` and `ambar:contracts:write`; the contract must be active. Returns a receipt with the contract `id` and the new policy `version`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body; `reason` must be `study_order.registration_policy_save`); `ACCESS_DENIED` (not human, missing scope or grant); `CONFLICT` (version changed or contract not active: re-read); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Save a genuinely incomplete technical-note draft](https://docs.getarbol.com/api/ambar/save-technical-note-preparation/index.md) — Creates with expectedVersion 0 or replaces a draft or active technical-note preparation at its current version, preserving its state. definition is a full replacement: null or omitted facts remain unknown; no clinical or financial defaults are supplied. Each line has a stable key; coverage booleans may be null. An active preparation must retain its name and at least one line with a service description. source must be a ready artifact of this contract; provenance cites fields by JSON pointer and documentary reference. Body at most 192 KiB. The normal contract version and technical-note sequence do not change. Requires contracts read/write scopes, contract finance write access and a person or delegated internal operator. Returns preparation with computed pendingFields. CONFLICT: stale version, finalized preparation, suspended contract or unverified source. INVALID_INPUT: malformed known values, insufficient active documentary content or oversized body. IDEMPOTENCY_CONFLICT: requestKey reused with changed input. Retry COMMIT_UNCERTAIN with the identical requestKey and body. - [Save a technical note](https://docs.getarbol.com/api/ambar/save-technical-note/index.md) — Saves a new technical note revision as `draft` with the next `number`. Notes are immutable: to change one, save a new note (optionally with `variantOfId`). People only; needs `ambar:contracts:write`. Send the contract `version` and the highest note `number` (`0` if none); saving increments the contract `version`. `source` must be a `ready` uploaded file. Idempotent by `requestKey` (scoped to you): the same key with the same input returns the saved note again; the same key with different input fails with `IDEMPOTENCY_CONFLICT`. Failures: `CONFLICT`: stale version or number, suspended contract, existing `id`, unknown `variantOfId`, unverified source or invalid `financialBinding`; re-read and fix. `INVALID_INPUT`: the definition breaks a documented rule (body up to 192 KiB). `ACCESS_DENIED`: not a person, missing scope or grant, or a linked cohort, program or study definition is not readable or not active. `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend with the same `requestKey`. - [Create or change a travel zone](https://docs.getarbol.com/api/ambar/save-travel-zone/index.md) — Keeps a travel zone: its name, the most sites one slot search asks the agenda about (`maxSitesPerSearch`, 1 to 8, the contracted site included, since asking an agenda may take seconds per site) and all its sites, each with its latitude and longitude, so searches ask the nearest first. Saving an existing zone replaces its name, bound and sites. A site is in at most one zone. Use it when the organization groups its sites by where people can travel, for example Armenia and Pereira in the Eje Cafetero, or moves a site to another zone (save the zone that lets it go first). `dryRun: true` checks and keeps nothing. Saving the same zone again answers `replayed: true`. Returns the zone as kept and the `requestKey`. Requires `ambar:appointments:read`, `ambar:appointments:write` and `ambar:operations:write`, and the registry write grant on care sites for care operations. `INVALID_INPUT`: malformed body, a blank name, a bound out of 1 to 8, no site or more than 100, a site twice, or coordinates off the Earth; fix it. `CONFLICT`: a site is in another zone, or is not a care site of the organization. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Save workspace preferences](https://docs.getarbol.com/api/ambar/save-workspace-preferences/index.md) — Changes the organization's workspace preferences and, when `input.settings` is sent, replaces its workspace settings as a whole. Read getWorkspacePreferences first and send its `version` as `expectedVersion`. Only people with the `ambar:settings:write` scope and a configuration write grant can save. Saving configuration never activates agents, calls, email or clinical rules. Returns the new `version`. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: CONFLICT when `expectedVersion` is stale (read again), or stored settings are `policy_unavailable` and `replaceUnavailableSettings` is not `true`; CAPABILITY_NOT_CONFIGURED when settings enable a governed feature (an enabled agent, `auto` or `auto_notify` autonomy, `calls`, `emailEnabled: true`, `tfgFormula: ckd_epi_2021`, an approved or reviewed lab range) or stored settings are unreadable; INVALID_INPUT for invalid values or an unknown time zone; BODY_TOO_LARGE when settings exceed 64 KiB; ACCESS_DENIED without scope or grant. - [Search a patient's memory](https://docs.getarbol.com/api/ambar/search-patient-memory/index.md) — Finds where the patient's notes, call and chat transcripts and read documents talk about what the question asks, by meaning rather than words, nearest first. Use it to answer "was it ever said?" before contacting or attending the patient; read `getPatientSummary` first for the current picture. The question goes in the body, never in a URL. Returns the closest fragments with their source (`note`, `transcript` or `document`), its custody reference, when it happened and the cosine distance; it never returns text: open the source with your own grant. Requires the `ambar:patients:read` scope and a read grant on the patient. `INVALID_INPUT`: malformed `patientId`, a blank question or one over 2,000 characters, or a `limit` outside 1 to 50; fix it. `NOT_FOUND`: no such patient. `CAPABILITY_NOT_CONFIGURED`: the organization has no semantic memory; read the record instead. `BUSY`: the AI Gateway or the memory store is unavailable; retry later. `ACCESS_DENIED`: missing scope or patient grant; do not retry. - [Search the payer catalog](https://docs.getarbol.com/api/ambar/search-payer-catalog/index.md) — Lists the payers of the global catalog for one `country`, ordered by `payerId`, 50 per page; `related` tells whether the organization already works with each one. Use it to find the code to pass to `savePayer`. The catalog is loaded by the operator from the official registry; a payer missing here cannot be added. Returns `items` and `nextCursor` (pass it as `after`; `null` on the last page). Requires the `ambar:contracts:read` scope. `INVALID_INPUT`: `country` is not two uppercase letters or `after` is not a payer code. `ACCESS_DENIED`: missing scope; do not retry. - [Search reference codes](https://docs.getarbol.com/api/ambar/search-reference-codes/index.md) — Searches the bundled terminology (Ambar clinical concepts, CUPS procedures, ICD-10 diagnoses) plus the organization's own observations from its workspace settings, by words or by code. Concepts carry the national procedure codes of your organization's jurisdiction (`jurisdiction` in getSession): CUPS for Colombia and for an organization without one; a CUPS lookup shows them in any jurisdiction. LOINC and SNOMED CT releases are not loaded: their codes resolve only through bundled concepts that declare them. Use it to resolve a code or find the concept behind a name. A hit is neither an approved clinical rule nor a tariff, and the bundled catalogs are historical references, not certified current releases. Returns `results` (concepts with their codings), `reference` (raw CUPS or ICD-10 rows), the codes `detected` in `q`, `unresolved` codes, `ambiguous`, catalog `sources` and `provenance`. Not paginated: narrow `q` instead. The organization overlay applies only when the token has a settings scope; `provenance.overlayState` tells whether it was applied. Failures: INVALID_INPUT for a bad `q`, `system` or `limit`; ACCESS_DENIED without a data, clinical or settings scope, without data admission, or with a settings scope but no configuration read grant; CONFLICT when workspace settings changed during the search (retry); RESOURCE_LIMIT_EXCEEDED when the answer exceeds 256 KiB (lower `limit`); CAPABILITY_NOT_CONFIGURED when the bundled catalog cannot be loaded. - [Set the organization's AI budget](https://docs.getarbol.com/api/ambar/set-ai-budget/index.md) — Sets what the organization may spend on AI per day and per calendar month, in US dollars, and the UTC offset its days start at. Until a budget is set nothing calls a model for the organization. The limits take effect at the next call; spend already recorded stays. Use `getAiBudget` first: omit `expectedVersion` for the first budget, send the `version` it returns afterwards. `dryRun: true` checks everything and keeps nothing. Returns the budget with the `requestKey`. Requires `ambar:settings:read` and `ambar:settings:write`, a person, and a workspace configuration write grant. `INVALID_INPUT`: an amount that is not dollars with up to six decimals, a daily limit of 0 or above the monthly one, or an offset outside `-12:00` to `+14:00`; fix it. `CONFLICT`: a budget exists and no `expectedVersion` was sent, or the version is stale; read it again. `NOT_FOUND`: `expectedVersion` was sent and no budget exists; omit it. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Set the indicator weights of a contract version](https://docs.getarbol.com/api/ambar/set-contract-indicators/index.md) — Sets, once per version, the indicators whose results release a pay-for-results retention and each one's share of it, for example timeliness 40, monthly execution 30 and complaints 30. Setting the same weights again changes nothing; `dryRun: true` checks everything and keeps nothing. Returns the weights with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: no indicators, more than 50, a repeated one, a weight that is not positive, or weights that do not add up to exactly 100; fix them. `CONFLICT`: the version already has other weights (propose a new version to change them), or the version is not this contract's. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Set the payer of a contract](https://docs.getarbol.com/api/ambar/set-contract-payer/index.md) — Sets which of the organization's active payers pays a contract, and closes the contract's open payer review. The change is audited. Use it to settle a review from `listContractPayerReviews` or to correct a payer. Setting the same payer again changes nothing; `dryRun: true` returns the result without keeping it. Returns the new and previous payer with the `requestKey`. Requires the `ambar:contracts:read` and `ambar:contracts:write` scopes, a write grant on the contract and a read grant on `payer_relation`. `INVALID_INPUT`: malformed `requestKey`. `NOT_FOUND`: no such contract. `CONFLICT`: the payer is not an active payer of the organization; add or reactivate it with `savePayer`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Set the organization's detector rules](https://docs.getarbol.com/api/ambar/set-detector-rules/index.md) — Sets the configured detector rules, retaining their version, actor and time; this operation does not record clinical approval. Clinical values have no defaults: `critical.recentDays` (1 to 3650), up to 100 critical limits (one per LOINC code and unit, finite, at least one side), up to 50 trends (2 to 10 results, a positive `minChange`, `windowDays` 1 to 3650), adherence days 1 to 365, and no-shows (2 to 10 repeats, `windowDays` 1 to 3650, up to 50 hospitalization procedure codes found 0 to 90 days before). The next detection uses them; alerts already open stay. Use `getDetectorRules` first: omit `expectedVersion` for the first rules, send the `version` it returns afterwards. `dryRun: true` checks everything and keeps nothing. Returns the rules with the `requestKey`. Repeating the identical key and input returns the original rules, version, actor and time, including after later edits. Changed input with the same key is IDEMPOTENCY_CONFLICT. Retry COMMIT_UNCERTAIN with identical input. Requires the `ambar:patients:read` and `ambar:patients:write` scopes, a person (not an agent's service account), and the registry-wide patient read and write grants for care operations. `INVALID_INPUT`: rules that break a bound above, or a malformed version; fix them. `CONFLICT`: rules exist and no `expectedVersion` was sent, or the version is stale; read them again. `NOT_FOUND`: `expectedVersion` was sent and no rules exist; omit it. `ACCESS_DENIED`: missing scope or grant, or an agent setting them; do not retry. DATABASE_UNAVAILABLE (503): migration 104 is pending or the database is unavailable; retry later. - [Switch on or off the creation of the people a payer's file lists](https://docs.getarbol.com/api/ambar/set-identity-onboarding/index.md) — Switches a payer population installation's onboarding on or off, or changes the most people one of its files creates by the rule (`maxCreations`, 1 to 1,000,000), as a new revision that keeps who and why. While it is on, the ingest worker creates, in batches, the people its files list and nobody has the document of, by the rule `listIdentityOnboarding` describes: each with its profile from the file (names, birth date, sex, phone and municipality), sealed like any patient's, and with the file, the record, the rule and the time that created them (`listOnboardedPatients`). The people beyond a file's bound, and every doubtful record, wait in the identity queue; a person may resolve one as someone new (`resolveIdentityCase` with `created`), which the bound does not limit. Switching it off stops new creations at once (a file being read finishes its batch); the people already created stay, and `mergePatients` or `erasePatient` undo one. Use it after `listIdentityOnboarding`, with its `version` as `expectedVersion`. `dryRun: true` checks and keeps nothing. Retrying with the same `requestKey` and body keeps nothing new and answers the installation's onboarding as it stands. Returns the installation's onboarding as `listIdentityOnboarding` lists it. Requires `ambar:patients:read` and `ambar:patients:write`, a person, and the registry-wide patient write grant for care operations (the grant that creates a patient by hand); the change is audited. `INVALID_INPUT`: malformed fields, a bound out of range, or an installation that is not a payer's population file; fix them. `CONFLICT`: someone changed it since you read it; read it again. `IDEMPOTENCY_CONFLICT`: the key was used for another request. `ACCESS_DENIED`: missing scope or grant, or not a person; do not retry. - [Set indicator baseline](https://docs.getarbol.com/api/ambar/set-indicator-baseline/index.md) — Creates or moves your single indicator baseline in a scope (compare and swap). First time: a new `id` with `expectedVersion` `0`; afterwards: the same `id` with its current `version` (from getIndicatorBaseline). `publicationId` must be one of your publications in the same scope. Returns the stored baseline. Idempotency: the same `requestKey` with the same body returns the stored result; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: CONFLICT when `expectedVersion` is stale or the id already exists; RESOURCE_LIMIT_EXCEEDED when you already have a baseline with another id in the scope (move that one instead); ACCESS_DENIED when the publication is not yours, belongs to another scope or expired, the token lacks `ambar:patients:read` or `ambar:patients:write`, the caller is not a person, or you lack clinical write access or an analytics authoring grant; INVALID_INPUT for malformed fields. - [Turn the organization's modules on and off](https://docs.getarbol.com/api/ambar/set-organization-modules/index.md) — Turns on exactly the modules in `modules` and turns off every other one, for everyone in the organization from their next request. Turning a module off hides and stops it; nothing it kept is deleted, and turning it on again shows it as it was. A module turned on must be contracted, with one of the modules it requires on in the same request; a module you keep goes off with the last module it requires, as `offWithRequirement` lists. Use `getOrganizationModules` first: omit `expectedVersion` while it has no `version`, send it afterwards. Send `dryRun: true` first to see what turns on and off; nothing is kept. Returns the modules after the change, what turned on and off, and the `requestKey`. Requires `ambar:settings:read` and `ambar:settings:write`, a person, and a workspace configuration write grant. `MODULE_NOT_CONTRACTED`: the module in `details.module` was not contracted; leave it off. `MODULE_REQUIREMENT_MISSING`: turn on one of the modules it requires too. `CONFLICT`: the version is stale, or missing while there is one; read again. `INVALID_INPUT`: an unknown module, a reason of 0 or over 200 characters or with line breaks, or a malformed key or version. `ACCESS_DENIED`: missing scope or grant, or not a person; do not retry. - [Name who handles a patient's conversations](https://docs.getarbol.com/api/ambar/set-patient-handler/index.md) — Names the person or team who handles a patient's conversations by default (`handler`), or gives them back to the program's agent (`handler: null`). It applies to conversations that start or reopen afterwards; one in progress keeps its owner (hand it over with `changeConversationHandling`). The first time omit `expectedVersion`; afterwards send the `version` read with `getPatientHandler`. Use it when the care team decides that a nurse or a team follows the patient instead of the agent, or the other way round. `dryRun: true` checks and keeps nothing. Returns the handler as set and the `requestKey`. Requires the `ambar:patients:read` and `ambar:patients:write` scopes, a person (not an agent's service account), and the patient's write grant for care operations. `INVALID_INPUT`: malformed body, or the agent as `handler` (send `null`); fix it. `NOT_FOUND`: `expectedVersion` sent while none is set; omit it. `CONFLICT`: a first set while one is set, or a stale version; read it again with `getPatientHandler`. `ACCESS_DENIED`: missing scope or grant, or an agent setting it; do not retry. - [Activate or deactivate a real technical note with pending fields](https://docs.getarbol.com/api/ambar/set-technical-note-preparation-active/index.md) — Explicitly sets active:true to activate one real documentary technical-note preparation, or active:false to return it to draft. Requires current expectedVersion and a stable requestKey. Both transitions increment the preparation version and keep an immutable audited receipt. Only one preparation may be active per contract; explicitly deactivate the other before activating another. Activation needs a known name and at least one documentary line with a service description; all other unknown fields and pendingFields remain intact. Operational activation is independent of contractual approval: it does not create or approve a complete revision, change contractual terms, feed approved-note execution, or authorize payment. The contract version and note sequence do not change. Requires contracts read/write scopes and contract finance write access, for a person or explicitly delegated internal operator. Source must still be a ready artifact of the same contract. Returns preparation with its pendingFields. CONFLICT: stale version, finalized preparation, another active note, suspended contract or unavailable source; INVALID_INPUT: malformed command or insufficient documentary content; ACCESS_DENIED: missing authority. After COMMIT_UNCERTAIN resend the identical body and requestKey; a replay returns that command's exact saved version. - [Switch workflows off or back on](https://docs.getarbol.com/api/ambar/set-workflow-switch/index.md) — Switches a workflow, a cohort or the whole organization off (with a reason code) or back on. While a switch covering a workflow is off, the worker pauses each of its runs instead of acting, which stops their contacts; switching back on lets people resume the paused runs. Use it to stop outreach at once, for example during a protocol review or an incident. `dryRun: true` returns the result without keeping it. Returns the switch as set with the `requestKey`. Requires the `ambar:programs:read` and `ambar:programs:write` scopes and a write grant on `workflow`. `INVALID_INPUT`: malformed input, an off switch without a reason, or a `scopeId` that does not fit the scope (the organization's own id for `organization`). `ACCESS_DENIED`: missing scope or grant; do not retry. - [Move a workflow version along the approval path](https://docs.getarbol.com/api/ambar/set-workflow-version-state/index.md) — Moves a version: `draft` to `validated`; `simulated` to `in_review`; `in_review` to `approved` or back to `draft` (changes requested); `approved`, `paused` or `superseded` to `active` (the active version becomes `superseded`, and new runs use this one); `active` to `paused`. Reaching `simulated` takes a simulation. Activating checks that this build still serves the app versions the version recorded (`appVersions`), that its integration calls still match the catalog, and that the organization uses every module it needs. Use it to submit, approve, activate, pause or roll back a version. Only a person may approve, activate, pause or send back; an agent may validate and submit. The approver cannot be the version's author. A version that lets a step do more on its own than the active version (for example `approve` to `auto`) needs two approvers: the first approval is kept in `firstApprovedBy` and the version stays `in_review` until another person approves it; sending it back drops the first approval. `dryRun: true` returns the result without keeping it. Returns the version as changed with the `requestKey`. Requires the `ambar:programs:read` and `ambar:programs:write` scopes and a write grant on `workflow`. `INVALID_INPUT`: malformed input. `NOT_FOUND`: no such version. `CONFLICT`: the move is not on the approval path, the caller wrote the version being approved or already gave its first approval, or the version calls an app this build cannot serve as recorded or needs a module the organization turned off (write a new version and check it with `validateWorkflowDefinition`, or have the module turned on); read the version with `listWorkflowVersions`. `ACCESS_DENIED`: missing scope or grant, or an agent asking for a person's step; do not retry. - [Simulate a workflow version over real data](https://docs.getarbol.com/api/ambar/simulate-workflow-version/index.md) — Queues a simulation of a `validated` or `simulated` version over the people of the workflow's cohort, without acting: the worker builds each person as a run would see them (guards from their sources, appointment, contacts, and when the version's triggers would start the run, from their care route's due dates) and the slots a week of the activity's services, then keeps the report on the version, which becomes `simulated`. Event, threshold, population and manual triggers cannot be foreseen, so only `activity_due` and `monthly` triggers bring people in. Use it before sending a version to review; a person or an agent may ask. Asking while one is open for the version returns that one. Follow it with `listWorkflowSimulations`; once `done`, read the report as the version's `simulation` with `listWorkflowVersions`. `dryRun: true` checks without queuing. Returns the simulation with the `requestKey`. Requires the `ambar:programs:read` and `ambar:programs:write` scopes and a write grant on `workflow`. `INVALID_INPUT`: malformed input (a horizon, assumptions or prices out of shape), or assumptions that do not fit the version (a step or outcome it does not have, shares that weigh nothing). `NOT_FOUND`: no such version. `CONFLICT`: the version is not `validated` or `simulated`; read it with `listWorkflowVersions`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Snapshot a cohort](https://docs.getarbol.com/api/ambar/snapshot-cohort/index.md) — Freezes a new immutable membership snapshot of an `active` cohort at `expectedVersion`. `curated` cohorts: send the members (0-500, each with 1-200 accepted evidence ids). `accepted_concepts` cohorts: send `members: []`; the server selects patients whose accepted evidence has every concept (at most 5,000). A snapshot is a candidate list: it never enrolls or contacts anyone (see enrollProgram). Returns the snapshot with its first page of members; read more pages with getCohort. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: COHORT_ACTIVE_REQUIRED when the cohort is not `active`: activate it with updateCohort first; CONFLICT for a stale `expectedVersion`, members sent for a derived cohort, evidence that is not accepted for that patient, or more than 5,000 derived members. ACCESS_DENIED without write grants or patient access; INVALID_INPUT; COMMIT_UNCERTAIN: retry with the same `requestKey`. - [Stage a population import](https://docs.getarbol.com/api/ambar/stage-clinical-population-import/index.md) — Stages a CSV file (UTF-8, up to 128 KiB and 500 data rows) for adoption into a cohort that has a review policy. Nothing is adopted yet: each row is reviewed and published later. Send the cohort's current `policyVersion` and latest snapshot as `baseSnapshotId` (see getCohortPolicy). The file is kept encrypted until `expiresAt` (at most 7 days). Returns a receipt (`status: staged`, `version` `1`); read rows and warnings with getClinicalPopulationImport. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: INVALID_INPUT when the file does not match the mapping (headers, no data rows, too many rows) or a field is malformed; CONFLICT when the policy or snapshot changed (re-read getCohortPolicy) or the id exists. ACCESS_DENIED without cohort write and approve grants, without an active clinical policy or as a non-human caller; COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Start a FHIR Bulk Data export of an agreement](https://docs.getarbol.com/api/ambar/start-lake-fhir-export/index.md) — FHIR Bulk Data `$export` at system level over the FHIR base `/v1/lake-sharing/fhir/{agreement}` ([36] section 8.5): every data product of the agreement as FHIR R4 resources, one NDJSON file per type. Send `Prefer: respond-async`; the answer is `202` with `Content-Location`, the status URL to poll. The resources carry the agreement's pseudonyms (`meta.security` `PSEUDED`), days and places as coarse as its rules, never an erased person. Agreements that suppress small cells (a minimum cell over 1) are exported through their share instead. Only the service account the revision in force names; requires `ambar:datasets:read`. Each call is audited. At most two exports of an agreement wait or run at a time. `_typeFilter` keeps only the resources of its types that match its FHIR search queries, within the bounded subset its parameter lists; anything else is refused. Errors answer with an OperationOutcome: `400` for an unsupported parameter (`_elements`, `includeAssociatedData`, `organizeOutputBy`; `patient`, which only a POST of a patient or group export takes), type or `_typeFilter` (`BULK_TYPE_FILTER_INVALID`, `BULK_TYPE_FILTER_NOT_SUPPORTED`, `BULK_TYPE_FILTER_TOO_LARGE`); `403` when not the agreement's account; `422` `BULK_NEEDS_CELLS` or `BULK_NOTHING_TO_EXPORT`; `429` while two exports run. - [Start a FHIR Bulk Data export of one data product](https://docs.getarbol.com/api/ambar/start-lake-fhir-group-export/index.md) — FHIR Bulk Data `$export` of a group ([36] section 8.5): the group is one of the agreement's data products, by its key, so the export holds only that product's tables, filters and people. Only the service account the revision in force names; requires `ambar:datasets:read`. Each call is audited. Errors answer with an OperationOutcome, as for `startLakeFhirExport`, and `404` `BULK_UNKNOWN_GROUP` for a product the agreement does not have. - [Start a FHIR Bulk Data export of an agreement's patients](https://docs.getarbol.com/api/ambar/start-lake-fhir-patient-export/index.md) — FHIR Bulk Data `$export` at patient level ([36] section 8.5): the same as `startLakeFhirExport`, every resource being about a person of the agreement's products: all of them in the patient compartment. To name the people, POST the parameters instead (`submitLakeFhirPatientExport`). Only the service account the revision in force names; requires `ambar:datasets:read`. Each call is audited. Errors answer with an OperationOutcome, as for `startLakeFhirExport`. - [Start note extraction](https://docs.getarbol.com/api/ambar/start-note-extraction/index.md) — Registers a new extraction of a technical note candidate from one registered contract document, with your explicit consent to send it to the configured external model. Nothing is processed yet: call runNoteExtraction next. Requires a person whose token has `ambar:contracts:read`, `ambar:contracts:write`, `ambar:arbi:read` and `ambar:arbi:write`, plus contract finance write access. The extraction is private to you. Returns the extraction in state `pending` (without candidate). Idempotency: the same `requestKey` with the same body returns the original extraction; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: ASSISTANT_UNAVAILABLE when no extraction model is configured for this deployment; CONFLICT when `expectedContractVersion` is stale or the contract is suspended (read the contract again), or the `id` exists; ACCESS_DENIED when the document is not a registered artifact of the contract with that SHA-256, or a scope or access is missing; INVALID_INPUT for malformed fields or `externalProcessingAccepted` not `true`. - [Start a workflow run for a patient](https://docs.getarbol.com/api/ambar/start-workflow-run/index.md) — Starts a run of the workflow's active version for one patient, at the version's first step: the manual trigger, for example a nurse starting a follow-up from the patient's record. The worker advances it within a minute, checking the workflow's guards before it acts. Use it when a person or an agent decides the patient needs the workflow now. A patient has at most one live run per workflow. The run's id is `run-` followed by the `requestKey`, so repeating the request returns the same run. `dryRun: true` returns the run without keeping it. Returns the run with the `requestKey`. Requires the `ambar:programs:read`, `ambar:patients:read` and `ambar:patients:write` scopes and a write grant on the patient. `INVALID_INPUT`: malformed `workflowId`, `caseId`, `priority` or `requestKey`. `CONFLICT`: the workflow has no active version (activate one with `setWorkflowVersionState`), the patient does not exist, or the patient already has a live run of it (find it with `listWorkflowRuns`). `IDEMPOTENCY_CONFLICT`: the `requestKey` already started a run for another workflow or patient; use a new key. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Start a FHIR Bulk Data export of some people of one data product](https://docs.getarbol.com/api/ambar/submit-lake-fhir-group-export/index.md) — FHIR Bulk Data `$export` of a group by POST ([36] section 8.5): the parameters of `startLakeFhirGroupExport` in a FHIR `Parameters` body, and `patient`, up to 1,000 people of the product by their pseudonym under the agreement's key, as `submitLakeFhirPatientExport` takes them. Only the product's tables, filters and those people are written; the people never found are listed in the manifest's `error` file. Only the service account the revision in force names; requires `ambar:datasets:read`. Each call is audited. Errors answer with an OperationOutcome, as for `submitLakeFhirPatientExport`, and `404` `BULK_UNKNOWN_GROUP` for a product the agreement does not have. - [Start a FHIR Bulk Data export of some of an agreement's patients](https://docs.getarbol.com/api/ambar/submit-lake-fhir-patient-export/index.md) — FHIR Bulk Data `$export` at patient level by POST ([36] section 8.5): the parameters of `startLakeFhirPatientExport` in a FHIR `Parameters` body, and `patient`, up to 1,000 people by their pseudonym under the agreement's key (`Patient/`, as the agreement's exports and linkage tokens name them). Only those people's resources are written; the people the organization does not have, or has erased, are listed in the manifest's `error` file (`BULK_UNKNOWN_PATIENT`), or in `deleted` when erased since `_since`. The worker first reads the organization's people to find them (pages of 10,000 ids), so the export starts a few passes later. Send `Prefer: respond-async`; the answer is `202` with `Content-Location`. Only the service account the revision in force names; requires `ambar:datasets:read`. Each call is audited. Errors answer with an OperationOutcome, as for `startLakeFhirExport`; `400` `INVALID_INPUT` for a body that is not a `Parameters` resource or a `patient` that is not `Patient/` and 64 hexadecimal characters, `BULK_TOO_MANY_PATIENTS` over 1,000. - [Count care cases](https://docs.getarbol.com/api/ambar/summarize-care-cases/index.md) — Count the care cases you can see now that match the filters: per status, open, overdue, due within seven days, unassigned, assigned to you, with a call in the next hour, and the people with open, overdue and unassigned cases. Cases are counted most overdue first for about two seconds: on a large board `complete` is `false` and every count is a lower bound, except that every case due before `throughDueAt` was counted, so `overdue` is exact when `throughDueAt` is later than now. The calls of the next hour are counted apart over that hour alone, so `nextHour` is exact whenever `nextHourComplete` is `true`. Filters are those of `listCareCases`: `patientId`, `portfolioId`, `cohortKey`, `assigned=me` and `dueBefore`. Missing cases never prove that care is complete. Requires a human caller with the patients read and contracts read scopes. `INVALID_INPUT`: a filter is malformed. `ACCESS_DENIED`: missing scope, or no access to the given `patientId`; do not retry. - [Count the patients in a population view](https://docs.getarbol.com/api/ambar/summarize-patient-population/index.md) — Counts the active patients you may read that match every given filter, the same filters and the same selection as `listPatientPopulation` (contract, site, cohort program, cohorts, and the place they live in), and how many of them have no phone, so a summary of the view never counts only the pages loaded. The count runs in the database over the list's own selection, without opening a profile: every person is counted and `complete` is `true`, unless the count runs out of time on a view of hundreds of thousands of people. The place people live in is in their sealed profile, so a view filtered by residence is counted by reading the view's patients as the list reads a page (each read is recorded), from the start, up to 5,000 matches by the other filters or 10,000 patients scanned. When `complete` is `false` the figures are a lower bound. Use it for the totals of a view; page through `listPatientPopulation` for the people themselves. Returns `people`, `withoutPhone`, `complete` and `asOf` (Unix epoch milliseconds). Errors: INVALID_INPUT for malformed filters; ACCESS_DENIED without the scopes a filter needs or a grant on a filtered resource. CONFLICT when a filter source cannot be used (an inactive cohort, program, site or contract, an outdated snapshot, or a matched membership or enrollment that is no longer current): reconcile or re-assess, then retry. RESOURCE_LIMIT_EXCEEDED when a patient has more than 25 matching enrollments or the contract's current technical note has more than 200 requirements. - [Read a bounded demographic profile of the active patient population](https://docs.getarbol.com/api/ambar/summarize-patient-profile/index.md) — Aggregates at most 1,000 currently authorized active retained patients per call. Returns administrative sex/decade, municipality and contact-presence counts only; never names, documents, contact values or patient records. Follow nextCursor until null and add the disjoint batch counts; partial batches are not a population total. Ages use the returned UTC ageAsOf. Every batch rechecks native care-purpose admission, patient read grants and retention, and records patient access. No clinical or contractual inference. Requires ambar:patients:read and configured clinical privacy. INVALID_INPUT for a malformed cursor; DATABASE_UNAVAILABLE before migration 0109 or a failed read; ACCESS_DENIED for missing authority. - [Add up what the invoices still owe](https://docs.getarbol.com/api/ambar/summarize-receivables/index.md) — Adds up the receivables of every invoice the selection names on `asOf` (default today): per currency, how many invoices still owe, their balance, the part disputed and undisputed, the late-payment interest and the balance by age since filing. It reads at most 10,000 invoices; `complete: false` says there were more, so narrow the selection by contract or by days. Use it for the receivables report by age that payers and supervisors ask for. Returns the totals and the months whose rate is missing. Requires `ambar:contracts:read`; only invoices of contracts you hold a read grant on are counted. `INVALID_INPUT`: an empty window or a cursor (the summary reads from the start); fix it. `ACCESS_DENIED`: missing scope; do not retry. - [Aggregate current routed services by month, CUPS, day, state, site and contract](https://docs.getarbol.com/api/ambar/summarize-service-routes/index.md) — Reads a 1–366 day window in one database snapshot with the same care-operations patient RLS as listServiceRoutes, excluding superseded encounters. No patient profiles or identifiers are returned. Requires ambar:patients:read and ambar:contracts:read. Without contractId this is organization activity, NOT contractual PGP execution. With contractId only services assigned to that contract count. Months without rows have zero visible services, not certified zero delivery. RESOURCE_LIMIT_EXCEEDED above 20,000 buckets: narrow the window; partial totals are never returned. Distinct people counts are per bucket and must not be summed across months or codes. - [Transition campaign state](https://docs.getarbol.com/api/ambar/transition-campaign/index.md) — Change a campaign's state with `action`: `pause` (approved to paused), `resume` (paused to approved; needs the `ambar:patients:review` scope and program approve access), `cancel` (draft, approved or paused to cancelled) or `complete` (approved or paused to completed). `cancel` turns `pending` and `leased` recipients into `cancelled` and `sending` ones into `unknown`. `complete` requires every recipient to be `accepted`, `blocked`, `cancelled` or `disposed`. Returns a receipt with the new `version` and `state`. Idempotency: the same `requestKey` with the same input returns the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `CONFLICT`: stale `expectedVersion`, an action not allowed from the current state, or recipients still outstanding for `complete`; read the campaign with `getCampaign`. `ACCESS_DENIED`: missing scope or grant (`cancel` and `complete` also need read access to every patient); do not retry. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input to learn the outcome. - [Transition program participation](https://docs.getarbol.com/api/ambar/transition-program/index.md) — Changes an existing enrollment: `suspend` (enrolled to suspended), `withdraw` (enrolled or suspended to withdrawn, always allowed) or `resume` (suspended to enrolled). `resume` needs an active program and a new current eligible assessment recorded after the last change (`assessmentId`); `suspend` and `withdraw` take no `assessmentId`. A withdrawal also ends the patient's live runs of the program's workflows at the lifecycle worker's next pass, within about a minute, with reason `program_withdrawn` (see listWorkflowRuns); runs of their other programs and cohorts go on. Suspending ends no run. Returns the enrollment after the change. Use enrollProgram to enroll again after a withdrawal. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: PROGRAM_NEW_ASSESSMENT_REQUIRED when `resume` lacks a newer assessment: call assessProgram, then retry with its id; CONFLICT for a stale `expectedVersion`, a change not allowed from the current state or an assessment that is not current. ACCESS_DENIED without the needed grants (resume also needs approve) or patient access; INVALID_INPUT; COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Unlink a study submission](https://docs.getarbol.com/api/ambar/unlink-study-submission/index.md) — Removes the patient link of a `linked` submission and returns it to `unresolved`. Use it when a link was wrong. Send the submission `version`, the linked `patientId` and that patient's current `version`. Retract derived records with `reviewStudyRecord` first. Requires `ambar:studies:read`, `ambar:studies:write`, `ambar:patients:read` and `ambar:patients:write`. Returns a receipt with the submission `id` and new `version`. Idempotency: the same `requestKey` with the same body returns the original receipt; a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (missing scope or grant); `CONFLICT` (versions changed, not linked to that patient, or derived records exist: re-read); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Update a manual table cell](https://docs.getarbol.com/api/ambar/update-analytical-table-cell/index.md) — Changes one cell of one row in your active manual (`custom`) analytical table (compare and swap on the row `version`). The other cells are kept; cells of columns no longer declared are dropped. The value must fit the column type (see createAnalyticalTableRow) or be `null`. Use listAnalyticalTableRows to get each row's `version`. Returns the row at its new version. Idempotency: the same `requestKey` with the same body returns the stored result; a different body with that key fails with IDEMPOTENCY_CONFLICT. After COMMIT_UNCERTAIN, retry with the same key. Failures: NOT_FOUND when the table is missing, not yours, inactive or a query table, or the row does not exist; CONFLICT when the row belongs to another table, is inactive or `expectedVersion` is stale (read again); INVALID_INPUT when the value does not fit the column; RESOURCE_LIMIT_EXCEEDED for a row larger than about 8 KiB; ACCESS_DENIED when the table changed meanwhile, the token lacks `ambar:patients:read` or `ambar:patients:write`, or you lack clinical write access or an analytics authoring grant. - [Update a care provider](https://docs.getarbol.com/api/ambar/update-care-provider/index.md) — Replace the `status` and `content` of a care provider; `expectedVersion` must be its current `version` (not `"0"`). Setting `inactive` blocks new selections; existing appointments keep the label captured when they were recorded. Returns a receipt with the new `version`. Idempotency: the same `requestKey` with the same input returns the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `CONFLICT`: stale `expectedVersion` or unknown `id`; read it with `getCareProvider` and retry. Also for an entry stored with the retired payer kind, which never changes: it is a payer already moved to `listPayers`; do not retry. `INVALID_INPUT`: a field is malformed or `kind` is not a care provider kind. `ACCESS_DENIED`: missing scope or grant; do not retry. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input to learn the outcome. - [Update a care site](https://docs.getarbol.com/api/ambar/update-care-site/index.md) — Replace the `status` and `content` of a care site; `expectedVersion` must be its current `version` and `providerId` its current care provider. Setting `inactive` blocks new selections; existing appointments keep the label captured when they were recorded. Returns a receipt with the new `version`. Idempotency: the same `requestKey` with the same input returns the original receipt; a different input with that key fails with `IDEMPOTENCY_CONFLICT`. `CONFLICT`: stale `expectedVersion`, unknown `id`, a different `providerId`, or `active` with an inactive care provider; read it with `getCareSite`. `INVALID_INPUT`: a field is malformed. `ACCESS_DENIED`: missing scope or grant; do not retry. `COMMIT_UNCERTAIN`: retry with the same `requestKey` and input to learn the outcome. - [Update a cohort](https://docs.getarbol.com/api/ambar/update-cohort/index.md) — Saves a new cohort revision (title, status and complete definition) only if `expectedVersion` equals the current `version`. Use it to edit, activate (`active`, needs the approve grant) or retire a cohort. Retiring is final. Use createCohort for a new cohort. Returns the new revision: `version` grows by 1; `definitionVersion` changes only when the status or definition change. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT when `expectedVersion` is stale, the cohort is missing, or a retired cohort would leave `retired`: re-read it with getCohort and decide again; ACCESS_DENIED without the write or approve grant; INVALID_INPUT. COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Update a clinical contract](https://docs.getarbol.com/api/ambar/update-contract/index.md) — Changes a contract's title or suspends it (`status: suspended`). It cannot activate: approving a version activates a draft, and `resumeContract` ends a suspension. Send the `version` from `getContract` as `expectedVersion`. Returns the saved `contract` with a new `version`. Idempotent by `requestKey` (scoped to you): the same key with the same input does not apply the change twice and returns the current state; the same key with different input fails with `IDEMPOTENCY_CONFLICT`. Failures: `CONFLICT`: stale `expectedVersion` or a status change that is not allowed; re-read and decide again. `INVALID_INPUT`: fix the fields. `ACCESS_DENIED`: missing scope or write grant; do not retry. `COMMIT_UNCERTAIN` or `DATABASE_UNAVAILABLE`: resend the identical request with the same `requestKey`. - [Update a patient](https://docs.getarbol.com/api/ambar/update-patient/index.md) — Replaces a patient's whole profile and sets its status (`active` or `inactive`). Read the patient first with `getPatient` and send its `version` as `expectedVersion`. To record a death, discharge or transfer use `recordPatientExit` instead. Returns the patient as stored, with its new `version`. Idempotency: the same `idempotencyKey` with an identical body saves nothing new and returns the patient's current state; the same key with a different body fails with `IDEMPOTENCY_CONFLICT`. Errors: `INVALID_INPUT` (fix the body); `ACCESS_DENIED` (no read and write grant for this patient: do not retry); `CONFLICT` (the patient changed, was erased, or has a recorded exit and cannot be reactivated: re-read, then retry with a new key); `COMMIT_UNCERTAIN` (retry with the same key and body). - [Update a program](https://docs.getarbol.com/api/ambar/update-program/index.md) — Saves a new cohort program revision (title, status, linked cohort) only if `expectedVersion` equals the current `version`. Status changes allowed: draft to active or retired; active to suspended or retired; suspended to active or retired. Activating needs the approve grant and an `active` linked cohort. Always send `cohortId` (`null` unlinks). Returns the new revision; `eligibilityVersion` changes when the status or linked cohort change, which can make earlier assessments stop being current. Idempotency: the same `requestKey` with the same body returns the original result; a different body with that key fails with IDEMPOTENCY_CONFLICT. Errors: CONFLICT for a stale `expectedVersion`, a missing program, a disallowed status change or an inactive linked cohort: re-read with getProgram; ACCESS_DENIED; INVALID_INPUT. COMMIT_UNCERTAIN: retry with the same `requestKey` before doing anything else. - [Update a saved analytic](https://docs.getarbol.com/api/ambar/update-saved-analytic/index.md) — Writes a new version of one of your saved analytics (title, metric, item). Send the `version` you last read as `expectedVersion`; the dataset cannot change. Earlier versions are kept unchanged. Use createSavedAnalytic for a new one. Returns the new version in `view`. Idempotency: the same `requestKey` with the same body returns the original result. Reusing the key with a different body fails with CONFLICT (not IDEMPOTENCY_CONFLICT). After COMMIT_UNCERTAIN, retry with the same key or call getSavedAnalytic. Failures: CONFLICT when `expectedVersion` is stale, the analytic does not exist for you, `datasetId` differs, or the key was used for different input (read again and retry with a new key); ACCESS_DENIED when the token lacks `ambar:datasets:read` or `ambar:datasets:write`, or the dataset is not readable or supported; INVALID_INPUT for malformed fields. - [Upload a contract file](https://docs.getarbol.com/api/ambar/upload-contract-artifact/index.md) — Uploads the exact bytes for a slot created by `reserveContractArtifact`. Send the raw bytes as the body with `Content-Type` exactly equal to the reserved `mediaType` and `Content-Length` equal to `byteCount`, without compression or chunking. The server checks size and SHA-256, stores the bytes immutably and returns the file with `state: ready`. Safe to repeat: stored bytes are never overwritten. If the response is lost or fails with `PIPELINE_UNAVAILABLE` or `COMMIT_UNCERTAIN`, call `reconcileContractArtifact`. Failures: `INVALID_INPUT`: headers do not match the reservation. `BODY_TOO_LARGE`: more bytes than reserved. `CONFLICT`: bytes differ from the declared size or hash; reserve a new slot for other bytes. `NOT_FOUND`: no such slot or its retention ended. `SERVICE_BUSY`: too many transfers; retry shortly. `ACCESS_DENIED`: missing `ambar:contracts:write` or no write grant; do not retry. - [Upload a document to be read](https://docs.getarbol.com/api/ambar/upload-document-for-reading/index.md) — Takes one document (a PDF, PNG, JPEG or WebP image, at most 8 MiB), keeps it exactly as uploaded and starts its reading: the reading worker reads it into text, classifies it (lab result, discharge summary, order, prescription, contract annex, technical note, consent or other) and extracts its values against the kind's schema, each with the lines it was read from and a confidence. Administrative values the model is sure of are accepted; clinical values and doubtful ones wait in the review inbox. A document is read once: uploading the same bytes again returns its reading with `existing: true`. Use it from the patient's record (`patientId`) or for a document of no patient (contract annexes). Send the file as the body with its `Content-Type`; name the sender (an installation id or a name such as `lab-norte`: its corrections teach a template for its documents) and the `kind` when you know it. `dryRun=true` checks everything and keeps nothing. Returns the reading, where the upload is kept and whether it already existed. Requires `ambar:patients:read` and `ambar:patients:write`, and a write grant on the patient for care operations (the registry-wide one without a patient). `INVALID_INPUT`: a malformed `sender` or `patientId`, an empty body, or a media type other than PDF, PNG, JPEG or WebP; fix it. `BODY_TOO_LARGE`: over 8 MiB. `CONFLICT`: the same document is being read for another patient, or by someone the caller may not see. `ACCESS_DENIED`: missing scope or grant, or clinical privacy not configured; do not retry. - [Upload a patient file](https://docs.getarbol.com/api/ambar/upload-patient-document/index.md) — Uploads the exact bytes of a file whose slot you reserved with `reservePatientDocument`. The request body is the raw file, not JSON. Send exactly one `Content-Type` equal to the declared `mediaType` and one `Content-Length` equal to `byteCount`, without content or transfer encoding. The bytes must match the declared SHA-256 and file signature. Only the human who reserved the slot can upload, before `reservationUntil`. A retry after an uncertain attempt never writes again; it reconciles the earlier attempt. Returns the document, normally in state `received`. Errors: `INVALID_INPUT` (headers, size or signature do not match); `BODY_TOO_LARGE`; `ACCESS_DENIED` (not the reserving human, slot expired, missing scope); `CONFLICT` (bytes do not match the declaration, or the document changed); `COMMIT_UNCERTAIN` or `PIPELINE_UNAVAILABLE` (call `reconcilePatientDocument`); `SERVICE_BUSY` (retry later). - [Check a workflow definition](https://docs.getarbol.com/api/ambar/validate-workflow-definition/index.md) — Reads a definition (YAML or JSON text) and runs the automatic validation without storing anything: unreachable steps, waits without a limit, event waits by a legal term no jurisdiction sets (`term_unknown`: name one `getJurisdiction` lists in `terms`, or write a span such as `3d`), loops without a maximum, contacts without the consent guard, clinical steps on `auto`, unknown or unmapped outcomes, and every `call_integration` step and the `integration_check` guard against the catalog of apps (`listIntegrationOperations`): the app offers the operation and lets a workflow call it, the installation can be picked as written, each required input field is filled with a value of its kind and the rules read fields the result has, and every step, guard and trigger against the modules the organization uses (`step_module_not_used`, `guard_module_not_used`, `trigger_module_not_used`: a WhatsApp step where only email is used, a booking without the agenda; `getSession` lists the modules in use). A definition may share its calls out with people: `handling: { agent_share: 20 }` is the percent of its people the agent calls, each person on one side by a draw fixed to them, and `people_capacity: 40` the most of its calls people hold at once, past which the agent makes theirs too (`overflow` on the attempt); a share over 100 or a capacity of 0 makes the text unreadable. Use it before `addWorkflowVersion`, which refuses any definition this operation does not call valid. Agents should fix every issue listed and check again. Returns `valid`, the reader's message when the text is not a definition, and each issue with its `code` and step. Requires the `ambar:programs:read` scope. `INVALID_INPUT`: an empty definition or one over 256 KiB. `ACCESS_DENIED`: missing scope; do not retry. - [Bill the routed services a fee-for-service contract has not billed](https://docs.getarbol.com/api/ambar/value-routed-services/index.md) — Adds one invoice line for each service routed to a `fee_for_service` component of the contract (by the router, or by a person's correction) provided from `from` (included) to `to` (excluded) that no line that counts bills, priced by the fee schedule in force on the service day among those of the contract's approved versions: a service that opens a package bills the package once at its price; a service a package covers (one it includes that the same person received inside its days around the service that opens it) gets a line at 0 that names the package's line, so it is billed once, with the package, on the package's invoice; any other bills its units by its explicit line in its code system, or by the reference manual of its group or of the schedule, moved by the group's or the schedule's adjustment, at the manual's price in the catalog of the contract's jurisdiction (release in force that day, under the manual's own code when the schedule homologates the procedure). Every line keeps where its price came from (`pricing`). A service it cannot price stays apart with why: `no_fee_schedule`, `not_in_schedule`, `no_manual_price`, `already_billed` when another line bills it, `period_closed` when an accepted settlement closed the period of its day, or `no_units`; bill the first ones with `addInvoiceLine`. It reads up to 200 services, by service day, encounter and procedure: when `next` comes back, send it as `after` to value the following ones. Valuing again values only what is still unbilled, each service under a line id derived from it, so no service is billed twice; `dryRun: true` prices everything and keeps nothing. Returns the lines added with how each was priced, the services left apart, the totals by currency and `next`, with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: `to` not 1 to 366 days after `from`, or a malformed `after`; fix it. `CONFLICT`: a person was erased, an encounter replaced or a period closed while valuing; value again. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Void a payment recorded by mistake](https://docs.getarbol.com/api/ambar/void-contract-payment/index.md) — Voids a payment with a reason code: it no longer counts, never changes again, and its transfer reference may be recorded again. Voiding again for the same reason returns it; `dryRun: true` checks everything and keeps nothing. Returns the payment with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: a reason that is not a reason code; fix it. `NOT_FOUND`: no such payment. `CONFLICT`: voided for another reason; read it with `listContractPayments`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Void an authorization recorded by mistake or withdrawn](https://docs.getarbol.com/api/ambar/void-service-authorization/index.md) — Voids an authorization with a reason code: it no longer admits services, never changes again, and its number may be recorded again. The services it admitted go back to the router, which decides them again on its next pass: without another authorization they wait for a person. Voiding again for the same reason returns it; `dryRun: true` checks everything and keeps nothing. Returns the authorization as kept with the `requestKey`. Requires `ambar:patients:write` and `ambar:contracts:write`, and for care operations the patient's write grant and the contract's. `INVALID_INPUT`: a malformed id or a reason that is not a reason code; fix it. `NOT_FOUND`: no such authorization, or you may not void it (the patient's or the contract's write grant is missing). `CONFLICT`: voided for another reason; read it with `listServiceAuthorizations`. `ACCESS_DENIED`: a missing scope; do not retry. - [Void a person's payment recorded by mistake](https://docs.getarbol.com/api/ambar/void-user-payment/index.md) — Voids a payment with a reason code: it no longer counts, never changes again, and another payment may be recorded for its service. Voiding again for the same reason returns it; `dryRun: true` checks everything and keeps nothing. Returns the payment with the `requestKey`. Requires `ambar:contracts:read` and `ambar:contracts:write` and a write grant on the contract. `INVALID_INPUT`: a reason that is not a reason code; fix it. `NOT_FOUND`: no such payment. `CONFLICT`: voided for another reason; read it with `listUserPayments`. `ACCESS_DENIED`: missing scope or grant; do not retry. - [Take a person off a waitlist](https://docs.getarbol.com/api/ambar/withdraw-from-waitlist/index.md) — Takes a person off a service's waitlist at the entry's `version`. Use it once the person is booked (by a person, the agent or the agenda's app), when they no longer need the service, got an appointment elsewhere, or ask to leave. `dryRun: true` checks and keeps nothing. An entry already withdrawn answers with `replayed: true`. Returns the entry and the `requestKey`. Requires `ambar:appointments:read`, `ambar:appointments:write`, `ambar:patients:read` and `ambar:patients:write`, and the patient's write grant for care operations. `CONFLICT`: the version is stale, or the entry expired; read it again with `listWaitlist`. `NOT_FOUND`: no such entry, or the caller may not change it. `INVALID_INPUT`: malformed body; fix it. `ACCESS_DENIED`: missing scope or grant; do not retry. ## Sections - [Tags](https://docs.getarbol.com/api/ambar/tags/llms.txt)