---
title: "Draft a month's payer report from its template"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.getarbol.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Draft a month's payer report from its template

Path: Ámbar API › Payer reports

`GET /v1/payer-reports/draft`

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.

## Authentication

- `bearer_auth`, http, header `Authorization`, format `JWT`

## Query parameters

- `templateId` (`draftPayerReport.query.templateId`; string, required) — The template to follow.
- `contractId` (`draftPayerReport.query.contractId`; string, required) — The contract reported: the template's own, or one of its payer's.
- `month` (`draftPayerReport.query.month`; string, required) — The month, `YYYY-MM`.
- `version` (`draftPayerReport.query.version`; integer, optional) — A version to follow instead of the one in force; an unconfirmed one is a preview for its review.
  - format `int32`; min 0

## Code samples

### cURL

```bash
curl --request GET \
  --url 'https://api-ambar.getarbol.com/v1/payer-reports/draft?templateId=informe-mensual-imagenes&contractId=pgp-imagenes-2026&month=2026-10' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://api-ambar.getarbol.com/v1/payer-reports/draft?templateId=informe-mensual-imagenes&contractId=pgp-imagenes-2026&month=2026-10';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api-ambar.getarbol.com/v1/payer-reports/draft?templateId=informe-mensual-imagenes&contractId=pgp-imagenes-2026&month=2026-10"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 200

#### Example

```json
{
  "data": {
    "confirmed": true,
    "contractId": "pgp-imagenes-2026",
    "files": [
      {
        "content": "CUPS,Estudios,Personas\r\n881201,3,2\r\n883101,1,1\r\n",
        "mediaType": "text/csv",
        "name": "informe-mensual-imagenes-2026-10-servicios.csv"
      }
    ],
    "format": "csv",
    "measuredNotes": [],
    "missing": [],
    "missingByField": {},
    "month": "2026-10",
    "notKept": {},
    "sections": [
      {
        "key": "servicios",
        "rows": 2,
        "source": "routed_services"
      }
    ],
    "templateId": "informe-mensual-imagenes",
    "version": 2
  },
  "metadata": {
    "requestId": "request_01"
  },
  "success": true
}
```

- `data` (`draftPayerReport.response.200.data`; object, required) — A month's payer report, drafted for a person to complete and send.
  - example `{"confirmed":true,"contractId":"pgp-imagenes-2026","files":[{"content":"CUPS,Estudios,Personas\r\n881201,3,2\r\n883101,1,1\r\n","mediaType":"text/csv","name":"informe-mensual-imagenes-2026-10-servicios.csv"}],"format":"csv","measuredNotes":[],"missing":[],"missingByField":{},"month":"2026-10","notKept":{},"sections":[{"key":"servicios","rows":2,"source":"routed_services"}],"templateId":"informe-mensual-imagenes","version":2}`
  - `confirmed` (`draftPayerReport.response.200.data.confirmed`; boolean, required) — Whether a second person confirmed that version: a report of another is a preview for its review, not the report the payer agreed.
  - `contractId` (`draftPayerReport.response.200.data.contractId`; string, required) — The contract reported.
  - `files` (`draftPayerReport.response.200.data.files`; array<object>, required) — The files, as the payer receives them: one CSV per section, or one JSON document.
    - `content` (`draftPayerReport.response.200.data.files.content`; string, required) — Its content, in UTF-8.
    - `mediaType` (`draftPayerReport.response.200.data.files.mediaType`; string, required) — `text/csv` or `application/json`.
    - `name` (`draftPayerReport.response.200.data.files.name`; string, required) — Its name: `<template>-<YYYY-MM>-<section>.csv` or `<template>-<YYYY-MM>.json`.
  - `format` (`draftPayerReport.response.200.data.format`; string, required) — The file it is written as.
    - one of `"csv"`, `"json"`
  - `measuredNotes` (`draftPayerReport.response.200.data.measuredNotes`; array<object>, required) — The technical notes' months the execution sections read, as last measured; empty without such sections.
    - `inForceUntil` (`draftPayerReport.response.200.data.measuredNotes.inForceUntil`; string, required) — The month's last day the note is in force.
      - format `date`
    - `measuredAt` (`draftPayerReport.response.200.data.measuredNotes.measuredAt`; string, required) — When it was measured.
      - format `date-time`
    - `measuredFrom` (`draftPayerReport.response.200.data.measuredNotes.measuredFrom`; string, required) — The first day measured.
      - format `date`
    - `measuredThrough` (`draftPayerReport.response.200.data.measuredNotes.measuredThrough`; string, required) — The last day measured: the month is complete once it reaches `inForceUntil`.
      - format `date`
    - `noteId` (`draftPayerReport.response.200.data.measuredNotes.noteId`; string, required) — The note; read it with `getTechnicalNote`.
  - `missing` (`draftPayerReport.response.200.data.missing`; array<string>, required) — Paths (`<section>[<row>].<header>`) of the values the record lacks: a service whose site is unknown, a month of a note never measured. Complete the record (a site, a measurement) or the report.
  - `missingByField` (`draftPayerReport.response.200.data.missingByField`; map<integer>, required) — The values left for a person per `<section>.<header>`, both the missing and the not kept: the work before the report can be sent.
  - `month` (`draftPayerReport.response.200.data.month`; string, required) — The month, `YYYY-MM`.
    - example `"2026-10"`
  - `notKept` (`draftPayerReport.response.200.data.notKept`; map<array<string>>, required) — The headers of the columns Ámbar keeps nothing for, by section: a person fills them in every row before sending.
  - `sections` (`draftPayerReport.response.200.data.sections`; array<object>, required) — Each section's source and rows, in the report's order.
    - `key` (`draftPayerReport.response.200.data.sections.key`; string, required) — The section's key.
    - `rows` (`draftPayerReport.response.200.data.sections.rows`; integer, required) — Its rows.
      - min 0
    - `source` (`draftPayerReport.response.200.data.sections.source`; string, required) — What it read; every value of its rows comes from it, for the contract's month.
      - one of `"line_execution"`, `"note_execution"`, `"routed_services"`, `"population_changes"`, `"capacity"`, `"complaints"`, `"contact_attempts"`, `"outside_municipality"`
  - `templateId` (`draftPayerReport.response.200.data.templateId`; string, required) — The template followed.
  - `version` (`draftPayerReport.response.200.data.version`; integer, required) — Its version followed: the one in force, or the one asked for.
    - format `int32`; min 0
- `metadata` (`draftPayerReport.response.200.metadata`; object, required) — Request metadata, including the request identifier.
  - `requestId` (`draftPayerReport.response.200.metadata.requestId`; string, required) — Server-assigned request identifier (opaque). Quote it when reporting a problem.
- `success` (`draftPayerReport.response.200.success`; boolean, required) — Always `true` in a success envelope.
  - one of `true`

### 400

Failure. The `error.code` is one of:
- `INVALID_INPUT`: Do not retry unchanged. Fix the request against the operation's schema.
- `USER_PAYMENT_REFUSED`: Check the collection basis and caps in details.paymentProblem before recording the payment.
- `INVALID_INVENTORY`: Do not retry unchanged. Fix the request against the operation's schema.
- `ANALYTICS_QUERY_REJECTED`: Rewrite the query as one read-only statement over the published catalog.
- `MINOR_UNIT_SCALE_MISMATCH`: Write each component's money in the minor units of its currency (minorUnitScale 2 for COP, PEN, MXN and BRL; 0 for CLP) and propose again.

#### Example

```json
{
  "error": {
    "code": "INVALID_INPUT",
    "message": "The request does not match the documented contract."
  },
  "metadata": {
    "requestId": "3f2b8c1e-5d4a-4b6f-9c2e-0a1b2c3d4e5f"
  },
  "success": false
}
```

- `error` (`draftPayerReport.response.400.error`; object, required) — The stable failure code, its message and optional details.
  - `code` (`draftPayerReport.response.400.error.code`; string, required) — Stable failure code. Branch on this value, never on `message`. - `UNAUTHORIZED` (HTTP 401): A valid access token is required. Obtain a fresh access token and repeat the request. - `AUTHENTICATION_UNAVAILABLE` (HTTP 503): Identity verification is temporarily unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `ACCESS_DENIED` (HTTP 403): Access denied. Do not retry. The signed-in actor lacks this purpose or grant; ask an administrator. - `MODULE_DISABLED` (HTTP 403): This operation belongs to a module the organization does not use. Do not retry. The organization does not use the module in details.module (getSession lists the ones it uses); an administrator turns it on with setOrganizationModules. - `INVALID_INPUT` (HTTP 400): The request does not match the documented contract. Do not retry unchanged. Fix the request against the operation's schema. - `USER_PAYMENT_REFUSED` (HTTP 400): The collection exceeds the applicable payment rules. Check the collection basis and caps in details.paymentProblem before recording the payment. - `INVALID_INVENTORY` (HTTP 400): The content does not match the selected inventory contract. Do not retry unchanged. Fix the request against the operation's schema. - `ANALYTICS_QUERY_REJECTED` (HTTP 400): Use one read-only query over the admitted catalog and its supported functions. Rewrite the query as one read-only statement over the published catalog. - `BODY_TOO_LARGE` (HTTP 413): The request body exceeds the supported limit. Send a smaller body, or split the content into several requests. - `NOT_FOUND` (HTTP 404): The resource does not exist. Check the identifier. The record may not exist or may not be visible to this actor. - `METHOD_NOT_ALLOWED` (HTTP 405): The method is not supported for this resource. Use the HTTP method documented for this path. - `CONFLICT` (HTTP 409): The resource conflicts with its current state. Read the current state with the matching get operation, then decide again. - `IDEMPOTENCY_CONFLICT` (HTTP 409): The command key already identifies a different request. The requestKey was already used for a different request. Use a new key for a new action. - `TRANSACTION_ABORTED` (HTTP 409): The transaction rolled back without committing changes. Nothing was written. Retry the same request. - `INVENTORY_INTEGRITY_CONFLICT` (HTTP 409): The current build failed integrity verification. Do not retry. Report the integrity failure to an operator. - `TEAM_PRIOR_UNRESOLVED` (HTTP 409): Reconcile the existing team command before preparing another change. Reconcile the earlier team command (see details.commandId) before a new change. - `COHORT_ACTIVE_REQUIRED` (HTTP 409): Only an active cohort can create a new candidate snapshot. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_CHANGED` (HTTP 409): The current cohort cut changed. Restart this read from the first page. Restart the paginated read from the first page. - `COHORT_READ_REQUIRES_ACTIVE` (HTTP 409): Only an active cohort has a current care-facts view. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_NEEDS_RECONCILIATION` (HTTP 409): The cohort cut needs reconciliation before its care facts can be read. Read the current state with the matching get operation, then decide again. - `PROGRAM_NEW_ASSESSMENT_REQUIRED` (HTTP 409): Select a new eligible assessment recorded after the last participation change. Read the current state with the matching get operation, then decide again. - `CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED` (HTTP 409): The proposed terms change component identities already fixed by an accepted close. Read the current state with the matching get operation, then decide again. - `MINOR_UNIT_SCALE_MISMATCH` (HTTP 400): A component's money is not in the minor units of its currency (ISO 4217). Write each component's money in the minor units of its currency (minorUnitScale 2 for COP, PEN, MXN and BRL; 0 for CLP) and propose again. - `INVOICE_COMPONENT_AMBIGUOUS` (HTTP 409): Invoice lines have no unique fee-for-service component. Route the lines in details.lineIds to their paying component, then request the proposal again. At most 100 identifiers are returned. - `SITE_SUBSTITUTION_REFUSED` (HTTP 409): The contract does not let this site serve for the contracted site as booked. Book at the contracted site, or at a site its contract lets serve for it on the appointment's day (listContractSites), recording what details.reason says is missing: the patient's acceptance or the payer's authorization. - `RESOURCE_LIMIT_EXCEEDED` (HTTP 422): This resource has reached its supported capacity. Do not retry. Reduce the request or archive records first. - `MODULE_NOT_CONTRACTED` (HTTP 422): The organization did not contract this module. Leave the module in details.module off: the organization did not contract it. Árbol adds it to the contract when the organization buys it. - `MODULE_REQUIREMENT_MISSING` (HTTP 422): This module needs one of the modules it requires to be on. Turn on, in the same request, one of the modules the module in details.module requires (getOrganizationModules lists them). - `CAPABILITY_NOT_CONFIGURED` (HTTP 422): This operation requires its governed native implementation before it can be activated. Do not retry. The capability is not enabled for this organization. - `INSTALLATION_NOT_READY` (HTTP 422): The installation cannot be activated: its app version is not certified or a credential its app declares is missing. Do not retry unchanged. Wait for a certified app version, record examples that cover every operation and change of a custom-http installation, or add the missing credentials to the deployment, then activate again. - `EVIDENCE_NOT_READABLE` (HTTP 422): Accepting evidence requires readable content and independent reporter provenance. Leave it pending until its source is readable. Leave the evidence pending until its source content is readable. - `ANALYTICS_QUERY_LIMIT` (HTTP 422): The query exceeded its bounded work, memory or output budget. Narrow the query. Narrow the query (filters, columns or range) and retry. - `COMMIT_UNCERTAIN` (HTTP 503): The commit outcome is unknown. Reconcile before retrying. The write may have happened. Repeat it with the same requestKey or read the record first. - `DATABASE_UNAVAILABLE` (HTTP 503): The database is unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `PIPELINE_UNAVAILABLE` (HTTP 503): The pipeline is unavailable. Reconcile using the same request key. The write may have happened. Repeat it with the same requestKey or read the record first. - `ASSISTANT_UNAVAILABLE` (HTTP 503): The assistant is not available for this workspace. Do not retry. The capability is not enabled for this organization. - `SERVICE_BUSY` (HTTP 503): The service is handling its current request limit. Retry later with backoff; for a write, reuse the same requestKey. - `INVALID_CONFIGURATION` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support. - `INTERNAL` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support.
    - one of `"UNAUTHORIZED"`, `"AUTHENTICATION_UNAVAILABLE"`, `"ACCESS_DENIED"`, `"MODULE_DISABLED"`, `"INVALID_INPUT"`, `"USER_PAYMENT_REFUSED"`, `"INVALID_INVENTORY"`, `"ANALYTICS_QUERY_REJECTED"`, `"BODY_TOO_LARGE"`, `"NOT_FOUND"`, `"METHOD_NOT_ALLOWED"`, `"CONFLICT"`, `"IDEMPOTENCY_CONFLICT"`, `"TRANSACTION_ABORTED"`, `"INVENTORY_INTEGRITY_CONFLICT"`, `"TEAM_PRIOR_UNRESOLVED"`, `"COHORT_ACTIVE_REQUIRED"`, `"COHORT_CUT_CHANGED"`, `"COHORT_READ_REQUIRES_ACTIVE"`, `"COHORT_CUT_NEEDS_RECONCILIATION"`, `"PROGRAM_NEW_ASSESSMENT_REQUIRED"`, `"CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED"`, `"MINOR_UNIT_SCALE_MISMATCH"`, `"INVOICE_COMPONENT_AMBIGUOUS"`, `"SITE_SUBSTITUTION_REFUSED"`, `"RESOURCE_LIMIT_EXCEEDED"`, `"MODULE_NOT_CONTRACTED"`, `"MODULE_REQUIREMENT_MISSING"`, `"CAPABILITY_NOT_CONFIGURED"`, `"INSTALLATION_NOT_READY"`, `"EVIDENCE_NOT_READABLE"`, `"ANALYTICS_QUERY_LIMIT"`, `"COMMIT_UNCERTAIN"`, `"DATABASE_UNAVAILABLE"`, `"PIPELINE_UNAVAILABLE"`, `"ASSISTANT_UNAVAILABLE"`, `"SERVICE_BUSY"`, `"INVALID_CONFIGURATION"`, `"INTERNAL"`; example `"INVALID_INPUT"`
  - `message` (`draftPayerReport.response.400.error.message`; string, required) — Fixed English explanation for people; it may change without notice.
  - `details` (`draftPayerReport.response.400.error.details`; object, optional) — Extra data for the codes that need it; absent for every other code.
    - `commandId` (`draftPayerReport.response.400.error.details.commandId`; string, optional) — Identifier (`tcm_` prefix) of the earlier team command to reconcile before retrying.
    - `lineIds` (`draftPayerReport.response.400.error.details.lineIds`; array<string>, optional) — Unassigned invoice lines that prevent a unique component proposal; at most 100.
    - `module` (`draftPayerReport.response.400.error.details.module`; string, optional) — The module the failure is about, for example `agenda`.
      - one of `"pgp"`, `"capitation"`, `"fee_for_service"`, `"results_payment"`, `"service_record"`, `"cac"`, `"cohorts"`, `"studies"`, `"agenda"`, `"voice"`, `"whatsapp"`, `"sms"`, `"email"`, `"arbi"`, `"ai_documents"`, `"ai_care"`, `"analytics"`
    - `paymentProblem` (`draftPayerReport.response.400.error.details.paymentProblem`; string, optional) — Why the collection was refused.
      - one of `"rules_unavailable"`, `"not_collectable"`, `"not_for_this_person"`, `"basis_incomplete"`, `"moderator_fee_value"`, `"service_value_unavailable"`, `"above_share"`, `"above_event_cap"`, `"above_year_cap"`
    - `reason` (`draftPayerReport.response.400.error.details.reason`; string, optional) — Why the booking's site was refused: `not_contracted` (the contracted site is not one of the contract that day), `not_a_substitute` (no substitution in force that day lets the site serve for it), `patient_acceptance_missing` or `payer_authorization_missing` (the substitution asks for them).
      - one of `"not_contracted"`, `"not_a_substitute"`, `"patient_acceptance_missing"`, `"payer_authorization_missing"`
- `metadata` (`draftPayerReport.response.400.metadata`; object, required) — Request metadata, including the request identifier.
  - `requestId` (`draftPayerReport.response.400.metadata.requestId`; string, required) — Server-assigned request identifier (opaque). Quote it when reporting a problem.
- `success` (`draftPayerReport.response.400.success`; boolean, required) — Always `false` in a failure envelope.
  - one of `false`

### 401

Failure. The `error.code` is one of:
- `UNAUTHORIZED`: Obtain a fresh access token and repeat the request.

#### Example

```json
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "A valid access token is required."
  },
  "metadata": {
    "requestId": "3f2b8c1e-5d4a-4b6f-9c2e-0a1b2c3d4e5f"
  },
  "success": false
}
```

- `error` (`draftPayerReport.response.401.error`; object, required) — The stable failure code, its message and optional details.
  - `code` (`draftPayerReport.response.401.error.code`; string, required) — Stable failure code. Branch on this value, never on `message`. - `UNAUTHORIZED` (HTTP 401): A valid access token is required. Obtain a fresh access token and repeat the request. - `AUTHENTICATION_UNAVAILABLE` (HTTP 503): Identity verification is temporarily unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `ACCESS_DENIED` (HTTP 403): Access denied. Do not retry. The signed-in actor lacks this purpose or grant; ask an administrator. - `MODULE_DISABLED` (HTTP 403): This operation belongs to a module the organization does not use. Do not retry. The organization does not use the module in details.module (getSession lists the ones it uses); an administrator turns it on with setOrganizationModules. - `INVALID_INPUT` (HTTP 400): The request does not match the documented contract. Do not retry unchanged. Fix the request against the operation's schema. - `USER_PAYMENT_REFUSED` (HTTP 400): The collection exceeds the applicable payment rules. Check the collection basis and caps in details.paymentProblem before recording the payment. - `INVALID_INVENTORY` (HTTP 400): The content does not match the selected inventory contract. Do not retry unchanged. Fix the request against the operation's schema. - `ANALYTICS_QUERY_REJECTED` (HTTP 400): Use one read-only query over the admitted catalog and its supported functions. Rewrite the query as one read-only statement over the published catalog. - `BODY_TOO_LARGE` (HTTP 413): The request body exceeds the supported limit. Send a smaller body, or split the content into several requests. - `NOT_FOUND` (HTTP 404): The resource does not exist. Check the identifier. The record may not exist or may not be visible to this actor. - `METHOD_NOT_ALLOWED` (HTTP 405): The method is not supported for this resource. Use the HTTP method documented for this path. - `CONFLICT` (HTTP 409): The resource conflicts with its current state. Read the current state with the matching get operation, then decide again. - `IDEMPOTENCY_CONFLICT` (HTTP 409): The command key already identifies a different request. The requestKey was already used for a different request. Use a new key for a new action. - `TRANSACTION_ABORTED` (HTTP 409): The transaction rolled back without committing changes. Nothing was written. Retry the same request. - `INVENTORY_INTEGRITY_CONFLICT` (HTTP 409): The current build failed integrity verification. Do not retry. Report the integrity failure to an operator. - `TEAM_PRIOR_UNRESOLVED` (HTTP 409): Reconcile the existing team command before preparing another change. Reconcile the earlier team command (see details.commandId) before a new change. - `COHORT_ACTIVE_REQUIRED` (HTTP 409): Only an active cohort can create a new candidate snapshot. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_CHANGED` (HTTP 409): The current cohort cut changed. Restart this read from the first page. Restart the paginated read from the first page. - `COHORT_READ_REQUIRES_ACTIVE` (HTTP 409): Only an active cohort has a current care-facts view. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_NEEDS_RECONCILIATION` (HTTP 409): The cohort cut needs reconciliation before its care facts can be read. Read the current state with the matching get operation, then decide again. - `PROGRAM_NEW_ASSESSMENT_REQUIRED` (HTTP 409): Select a new eligible assessment recorded after the last participation change. Read the current state with the matching get operation, then decide again. - `CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED` (HTTP 409): The proposed terms change component identities already fixed by an accepted close. Read the current state with the matching get operation, then decide again. - `MINOR_UNIT_SCALE_MISMATCH` (HTTP 400): A component's money is not in the minor units of its currency (ISO 4217). Write each component's money in the minor units of its currency (minorUnitScale 2 for COP, PEN, MXN and BRL; 0 for CLP) and propose again. - `INVOICE_COMPONENT_AMBIGUOUS` (HTTP 409): Invoice lines have no unique fee-for-service component. Route the lines in details.lineIds to their paying component, then request the proposal again. At most 100 identifiers are returned. - `SITE_SUBSTITUTION_REFUSED` (HTTP 409): The contract does not let this site serve for the contracted site as booked. Book at the contracted site, or at a site its contract lets serve for it on the appointment's day (listContractSites), recording what details.reason says is missing: the patient's acceptance or the payer's authorization. - `RESOURCE_LIMIT_EXCEEDED` (HTTP 422): This resource has reached its supported capacity. Do not retry. Reduce the request or archive records first. - `MODULE_NOT_CONTRACTED` (HTTP 422): The organization did not contract this module. Leave the module in details.module off: the organization did not contract it. Árbol adds it to the contract when the organization buys it. - `MODULE_REQUIREMENT_MISSING` (HTTP 422): This module needs one of the modules it requires to be on. Turn on, in the same request, one of the modules the module in details.module requires (getOrganizationModules lists them). - `CAPABILITY_NOT_CONFIGURED` (HTTP 422): This operation requires its governed native implementation before it can be activated. Do not retry. The capability is not enabled for this organization. - `INSTALLATION_NOT_READY` (HTTP 422): The installation cannot be activated: its app version is not certified or a credential its app declares is missing. Do not retry unchanged. Wait for a certified app version, record examples that cover every operation and change of a custom-http installation, or add the missing credentials to the deployment, then activate again. - `EVIDENCE_NOT_READABLE` (HTTP 422): Accepting evidence requires readable content and independent reporter provenance. Leave it pending until its source is readable. Leave the evidence pending until its source content is readable. - `ANALYTICS_QUERY_LIMIT` (HTTP 422): The query exceeded its bounded work, memory or output budget. Narrow the query. Narrow the query (filters, columns or range) and retry. - `COMMIT_UNCERTAIN` (HTTP 503): The commit outcome is unknown. Reconcile before retrying. The write may have happened. Repeat it with the same requestKey or read the record first. - `DATABASE_UNAVAILABLE` (HTTP 503): The database is unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `PIPELINE_UNAVAILABLE` (HTTP 503): The pipeline is unavailable. Reconcile using the same request key. The write may have happened. Repeat it with the same requestKey or read the record first. - `ASSISTANT_UNAVAILABLE` (HTTP 503): The assistant is not available for this workspace. Do not retry. The capability is not enabled for this organization. - `SERVICE_BUSY` (HTTP 503): The service is handling its current request limit. Retry later with backoff; for a write, reuse the same requestKey. - `INVALID_CONFIGURATION` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support. - `INTERNAL` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support.
    - one of `"UNAUTHORIZED"`, `"AUTHENTICATION_UNAVAILABLE"`, `"ACCESS_DENIED"`, `"MODULE_DISABLED"`, `"INVALID_INPUT"`, `"USER_PAYMENT_REFUSED"`, `"INVALID_INVENTORY"`, `"ANALYTICS_QUERY_REJECTED"`, `"BODY_TOO_LARGE"`, `"NOT_FOUND"`, `"METHOD_NOT_ALLOWED"`, `"CONFLICT"`, `"IDEMPOTENCY_CONFLICT"`, `"TRANSACTION_ABORTED"`, `"INVENTORY_INTEGRITY_CONFLICT"`, `"TEAM_PRIOR_UNRESOLVED"`, `"COHORT_ACTIVE_REQUIRED"`, `"COHORT_CUT_CHANGED"`, `"COHORT_READ_REQUIRES_ACTIVE"`, `"COHORT_CUT_NEEDS_RECONCILIATION"`, `"PROGRAM_NEW_ASSESSMENT_REQUIRED"`, `"CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED"`, `"MINOR_UNIT_SCALE_MISMATCH"`, `"INVOICE_COMPONENT_AMBIGUOUS"`, `"SITE_SUBSTITUTION_REFUSED"`, `"RESOURCE_LIMIT_EXCEEDED"`, `"MODULE_NOT_CONTRACTED"`, `"MODULE_REQUIREMENT_MISSING"`, `"CAPABILITY_NOT_CONFIGURED"`, `"INSTALLATION_NOT_READY"`, `"EVIDENCE_NOT_READABLE"`, `"ANALYTICS_QUERY_LIMIT"`, `"COMMIT_UNCERTAIN"`, `"DATABASE_UNAVAILABLE"`, `"PIPELINE_UNAVAILABLE"`, `"ASSISTANT_UNAVAILABLE"`, `"SERVICE_BUSY"`, `"INVALID_CONFIGURATION"`, `"INTERNAL"`; example `"INVALID_INPUT"`
  - `message` (`draftPayerReport.response.401.error.message`; string, required) — Fixed English explanation for people; it may change without notice.
  - `details` (`draftPayerReport.response.401.error.details`; object, optional) — Extra data for the codes that need it; absent for every other code.
    - `commandId` (`draftPayerReport.response.401.error.details.commandId`; string, optional) — Identifier (`tcm_` prefix) of the earlier team command to reconcile before retrying.
    - `lineIds` (`draftPayerReport.response.401.error.details.lineIds`; array<string>, optional) — Unassigned invoice lines that prevent a unique component proposal; at most 100.
    - `module` (`draftPayerReport.response.401.error.details.module`; string, optional) — The module the failure is about, for example `agenda`.
      - one of `"pgp"`, `"capitation"`, `"fee_for_service"`, `"results_payment"`, `"service_record"`, `"cac"`, `"cohorts"`, `"studies"`, `"agenda"`, `"voice"`, `"whatsapp"`, `"sms"`, `"email"`, `"arbi"`, `"ai_documents"`, `"ai_care"`, `"analytics"`
    - `paymentProblem` (`draftPayerReport.response.401.error.details.paymentProblem`; string, optional) — Why the collection was refused.
      - one of `"rules_unavailable"`, `"not_collectable"`, `"not_for_this_person"`, `"basis_incomplete"`, `"moderator_fee_value"`, `"service_value_unavailable"`, `"above_share"`, `"above_event_cap"`, `"above_year_cap"`
    - `reason` (`draftPayerReport.response.401.error.details.reason`; string, optional) — Why the booking's site was refused: `not_contracted` (the contracted site is not one of the contract that day), `not_a_substitute` (no substitution in force that day lets the site serve for it), `patient_acceptance_missing` or `payer_authorization_missing` (the substitution asks for them).
      - one of `"not_contracted"`, `"not_a_substitute"`, `"patient_acceptance_missing"`, `"payer_authorization_missing"`
- `metadata` (`draftPayerReport.response.401.metadata`; object, required) — Request metadata, including the request identifier.
  - `requestId` (`draftPayerReport.response.401.metadata.requestId`; string, required) — Server-assigned request identifier (opaque). Quote it when reporting a problem.
- `success` (`draftPayerReport.response.401.success`; boolean, required) — Always `false` in a failure envelope.
  - one of `false`

### 403

Failure. The `error.code` is one of:
- `ACCESS_DENIED`: Do not retry. The signed-in actor lacks this purpose or grant; ask an administrator.
- `MODULE_DISABLED`: Do not retry. The organization does not use the module in details.module (getSession lists the ones it uses); an administrator turns it on with setOrganizationModules.

#### Example

```json
{
  "error": {
    "code": "ACCESS_DENIED",
    "message": "Access denied."
  },
  "metadata": {
    "requestId": "3f2b8c1e-5d4a-4b6f-9c2e-0a1b2c3d4e5f"
  },
  "success": false
}
```

- `error` (`draftPayerReport.response.403.error`; object, required) — The stable failure code, its message and optional details.
  - `code` (`draftPayerReport.response.403.error.code`; string, required) — Stable failure code. Branch on this value, never on `message`. - `UNAUTHORIZED` (HTTP 401): A valid access token is required. Obtain a fresh access token and repeat the request. - `AUTHENTICATION_UNAVAILABLE` (HTTP 503): Identity verification is temporarily unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `ACCESS_DENIED` (HTTP 403): Access denied. Do not retry. The signed-in actor lacks this purpose or grant; ask an administrator. - `MODULE_DISABLED` (HTTP 403): This operation belongs to a module the organization does not use. Do not retry. The organization does not use the module in details.module (getSession lists the ones it uses); an administrator turns it on with setOrganizationModules. - `INVALID_INPUT` (HTTP 400): The request does not match the documented contract. Do not retry unchanged. Fix the request against the operation's schema. - `USER_PAYMENT_REFUSED` (HTTP 400): The collection exceeds the applicable payment rules. Check the collection basis and caps in details.paymentProblem before recording the payment. - `INVALID_INVENTORY` (HTTP 400): The content does not match the selected inventory contract. Do not retry unchanged. Fix the request against the operation's schema. - `ANALYTICS_QUERY_REJECTED` (HTTP 400): Use one read-only query over the admitted catalog and its supported functions. Rewrite the query as one read-only statement over the published catalog. - `BODY_TOO_LARGE` (HTTP 413): The request body exceeds the supported limit. Send a smaller body, or split the content into several requests. - `NOT_FOUND` (HTTP 404): The resource does not exist. Check the identifier. The record may not exist or may not be visible to this actor. - `METHOD_NOT_ALLOWED` (HTTP 405): The method is not supported for this resource. Use the HTTP method documented for this path. - `CONFLICT` (HTTP 409): The resource conflicts with its current state. Read the current state with the matching get operation, then decide again. - `IDEMPOTENCY_CONFLICT` (HTTP 409): The command key already identifies a different request. The requestKey was already used for a different request. Use a new key for a new action. - `TRANSACTION_ABORTED` (HTTP 409): The transaction rolled back without committing changes. Nothing was written. Retry the same request. - `INVENTORY_INTEGRITY_CONFLICT` (HTTP 409): The current build failed integrity verification. Do not retry. Report the integrity failure to an operator. - `TEAM_PRIOR_UNRESOLVED` (HTTP 409): Reconcile the existing team command before preparing another change. Reconcile the earlier team command (see details.commandId) before a new change. - `COHORT_ACTIVE_REQUIRED` (HTTP 409): Only an active cohort can create a new candidate snapshot. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_CHANGED` (HTTP 409): The current cohort cut changed. Restart this read from the first page. Restart the paginated read from the first page. - `COHORT_READ_REQUIRES_ACTIVE` (HTTP 409): Only an active cohort has a current care-facts view. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_NEEDS_RECONCILIATION` (HTTP 409): The cohort cut needs reconciliation before its care facts can be read. Read the current state with the matching get operation, then decide again. - `PROGRAM_NEW_ASSESSMENT_REQUIRED` (HTTP 409): Select a new eligible assessment recorded after the last participation change. Read the current state with the matching get operation, then decide again. - `CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED` (HTTP 409): The proposed terms change component identities already fixed by an accepted close. Read the current state with the matching get operation, then decide again. - `MINOR_UNIT_SCALE_MISMATCH` (HTTP 400): A component's money is not in the minor units of its currency (ISO 4217). Write each component's money in the minor units of its currency (minorUnitScale 2 for COP, PEN, MXN and BRL; 0 for CLP) and propose again. - `INVOICE_COMPONENT_AMBIGUOUS` (HTTP 409): Invoice lines have no unique fee-for-service component. Route the lines in details.lineIds to their paying component, then request the proposal again. At most 100 identifiers are returned. - `SITE_SUBSTITUTION_REFUSED` (HTTP 409): The contract does not let this site serve for the contracted site as booked. Book at the contracted site, or at a site its contract lets serve for it on the appointment's day (listContractSites), recording what details.reason says is missing: the patient's acceptance or the payer's authorization. - `RESOURCE_LIMIT_EXCEEDED` (HTTP 422): This resource has reached its supported capacity. Do not retry. Reduce the request or archive records first. - `MODULE_NOT_CONTRACTED` (HTTP 422): The organization did not contract this module. Leave the module in details.module off: the organization did not contract it. Árbol adds it to the contract when the organization buys it. - `MODULE_REQUIREMENT_MISSING` (HTTP 422): This module needs one of the modules it requires to be on. Turn on, in the same request, one of the modules the module in details.module requires (getOrganizationModules lists them). - `CAPABILITY_NOT_CONFIGURED` (HTTP 422): This operation requires its governed native implementation before it can be activated. Do not retry. The capability is not enabled for this organization. - `INSTALLATION_NOT_READY` (HTTP 422): The installation cannot be activated: its app version is not certified or a credential its app declares is missing. Do not retry unchanged. Wait for a certified app version, record examples that cover every operation and change of a custom-http installation, or add the missing credentials to the deployment, then activate again. - `EVIDENCE_NOT_READABLE` (HTTP 422): Accepting evidence requires readable content and independent reporter provenance. Leave it pending until its source is readable. Leave the evidence pending until its source content is readable. - `ANALYTICS_QUERY_LIMIT` (HTTP 422): The query exceeded its bounded work, memory or output budget. Narrow the query. Narrow the query (filters, columns or range) and retry. - `COMMIT_UNCERTAIN` (HTTP 503): The commit outcome is unknown. Reconcile before retrying. The write may have happened. Repeat it with the same requestKey or read the record first. - `DATABASE_UNAVAILABLE` (HTTP 503): The database is unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `PIPELINE_UNAVAILABLE` (HTTP 503): The pipeline is unavailable. Reconcile using the same request key. The write may have happened. Repeat it with the same requestKey or read the record first. - `ASSISTANT_UNAVAILABLE` (HTTP 503): The assistant is not available for this workspace. Do not retry. The capability is not enabled for this organization. - `SERVICE_BUSY` (HTTP 503): The service is handling its current request limit. Retry later with backoff; for a write, reuse the same requestKey. - `INVALID_CONFIGURATION` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support. - `INTERNAL` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support.
    - one of `"UNAUTHORIZED"`, `"AUTHENTICATION_UNAVAILABLE"`, `"ACCESS_DENIED"`, `"MODULE_DISABLED"`, `"INVALID_INPUT"`, `"USER_PAYMENT_REFUSED"`, `"INVALID_INVENTORY"`, `"ANALYTICS_QUERY_REJECTED"`, `"BODY_TOO_LARGE"`, `"NOT_FOUND"`, `"METHOD_NOT_ALLOWED"`, `"CONFLICT"`, `"IDEMPOTENCY_CONFLICT"`, `"TRANSACTION_ABORTED"`, `"INVENTORY_INTEGRITY_CONFLICT"`, `"TEAM_PRIOR_UNRESOLVED"`, `"COHORT_ACTIVE_REQUIRED"`, `"COHORT_CUT_CHANGED"`, `"COHORT_READ_REQUIRES_ACTIVE"`, `"COHORT_CUT_NEEDS_RECONCILIATION"`, `"PROGRAM_NEW_ASSESSMENT_REQUIRED"`, `"CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED"`, `"MINOR_UNIT_SCALE_MISMATCH"`, `"INVOICE_COMPONENT_AMBIGUOUS"`, `"SITE_SUBSTITUTION_REFUSED"`, `"RESOURCE_LIMIT_EXCEEDED"`, `"MODULE_NOT_CONTRACTED"`, `"MODULE_REQUIREMENT_MISSING"`, `"CAPABILITY_NOT_CONFIGURED"`, `"INSTALLATION_NOT_READY"`, `"EVIDENCE_NOT_READABLE"`, `"ANALYTICS_QUERY_LIMIT"`, `"COMMIT_UNCERTAIN"`, `"DATABASE_UNAVAILABLE"`, `"PIPELINE_UNAVAILABLE"`, `"ASSISTANT_UNAVAILABLE"`, `"SERVICE_BUSY"`, `"INVALID_CONFIGURATION"`, `"INTERNAL"`; example `"INVALID_INPUT"`
  - `message` (`draftPayerReport.response.403.error.message`; string, required) — Fixed English explanation for people; it may change without notice.
  - `details` (`draftPayerReport.response.403.error.details`; object, optional) — Extra data for the codes that need it; absent for every other code.
    - `commandId` (`draftPayerReport.response.403.error.details.commandId`; string, optional) — Identifier (`tcm_` prefix) of the earlier team command to reconcile before retrying.
    - `lineIds` (`draftPayerReport.response.403.error.details.lineIds`; array<string>, optional) — Unassigned invoice lines that prevent a unique component proposal; at most 100.
    - `module` (`draftPayerReport.response.403.error.details.module`; string, optional) — The module the failure is about, for example `agenda`.
      - one of `"pgp"`, `"capitation"`, `"fee_for_service"`, `"results_payment"`, `"service_record"`, `"cac"`, `"cohorts"`, `"studies"`, `"agenda"`, `"voice"`, `"whatsapp"`, `"sms"`, `"email"`, `"arbi"`, `"ai_documents"`, `"ai_care"`, `"analytics"`
    - `paymentProblem` (`draftPayerReport.response.403.error.details.paymentProblem`; string, optional) — Why the collection was refused.
      - one of `"rules_unavailable"`, `"not_collectable"`, `"not_for_this_person"`, `"basis_incomplete"`, `"moderator_fee_value"`, `"service_value_unavailable"`, `"above_share"`, `"above_event_cap"`, `"above_year_cap"`
    - `reason` (`draftPayerReport.response.403.error.details.reason`; string, optional) — Why the booking's site was refused: `not_contracted` (the contracted site is not one of the contract that day), `not_a_substitute` (no substitution in force that day lets the site serve for it), `patient_acceptance_missing` or `payer_authorization_missing` (the substitution asks for them).
      - one of `"not_contracted"`, `"not_a_substitute"`, `"patient_acceptance_missing"`, `"payer_authorization_missing"`
- `metadata` (`draftPayerReport.response.403.metadata`; object, required) — Request metadata, including the request identifier.
  - `requestId` (`draftPayerReport.response.403.metadata.requestId`; string, required) — Server-assigned request identifier (opaque). Quote it when reporting a problem.
- `success` (`draftPayerReport.response.403.success`; boolean, required) — Always `false` in a failure envelope.
  - one of `false`

### 404

Failure. The `error.code` is one of:
- `NOT_FOUND`: Check the identifier. The record may not exist or may not be visible to this actor.

#### Example

```json
{
  "error": {
    "code": "NOT_FOUND",
    "message": "The resource does not exist."
  },
  "metadata": {
    "requestId": "3f2b8c1e-5d4a-4b6f-9c2e-0a1b2c3d4e5f"
  },
  "success": false
}
```

- `error` (`draftPayerReport.response.404.error`; object, required) — The stable failure code, its message and optional details.
  - `code` (`draftPayerReport.response.404.error.code`; string, required) — Stable failure code. Branch on this value, never on `message`. - `UNAUTHORIZED` (HTTP 401): A valid access token is required. Obtain a fresh access token and repeat the request. - `AUTHENTICATION_UNAVAILABLE` (HTTP 503): Identity verification is temporarily unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `ACCESS_DENIED` (HTTP 403): Access denied. Do not retry. The signed-in actor lacks this purpose or grant; ask an administrator. - `MODULE_DISABLED` (HTTP 403): This operation belongs to a module the organization does not use. Do not retry. The organization does not use the module in details.module (getSession lists the ones it uses); an administrator turns it on with setOrganizationModules. - `INVALID_INPUT` (HTTP 400): The request does not match the documented contract. Do not retry unchanged. Fix the request against the operation's schema. - `USER_PAYMENT_REFUSED` (HTTP 400): The collection exceeds the applicable payment rules. Check the collection basis and caps in details.paymentProblem before recording the payment. - `INVALID_INVENTORY` (HTTP 400): The content does not match the selected inventory contract. Do not retry unchanged. Fix the request against the operation's schema. - `ANALYTICS_QUERY_REJECTED` (HTTP 400): Use one read-only query over the admitted catalog and its supported functions. Rewrite the query as one read-only statement over the published catalog. - `BODY_TOO_LARGE` (HTTP 413): The request body exceeds the supported limit. Send a smaller body, or split the content into several requests. - `NOT_FOUND` (HTTP 404): The resource does not exist. Check the identifier. The record may not exist or may not be visible to this actor. - `METHOD_NOT_ALLOWED` (HTTP 405): The method is not supported for this resource. Use the HTTP method documented for this path. - `CONFLICT` (HTTP 409): The resource conflicts with its current state. Read the current state with the matching get operation, then decide again. - `IDEMPOTENCY_CONFLICT` (HTTP 409): The command key already identifies a different request. The requestKey was already used for a different request. Use a new key for a new action. - `TRANSACTION_ABORTED` (HTTP 409): The transaction rolled back without committing changes. Nothing was written. Retry the same request. - `INVENTORY_INTEGRITY_CONFLICT` (HTTP 409): The current build failed integrity verification. Do not retry. Report the integrity failure to an operator. - `TEAM_PRIOR_UNRESOLVED` (HTTP 409): Reconcile the existing team command before preparing another change. Reconcile the earlier team command (see details.commandId) before a new change. - `COHORT_ACTIVE_REQUIRED` (HTTP 409): Only an active cohort can create a new candidate snapshot. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_CHANGED` (HTTP 409): The current cohort cut changed. Restart this read from the first page. Restart the paginated read from the first page. - `COHORT_READ_REQUIRES_ACTIVE` (HTTP 409): Only an active cohort has a current care-facts view. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_NEEDS_RECONCILIATION` (HTTP 409): The cohort cut needs reconciliation before its care facts can be read. Read the current state with the matching get operation, then decide again. - `PROGRAM_NEW_ASSESSMENT_REQUIRED` (HTTP 409): Select a new eligible assessment recorded after the last participation change. Read the current state with the matching get operation, then decide again. - `CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED` (HTTP 409): The proposed terms change component identities already fixed by an accepted close. Read the current state with the matching get operation, then decide again. - `MINOR_UNIT_SCALE_MISMATCH` (HTTP 400): A component's money is not in the minor units of its currency (ISO 4217). Write each component's money in the minor units of its currency (minorUnitScale 2 for COP, PEN, MXN and BRL; 0 for CLP) and propose again. - `INVOICE_COMPONENT_AMBIGUOUS` (HTTP 409): Invoice lines have no unique fee-for-service component. Route the lines in details.lineIds to their paying component, then request the proposal again. At most 100 identifiers are returned. - `SITE_SUBSTITUTION_REFUSED` (HTTP 409): The contract does not let this site serve for the contracted site as booked. Book at the contracted site, or at a site its contract lets serve for it on the appointment's day (listContractSites), recording what details.reason says is missing: the patient's acceptance or the payer's authorization. - `RESOURCE_LIMIT_EXCEEDED` (HTTP 422): This resource has reached its supported capacity. Do not retry. Reduce the request or archive records first. - `MODULE_NOT_CONTRACTED` (HTTP 422): The organization did not contract this module. Leave the module in details.module off: the organization did not contract it. Árbol adds it to the contract when the organization buys it. - `MODULE_REQUIREMENT_MISSING` (HTTP 422): This module needs one of the modules it requires to be on. Turn on, in the same request, one of the modules the module in details.module requires (getOrganizationModules lists them). - `CAPABILITY_NOT_CONFIGURED` (HTTP 422): This operation requires its governed native implementation before it can be activated. Do not retry. The capability is not enabled for this organization. - `INSTALLATION_NOT_READY` (HTTP 422): The installation cannot be activated: its app version is not certified or a credential its app declares is missing. Do not retry unchanged. Wait for a certified app version, record examples that cover every operation and change of a custom-http installation, or add the missing credentials to the deployment, then activate again. - `EVIDENCE_NOT_READABLE` (HTTP 422): Accepting evidence requires readable content and independent reporter provenance. Leave it pending until its source is readable. Leave the evidence pending until its source content is readable. - `ANALYTICS_QUERY_LIMIT` (HTTP 422): The query exceeded its bounded work, memory or output budget. Narrow the query. Narrow the query (filters, columns or range) and retry. - `COMMIT_UNCERTAIN` (HTTP 503): The commit outcome is unknown. Reconcile before retrying. The write may have happened. Repeat it with the same requestKey or read the record first. - `DATABASE_UNAVAILABLE` (HTTP 503): The database is unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `PIPELINE_UNAVAILABLE` (HTTP 503): The pipeline is unavailable. Reconcile using the same request key. The write may have happened. Repeat it with the same requestKey or read the record first. - `ASSISTANT_UNAVAILABLE` (HTTP 503): The assistant is not available for this workspace. Do not retry. The capability is not enabled for this organization. - `SERVICE_BUSY` (HTTP 503): The service is handling its current request limit. Retry later with backoff; for a write, reuse the same requestKey. - `INVALID_CONFIGURATION` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support. - `INTERNAL` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support.
    - one of `"UNAUTHORIZED"`, `"AUTHENTICATION_UNAVAILABLE"`, `"ACCESS_DENIED"`, `"MODULE_DISABLED"`, `"INVALID_INPUT"`, `"USER_PAYMENT_REFUSED"`, `"INVALID_INVENTORY"`, `"ANALYTICS_QUERY_REJECTED"`, `"BODY_TOO_LARGE"`, `"NOT_FOUND"`, `"METHOD_NOT_ALLOWED"`, `"CONFLICT"`, `"IDEMPOTENCY_CONFLICT"`, `"TRANSACTION_ABORTED"`, `"INVENTORY_INTEGRITY_CONFLICT"`, `"TEAM_PRIOR_UNRESOLVED"`, `"COHORT_ACTIVE_REQUIRED"`, `"COHORT_CUT_CHANGED"`, `"COHORT_READ_REQUIRES_ACTIVE"`, `"COHORT_CUT_NEEDS_RECONCILIATION"`, `"PROGRAM_NEW_ASSESSMENT_REQUIRED"`, `"CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED"`, `"MINOR_UNIT_SCALE_MISMATCH"`, `"INVOICE_COMPONENT_AMBIGUOUS"`, `"SITE_SUBSTITUTION_REFUSED"`, `"RESOURCE_LIMIT_EXCEEDED"`, `"MODULE_NOT_CONTRACTED"`, `"MODULE_REQUIREMENT_MISSING"`, `"CAPABILITY_NOT_CONFIGURED"`, `"INSTALLATION_NOT_READY"`, `"EVIDENCE_NOT_READABLE"`, `"ANALYTICS_QUERY_LIMIT"`, `"COMMIT_UNCERTAIN"`, `"DATABASE_UNAVAILABLE"`, `"PIPELINE_UNAVAILABLE"`, `"ASSISTANT_UNAVAILABLE"`, `"SERVICE_BUSY"`, `"INVALID_CONFIGURATION"`, `"INTERNAL"`; example `"INVALID_INPUT"`
  - `message` (`draftPayerReport.response.404.error.message`; string, required) — Fixed English explanation for people; it may change without notice.
  - `details` (`draftPayerReport.response.404.error.details`; object, optional) — Extra data for the codes that need it; absent for every other code.
    - `commandId` (`draftPayerReport.response.404.error.details.commandId`; string, optional) — Identifier (`tcm_` prefix) of the earlier team command to reconcile before retrying.
    - `lineIds` (`draftPayerReport.response.404.error.details.lineIds`; array<string>, optional) — Unassigned invoice lines that prevent a unique component proposal; at most 100.
    - `module` (`draftPayerReport.response.404.error.details.module`; string, optional) — The module the failure is about, for example `agenda`.
      - one of `"pgp"`, `"capitation"`, `"fee_for_service"`, `"results_payment"`, `"service_record"`, `"cac"`, `"cohorts"`, `"studies"`, `"agenda"`, `"voice"`, `"whatsapp"`, `"sms"`, `"email"`, `"arbi"`, `"ai_documents"`, `"ai_care"`, `"analytics"`
    - `paymentProblem` (`draftPayerReport.response.404.error.details.paymentProblem`; string, optional) — Why the collection was refused.
      - one of `"rules_unavailable"`, `"not_collectable"`, `"not_for_this_person"`, `"basis_incomplete"`, `"moderator_fee_value"`, `"service_value_unavailable"`, `"above_share"`, `"above_event_cap"`, `"above_year_cap"`
    - `reason` (`draftPayerReport.response.404.error.details.reason`; string, optional) — Why the booking's site was refused: `not_contracted` (the contracted site is not one of the contract that day), `not_a_substitute` (no substitution in force that day lets the site serve for it), `patient_acceptance_missing` or `payer_authorization_missing` (the substitution asks for them).
      - one of `"not_contracted"`, `"not_a_substitute"`, `"patient_acceptance_missing"`, `"payer_authorization_missing"`
- `metadata` (`draftPayerReport.response.404.metadata`; object, required) — Request metadata, including the request identifier.
  - `requestId` (`draftPayerReport.response.404.metadata.requestId`; string, required) — Server-assigned request identifier (opaque). Quote it when reporting a problem.
- `success` (`draftPayerReport.response.404.success`; boolean, required) — Always `false` in a failure envelope.
  - one of `false`

### 409

Failure. The `error.code` is one of:
- `CONFLICT`: Read the current state with the matching get operation, then decide again.
- `IDEMPOTENCY_CONFLICT`: The requestKey was already used for a different request. Use a new key for a new action.
- `TRANSACTION_ABORTED`: Nothing was written. Retry the same request.
- `INVENTORY_INTEGRITY_CONFLICT`: Do not retry. Report the integrity failure to an operator.
- `TEAM_PRIOR_UNRESOLVED`: Reconcile the earlier team command (see details.commandId) before a new change.
- `COHORT_ACTIVE_REQUIRED`: Read the current state with the matching get operation, then decide again.
- `COHORT_CUT_CHANGED`: Restart the paginated read from the first page.
- `COHORT_READ_REQUIRES_ACTIVE`: Read the current state with the matching get operation, then decide again.
- `COHORT_CUT_NEEDS_RECONCILIATION`: Read the current state with the matching get operation, then decide again.
- `PROGRAM_NEW_ASSESSMENT_REQUIRED`: Read the current state with the matching get operation, then decide again.
- `CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED`: Read the current state with the matching get operation, then decide again.
- `INVOICE_COMPONENT_AMBIGUOUS`: Route the lines in details.lineIds to their paying component, then request the proposal again. At most 100 identifiers are returned.
- `SITE_SUBSTITUTION_REFUSED`: Book at the contracted site, or at a site its contract lets serve for it on the appointment's day (listContractSites), recording what details.reason says is missing: the patient's acceptance or the payer's authorization.

#### Example

```json
{
  "error": {
    "code": "CONFLICT",
    "message": "The resource conflicts with its current state."
  },
  "metadata": {
    "requestId": "3f2b8c1e-5d4a-4b6f-9c2e-0a1b2c3d4e5f"
  },
  "success": false
}
```

- `error` (`draftPayerReport.response.409.error`; object, required) — The stable failure code, its message and optional details.
  - `code` (`draftPayerReport.response.409.error.code`; string, required) — Stable failure code. Branch on this value, never on `message`. - `UNAUTHORIZED` (HTTP 401): A valid access token is required. Obtain a fresh access token and repeat the request. - `AUTHENTICATION_UNAVAILABLE` (HTTP 503): Identity verification is temporarily unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `ACCESS_DENIED` (HTTP 403): Access denied. Do not retry. The signed-in actor lacks this purpose or grant; ask an administrator. - `MODULE_DISABLED` (HTTP 403): This operation belongs to a module the organization does not use. Do not retry. The organization does not use the module in details.module (getSession lists the ones it uses); an administrator turns it on with setOrganizationModules. - `INVALID_INPUT` (HTTP 400): The request does not match the documented contract. Do not retry unchanged. Fix the request against the operation's schema. - `USER_PAYMENT_REFUSED` (HTTP 400): The collection exceeds the applicable payment rules. Check the collection basis and caps in details.paymentProblem before recording the payment. - `INVALID_INVENTORY` (HTTP 400): The content does not match the selected inventory contract. Do not retry unchanged. Fix the request against the operation's schema. - `ANALYTICS_QUERY_REJECTED` (HTTP 400): Use one read-only query over the admitted catalog and its supported functions. Rewrite the query as one read-only statement over the published catalog. - `BODY_TOO_LARGE` (HTTP 413): The request body exceeds the supported limit. Send a smaller body, or split the content into several requests. - `NOT_FOUND` (HTTP 404): The resource does not exist. Check the identifier. The record may not exist or may not be visible to this actor. - `METHOD_NOT_ALLOWED` (HTTP 405): The method is not supported for this resource. Use the HTTP method documented for this path. - `CONFLICT` (HTTP 409): The resource conflicts with its current state. Read the current state with the matching get operation, then decide again. - `IDEMPOTENCY_CONFLICT` (HTTP 409): The command key already identifies a different request. The requestKey was already used for a different request. Use a new key for a new action. - `TRANSACTION_ABORTED` (HTTP 409): The transaction rolled back without committing changes. Nothing was written. Retry the same request. - `INVENTORY_INTEGRITY_CONFLICT` (HTTP 409): The current build failed integrity verification. Do not retry. Report the integrity failure to an operator. - `TEAM_PRIOR_UNRESOLVED` (HTTP 409): Reconcile the existing team command before preparing another change. Reconcile the earlier team command (see details.commandId) before a new change. - `COHORT_ACTIVE_REQUIRED` (HTTP 409): Only an active cohort can create a new candidate snapshot. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_CHANGED` (HTTP 409): The current cohort cut changed. Restart this read from the first page. Restart the paginated read from the first page. - `COHORT_READ_REQUIRES_ACTIVE` (HTTP 409): Only an active cohort has a current care-facts view. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_NEEDS_RECONCILIATION` (HTTP 409): The cohort cut needs reconciliation before its care facts can be read. Read the current state with the matching get operation, then decide again. - `PROGRAM_NEW_ASSESSMENT_REQUIRED` (HTTP 409): Select a new eligible assessment recorded after the last participation change. Read the current state with the matching get operation, then decide again. - `CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED` (HTTP 409): The proposed terms change component identities already fixed by an accepted close. Read the current state with the matching get operation, then decide again. - `MINOR_UNIT_SCALE_MISMATCH` (HTTP 400): A component's money is not in the minor units of its currency (ISO 4217). Write each component's money in the minor units of its currency (minorUnitScale 2 for COP, PEN, MXN and BRL; 0 for CLP) and propose again. - `INVOICE_COMPONENT_AMBIGUOUS` (HTTP 409): Invoice lines have no unique fee-for-service component. Route the lines in details.lineIds to their paying component, then request the proposal again. At most 100 identifiers are returned. - `SITE_SUBSTITUTION_REFUSED` (HTTP 409): The contract does not let this site serve for the contracted site as booked. Book at the contracted site, or at a site its contract lets serve for it on the appointment's day (listContractSites), recording what details.reason says is missing: the patient's acceptance or the payer's authorization. - `RESOURCE_LIMIT_EXCEEDED` (HTTP 422): This resource has reached its supported capacity. Do not retry. Reduce the request or archive records first. - `MODULE_NOT_CONTRACTED` (HTTP 422): The organization did not contract this module. Leave the module in details.module off: the organization did not contract it. Árbol adds it to the contract when the organization buys it. - `MODULE_REQUIREMENT_MISSING` (HTTP 422): This module needs one of the modules it requires to be on. Turn on, in the same request, one of the modules the module in details.module requires (getOrganizationModules lists them). - `CAPABILITY_NOT_CONFIGURED` (HTTP 422): This operation requires its governed native implementation before it can be activated. Do not retry. The capability is not enabled for this organization. - `INSTALLATION_NOT_READY` (HTTP 422): The installation cannot be activated: its app version is not certified or a credential its app declares is missing. Do not retry unchanged. Wait for a certified app version, record examples that cover every operation and change of a custom-http installation, or add the missing credentials to the deployment, then activate again. - `EVIDENCE_NOT_READABLE` (HTTP 422): Accepting evidence requires readable content and independent reporter provenance. Leave it pending until its source is readable. Leave the evidence pending until its source content is readable. - `ANALYTICS_QUERY_LIMIT` (HTTP 422): The query exceeded its bounded work, memory or output budget. Narrow the query. Narrow the query (filters, columns or range) and retry. - `COMMIT_UNCERTAIN` (HTTP 503): The commit outcome is unknown. Reconcile before retrying. The write may have happened. Repeat it with the same requestKey or read the record first. - `DATABASE_UNAVAILABLE` (HTTP 503): The database is unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `PIPELINE_UNAVAILABLE` (HTTP 503): The pipeline is unavailable. Reconcile using the same request key. The write may have happened. Repeat it with the same requestKey or read the record first. - `ASSISTANT_UNAVAILABLE` (HTTP 503): The assistant is not available for this workspace. Do not retry. The capability is not enabled for this organization. - `SERVICE_BUSY` (HTTP 503): The service is handling its current request limit. Retry later with backoff; for a write, reuse the same requestKey. - `INVALID_CONFIGURATION` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support. - `INTERNAL` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support.
    - one of `"UNAUTHORIZED"`, `"AUTHENTICATION_UNAVAILABLE"`, `"ACCESS_DENIED"`, `"MODULE_DISABLED"`, `"INVALID_INPUT"`, `"USER_PAYMENT_REFUSED"`, `"INVALID_INVENTORY"`, `"ANALYTICS_QUERY_REJECTED"`, `"BODY_TOO_LARGE"`, `"NOT_FOUND"`, `"METHOD_NOT_ALLOWED"`, `"CONFLICT"`, `"IDEMPOTENCY_CONFLICT"`, `"TRANSACTION_ABORTED"`, `"INVENTORY_INTEGRITY_CONFLICT"`, `"TEAM_PRIOR_UNRESOLVED"`, `"COHORT_ACTIVE_REQUIRED"`, `"COHORT_CUT_CHANGED"`, `"COHORT_READ_REQUIRES_ACTIVE"`, `"COHORT_CUT_NEEDS_RECONCILIATION"`, `"PROGRAM_NEW_ASSESSMENT_REQUIRED"`, `"CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED"`, `"MINOR_UNIT_SCALE_MISMATCH"`, `"INVOICE_COMPONENT_AMBIGUOUS"`, `"SITE_SUBSTITUTION_REFUSED"`, `"RESOURCE_LIMIT_EXCEEDED"`, `"MODULE_NOT_CONTRACTED"`, `"MODULE_REQUIREMENT_MISSING"`, `"CAPABILITY_NOT_CONFIGURED"`, `"INSTALLATION_NOT_READY"`, `"EVIDENCE_NOT_READABLE"`, `"ANALYTICS_QUERY_LIMIT"`, `"COMMIT_UNCERTAIN"`, `"DATABASE_UNAVAILABLE"`, `"PIPELINE_UNAVAILABLE"`, `"ASSISTANT_UNAVAILABLE"`, `"SERVICE_BUSY"`, `"INVALID_CONFIGURATION"`, `"INTERNAL"`; example `"INVALID_INPUT"`
  - `message` (`draftPayerReport.response.409.error.message`; string, required) — Fixed English explanation for people; it may change without notice.
  - `details` (`draftPayerReport.response.409.error.details`; object, optional) — Extra data for the codes that need it; absent for every other code.
    - `commandId` (`draftPayerReport.response.409.error.details.commandId`; string, optional) — Identifier (`tcm_` prefix) of the earlier team command to reconcile before retrying.
    - `lineIds` (`draftPayerReport.response.409.error.details.lineIds`; array<string>, optional) — Unassigned invoice lines that prevent a unique component proposal; at most 100.
    - `module` (`draftPayerReport.response.409.error.details.module`; string, optional) — The module the failure is about, for example `agenda`.
      - one of `"pgp"`, `"capitation"`, `"fee_for_service"`, `"results_payment"`, `"service_record"`, `"cac"`, `"cohorts"`, `"studies"`, `"agenda"`, `"voice"`, `"whatsapp"`, `"sms"`, `"email"`, `"arbi"`, `"ai_documents"`, `"ai_care"`, `"analytics"`
    - `paymentProblem` (`draftPayerReport.response.409.error.details.paymentProblem`; string, optional) — Why the collection was refused.
      - one of `"rules_unavailable"`, `"not_collectable"`, `"not_for_this_person"`, `"basis_incomplete"`, `"moderator_fee_value"`, `"service_value_unavailable"`, `"above_share"`, `"above_event_cap"`, `"above_year_cap"`
    - `reason` (`draftPayerReport.response.409.error.details.reason`; string, optional) — Why the booking's site was refused: `not_contracted` (the contracted site is not one of the contract that day), `not_a_substitute` (no substitution in force that day lets the site serve for it), `patient_acceptance_missing` or `payer_authorization_missing` (the substitution asks for them).
      - one of `"not_contracted"`, `"not_a_substitute"`, `"patient_acceptance_missing"`, `"payer_authorization_missing"`
- `metadata` (`draftPayerReport.response.409.metadata`; object, required) — Request metadata, including the request identifier.
  - `requestId` (`draftPayerReport.response.409.metadata.requestId`; string, required) — Server-assigned request identifier (opaque). Quote it when reporting a problem.
- `success` (`draftPayerReport.response.409.success`; boolean, required) — Always `false` in a failure envelope.
  - one of `false`

### 422

Failure. The `error.code` is one of:
- `RESOURCE_LIMIT_EXCEEDED`: Do not retry. Reduce the request or archive records first.
- `MODULE_NOT_CONTRACTED`: Leave the module in details.module off: the organization did not contract it. Árbol adds it to the contract when the organization buys it.
- `MODULE_REQUIREMENT_MISSING`: Turn on, in the same request, one of the modules the module in details.module requires (getOrganizationModules lists them).
- `CAPABILITY_NOT_CONFIGURED`: Do not retry. The capability is not enabled for this organization.
- `INSTALLATION_NOT_READY`: Do not retry unchanged. Wait for a certified app version, record examples that cover every operation and change of a custom-http installation, or add the missing credentials to the deployment, then activate again.
- `EVIDENCE_NOT_READABLE`: Leave the evidence pending until its source content is readable.
- `ANALYTICS_QUERY_LIMIT`: Narrow the query (filters, columns or range) and retry.

#### Example

```json
{
  "error": {
    "code": "RESOURCE_LIMIT_EXCEEDED",
    "message": "This resource has reached its supported capacity."
  },
  "metadata": {
    "requestId": "3f2b8c1e-5d4a-4b6f-9c2e-0a1b2c3d4e5f"
  },
  "success": false
}
```

- `error` (`draftPayerReport.response.422.error`; object, required) — The stable failure code, its message and optional details.
  - `code` (`draftPayerReport.response.422.error.code`; string, required) — Stable failure code. Branch on this value, never on `message`. - `UNAUTHORIZED` (HTTP 401): A valid access token is required. Obtain a fresh access token and repeat the request. - `AUTHENTICATION_UNAVAILABLE` (HTTP 503): Identity verification is temporarily unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `ACCESS_DENIED` (HTTP 403): Access denied. Do not retry. The signed-in actor lacks this purpose or grant; ask an administrator. - `MODULE_DISABLED` (HTTP 403): This operation belongs to a module the organization does not use. Do not retry. The organization does not use the module in details.module (getSession lists the ones it uses); an administrator turns it on with setOrganizationModules. - `INVALID_INPUT` (HTTP 400): The request does not match the documented contract. Do not retry unchanged. Fix the request against the operation's schema. - `USER_PAYMENT_REFUSED` (HTTP 400): The collection exceeds the applicable payment rules. Check the collection basis and caps in details.paymentProblem before recording the payment. - `INVALID_INVENTORY` (HTTP 400): The content does not match the selected inventory contract. Do not retry unchanged. Fix the request against the operation's schema. - `ANALYTICS_QUERY_REJECTED` (HTTP 400): Use one read-only query over the admitted catalog and its supported functions. Rewrite the query as one read-only statement over the published catalog. - `BODY_TOO_LARGE` (HTTP 413): The request body exceeds the supported limit. Send a smaller body, or split the content into several requests. - `NOT_FOUND` (HTTP 404): The resource does not exist. Check the identifier. The record may not exist or may not be visible to this actor. - `METHOD_NOT_ALLOWED` (HTTP 405): The method is not supported for this resource. Use the HTTP method documented for this path. - `CONFLICT` (HTTP 409): The resource conflicts with its current state. Read the current state with the matching get operation, then decide again. - `IDEMPOTENCY_CONFLICT` (HTTP 409): The command key already identifies a different request. The requestKey was already used for a different request. Use a new key for a new action. - `TRANSACTION_ABORTED` (HTTP 409): The transaction rolled back without committing changes. Nothing was written. Retry the same request. - `INVENTORY_INTEGRITY_CONFLICT` (HTTP 409): The current build failed integrity verification. Do not retry. Report the integrity failure to an operator. - `TEAM_PRIOR_UNRESOLVED` (HTTP 409): Reconcile the existing team command before preparing another change. Reconcile the earlier team command (see details.commandId) before a new change. - `COHORT_ACTIVE_REQUIRED` (HTTP 409): Only an active cohort can create a new candidate snapshot. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_CHANGED` (HTTP 409): The current cohort cut changed. Restart this read from the first page. Restart the paginated read from the first page. - `COHORT_READ_REQUIRES_ACTIVE` (HTTP 409): Only an active cohort has a current care-facts view. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_NEEDS_RECONCILIATION` (HTTP 409): The cohort cut needs reconciliation before its care facts can be read. Read the current state with the matching get operation, then decide again. - `PROGRAM_NEW_ASSESSMENT_REQUIRED` (HTTP 409): Select a new eligible assessment recorded after the last participation change. Read the current state with the matching get operation, then decide again. - `CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED` (HTTP 409): The proposed terms change component identities already fixed by an accepted close. Read the current state with the matching get operation, then decide again. - `MINOR_UNIT_SCALE_MISMATCH` (HTTP 400): A component's money is not in the minor units of its currency (ISO 4217). Write each component's money in the minor units of its currency (minorUnitScale 2 for COP, PEN, MXN and BRL; 0 for CLP) and propose again. - `INVOICE_COMPONENT_AMBIGUOUS` (HTTP 409): Invoice lines have no unique fee-for-service component. Route the lines in details.lineIds to their paying component, then request the proposal again. At most 100 identifiers are returned. - `SITE_SUBSTITUTION_REFUSED` (HTTP 409): The contract does not let this site serve for the contracted site as booked. Book at the contracted site, or at a site its contract lets serve for it on the appointment's day (listContractSites), recording what details.reason says is missing: the patient's acceptance or the payer's authorization. - `RESOURCE_LIMIT_EXCEEDED` (HTTP 422): This resource has reached its supported capacity. Do not retry. Reduce the request or archive records first. - `MODULE_NOT_CONTRACTED` (HTTP 422): The organization did not contract this module. Leave the module in details.module off: the organization did not contract it. Árbol adds it to the contract when the organization buys it. - `MODULE_REQUIREMENT_MISSING` (HTTP 422): This module needs one of the modules it requires to be on. Turn on, in the same request, one of the modules the module in details.module requires (getOrganizationModules lists them). - `CAPABILITY_NOT_CONFIGURED` (HTTP 422): This operation requires its governed native implementation before it can be activated. Do not retry. The capability is not enabled for this organization. - `INSTALLATION_NOT_READY` (HTTP 422): The installation cannot be activated: its app version is not certified or a credential its app declares is missing. Do not retry unchanged. Wait for a certified app version, record examples that cover every operation and change of a custom-http installation, or add the missing credentials to the deployment, then activate again. - `EVIDENCE_NOT_READABLE` (HTTP 422): Accepting evidence requires readable content and independent reporter provenance. Leave it pending until its source is readable. Leave the evidence pending until its source content is readable. - `ANALYTICS_QUERY_LIMIT` (HTTP 422): The query exceeded its bounded work, memory or output budget. Narrow the query. Narrow the query (filters, columns or range) and retry. - `COMMIT_UNCERTAIN` (HTTP 503): The commit outcome is unknown. Reconcile before retrying. The write may have happened. Repeat it with the same requestKey or read the record first. - `DATABASE_UNAVAILABLE` (HTTP 503): The database is unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `PIPELINE_UNAVAILABLE` (HTTP 503): The pipeline is unavailable. Reconcile using the same request key. The write may have happened. Repeat it with the same requestKey or read the record first. - `ASSISTANT_UNAVAILABLE` (HTTP 503): The assistant is not available for this workspace. Do not retry. The capability is not enabled for this organization. - `SERVICE_BUSY` (HTTP 503): The service is handling its current request limit. Retry later with backoff; for a write, reuse the same requestKey. - `INVALID_CONFIGURATION` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support. - `INTERNAL` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support.
    - one of `"UNAUTHORIZED"`, `"AUTHENTICATION_UNAVAILABLE"`, `"ACCESS_DENIED"`, `"MODULE_DISABLED"`, `"INVALID_INPUT"`, `"USER_PAYMENT_REFUSED"`, `"INVALID_INVENTORY"`, `"ANALYTICS_QUERY_REJECTED"`, `"BODY_TOO_LARGE"`, `"NOT_FOUND"`, `"METHOD_NOT_ALLOWED"`, `"CONFLICT"`, `"IDEMPOTENCY_CONFLICT"`, `"TRANSACTION_ABORTED"`, `"INVENTORY_INTEGRITY_CONFLICT"`, `"TEAM_PRIOR_UNRESOLVED"`, `"COHORT_ACTIVE_REQUIRED"`, `"COHORT_CUT_CHANGED"`, `"COHORT_READ_REQUIRES_ACTIVE"`, `"COHORT_CUT_NEEDS_RECONCILIATION"`, `"PROGRAM_NEW_ASSESSMENT_REQUIRED"`, `"CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED"`, `"MINOR_UNIT_SCALE_MISMATCH"`, `"INVOICE_COMPONENT_AMBIGUOUS"`, `"SITE_SUBSTITUTION_REFUSED"`, `"RESOURCE_LIMIT_EXCEEDED"`, `"MODULE_NOT_CONTRACTED"`, `"MODULE_REQUIREMENT_MISSING"`, `"CAPABILITY_NOT_CONFIGURED"`, `"INSTALLATION_NOT_READY"`, `"EVIDENCE_NOT_READABLE"`, `"ANALYTICS_QUERY_LIMIT"`, `"COMMIT_UNCERTAIN"`, `"DATABASE_UNAVAILABLE"`, `"PIPELINE_UNAVAILABLE"`, `"ASSISTANT_UNAVAILABLE"`, `"SERVICE_BUSY"`, `"INVALID_CONFIGURATION"`, `"INTERNAL"`; example `"INVALID_INPUT"`
  - `message` (`draftPayerReport.response.422.error.message`; string, required) — Fixed English explanation for people; it may change without notice.
  - `details` (`draftPayerReport.response.422.error.details`; object, optional) — Extra data for the codes that need it; absent for every other code.
    - `commandId` (`draftPayerReport.response.422.error.details.commandId`; string, optional) — Identifier (`tcm_` prefix) of the earlier team command to reconcile before retrying.
    - `lineIds` (`draftPayerReport.response.422.error.details.lineIds`; array<string>, optional) — Unassigned invoice lines that prevent a unique component proposal; at most 100.
    - `module` (`draftPayerReport.response.422.error.details.module`; string, optional) — The module the failure is about, for example `agenda`.
      - one of `"pgp"`, `"capitation"`, `"fee_for_service"`, `"results_payment"`, `"service_record"`, `"cac"`, `"cohorts"`, `"studies"`, `"agenda"`, `"voice"`, `"whatsapp"`, `"sms"`, `"email"`, `"arbi"`, `"ai_documents"`, `"ai_care"`, `"analytics"`
    - `paymentProblem` (`draftPayerReport.response.422.error.details.paymentProblem`; string, optional) — Why the collection was refused.
      - one of `"rules_unavailable"`, `"not_collectable"`, `"not_for_this_person"`, `"basis_incomplete"`, `"moderator_fee_value"`, `"service_value_unavailable"`, `"above_share"`, `"above_event_cap"`, `"above_year_cap"`
    - `reason` (`draftPayerReport.response.422.error.details.reason`; string, optional) — Why the booking's site was refused: `not_contracted` (the contracted site is not one of the contract that day), `not_a_substitute` (no substitution in force that day lets the site serve for it), `patient_acceptance_missing` or `payer_authorization_missing` (the substitution asks for them).
      - one of `"not_contracted"`, `"not_a_substitute"`, `"patient_acceptance_missing"`, `"payer_authorization_missing"`
- `metadata` (`draftPayerReport.response.422.metadata`; object, required) — Request metadata, including the request identifier.
  - `requestId` (`draftPayerReport.response.422.metadata.requestId`; string, required) — Server-assigned request identifier (opaque). Quote it when reporting a problem.
- `success` (`draftPayerReport.response.422.success`; boolean, required) — Always `false` in a failure envelope.
  - one of `false`

### 500

Failure. The `error.code` is one of:
- `INVALID_CONFIGURATION`: Retry once later; if it persists, report the requestId to support.
- `INTERNAL`: Retry once later; if it persists, report the requestId to support.

#### Example

```json
{
  "error": {
    "code": "INVALID_CONFIGURATION",
    "message": "The request could not be completed."
  },
  "metadata": {
    "requestId": "3f2b8c1e-5d4a-4b6f-9c2e-0a1b2c3d4e5f"
  },
  "success": false
}
```

- `error` (`draftPayerReport.response.500.error`; object, required) — The stable failure code, its message and optional details.
  - `code` (`draftPayerReport.response.500.error.code`; string, required) — Stable failure code. Branch on this value, never on `message`. - `UNAUTHORIZED` (HTTP 401): A valid access token is required. Obtain a fresh access token and repeat the request. - `AUTHENTICATION_UNAVAILABLE` (HTTP 503): Identity verification is temporarily unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `ACCESS_DENIED` (HTTP 403): Access denied. Do not retry. The signed-in actor lacks this purpose or grant; ask an administrator. - `MODULE_DISABLED` (HTTP 403): This operation belongs to a module the organization does not use. Do not retry. The organization does not use the module in details.module (getSession lists the ones it uses); an administrator turns it on with setOrganizationModules. - `INVALID_INPUT` (HTTP 400): The request does not match the documented contract. Do not retry unchanged. Fix the request against the operation's schema. - `USER_PAYMENT_REFUSED` (HTTP 400): The collection exceeds the applicable payment rules. Check the collection basis and caps in details.paymentProblem before recording the payment. - `INVALID_INVENTORY` (HTTP 400): The content does not match the selected inventory contract. Do not retry unchanged. Fix the request against the operation's schema. - `ANALYTICS_QUERY_REJECTED` (HTTP 400): Use one read-only query over the admitted catalog and its supported functions. Rewrite the query as one read-only statement over the published catalog. - `BODY_TOO_LARGE` (HTTP 413): The request body exceeds the supported limit. Send a smaller body, or split the content into several requests. - `NOT_FOUND` (HTTP 404): The resource does not exist. Check the identifier. The record may not exist or may not be visible to this actor. - `METHOD_NOT_ALLOWED` (HTTP 405): The method is not supported for this resource. Use the HTTP method documented for this path. - `CONFLICT` (HTTP 409): The resource conflicts with its current state. Read the current state with the matching get operation, then decide again. - `IDEMPOTENCY_CONFLICT` (HTTP 409): The command key already identifies a different request. The requestKey was already used for a different request. Use a new key for a new action. - `TRANSACTION_ABORTED` (HTTP 409): The transaction rolled back without committing changes. Nothing was written. Retry the same request. - `INVENTORY_INTEGRITY_CONFLICT` (HTTP 409): The current build failed integrity verification. Do not retry. Report the integrity failure to an operator. - `TEAM_PRIOR_UNRESOLVED` (HTTP 409): Reconcile the existing team command before preparing another change. Reconcile the earlier team command (see details.commandId) before a new change. - `COHORT_ACTIVE_REQUIRED` (HTTP 409): Only an active cohort can create a new candidate snapshot. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_CHANGED` (HTTP 409): The current cohort cut changed. Restart this read from the first page. Restart the paginated read from the first page. - `COHORT_READ_REQUIRES_ACTIVE` (HTTP 409): Only an active cohort has a current care-facts view. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_NEEDS_RECONCILIATION` (HTTP 409): The cohort cut needs reconciliation before its care facts can be read. Read the current state with the matching get operation, then decide again. - `PROGRAM_NEW_ASSESSMENT_REQUIRED` (HTTP 409): Select a new eligible assessment recorded after the last participation change. Read the current state with the matching get operation, then decide again. - `CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED` (HTTP 409): The proposed terms change component identities already fixed by an accepted close. Read the current state with the matching get operation, then decide again. - `MINOR_UNIT_SCALE_MISMATCH` (HTTP 400): A component's money is not in the minor units of its currency (ISO 4217). Write each component's money in the minor units of its currency (minorUnitScale 2 for COP, PEN, MXN and BRL; 0 for CLP) and propose again. - `INVOICE_COMPONENT_AMBIGUOUS` (HTTP 409): Invoice lines have no unique fee-for-service component. Route the lines in details.lineIds to their paying component, then request the proposal again. At most 100 identifiers are returned. - `SITE_SUBSTITUTION_REFUSED` (HTTP 409): The contract does not let this site serve for the contracted site as booked. Book at the contracted site, or at a site its contract lets serve for it on the appointment's day (listContractSites), recording what details.reason says is missing: the patient's acceptance or the payer's authorization. - `RESOURCE_LIMIT_EXCEEDED` (HTTP 422): This resource has reached its supported capacity. Do not retry. Reduce the request or archive records first. - `MODULE_NOT_CONTRACTED` (HTTP 422): The organization did not contract this module. Leave the module in details.module off: the organization did not contract it. Árbol adds it to the contract when the organization buys it. - `MODULE_REQUIREMENT_MISSING` (HTTP 422): This module needs one of the modules it requires to be on. Turn on, in the same request, one of the modules the module in details.module requires (getOrganizationModules lists them). - `CAPABILITY_NOT_CONFIGURED` (HTTP 422): This operation requires its governed native implementation before it can be activated. Do not retry. The capability is not enabled for this organization. - `INSTALLATION_NOT_READY` (HTTP 422): The installation cannot be activated: its app version is not certified or a credential its app declares is missing. Do not retry unchanged. Wait for a certified app version, record examples that cover every operation and change of a custom-http installation, or add the missing credentials to the deployment, then activate again. - `EVIDENCE_NOT_READABLE` (HTTP 422): Accepting evidence requires readable content and independent reporter provenance. Leave it pending until its source is readable. Leave the evidence pending until its source content is readable. - `ANALYTICS_QUERY_LIMIT` (HTTP 422): The query exceeded its bounded work, memory or output budget. Narrow the query. Narrow the query (filters, columns or range) and retry. - `COMMIT_UNCERTAIN` (HTTP 503): The commit outcome is unknown. Reconcile before retrying. The write may have happened. Repeat it with the same requestKey or read the record first. - `DATABASE_UNAVAILABLE` (HTTP 503): The database is unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `PIPELINE_UNAVAILABLE` (HTTP 503): The pipeline is unavailable. Reconcile using the same request key. The write may have happened. Repeat it with the same requestKey or read the record first. - `ASSISTANT_UNAVAILABLE` (HTTP 503): The assistant is not available for this workspace. Do not retry. The capability is not enabled for this organization. - `SERVICE_BUSY` (HTTP 503): The service is handling its current request limit. Retry later with backoff; for a write, reuse the same requestKey. - `INVALID_CONFIGURATION` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support. - `INTERNAL` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support.
    - one of `"UNAUTHORIZED"`, `"AUTHENTICATION_UNAVAILABLE"`, `"ACCESS_DENIED"`, `"MODULE_DISABLED"`, `"INVALID_INPUT"`, `"USER_PAYMENT_REFUSED"`, `"INVALID_INVENTORY"`, `"ANALYTICS_QUERY_REJECTED"`, `"BODY_TOO_LARGE"`, `"NOT_FOUND"`, `"METHOD_NOT_ALLOWED"`, `"CONFLICT"`, `"IDEMPOTENCY_CONFLICT"`, `"TRANSACTION_ABORTED"`, `"INVENTORY_INTEGRITY_CONFLICT"`, `"TEAM_PRIOR_UNRESOLVED"`, `"COHORT_ACTIVE_REQUIRED"`, `"COHORT_CUT_CHANGED"`, `"COHORT_READ_REQUIRES_ACTIVE"`, `"COHORT_CUT_NEEDS_RECONCILIATION"`, `"PROGRAM_NEW_ASSESSMENT_REQUIRED"`, `"CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED"`, `"MINOR_UNIT_SCALE_MISMATCH"`, `"INVOICE_COMPONENT_AMBIGUOUS"`, `"SITE_SUBSTITUTION_REFUSED"`, `"RESOURCE_LIMIT_EXCEEDED"`, `"MODULE_NOT_CONTRACTED"`, `"MODULE_REQUIREMENT_MISSING"`, `"CAPABILITY_NOT_CONFIGURED"`, `"INSTALLATION_NOT_READY"`, `"EVIDENCE_NOT_READABLE"`, `"ANALYTICS_QUERY_LIMIT"`, `"COMMIT_UNCERTAIN"`, `"DATABASE_UNAVAILABLE"`, `"PIPELINE_UNAVAILABLE"`, `"ASSISTANT_UNAVAILABLE"`, `"SERVICE_BUSY"`, `"INVALID_CONFIGURATION"`, `"INTERNAL"`; example `"INVALID_INPUT"`
  - `message` (`draftPayerReport.response.500.error.message`; string, required) — Fixed English explanation for people; it may change without notice.
  - `details` (`draftPayerReport.response.500.error.details`; object, optional) — Extra data for the codes that need it; absent for every other code.
    - `commandId` (`draftPayerReport.response.500.error.details.commandId`; string, optional) — Identifier (`tcm_` prefix) of the earlier team command to reconcile before retrying.
    - `lineIds` (`draftPayerReport.response.500.error.details.lineIds`; array<string>, optional) — Unassigned invoice lines that prevent a unique component proposal; at most 100.
    - `module` (`draftPayerReport.response.500.error.details.module`; string, optional) — The module the failure is about, for example `agenda`.
      - one of `"pgp"`, `"capitation"`, `"fee_for_service"`, `"results_payment"`, `"service_record"`, `"cac"`, `"cohorts"`, `"studies"`, `"agenda"`, `"voice"`, `"whatsapp"`, `"sms"`, `"email"`, `"arbi"`, `"ai_documents"`, `"ai_care"`, `"analytics"`
    - `paymentProblem` (`draftPayerReport.response.500.error.details.paymentProblem`; string, optional) — Why the collection was refused.
      - one of `"rules_unavailable"`, `"not_collectable"`, `"not_for_this_person"`, `"basis_incomplete"`, `"moderator_fee_value"`, `"service_value_unavailable"`, `"above_share"`, `"above_event_cap"`, `"above_year_cap"`
    - `reason` (`draftPayerReport.response.500.error.details.reason`; string, optional) — Why the booking's site was refused: `not_contracted` (the contracted site is not one of the contract that day), `not_a_substitute` (no substitution in force that day lets the site serve for it), `patient_acceptance_missing` or `payer_authorization_missing` (the substitution asks for them).
      - one of `"not_contracted"`, `"not_a_substitute"`, `"patient_acceptance_missing"`, `"payer_authorization_missing"`
- `metadata` (`draftPayerReport.response.500.metadata`; object, required) — Request metadata, including the request identifier.
  - `requestId` (`draftPayerReport.response.500.metadata.requestId`; string, required) — Server-assigned request identifier (opaque). Quote it when reporting a problem.
- `success` (`draftPayerReport.response.500.success`; boolean, required) — Always `false` in a failure envelope.
  - one of `false`

### 503

Failure. The `error.code` is one of:
- `AUTHENTICATION_UNAVAILABLE`: Retry later with backoff; for a write, reuse the same requestKey.
- `COMMIT_UNCERTAIN`: The write may have happened. Repeat it with the same requestKey or read the record first.
- `DATABASE_UNAVAILABLE`: Retry later with backoff; for a write, reuse the same requestKey.
- `PIPELINE_UNAVAILABLE`: The write may have happened. Repeat it with the same requestKey or read the record first.
- `ASSISTANT_UNAVAILABLE`: Do not retry. The capability is not enabled for this organization.
- `SERVICE_BUSY`: Retry later with backoff; for a write, reuse the same requestKey.

#### Example

```json
{
  "error": {
    "code": "AUTHENTICATION_UNAVAILABLE",
    "message": "Identity verification is temporarily unavailable."
  },
  "metadata": {
    "requestId": "3f2b8c1e-5d4a-4b6f-9c2e-0a1b2c3d4e5f"
  },
  "success": false
}
```

- `error` (`draftPayerReport.response.503.error`; object, required) — The stable failure code, its message and optional details.
  - `code` (`draftPayerReport.response.503.error.code`; string, required) — Stable failure code. Branch on this value, never on `message`. - `UNAUTHORIZED` (HTTP 401): A valid access token is required. Obtain a fresh access token and repeat the request. - `AUTHENTICATION_UNAVAILABLE` (HTTP 503): Identity verification is temporarily unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `ACCESS_DENIED` (HTTP 403): Access denied. Do not retry. The signed-in actor lacks this purpose or grant; ask an administrator. - `MODULE_DISABLED` (HTTP 403): This operation belongs to a module the organization does not use. Do not retry. The organization does not use the module in details.module (getSession lists the ones it uses); an administrator turns it on with setOrganizationModules. - `INVALID_INPUT` (HTTP 400): The request does not match the documented contract. Do not retry unchanged. Fix the request against the operation's schema. - `USER_PAYMENT_REFUSED` (HTTP 400): The collection exceeds the applicable payment rules. Check the collection basis and caps in details.paymentProblem before recording the payment. - `INVALID_INVENTORY` (HTTP 400): The content does not match the selected inventory contract. Do not retry unchanged. Fix the request against the operation's schema. - `ANALYTICS_QUERY_REJECTED` (HTTP 400): Use one read-only query over the admitted catalog and its supported functions. Rewrite the query as one read-only statement over the published catalog. - `BODY_TOO_LARGE` (HTTP 413): The request body exceeds the supported limit. Send a smaller body, or split the content into several requests. - `NOT_FOUND` (HTTP 404): The resource does not exist. Check the identifier. The record may not exist or may not be visible to this actor. - `METHOD_NOT_ALLOWED` (HTTP 405): The method is not supported for this resource. Use the HTTP method documented for this path. - `CONFLICT` (HTTP 409): The resource conflicts with its current state. Read the current state with the matching get operation, then decide again. - `IDEMPOTENCY_CONFLICT` (HTTP 409): The command key already identifies a different request. The requestKey was already used for a different request. Use a new key for a new action. - `TRANSACTION_ABORTED` (HTTP 409): The transaction rolled back without committing changes. Nothing was written. Retry the same request. - `INVENTORY_INTEGRITY_CONFLICT` (HTTP 409): The current build failed integrity verification. Do not retry. Report the integrity failure to an operator. - `TEAM_PRIOR_UNRESOLVED` (HTTP 409): Reconcile the existing team command before preparing another change. Reconcile the earlier team command (see details.commandId) before a new change. - `COHORT_ACTIVE_REQUIRED` (HTTP 409): Only an active cohort can create a new candidate snapshot. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_CHANGED` (HTTP 409): The current cohort cut changed. Restart this read from the first page. Restart the paginated read from the first page. - `COHORT_READ_REQUIRES_ACTIVE` (HTTP 409): Only an active cohort has a current care-facts view. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_NEEDS_RECONCILIATION` (HTTP 409): The cohort cut needs reconciliation before its care facts can be read. Read the current state with the matching get operation, then decide again. - `PROGRAM_NEW_ASSESSMENT_REQUIRED` (HTTP 409): Select a new eligible assessment recorded after the last participation change. Read the current state with the matching get operation, then decide again. - `CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED` (HTTP 409): The proposed terms change component identities already fixed by an accepted close. Read the current state with the matching get operation, then decide again. - `MINOR_UNIT_SCALE_MISMATCH` (HTTP 400): A component's money is not in the minor units of its currency (ISO 4217). Write each component's money in the minor units of its currency (minorUnitScale 2 for COP, PEN, MXN and BRL; 0 for CLP) and propose again. - `INVOICE_COMPONENT_AMBIGUOUS` (HTTP 409): Invoice lines have no unique fee-for-service component. Route the lines in details.lineIds to their paying component, then request the proposal again. At most 100 identifiers are returned. - `SITE_SUBSTITUTION_REFUSED` (HTTP 409): The contract does not let this site serve for the contracted site as booked. Book at the contracted site, or at a site its contract lets serve for it on the appointment's day (listContractSites), recording what details.reason says is missing: the patient's acceptance or the payer's authorization. - `RESOURCE_LIMIT_EXCEEDED` (HTTP 422): This resource has reached its supported capacity. Do not retry. Reduce the request or archive records first. - `MODULE_NOT_CONTRACTED` (HTTP 422): The organization did not contract this module. Leave the module in details.module off: the organization did not contract it. Árbol adds it to the contract when the organization buys it. - `MODULE_REQUIREMENT_MISSING` (HTTP 422): This module needs one of the modules it requires to be on. Turn on, in the same request, one of the modules the module in details.module requires (getOrganizationModules lists them). - `CAPABILITY_NOT_CONFIGURED` (HTTP 422): This operation requires its governed native implementation before it can be activated. Do not retry. The capability is not enabled for this organization. - `INSTALLATION_NOT_READY` (HTTP 422): The installation cannot be activated: its app version is not certified or a credential its app declares is missing. Do not retry unchanged. Wait for a certified app version, record examples that cover every operation and change of a custom-http installation, or add the missing credentials to the deployment, then activate again. - `EVIDENCE_NOT_READABLE` (HTTP 422): Accepting evidence requires readable content and independent reporter provenance. Leave it pending until its source is readable. Leave the evidence pending until its source content is readable. - `ANALYTICS_QUERY_LIMIT` (HTTP 422): The query exceeded its bounded work, memory or output budget. Narrow the query. Narrow the query (filters, columns or range) and retry. - `COMMIT_UNCERTAIN` (HTTP 503): The commit outcome is unknown. Reconcile before retrying. The write may have happened. Repeat it with the same requestKey or read the record first. - `DATABASE_UNAVAILABLE` (HTTP 503): The database is unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `PIPELINE_UNAVAILABLE` (HTTP 503): The pipeline is unavailable. Reconcile using the same request key. The write may have happened. Repeat it with the same requestKey or read the record first. - `ASSISTANT_UNAVAILABLE` (HTTP 503): The assistant is not available for this workspace. Do not retry. The capability is not enabled for this organization. - `SERVICE_BUSY` (HTTP 503): The service is handling its current request limit. Retry later with backoff; for a write, reuse the same requestKey. - `INVALID_CONFIGURATION` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support. - `INTERNAL` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support.
    - one of `"UNAUTHORIZED"`, `"AUTHENTICATION_UNAVAILABLE"`, `"ACCESS_DENIED"`, `"MODULE_DISABLED"`, `"INVALID_INPUT"`, `"USER_PAYMENT_REFUSED"`, `"INVALID_INVENTORY"`, `"ANALYTICS_QUERY_REJECTED"`, `"BODY_TOO_LARGE"`, `"NOT_FOUND"`, `"METHOD_NOT_ALLOWED"`, `"CONFLICT"`, `"IDEMPOTENCY_CONFLICT"`, `"TRANSACTION_ABORTED"`, `"INVENTORY_INTEGRITY_CONFLICT"`, `"TEAM_PRIOR_UNRESOLVED"`, `"COHORT_ACTIVE_REQUIRED"`, `"COHORT_CUT_CHANGED"`, `"COHORT_READ_REQUIRES_ACTIVE"`, `"COHORT_CUT_NEEDS_RECONCILIATION"`, `"PROGRAM_NEW_ASSESSMENT_REQUIRED"`, `"CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED"`, `"MINOR_UNIT_SCALE_MISMATCH"`, `"INVOICE_COMPONENT_AMBIGUOUS"`, `"SITE_SUBSTITUTION_REFUSED"`, `"RESOURCE_LIMIT_EXCEEDED"`, `"MODULE_NOT_CONTRACTED"`, `"MODULE_REQUIREMENT_MISSING"`, `"CAPABILITY_NOT_CONFIGURED"`, `"INSTALLATION_NOT_READY"`, `"EVIDENCE_NOT_READABLE"`, `"ANALYTICS_QUERY_LIMIT"`, `"COMMIT_UNCERTAIN"`, `"DATABASE_UNAVAILABLE"`, `"PIPELINE_UNAVAILABLE"`, `"ASSISTANT_UNAVAILABLE"`, `"SERVICE_BUSY"`, `"INVALID_CONFIGURATION"`, `"INTERNAL"`; example `"INVALID_INPUT"`
  - `message` (`draftPayerReport.response.503.error.message`; string, required) — Fixed English explanation for people; it may change without notice.
  - `details` (`draftPayerReport.response.503.error.details`; object, optional) — Extra data for the codes that need it; absent for every other code.
    - `commandId` (`draftPayerReport.response.503.error.details.commandId`; string, optional) — Identifier (`tcm_` prefix) of the earlier team command to reconcile before retrying.
    - `lineIds` (`draftPayerReport.response.503.error.details.lineIds`; array<string>, optional) — Unassigned invoice lines that prevent a unique component proposal; at most 100.
    - `module` (`draftPayerReport.response.503.error.details.module`; string, optional) — The module the failure is about, for example `agenda`.
      - one of `"pgp"`, `"capitation"`, `"fee_for_service"`, `"results_payment"`, `"service_record"`, `"cac"`, `"cohorts"`, `"studies"`, `"agenda"`, `"voice"`, `"whatsapp"`, `"sms"`, `"email"`, `"arbi"`, `"ai_documents"`, `"ai_care"`, `"analytics"`
    - `paymentProblem` (`draftPayerReport.response.503.error.details.paymentProblem`; string, optional) — Why the collection was refused.
      - one of `"rules_unavailable"`, `"not_collectable"`, `"not_for_this_person"`, `"basis_incomplete"`, `"moderator_fee_value"`, `"service_value_unavailable"`, `"above_share"`, `"above_event_cap"`, `"above_year_cap"`
    - `reason` (`draftPayerReport.response.503.error.details.reason`; string, optional) — Why the booking's site was refused: `not_contracted` (the contracted site is not one of the contract that day), `not_a_substitute` (no substitution in force that day lets the site serve for it), `patient_acceptance_missing` or `payer_authorization_missing` (the substitution asks for them).
      - one of `"not_contracted"`, `"not_a_substitute"`, `"patient_acceptance_missing"`, `"payer_authorization_missing"`
- `metadata` (`draftPayerReport.response.503.metadata`; object, required) — Request metadata, including the request identifier.
  - `requestId` (`draftPayerReport.response.503.metadata.requestId`; string, required) — Server-assigned request identifier (opaque). Quote it when reporting a problem.
- `success` (`draftPayerReport.response.503.success`; boolean, required) — Always `false` in a failure envelope.
  - one of `false`

### default

#### Example

```json
{
  "error": {
    "code": "INVALID_INPUT",
    "details": {
      "commandId": "string",
      "lineIds": [
        "string"
      ],
      "module": "pgp",
      "paymentProblem": "rules_unavailable",
      "reason": "not_contracted"
    },
    "message": "string"
  },
  "metadata": {
    "requestId": "string"
  },
  "success": false
}
```

- `error` (`draftPayerReport.response.default.error`; object, required) — The stable failure code, its message and optional details.
  - `code` (`draftPayerReport.response.default.error.code`; string, required) — Stable failure code. Branch on this value, never on `message`. - `UNAUTHORIZED` (HTTP 401): A valid access token is required. Obtain a fresh access token and repeat the request. - `AUTHENTICATION_UNAVAILABLE` (HTTP 503): Identity verification is temporarily unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `ACCESS_DENIED` (HTTP 403): Access denied. Do not retry. The signed-in actor lacks this purpose or grant; ask an administrator. - `MODULE_DISABLED` (HTTP 403): This operation belongs to a module the organization does not use. Do not retry. The organization does not use the module in details.module (getSession lists the ones it uses); an administrator turns it on with setOrganizationModules. - `INVALID_INPUT` (HTTP 400): The request does not match the documented contract. Do not retry unchanged. Fix the request against the operation's schema. - `USER_PAYMENT_REFUSED` (HTTP 400): The collection exceeds the applicable payment rules. Check the collection basis and caps in details.paymentProblem before recording the payment. - `INVALID_INVENTORY` (HTTP 400): The content does not match the selected inventory contract. Do not retry unchanged. Fix the request against the operation's schema. - `ANALYTICS_QUERY_REJECTED` (HTTP 400): Use one read-only query over the admitted catalog and its supported functions. Rewrite the query as one read-only statement over the published catalog. - `BODY_TOO_LARGE` (HTTP 413): The request body exceeds the supported limit. Send a smaller body, or split the content into several requests. - `NOT_FOUND` (HTTP 404): The resource does not exist. Check the identifier. The record may not exist or may not be visible to this actor. - `METHOD_NOT_ALLOWED` (HTTP 405): The method is not supported for this resource. Use the HTTP method documented for this path. - `CONFLICT` (HTTP 409): The resource conflicts with its current state. Read the current state with the matching get operation, then decide again. - `IDEMPOTENCY_CONFLICT` (HTTP 409): The command key already identifies a different request. The requestKey was already used for a different request. Use a new key for a new action. - `TRANSACTION_ABORTED` (HTTP 409): The transaction rolled back without committing changes. Nothing was written. Retry the same request. - `INVENTORY_INTEGRITY_CONFLICT` (HTTP 409): The current build failed integrity verification. Do not retry. Report the integrity failure to an operator. - `TEAM_PRIOR_UNRESOLVED` (HTTP 409): Reconcile the existing team command before preparing another change. Reconcile the earlier team command (see details.commandId) before a new change. - `COHORT_ACTIVE_REQUIRED` (HTTP 409): Only an active cohort can create a new candidate snapshot. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_CHANGED` (HTTP 409): The current cohort cut changed. Restart this read from the first page. Restart the paginated read from the first page. - `COHORT_READ_REQUIRES_ACTIVE` (HTTP 409): Only an active cohort has a current care-facts view. Read the current state with the matching get operation, then decide again. - `COHORT_CUT_NEEDS_RECONCILIATION` (HTTP 409): The cohort cut needs reconciliation before its care facts can be read. Read the current state with the matching get operation, then decide again. - `PROGRAM_NEW_ASSESSMENT_REQUIRED` (HTTP 409): Select a new eligible assessment recorded after the last participation change. Read the current state with the matching get operation, then decide again. - `CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED` (HTTP 409): The proposed terms change component identities already fixed by an accepted close. Read the current state with the matching get operation, then decide again. - `MINOR_UNIT_SCALE_MISMATCH` (HTTP 400): A component's money is not in the minor units of its currency (ISO 4217). Write each component's money in the minor units of its currency (minorUnitScale 2 for COP, PEN, MXN and BRL; 0 for CLP) and propose again. - `INVOICE_COMPONENT_AMBIGUOUS` (HTTP 409): Invoice lines have no unique fee-for-service component. Route the lines in details.lineIds to their paying component, then request the proposal again. At most 100 identifiers are returned. - `SITE_SUBSTITUTION_REFUSED` (HTTP 409): The contract does not let this site serve for the contracted site as booked. Book at the contracted site, or at a site its contract lets serve for it on the appointment's day (listContractSites), recording what details.reason says is missing: the patient's acceptance or the payer's authorization. - `RESOURCE_LIMIT_EXCEEDED` (HTTP 422): This resource has reached its supported capacity. Do not retry. Reduce the request or archive records first. - `MODULE_NOT_CONTRACTED` (HTTP 422): The organization did not contract this module. Leave the module in details.module off: the organization did not contract it. Árbol adds it to the contract when the organization buys it. - `MODULE_REQUIREMENT_MISSING` (HTTP 422): This module needs one of the modules it requires to be on. Turn on, in the same request, one of the modules the module in details.module requires (getOrganizationModules lists them). - `CAPABILITY_NOT_CONFIGURED` (HTTP 422): This operation requires its governed native implementation before it can be activated. Do not retry. The capability is not enabled for this organization. - `INSTALLATION_NOT_READY` (HTTP 422): The installation cannot be activated: its app version is not certified or a credential its app declares is missing. Do not retry unchanged. Wait for a certified app version, record examples that cover every operation and change of a custom-http installation, or add the missing credentials to the deployment, then activate again. - `EVIDENCE_NOT_READABLE` (HTTP 422): Accepting evidence requires readable content and independent reporter provenance. Leave it pending until its source is readable. Leave the evidence pending until its source content is readable. - `ANALYTICS_QUERY_LIMIT` (HTTP 422): The query exceeded its bounded work, memory or output budget. Narrow the query. Narrow the query (filters, columns or range) and retry. - `COMMIT_UNCERTAIN` (HTTP 503): The commit outcome is unknown. Reconcile before retrying. The write may have happened. Repeat it with the same requestKey or read the record first. - `DATABASE_UNAVAILABLE` (HTTP 503): The database is unavailable. Retry later with backoff; for a write, reuse the same requestKey. - `PIPELINE_UNAVAILABLE` (HTTP 503): The pipeline is unavailable. Reconcile using the same request key. The write may have happened. Repeat it with the same requestKey or read the record first. - `ASSISTANT_UNAVAILABLE` (HTTP 503): The assistant is not available for this workspace. Do not retry. The capability is not enabled for this organization. - `SERVICE_BUSY` (HTTP 503): The service is handling its current request limit. Retry later with backoff; for a write, reuse the same requestKey. - `INVALID_CONFIGURATION` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support. - `INTERNAL` (HTTP 500): The request could not be completed. Retry once later; if it persists, report the requestId to support.
    - one of `"UNAUTHORIZED"`, `"AUTHENTICATION_UNAVAILABLE"`, `"ACCESS_DENIED"`, `"MODULE_DISABLED"`, `"INVALID_INPUT"`, `"USER_PAYMENT_REFUSED"`, `"INVALID_INVENTORY"`, `"ANALYTICS_QUERY_REJECTED"`, `"BODY_TOO_LARGE"`, `"NOT_FOUND"`, `"METHOD_NOT_ALLOWED"`, `"CONFLICT"`, `"IDEMPOTENCY_CONFLICT"`, `"TRANSACTION_ABORTED"`, `"INVENTORY_INTEGRITY_CONFLICT"`, `"TEAM_PRIOR_UNRESOLVED"`, `"COHORT_ACTIVE_REQUIRED"`, `"COHORT_CUT_CHANGED"`, `"COHORT_READ_REQUIRES_ACTIVE"`, `"COHORT_CUT_NEEDS_RECONCILIATION"`, `"PROGRAM_NEW_ASSESSMENT_REQUIRED"`, `"CONTRACT_CLOSED_WINDOW_CHANGE_UNSUPPORTED"`, `"MINOR_UNIT_SCALE_MISMATCH"`, `"INVOICE_COMPONENT_AMBIGUOUS"`, `"SITE_SUBSTITUTION_REFUSED"`, `"RESOURCE_LIMIT_EXCEEDED"`, `"MODULE_NOT_CONTRACTED"`, `"MODULE_REQUIREMENT_MISSING"`, `"CAPABILITY_NOT_CONFIGURED"`, `"INSTALLATION_NOT_READY"`, `"EVIDENCE_NOT_READABLE"`, `"ANALYTICS_QUERY_LIMIT"`, `"COMMIT_UNCERTAIN"`, `"DATABASE_UNAVAILABLE"`, `"PIPELINE_UNAVAILABLE"`, `"ASSISTANT_UNAVAILABLE"`, `"SERVICE_BUSY"`, `"INVALID_CONFIGURATION"`, `"INTERNAL"`; example `"INVALID_INPUT"`
  - `message` (`draftPayerReport.response.default.error.message`; string, required) — Fixed English explanation for people; it may change without notice.
  - `details` (`draftPayerReport.response.default.error.details`; object, optional) — Extra data for the codes that need it; absent for every other code.
    - `commandId` (`draftPayerReport.response.default.error.details.commandId`; string, optional) — Identifier (`tcm_` prefix) of the earlier team command to reconcile before retrying.
    - `lineIds` (`draftPayerReport.response.default.error.details.lineIds`; array<string>, optional) — Unassigned invoice lines that prevent a unique component proposal; at most 100.
    - `module` (`draftPayerReport.response.default.error.details.module`; string, optional) — The module the failure is about, for example `agenda`.
      - one of `"pgp"`, `"capitation"`, `"fee_for_service"`, `"results_payment"`, `"service_record"`, `"cac"`, `"cohorts"`, `"studies"`, `"agenda"`, `"voice"`, `"whatsapp"`, `"sms"`, `"email"`, `"arbi"`, `"ai_documents"`, `"ai_care"`, `"analytics"`
    - `paymentProblem` (`draftPayerReport.response.default.error.details.paymentProblem`; string, optional) — Why the collection was refused.
      - one of `"rules_unavailable"`, `"not_collectable"`, `"not_for_this_person"`, `"basis_incomplete"`, `"moderator_fee_value"`, `"service_value_unavailable"`, `"above_share"`, `"above_event_cap"`, `"above_year_cap"`
    - `reason` (`draftPayerReport.response.default.error.details.reason`; string, optional) — Why the booking's site was refused: `not_contracted` (the contracted site is not one of the contract that day), `not_a_substitute` (no substitution in force that day lets the site serve for it), `patient_acceptance_missing` or `payer_authorization_missing` (the substitution asks for them).
      - one of `"not_contracted"`, `"not_a_substitute"`, `"patient_acceptance_missing"`, `"payer_authorization_missing"`
- `metadata` (`draftPayerReport.response.default.metadata`; object, required) — Request metadata, including the request identifier.
  - `requestId` (`draftPayerReport.response.default.metadata.requestId`; string, required) — Server-assigned request identifier (opaque). Quote it when reporting a problem.
- `success` (`draftPayerReport.response.default.success`; boolean, required) — Always `false` in a failure envelope.
  - one of `false`


Source: https://docs.getarbol.com/api/ambar/draft-payer-report/index.md
