{"openapi":"3.0.0","paths":{"/":{"get":{"operationId":"AppController_getHello","parameters":[],"responses":{"200":{"description":""}},"tags":["App"],"x-public":true}},"/docs":{"get":{"operationId":"AppController_getApiDocs","parameters":[],"responses":{"200":{"description":""}},"tags":["App"],"x-public":true}},"/version":{"get":{"operationId":"AppController_getVersion","parameters":[],"responses":{"200":{"description":""}},"tags":["App"],"x-public":true}},"/auth/login":{"post":{"operationId":"AuthController_login","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginDto"}}}},"responses":{"201":{"description":""}},"tags":["Auth"],"x-public":true}},"/v1/me":{"get":{"operationId":"Auth.me","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Get the current principal","tags":["Auth"],"x-required-scopes":["auth:read"]}},"/v1/me/orgs":{"get":{"description":"A user principal gets every live org membership, ordered by org name, with `is_current` on the org this request acts in (selected with the `X-Org-Id` header). An API key is bound to one org, so it gets that single org with `role: null` and `is_current: true`.","operationId":"Auth.myOrgs","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/MeOrgMembershipV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List the orgs the caller can act in","tags":["Auth"],"x-pagination":{"mode":"none","reason":"a user's own org memberships; only Spark staff hold more than one","bound":"a handful of rows per user"},"x-required-scopes":["auth:read"]}},"/v1/connector/clients/{client_id}":{"get":{"description":"Returns an OAuth client's name, its registered redirect URIs and whether it may connect as an AI connector (every redirect URI is on the allowlist). An unknown client, or one that cannot be verified, returns `allowed: false` rather than 404.","operationId":"ConnectorClients.get","parameters":[{"name":"client_id","required":true,"in":"path","description":"The OAuth client id.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ConnectorClientV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Check whether an OAuth client may connect","tags":["Auth"],"x-connector-forbidden":true,"x-error-codes":[],"x-required-scopes":["org:read"]}},"/v1/connector-confirmations/{id}":{"get":{"description":"Returns a confirmation an AI connector asked the signed-in person for: what the call would do (`summary`), its status and when it expires. Only the person it was issued to can read it; any other id is 404. Refused to AI connector tokens.","operationId":"ConnectorConfirmations.get","parameters":[{"name":"id","required":true,"in":"path","description":"The confirmation id from `MCP_CONFIRMATION_REQUIRED`.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ConnectorConfirmationV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: MCP_CONFIRMATION_SELF","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a connector confirmation","tags":["Auth"],"x-connector-forbidden":true,"x-error-codes":["NOT_FOUND","MCP_CONFIRMATION_SELF"],"x-required-scopes":["org:read"]}},"/v1/connector-confirmations/{id}/confirm":{"post":{"description":"The signed-in person confirms one high-risk call their AI connector asked to make. Nothing runs here: the connector then re-sends the identical call with `X-Connector-Confirmation`, which runs it once. Only a pending, unexpired confirmation of the caller's own can be confirmed (`MCP_CONFIRMATION_INVALID` otherwise); any other id is 404. Refused to AI connector tokens.","operationId":"ConnectorConfirmations.confirm","parameters":[{"name":"id","required":true,"in":"path","description":"The confirmation id from `MCP_CONFIRMATION_REQUIRED`.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ConnectorConfirmationV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: MCP_CONFIRMATION_SELF","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: MCP_CONFIRMATION_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Confirm a connector confirmation","tags":["Auth"],"x-connector-forbidden":true,"x-error-codes":["NOT_FOUND","MCP_CONFIRMATION_INVALID","MCP_CONFIRMATION_SELF"],"x-required-scopes":["org:read"]}},"/v1/connector-confirmations/{id}/decline":{"post":{"description":"The signed-in person declines one high-risk call their AI connector asked to make; the connector's re-send is then refused with `MCP_CONFIRMATION_DECLINED`. Only a pending, unexpired confirmation of the caller's own can be declined (`MCP_CONFIRMATION_INVALID` otherwise); any other id is 404. Refused to AI connector tokens.","operationId":"ConnectorConfirmations.decline","parameters":[{"name":"id","required":true,"in":"path","description":"The confirmation id from `MCP_CONFIRMATION_REQUIRED`.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ConnectorConfirmationV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: MCP_CONFIRMATION_SELF","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: MCP_CONFIRMATION_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Decline a connector confirmation","tags":["Auth"],"x-connector-forbidden":true,"x-error-codes":["NOT_FOUND","MCP_CONFIRMATION_INVALID","MCP_CONFIRMATION_SELF"],"x-required-scopes":["org:read"]}},"/v1/security-groups":{"get":{"operationId":"SecurityGroups.list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SecurityGroupResponseDto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List security groups for the current org","tags":["security-groups"],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"tens of security groups per org"},"x-required-scopes":["admin:roles"]},"post":{"operationId":"SecurityGroups.create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSecurityGroupDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SecurityGroupResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: SECURITY_HIERARCHY_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SECURITY_GROUP_DUPLICATE_NAME","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SECURITY_GROUP_INVALID_RESOURCE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a custom security group","tags":["security-groups"],"x-connector-forbidden":true,"x-error-codes":["SECURITY_GROUP_INVALID_RESOURCE","SECURITY_GROUP_DUPLICATE_NAME","SECURITY_HIERARCHY_FORBIDDEN"],"x-required-scopes":["admin:roles"]}},"/v1/security-groups/{id}":{"get":{"operationId":"SecurityGroups.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SecurityGroupResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a single security group","tags":["security-groups"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["admin:roles"]},"patch":{"operationId":"SecurityGroups.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSecurityGroupDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SecurityGroupResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: SECURITY_GROUP_OWNER_IMMUTABLE, SECURITY_GROUP_SYSTEM_IMMUTABLE, SECURITY_HIERARCHY_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SECURITY_GROUP_DUPLICATE_NAME","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SECURITY_GROUP_INVALID_RESOURCE, SECURITY_LOCKOUT_PREVENTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a custom security group (name/description and/or replace its permissions). System groups are read-only in Phase 1.","tags":["security-groups"],"x-connector-forbidden":true,"x-error-codes":["NOT_FOUND","SECURITY_GROUP_INVALID_RESOURCE","SECURITY_GROUP_OWNER_IMMUTABLE","SECURITY_GROUP_SYSTEM_IMMUTABLE","SECURITY_GROUP_DUPLICATE_NAME","SECURITY_HIERARCHY_FORBIDDEN","SECURITY_LOCKOUT_PREVENTED"],"x-required-scopes":["admin:roles"]},"delete":{"operationId":"SecurityGroups.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SecurityGroupResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: SECURITY_GROUP_OWNER_IMMUTABLE, SECURITY_HIERARCHY_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SECURITY_GROUP_SYSTEM_UNDELETABLE, SECURITY_GROUP_DELETE_WIDENS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SECURITY_LOCKOUT_PREVENTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a custom security group (system groups cannot be deleted)","tags":["security-groups"],"x-error-codes":["NOT_FOUND","SECURITY_GROUP_SYSTEM_UNDELETABLE","SECURITY_GROUP_OWNER_IMMUTABLE","SECURITY_HIERARCHY_FORBIDDEN","SECURITY_GROUP_DELETE_WIDENS","SECURITY_LOCKOUT_PREVENTED"],"x-high-risk":true,"x-high-risk-reason":"Deletes a security group, changing its members' permissions.","x-required-scopes":["admin:roles"]}},"/v1/permissions/catalog":{"get":{"operationId":"SecurityGroups.permissionsCatalog","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PermissionCatalogResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Get the permission resource catalog and action vocabulary","tags":["security-groups"],"x-required-scopes":["admin:roles"]}},"/v1/permissions/scopes":{"get":{"operationId":"SecurityGroups.scopeCatalog","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ScopeCatalogResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Get the grantable API-key scope catalog","tags":["security-groups"],"x-required-scopes-any":["admin:keys","admin:roles"]}},"/v1/parties":{"get":{"description":"Filters combine with AND. `ids` is an exact lookup that ignores every other filter and `search`, so a saved reference to an inactive or mirror party still resolves; the one exception is `exclude_mirror=true` together with `mirror_only=true`, which is still rejected with 400. `updated_at` sorts on updated_at, falling back to created_at for a party never edited. Scope differs between the two legal-entity filters: `legal_entity_id` (like `mirror_only`) is not limited to the caller’s legal-entity scope, because mirror parties are org-wide, while `owner_candidate` only offers mirrors of legal entities inside that scope: the one entity of an LE-scoped API key, or the entities on a user’s allow-list.","operationId":"Parties.list","parameters":[{"name":"role","required":false,"in":"query","description":"Filter parties to those carrying this role code.","schema":{"type":"string"}},{"name":"is_active","required":false,"in":"query","schema":{"type":"boolean"}},{"name":"exclude_mirror","required":false,"in":"query","description":"When true, excludes system-managed legal-entity mirror parties (legal_entity_id IS NOT NULL) from the result. Default false.","schema":{"type":"boolean"}},{"name":"mirror_only","required":false,"in":"query","description":"When true, returns ONLY legal-entity mirror parties (legal_entity_id IS NOT NULL) — e.g. to offer the org's own entities as owners. Cannot be combined with exclude_mirror=true. Default false.","schema":{"type":"boolean"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Returns the mirror party of this legal entity (the party whose legal_entity_id is this id).","schema":{"format":"uuid","type":"string"}},{"name":"owner_candidate","required":false,"in":"query","description":"When true, returns only parties that can own a legal entity: parties with the investor role, and mirror parties of the org's owned (not managed) legal entities. Inactive parties are included. Default false.","schema":{"type":"boolean"}},{"name":"external_ref","required":false,"in":"query","description":"Exact match on the record's `external_ref` (another system's key); returns 0 or 1 row. Combines with the other filters.","schema":{"minLength":1,"maxLength":200,"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at","-name","name","-updated_at","updated_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: name, company_name, email.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PartyDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List parties","tags":["Parties"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","FORBIDDEN"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["parties:read"]},"post":{"operationId":"Parties.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePartyV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PartyDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, EXTERNAL_REF_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DEFAULT_ACCOUNT_NOT_ELIGIBLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create party","tags":["Parties"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","DEFAULT_ACCOUNT_NOT_ELIGIBLE","EXTERNAL_REF_TAKEN"],"x-plannable":true,"x-required-scopes":["parties:write"]}},"/v1/parties/{id}":{"get":{"operationId":"Parties.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PartyDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get party by id","tags":["Parties"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["parties:read"]},"put":{"description":"A party that mirrors a legal entity is managed by the legal entity: the only field it accepts here is `bank_account` (set or `null` to remove), used to pay an in-group owner. Any other field returns 409 `PARTY_IS_LEGAL_ENTITY_MIRROR`.","operationId":"Parties.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePartyV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PartyDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PARTY_IS_LEGAL_ENTITY_MIRROR, EXTERNAL_REF_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DEFAULT_ACCOUNT_NOT_ELIGIBLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update party","tags":["Parties"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","PARTY_IS_LEGAL_ENTITY_MIRROR","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","DEFAULT_ACCOUNT_NOT_ELIGIBLE","EXTERNAL_REF_TAKEN"],"x-plannable":true,"x-required-scopes":["parties:write"]}},"/v1/parties/categories":{"get":{"operationId":"PartyCategories.list","parameters":[{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: code","schema":{"enum":["-created_at","created_at","-code","code","-name","name"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: code, name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PartyCategoryDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List party categories","tags":["Party Categories"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["parties:read"]},"post":{"operationId":"PartyCategories.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePartyCategoryV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PartyCategoryDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create party category","tags":["Party Categories"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","CONFLICT"],"x-required-scopes":["parties:write"]}},"/v1/parties/categories/{id}":{"get":{"operationId":"PartyCategories.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PartyCategoryDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get party category by id","tags":["Party Categories"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["parties:read"]},"put":{"operationId":"PartyCategories.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePartyCategoryV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PartyCategoryDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update party category","tags":["Party Categories"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED"],"x-required-scopes":["parties:write"]},"delete":{"operationId":"PartyCategories.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete party category","tags":["Party Categories"],"x-error-codes":["NOT_FOUND","CONFLICT"],"x-required-scopes":["parties:write"]}},"/v1/parties/role-types":{"get":{"operationId":"PartyRoleTypes.list","parameters":[{"name":"is_active","required":false,"in":"query","description":"Filter by active state. Omit to return active and inactive role types.","schema":{"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: code","schema":{"enum":["-created_at","created_at","-code","code","-name","name"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: code, name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PartyRoleTypeDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List party role types","tags":["Party Role Types"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["parties:read"]},"post":{"operationId":"PartyRoleTypes.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePartyRoleTypeV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PartyRoleTypeDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create party role type","tags":["Party Role Types"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","CONFLICT"],"x-required-scopes":["parties:write"]}},"/v1/parties/role-types/{id}":{"get":{"operationId":"PartyRoleTypes.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PartyRoleTypeDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get party role type by id","tags":["Party Role Types"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["parties:read"]},"put":{"operationId":"PartyRoleTypes.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePartyRoleTypeV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PartyRoleTypeDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update party role type","tags":["Party Role Types"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED"],"x-required-scopes":["parties:write"]},"delete":{"operationId":"PartyRoleTypes.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete party role type","tags":["Party Role Types"],"x-error-codes":["NOT_FOUND","CONFLICT"],"x-required-scopes":["parties:write"]}},"/v1/parties/{id}/contacts":{"get":{"description":"Named people attached to the party. The party's own email is unchanged.","operationId":"Parties.listContacts","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"is_active","required":false,"in":"query","schema":{"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: last_name","schema":{"enum":["last_name","-last_name","created_at","-created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: first_name, last_name, email.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PartyContactV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a party's contacts","tags":["Parties"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["parties:read"]},"post":{"description":"Email is unique per party, case-insensitively. Setting is_primary demotes the current primary. An entity-restricted caller must be allowed every legal entity the party holds a position or ownership stake in, or is named in a portal package of, and the party must have at least one (403 LEGAL_ENTITY_NOT_IN_SCOPE otherwise).","operationId":"Parties.createContact","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePartyContactV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PartyContactV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a contact to a party","tags":["Parties"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-plannable":true,"x-required-scopes":["parties:write"]}},"/v1/parties/{id}/contacts/{contactId}":{"patch":{"description":"Partial update. is_active=false marks the contact inactive and revokes any invited or active portal link in the same transaction; reactivating (is_active=true) restores nothing — access requires a fresh grant. Changing email is refused while the contact holds invited or active portal access — revoke first, so the old login is never left silently attached. An entity-restricted caller must be allowed every legal entity the party holds a position or ownership stake in, or is named in a portal package of, and the party must have at least one (403 LEGAL_ENTITY_NOT_IN_SCOPE otherwise).","operationId":"Parties.updateContact","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"contactId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePartyContactV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PartyContactV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, CONTACT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, CONTACT_HAS_PORTAL_ACCESS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a contact","tags":["Parties"],"x-error-codes":["NOT_FOUND","CONTACT_NOT_FOUND","VALIDATION_FAILED","CONFLICT","CONTACT_HAS_PORTAL_ACCESS","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["parties:write"]},"delete":{"description":"Refused while the contact holds invited or active portal access; revoke first. An entity-restricted caller must be allowed every legal entity the party holds a position or ownership stake in, or is named in a portal package of, and the party must have at least one (403 LEGAL_ENTITY_NOT_IN_SCOPE otherwise).","operationId":"Parties.deleteContact","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"contactId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":"Contact deleted."},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, CONTACT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONTACT_HAS_PORTAL_ACCESS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a contact","tags":["Parties"],"x-error-codes":["NOT_FOUND","CONTACT_NOT_FOUND","CONTACT_HAS_PORTAL_ACCESS","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["parties:write"]}},"/v1/parties/{id}/vendor-identifiers":{"get":{"description":"Every identifier that recognizes this party on an incoming bill, learned or confirmed, plus blocked ones, oldest first by default; the other sorts are `-created_at` and `-last_seen_at` (never seen last). A `bank_fingerprint` is listed with `value_norm` null and is never matched by `search`.","operationId":"Parties.listVendorIdentifiers","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: created_at","schema":{"enum":["created_at","-created_at","-last_seen_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: value_norm.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/VendorIdentifierV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a party's vendor identifiers","tags":["Parties"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["parties:read"]},"post":{"description":"Stores the value, normalized by kind, as `confirmed` by the caller. Posting a value this party already holds re-confirms it. A value another party holds is 409; `kind: bank_fingerprint` is 422, since that one follows the bank account.","operationId":"Parties.createVendorIdentifier","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateVendorIdentifierV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/VendorIdentifierV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: VENDOR_IDENTIFIER_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: VENDOR_IDENTIFIER_DERIVED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a vendor identifier","tags":["Parties"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","VENDOR_IDENTIFIER_DERIVED","VENDOR_IDENTIFIER_TAKEN"],"x-required-scopes":["parties:write"]}},"/v1/parties/{id}/vendor-identifiers/{identifierId}":{"patch":{"description":"`confirmed` lets the identifier match this party with full weight; `blocked` stops it matching at all. Either records the caller in `verified_by`. Learning never changes a confirmed or blocked identifier back. A `bank_fingerprint` is 422: it follows the bank account and is re-derived as `confirmed` when the account changes.","operationId":"Parties.updateVendorIdentifier","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"identifierId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateVendorIdentifierV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/VendorIdentifierV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, VENDOR_IDENTIFIER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: VENDOR_IDENTIFIER_DERIVED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Confirm or block a vendor identifier","tags":["Parties"],"x-error-codes":["NOT_FOUND","VENDOR_IDENTIFIER_NOT_FOUND","VENDOR_IDENTIFIER_DERIVED","VALIDATION_FAILED"],"x-required-scopes":["parties:write"]},"delete":{"description":"Removes the identifier; learning may record it again later — block it to stop that. A `bank_fingerprint` is 422: it is removed with the bank account.","operationId":"Parties.deleteVendorIdentifier","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"identifierId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":"Identifier deleted."},"404":{"description":"Possible error codes: NOT_FOUND, VENDOR_IDENTIFIER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: VENDOR_IDENTIFIER_DERIVED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a vendor identifier","tags":["Parties"],"x-error-codes":["NOT_FOUND","VENDOR_IDENTIFIER_NOT_FOUND","VENDOR_IDENTIFIER_DERIVED"],"x-required-scopes":["parties:write"]}},"/v1/work-items":{"get":{"operationId":"WorkItems.list","parameters":[{"name":"module","required":false,"in":"query","description":"Producing module, e.g. \"re_tax\".","schema":{"type":"string"}},{"name":"type","required":false,"in":"query","description":"Producer-defined exception type.","schema":{"type":"string"}},{"name":"state","required":false,"in":"query","description":"Default: active","schema":{"type":"string","enum":["open","snoozed","resolved","dismissed","active"]}},{"name":"severity","required":false,"in":"query","schema":{"type":"string","enum":["info","warning","critical"]}},{"name":"entity_type","required":false,"in":"query","schema":{"type":"string"}},{"name":"entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"assignee","required":false,"in":"query","description":"Only items assigned to this org member.","schema":{"format":"uuid","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Only items attributed to this legal entity. A caller restricted to some entities always sees its own entities and org-wide items, never others.","schema":{"format":"uuid","type":"string"}},{"name":"objective_id","required":false,"in":"query","description":"Only items resolved into this objective.","schema":{"format":"uuid","type":"string"}},{"name":"objective_type","required":false,"in":"query","description":"Only items whose objective is of this type, e.g. \"routine\" for routine groups.","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: harm_date","schema":{"enum":["-severity","severity","-created_at","created_at","-harm_date","harm_date"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WorkItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List work items","tags":["Work Items"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["work-items:read"]}},"/v1/work-items/notification-settings":{"get":{"description":"The calling user's digest cadence and whether immediate notifications reach them. A user who never saved any gets the default: a daily digest and immediates on. Only a signed-in user has settings; an API key is refused (403).","operationId":"WorkItems.getNotificationSettings","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/NotificationSettingsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get your Work Center notification settings","tags":["Work Items"],"x-error-codes":["FORBIDDEN"],"x-required-scopes":["notifications:read"]},"put":{"description":"Full replacement: both digest and immediates are required. Changes only the calling user's settings in this org. Only a signed-in user has settings; an API key is refused (403).","operationId":"WorkItems.putNotificationSettings","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutNotificationSettingsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/NotificationSettingsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace your Work Center notification settings","tags":["Work Items"],"x-error-codes":["VALIDATION_FAILED","FORBIDDEN"],"x-required-scopes":["notifications:write"]}},"/v1/work-items/summary":{"get":{"operationId":"WorkItems.summary","parameters":[{"name":"module","required":false,"in":"query","description":"Producing module, e.g. \"re_tax\".","schema":{"type":"string"}},{"name":"type","required":false,"in":"query","description":"Producer-defined exception type.","schema":{"type":"string"}},{"name":"state","required":false,"in":"query","description":"Default: active","schema":{"type":"string","enum":["open","snoozed","resolved","dismissed","active"]}},{"name":"severity","required":false,"in":"query","schema":{"type":"string","enum":["info","warning","critical"]}},{"name":"entity_type","required":false,"in":"query","schema":{"type":"string"}},{"name":"entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Only items attributed to this legal entity. A caller restricted to some entities always sees its own entities and org-wide items, never others.","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WorkItemsSummaryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Count work items by module and severity","tags":["Work Items"],"x-error-codes":["VALIDATION_FAILED"],"x-required-scopes":["work-items:read"]}},"/v1/work-items/freshness":{"get":{"description":"One entry per sweep provider module: when it last ran, whether that run succeeded, when it last checked cleanly, and whether it is stale (never run, failed, or silent for longer than stale_after_hours).","operationId":"WorkItems.freshness","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WorkItemsFreshnessV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Per-module freshness of the work-item sweep","tags":["Work Items"],"x-required-scopes":["work-items:read"]}},"/v1/work-items/objectives":{"get":{"description":"Work items rolled up by objective: deadline objectives of one type and period form one group (\"37 of 40 clear\"); each routine occurrence and each module's undated group is its own group. Only groups holding an active (open or lapsed-snoozed) item are listed, soonest harm_date first, then earliest due_date, then group_key. A group past its due date with an objective still open is critical with overdue_days; its items keep their own severity. blocked_by lists the groups of a type declared to block this one whose period overlaps it. A caller restricted to some legal entities sees only their objectives and org-wide ones, and counts only items it may see. Drill into an objective with GET /v1/work-items?objective_id=.","operationId":"WorkItems.objectives","parameters":[{"name":"module","required":false,"in":"query","description":"Only objectives of this module, e.g. \"banking\".","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ObjectiveGroupV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List work items grouped by objective","tags":["Work Items"],"x-error-codes":["VALIDATION_FAILED"],"x-pagination":{"mode":"none","reason":"one row per group of objectives that holds an active work item, not a growing list of records","bound":"the deadline types and periods with open work, plus one routine group per module"},"x-required-scopes":["work-items:read"]}},"/v1/work-items/by-objective":{"get":{"description":"For each objective in objective_ids, its active work items (open, or snoozed past snoozed_until), soonest harm_date first, at most `limit` (default 10) per objective, plus a next_cursor. Each entry equals the first page of GET /v1/work-items?objective_id=<id>&state=active&sort=harm_date with the same severity and limit, and its next_cursor continues there. Results follow the order of objective_ids, each id once. An objective with no visible items (unknown, another org, an off module, or outside the caller's legal entities) returns an empty page.","operationId":"WorkItems.listByObjective","parameters":[{"name":"objective_ids","required":true,"in":"query","description":"The objectives to read, comma-separated or repeated; 1 to 50. Duplicates are read once.","schema":{"type":"array","items":{"type":"string","format":"uuid"}}},{"name":"limit","required":false,"in":"query","description":"Most active items returned per objective.","schema":{"minimum":1,"maximum":25,"default":10,"type":"integer"}},{"name":"severity","required":false,"in":"query","schema":{"type":"string","enum":["info","warning","critical"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WorkItemObjectivePageV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"First page of active work items for several objectives","tags":["Work Items"],"x-error-codes":["VALIDATION_FAILED"],"x-pagination":{"mode":"none","reason":"one entry per objective id the caller names, each a first page that continues on GET /v1/work-items","bound":"at most 50 objectives x 25 items each"},"x-required-scopes":["work-items:read"]}},"/v1/work-items/{id}/subjects":{"get":{"description":"One page of the subjects behind one aggregate work item, sorted by subject_key, with the live total you can see. Subjects already promoted to their own work item (claimed, dismissed or snoozed) are excluded. Nothing is written. If the producer does not answer in time, the response is 200 with empty data, meta.stale true and meta.total_count null.","operationId":"WorkItems.subjects","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 25","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WorkItemSubjectV1Dto"}},"meta":{"$ref":"#/components/schemas/WorkItemSubjectsMetaV1Dto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: WORK_ITEM_NOT_AGGREGATE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List an aggregate work item's subjects","tags":["Work Items"],"x-error-codes":["NOT_FOUND","WORK_ITEM_NOT_AGGREGATE","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["work-items:read"]}},"/v1/work-items/{id}/subjects/{key}/claim":{"patch":{"description":"Promotes the subject to its own work item, assigned to you, in one transaction, and returns that item. Claiming a subject that already has its own item claims that item. :key is the subject_key from the subjects list, URL-encoded. 404 when the subject is no longer in the set.","operationId":"WorkItems.claimSubject","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"key","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WorkItemV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: WORK_ITEM_NOT_AGGREGATE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Claim one of an aggregate's subjects for yourself","tags":["Work Items"],"x-error-codes":["NOT_FOUND","WORK_ITEM_NOT_AGGREGATE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["work-items:write"]}},"/v1/work-items/{id}/subjects/{key}/dismiss":{"patch":{"description":"Promotes the subject to its own work item and dismisses it, in one transaction, and returns that item. A refused dismissal (exit policy, scope) writes nothing. :key is the subject_key from the subjects list, URL-encoded. 404 when the subject is no longer in the set.","operationId":"WorkItems.dismissSubject","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"key","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DismissWorkItemDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WorkItemV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: WORK_ITEM_NOT_AGGREGATE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Dismiss one of an aggregate's subjects with a reason","tags":["Work Items"],"x-error-codes":["VALIDATION_FAILED","FORBIDDEN","NOT_FOUND","WORK_ITEM_NOT_AGGREGATE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["work-items:write"]}},"/v1/work-items/{id}/snooze":{"patch":{"operationId":"WorkItems.snooze","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SnoozeWorkItemDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WorkItemV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Snooze a work item until a given time","tags":["Work Items"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["work-items:write"]}},"/v1/work-items/{id}/resolve":{"patch":{"operationId":"WorkItems.resolve","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WorkItemV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: FORBIDDEN, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Resolve (dismiss) a work item","tags":["Work Items"],"x-error-codes":["NOT_FOUND","FORBIDDEN","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["work-items:write"]}},"/v1/work-items/{id}/dismiss":{"patch":{"operationId":"WorkItems.dismiss","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DismissWorkItemDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WorkItemV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Dismiss a work item with a reason","tags":["Work Items"],"x-error-codes":["VALIDATION_FAILED","FORBIDDEN","NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["work-items:write"]}},"/v1/work-items/{id}/reviewed":{"patch":{"description":"Spec §4.3. Counts as a decision for a routine objective's cycle. Refused (422) for an item in a deadline objective or with none, and for a dismissed or resolved item.","operationId":"WorkItems.markReviewed","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WorkItemV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: WORK_ITEM_REVIEW_REFUSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Mark a work item reviewed (seen, nothing to do yet)","tags":["Work Items"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","WORK_ITEM_REVIEW_REFUSED"],"x-required-scopes":["work-items:write"]}},"/v1/work-items/{id}/claim":{"patch":{"operationId":"WorkItems.claim","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WorkItemV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Claim a work item for yourself","tags":["Work Items"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["work-items:write"]}},"/v1/work-items/{id}/assign":{"patch":{"operationId":"WorkItems.assign","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignWorkItemDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WorkItemV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Assign a work item to a teammate","tags":["Work Items"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["work-items:write"]}},"/v1/work-items/{id}/release":{"patch":{"operationId":"WorkItems.release","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WorkItemV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Release a work item back to the pool","tags":["Work Items"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["work-items:write"]}},"/v1/work-items/policies":{"get":{"description":"One entry per configurable module, whether or not it was ever configured; a module with no stored policy is on and not paused.","operationId":"WorkItemPolicies.list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ModulePolicyV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List Work Center module policies","tags":["Work Center admin"],"x-pagination":{"mode":"none","reason":"one entry per configurable Work Center module, a fixed catalog","bound":"the modules in WORK_ITEM_MODULES, about two dozen"},"x-required-scopes":["attention:manage"]}},"/v1/work-items/policies/{module}":{"put":{"description":"Off hides the module and stops its sweep without deleting anything. Paused stops only its provider sweep and needs a reason. Re-pausing a paused module to edit the reason keeps paused_at and paused_by. A write that brings a module back from off or paused to on and not paused also queues a re-run of today's sweep for the org (the same job POST /v1/work-items/replay queues, so repeated toggles share one), so its items are fresh at once rather than at the next scheduled run; a failure to queue it does not fail this request.","operationId":"WorkItemPolicies.put","parameters":[{"name":"module","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutModulePolicyV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ModulePolicyV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ATTENTION_MODULE_UNKNOWN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Turn a Work Center module on or off, or pause its sweep","tags":["Work Center admin"],"x-error-codes":["VALIDATION_FAILED","ATTENTION_MODULE_UNKNOWN"],"x-required-scopes":["attention:manage"]}},"/v1/work-items/policies/{module}/dry-run":{"post":{"description":"Runs only this module's sweep for the org, as of today's UTC date, inside a transaction that always rolls back: nothing is written, no sweep run is recorded, no alert or notification is raised. It runs whether the module is on, off or paused. Returns the items the run would create (at most 500) and how many it would create, refresh in place and resolve. A provider error comes back in error, with what it produced before it; failed item writes come back as errored_count, and error then says the preview is incomplete.","operationId":"WorkItemPolicies.dryRun","parameters":[{"name":"module","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DryRunV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"422":{"description":"Possible error codes: ATTENTION_MODULE_UNKNOWN, ATTENTION_MODULE_NOT_SWEPT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview what a Work Center module's sweep would do","tags":["Work Center admin"],"x-error-codes":["ATTENTION_MODULE_UNKNOWN","ATTENTION_MODULE_NOT_SWEPT"],"x-required-scopes":["attention:manage"]}},"/v1/work-items/replay":{"post":{"description":"Queues a full sweep for the org as of the UTC date it runs on, run by the job queue rather than in the request. Modules that are off or paused are skipped, as in the scheduled run. While a re-run for the org is queued, another request joins it; while one is running, another request queues one more run after it. Either way it returns the job_id of that job with deduped true. The run is recorded with trigger replay.","operationId":"WorkItems.replay","parameters":[],"responses":{"202":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WorkItemsReplayV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Re-run today's Work Center sweep now","tags":["Work Center admin"],"x-required-scopes":["attention:manage"]}},"/v1/work-items/routine-series":{"post":{"description":"A routine series is a module's recurring review cycle (weekly to quarterly): items of the listed types count toward its current occurrence. The series_key is derived from the name and never changes. It takes effect today (effective_from is the org's today) and its current occurrence exists as soon as this returns, except on a module that is switched off: there it is generated when the module is turned back on. An item type can belong to one series of the org at most.","operationId":"WorkItemRoutineSeries.create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRoutineSeriesV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RoutineSeriesV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ROUTINE_SERIES_ITEM_TYPE_TAKEN, ROUTINE_SERIES_KEY_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ATTENTION_MODULE_UNKNOWN, ROUTINE_SERIES_ITEM_TYPE_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a routine series for a Work Center module","tags":["Work Center admin"],"x-error-codes":["VALIDATION_FAILED","ATTENTION_MODULE_UNKNOWN","ROUTINE_SERIES_ITEM_TYPE_INVALID","ROUTINE_SERIES_ITEM_TYPE_TAKEN","ROUTINE_SERIES_KEY_TAKEN"],"x-required-scopes":["attention:manage"]}},"/v1/work-items/routine-series/{id}":{"patch":{"description":"Send any of name, cadence, anchor, item_types. A rename keeps the series_key. A new item_types list replaces the old one; items already in an occurrence move to their type's new home when that occurrence closes. A cadence or anchor change takes effect today (effective_from becomes the org's today).","operationId":"WorkItemRoutineSeries.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRoutineSeriesV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RoutineSeriesV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ROUTINE_SERIES_ITEM_TYPE_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ROUTINE_SERIES_ITEM_TYPE_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Rename a routine series or change its rhythm or item types","tags":["Work Center admin"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","ROUTINE_SERIES_ITEM_TYPE_INVALID","ROUTINE_SERIES_ITEM_TYPE_TAKEN"],"x-required-scopes":["attention:manage"]},"delete":{"description":"The live items of its current occurrence move to the module's undated group, its occurrences that no item points at are deleted, and the series goes. Closed past occurrences that still hold items stay as history.","operationId":"WorkItemRoutineSeries.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":"The series is gone."},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a routine series","tags":["Work Center admin"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["attention:manage"]}},"/v1/internal/scheduler/tick":{"post":{"operationId":"Scheduler.tick","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TickSummaryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"summary":"Drain due scheduled jobs and queued work","tags":["internal"],"x-public":true}},"/v1/notifications":{"get":{"operationId":"Notifications.list","parameters":[{"name":"status","required":false,"in":"query","schema":{"default":"all","type":"string","enum":["unread","all"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/NotificationV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the current user inbox","tags":["Notifications"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["notifications:read"]}},"/v1/notifications/unread-count":{"get":{"operationId":"Notifications.unreadCount","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/UnreadCountV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Unread notification count","tags":["Notifications"],"x-required-scopes":["notifications:read"]}},"/v1/notifications/{id}/read":{"patch":{"operationId":"Notifications.markRead","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MarkReadResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Mark a notification read","tags":["Notifications"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["notifications:write"]}},"/v1/notifications/read-all":{"patch":{"operationId":"Notifications.markAllRead","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MarkReadResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Mark all visible notifications read","tags":["Notifications"],"x-required-scopes":["notifications:write"]}},"/v1/user-preferences/{key}":{"get":{"operationId":"UserPreferences.get","parameters":[{"name":"key","required":true,"in":"path","description":"Preference key (lowercase letters, digits, \"-\", \"_\", \".\"; 1-64 chars)","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/UserPreferenceV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a per-user preference value","tags":["User Preferences"],"x-error-codes":["NOT_FOUND"],"x-internal":true,"x-required-scopes":["user-preferences:read"]},"put":{"operationId":"UserPreferences.put","parameters":[{"name":"key","required":true,"in":"path","description":"Preference key (lowercase letters, digits, \"-\", \"_\", \".\"; 1-64 chars)","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutUserPreferenceV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/UserPreferenceV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upsert a per-user preference value","tags":["User Preferences"],"x-error-codes":["VALIDATION_FAILED"],"x-internal":true,"x-required-scopes":["user-preferences:write"]},"delete":{"operationId":"UserPreferences.delete","parameters":[{"name":"key","required":true,"in":"path","description":"Preference key (lowercase letters, digits, \"-\", \"_\", \".\"; 1-64 chars)","schema":{"type":"string"}}],"responses":{"204":{"description":""}},"security":[{"access-token":[]}],"summary":"Delete a per-user preference value","tags":["User Preferences"],"x-error-codes":[],"x-internal":true,"x-required-scopes":["user-preferences:write"]}},"/metrics":{"get":{"operationId":"MetricsController_getMetrics","parameters":[],"responses":{"200":{"description":""}},"tags":["Metrics"],"x-public":true}},"/health":{"get":{"operationId":"HealthController_check","parameters":[],"responses":{"200":{"description":"The Health Check is successful","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"ok"},"info":{"type":"object","example":{"database":{"status":"up"}},"additionalProperties":{"type":"object","required":["status"],"properties":{"status":{"type":"string"}},"additionalProperties":true},"nullable":true},"error":{"type":"object","example":{},"additionalProperties":{"type":"object","required":["status"],"properties":{"status":{"type":"string"}},"additionalProperties":true},"nullable":true},"details":{"type":"object","example":{"database":{"status":"up"}},"additionalProperties":{"type":"object","required":["status"],"properties":{"status":{"type":"string"}},"additionalProperties":true}}}}}}},"503":{"description":"The Health Check is not successful","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"info":{"type":"object","example":{"database":{"status":"up"}},"additionalProperties":{"type":"object","required":["status"],"properties":{"status":{"type":"string"}},"additionalProperties":true},"nullable":true},"error":{"type":"object","example":{"redis":{"status":"down","message":"Could not connect"}},"additionalProperties":{"type":"object","required":["status"],"properties":{"status":{"type":"string"}},"additionalProperties":true},"nullable":true},"details":{"type":"object","example":{"database":{"status":"up"},"redis":{"status":"down","message":"Could not connect"}},"additionalProperties":{"type":"object","required":["status"],"properties":{"status":{"type":"string"}},"additionalProperties":true}}}}}}}},"tags":["Health"],"x-public":true}},"/v1/journals":{"get":{"operationId":"Journals.list","parameters":[{"name":"status","required":false,"in":"query","description":"`posted`: entries in the posted state, which includes an entry reversed since reversals began to offset, and the contra entry that reversed it. `voided` / `reversed`: entries that were reversed. One reversed since then stays `posted`, is netted by its contra entry, and is selected by both values. One reversed before carries the value itself (`voided` for a void, `reversed` for an edit) and is selected by that value only.","schema":{"type":"string","enum":["posted","voided","reversed"]}},{"name":"from_date","required":false,"in":"query","description":"Inclusive lower bound on the journal entry date.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Inclusive upper bound on the journal entry date.","schema":{"format":"date","type":"string"}},{"name":"entry_date_from","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `from_date` (inclusive lower bound on the journal entry date).","schema":{"format":"date","type":"string"}},{"name":"entry_date_to","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `to_date` (inclusive upper bound on the journal entry date).","schema":{"format":"date","type":"string"}},{"name":"type","required":false,"in":"query","schema":{"type":"string","enum":["standard","intercompany"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at","-entry_date","entry_date"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/JournalListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List journal entries","tags":["Journals"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["accounting:read"]}},"/v1/journals/untagged-intercompany-balances":{"get":{"description":"Per Due From / Due To account, the entity's balance on posted lines that name no counterparty entity: what a journal entry may reclassify to an entity. Accounts whose untagged lines net to zero are left out.","operationId":"Journals.untaggedIntercompanyBalances","parameters":[{"name":"legal_entity_id","required":true,"in":"query","description":"The legal entity whose untagged balances to read.","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/UntaggedIntercompanyBalancesV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Read untagged intercompany balances of an entity","tags":["Journals"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["accounting:read"]}},"/v1/journals/{id}":{"get":{"operationId":"Journals.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/JournalDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get journal entry by id","tags":["Journals"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["accounting:read"]}},"/v1/accounting/accounts":{"get":{"description":"Results are always returned in chart-of-accounts tree order (depth-first by `report_order` then `code`); there is no `sort` parameter. Use `cursor`/`limit` to page through the tree.","operationId":"Accounts.list","parameters":[{"name":"search","required":false,"in":"query","schema":{"type":"string"}},{"name":"account_type_code","required":false,"in":"query","schema":{"type":"string"}},{"name":"is_active","required":false,"in":"query","schema":{"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AccountListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List chart of accounts","tags":["Accounting"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["accounting:read"]},"post":{"operationId":"Accounts.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAccountV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AccountDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create account","tags":["Accounting"],"x-error-codes":["VALIDATION_FAILED","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["accounting:write"]}},"/v1/accounting/accounts/meta":{"get":{"operationId":"Accounts.meta","parameters":[{"name":"account_type_code","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AccountMetaV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List account types and detail types (reference data)","tags":["Accounting"],"x-required-scopes":["accounting:read"]}},"/v1/accounting/accounts/{id}":{"get":{"operationId":"Accounts.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AccountDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get account by id","tags":["Accounting"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["accounting:read"]},"patch":{"description":"Updates the editable per-account fields (`name`, `is_active`). `system_role` is managed via PUT /v1/accounting/system-roles/:role to preserve a single audited reassignment path; `code`, type, detail type, and parent are locked once an account exists to keep the general ledger interpretable.","operationId":"Accounts.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAccountV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AccountDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: CASH_FLOW_CATEGORY_REQUIRES_ASSET","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update account","tags":["Accounting"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CASH_FLOW_CATEGORY_REQUIRES_ASSET","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["accounting:write"]}},"/v1/accounting/system-roles":{"get":{"description":"Returns one entry per system role, including its label, description, compatible account types, and the accounts currently holding the role (org-wide and any LE-scoped overrides). Use this to render the Default Accounts settings page.","operationId":"SystemRoles.list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SystemRoleAssignmentV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List system roles with current assignments","tags":["Accounting"],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"the fixed catalog of system roles, a handful per org"},"x-required-scopes":["accounting:read"]}},"/v1/accounting/system-roles/{role}":{"put":{"description":"Atomically reassigns a `system_role` within a bucket (org-wide or a specific legal entity). The role is cleared from any previous holder and applied to the target account in one transaction. Set `account_id` to null to clear the role entirely.","operationId":"SystemRoles.reassign","parameters":[{"name":"role","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReassignSystemRoleV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SystemRoleReassignResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SYSTEM_ROLE_TAKEN, SYSTEM_ROLE_HOLDER_HAS_BALANCE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SYSTEM_ROLE_INCOMPATIBLE_TYPE, SYSTEM_ROLE_INCOMPATIBLE_DETAIL_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Assign or clear a system role","tags":["Accounting"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","SYSTEM_ROLE_TAKEN","SYSTEM_ROLE_INCOMPATIBLE_TYPE","SYSTEM_ROLE_INCOMPATIBLE_DETAIL_TYPE","SYSTEM_ROLE_HOLDER_HAS_BALANCE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["accounting:write"]}},"/v1/accounting/gl-activity":{"get":{"description":"Lists journal lines with debit/credit totals over the whole filtered set (`meta.totals`), cursor-paged. With `basis=accrual` (the default) the rows are the posted journal lines. With `basis=cash` the rows are exactly the ones the cash-basis P&L (`GET /v1/reports/pl?basis=cash`) sums for the same account, date range and legal entity — so a P&L figure drilled into here lists the rows that make it up. See the `basis` parameter for what a cash row is and what the cash basis refuses.","operationId":"GlActivity.list","parameters":[{"name":"from_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"account_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"document_id","required":false,"in":"query","description":"Exact document_id (uuid) match — scopes to the GL lines posted from a single source document","schema":{"format":"uuid","type":"string"}},{"name":"search","required":false,"in":"query","schema":{"type":"string"}},{"name":"basis","required":false,"in":"query","description":"`accrual` (default): the posted journal lines, as this endpoint has always listed them. `cash`: exactly the rows `GET /v1/reports/pl?basis=cash` sums for the same `account_id`, `from_date`/`to_date` and `legal_entity_id` — income-statement accounts only. An invoice or bill line is listed when a payment applied to it, dated on the payment, as the share of the line that payment recognizes; the row carries the payment's journal entry and the invoice/bill line it pays. Refund payments and debt-service interest are listed the same way. Applications are read as they stand now, so applying or unapplying a payment re-categorizes past rows. A payment's unapplied remainder (the P&L's Uncategorized row) is not listed. On `cash`, `sort=created_at`/`-created_at` and `document_id` are refused (`GL_ACTIVITY_CASH_BASIS_PARAMETER_UNSUPPORTED`), a balance-sheet `account_id` is refused (`GL_ACTIVITY_CASH_BASIS_ACCOUNT_NOT_INCOME_STATEMENT`), and with no `legal_entity_id` managed legal entities are excluded, as on the P&L. A cursor is valid only on the basis that issued it.","schema":{"default":"accrual","type":"string","enum":["accrual","cash"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -entry_date","schema":{"enum":["-entry_date","entry_date","-created_at","created_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/GlActivityRowV1Dto"}},"meta":{"$ref":"#/components/schemas/GlActivityMetaV1Dto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED, GL_ACTIVITY_CASH_BASIS_PARAMETER_UNSUPPORTED, GL_ACTIVITY_CASH_BASIS_ACCOUNT_NOT_INCOME_STATEMENT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List GL activity (posted journal lines)","tags":["Accounting"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","GL_ACTIVITY_CASH_BASIS_PARAMETER_UNSUPPORTED","GL_ACTIVITY_CASH_BASIS_ACCOUNT_NOT_INCOME_STATEMENT"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["accounting:read"]}},"/v1/legal-entities/{id}/year-end-close":{"post":{"operationId":"YearEndClose.create","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateYearEndCloseV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/YearEndCloseCreatedV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, YEAR_END_NO_PL_ACTIVITY, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: YEAR_END_ALREADY_CLOSED, YEAR_END_PERIODS_OPEN, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Close and lock a fiscal year for a legal entity","tags":["Year-end close"],"x-error-codes":["VALIDATION_FAILED","YEAR_END_ALREADY_CLOSED","YEAR_END_PERIODS_OPEN","YEAR_END_NO_PL_ACTIVITY","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Closes and locks a fiscal year.","x-required-scopes":["accounting:write"]}},"/v1/legal-entities/{id}/year-end-close/reverse":{"post":{"operationId":"YearEndClose.reverse","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReverseYearEndCloseV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/YearEndCloseReversedV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: YEAR_END_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Reverse a year-end close and unlock the year","tags":["Year-end close"],"x-error-codes":["VALIDATION_FAILED","YEAR_END_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Reverses a year-end close and unlocks the year.","x-required-scopes":["accounting:periods_override"]}},"/v1/accounting/reconciliation":{"get":{"description":"Answers, per legal entity: does the sum of what customers owe us on the invoice list equal the AR balance in the general ledger — and if not, by how much? Same question for AP and vendors. Read-only; it reports a variance and never adjusts anything.\n\nCompares the subledger AS IT STANDS NOW against every posted journal line to date. It takes no period or as-of parameter on purpose: document balances are current mutable state with no history, so pairing a past period of GL against today's balances would report two different instants as one variance.\n\nThe difference is reported in three terms, not one. `variance` is the raw subledger-minus-GL difference and is normally large. `unrepresentable_gl_movement` is the part of it that no document could ever account for — manual journal entries posted straight at the control account, and settled-on-creation types such as `expense` and `deposit` whose balance is always zero. `residual_variance` is the two added together, and it is the number that should be zero: it is the only one of the three worth investigating.","operationId":"Reconciliation.list","parameters":[{"name":"legal_entity_id","required":false,"in":"query","description":"Restrict to one legal entity. Omit for every legal entity.","schema":{"format":"uuid","type":"string"}},{"name":"subledger","required":false,"in":"query","description":"Which subledger to tie out. Omit for both. `ar` compares open invoices and credit memos against the accounts_receivable control account; `ap` compares bills and vendor credits against accounts_payable.","schema":{"type":"string","enum":["ar","ap"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ReconciliationRowV1Dto"}},"meta":{"$ref":"#/components/schemas/ReconciliationMetaV1Dto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Tie the AR/AP subledgers out against their control accounts","tags":["Accounting"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"none","reason":"one row per (legal entity × subledger) tie-out, not a growing list of records","bound":"the org's legal-entity count times up to two subledgers"},"x-required-scopes":["accounting:read"]}},"/v1/tax-rates":{"get":{"operationId":"TaxRates.list","parameters":[{"name":"include_inactive","required":false,"in":"query","description":"Include deactivated (soft-deleted) tax rates in the list.","schema":{"default":false,"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: rate","schema":{"enum":["rate","-rate","label","-label"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TaxRateV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List tax rates","tags":["Tax Rates"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["tax-rates:read"]},"post":{"operationId":"TaxRates.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTaxRateV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TaxRateV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a tax rate","tags":["Tax Rates"],"x-error-codes":["VALIDATION_FAILED","CONFLICT","ACCOUNT_LEGAL_ENTITY_MISMATCH","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["tax-rates:write"]}},"/v1/tax-rates/{id}":{"get":{"operationId":"TaxRates.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TaxRateV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a tax rate","tags":["Tax Rates"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["tax-rates:read"]},"patch":{"operationId":"TaxRates.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTaxRateV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TaxRateV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a tax rate","tags":["Tax Rates"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","CONFLICT","ACCOUNT_LEGAL_ENTITY_MISMATCH","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["tax-rates:write"]},"delete":{"operationId":"TaxRates.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Soft-delete a tax rate","tags":["Tax Rates"],"x-error-codes":["NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["tax-rates:write"]}},"/v1/accounting-periods/close-readiness/bulk":{"post":{"description":"Per entity: how far its books are closed, how many open periods end on or before through_date, and what blocks the next one. A pure read; writes nothing. POST because the id list does not fit a query string.","operationId":"AccountingPeriods.bulkCloseReadiness","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkCloseReadinessV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EntityCloseReadinessV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Close readiness for many legal entities","tags":["Accounting Periods"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["accounting:read"]}},"/v1/accounting-periods/close-runs":{"post":{"description":"Commits a selection of legal entities and a through_date, then fans out one durable job per entity (spec D8) that closes its open periods ending on or before through_date, oldest first. A blocker stops that entity without aborting the others (D3). At most one run may be queued or running per org at a time (D10); a second create is refused with PERIOD_CLOSE_RUN_ALREADY_ACTIVE naming the run that holds the slot. There is no bulk override: the single-period period_override_reason has no counterpart here (D4) — a single sentence must never freeze hundreds of entities' known-wrong figures at once.","operationId":"AccountingPeriods.createCloseRun","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCloseRunV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PeriodCloseRunV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PERIOD_CLOSE_RUN_ALREADY_ACTIVE, IDEMPOTENCY_CONFLICT\n\nPERIOD_CLOSE_RUN_ALREADY_ACTIVE. `context.active_run_id` is NULLABLE: it names the run holding the slot, but is null in the rare case where that run reached a terminal status between the refusal and the lookup that names it — the refusal is still correct, and the same request can be retried immediately. This route also carries @Idempotent, so a 409 may instead be IDEMPOTENCY_CONFLICT, whose context has no active_run_id — that field is therefore NOT required on this status, only typed when present.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ProblemDetailsDto"},{"type":"object","properties":{"context":{"type":"object","properties":{"active_run_id":{"type":"string","format":"uuid","nullable":true,"description":"Present only for PERIOD_CLOSE_RUN_ALREADY_ACTIVE: the run holding the active slot, or null when it has since finished. Absent on an IDEMPOTENCY_CONFLICT 409."}}}}}]}}}}},"security":[{"access-token":[]}],"summary":"Start a bulk period close","tags":["Accounting Periods"],"x-error-codes":["VALIDATION_FAILED","PERIOD_CLOSE_RUN_ALREADY_ACTIVE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-high-risk":true,"x-high-risk-reason":"Closes accounting periods in bulk.","x-required-scopes":["accounting:write"]},"get":{"description":"Newest first. `ids` returns exactly those rows and overrides `search`; `search` matches `status` — the only low-cardinality column a run has (principal_id is a uuid, not meaningfully substring-searchable).","operationId":"AccountingPeriods.listCloseRuns","parameters":[{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: status.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PeriodCloseRunV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List bulk period close runs","tags":["Accounting Periods"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","FORBIDDEN"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["accounting:read"]}},"/v1/accounting-periods/close-runs/{id}":{"get":{"description":"The run's own counters plus one cursor page of its entity rows (meta.next_cursor pages `entities`, in a stable but arbitrary order — by id, which is a random uuid, not a time-ordered one). Another organization's run id answers 404, the same as an unknown one.","operationId":"AccountingPeriods.getCloseRun","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: id","schema":{"enum":["id"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PeriodCloseRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PERIOD_CLOSE_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a bulk period close run","tags":["Accounting Periods"],"x-error-codes":["PERIOD_CLOSE_RUN_NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["accounting:read"]}},"/v1/accounting-periods/close-runs/{id}/cancel":{"post":{"description":"Cooperative cancel (D9): stamps cancel_requested_at, and the run comes back TERMINAL — status is set to 'cancelled' and finished_at is stamped in this same call, which is what releases the org's single active-run slot (D10). Without that, a run whose remaining jobs never start would hold the slot forever, since nothing else would ever terminalize it. Each entity job still mid-flight reads the stamp before doing further work and records itself cancelled; an entity already applied keeps its result and its periods — cancel means \"stop starting new work\", never \"undo\". Cancelling a run that is already terminal (completed, cancelled or failed) is a NO-OP: it returns the run unchanged, rather than an error, because there is no work left to stop.","operationId":"AccountingPeriods.cancelCloseRun","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PeriodCloseRunV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PERIOD_CLOSE_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Cancel a bulk period close run","tags":["Accounting Periods"],"x-error-codes":["PERIOD_CLOSE_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["accounting:write"]}},"/v1/accounting-periods/exceptions":{"get":{"operationId":"AccountingPeriods.exceptions","parameters":[{"name":"from_date","required":false,"in":"query","description":"Inclusive lower bound on the exception occurrence date.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Inclusive upper bound on the exception occurrence date.","schema":{"format":"date","type":"string"}},{"name":"from","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `from_date` (inclusive lower bound on the exception occurrence date).","schema":{"format":"date","type":"string"}},{"name":"to","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `to_date` (inclusive upper bound on the exception occurrence date).","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ExceptionRowV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Closing-date exceptions report","tags":["Accounting Periods"],"x-error-codes":["INVALID_CURSOR","FORBIDDEN","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["accounting:read"]}},"/v1/accounting-periods":{"get":{"operationId":"AccountingPeriods.list","parameters":[{"name":"legal_entity_id","required":false,"in":"query","description":"Filter to a specific legal entity.","schema":{"type":"string"}},{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["open","closed","locked"]}},{"name":"from_date","required":false,"in":"query","description":"Inclusive lower bound on the period start date.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Inclusive upper bound on the period start date.","schema":{"format":"date","type":"string"}},{"name":"from","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `from_date` (inclusive lower bound on the period start date).","schema":{"format":"date","type":"string"}},{"name":"to","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `to_date` (inclusive upper bound on the period start date).","schema":{"format":"date","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: start_date","schema":{"enum":["start_date","-start_date"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AccountingPeriodV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List accounting periods","tags":["Accounting Periods"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","FORBIDDEN","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["accounting:read"]}},"/v1/accounting-periods/{id}":{"get":{"operationId":"AccountingPeriods.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AccountingPeriodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get accounting period by id","tags":["Accounting Periods"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["accounting:read"]}},"/v1/accounting-periods/{id}/close":{"post":{"description":"Closes the period. Refused with PERIOD_HAS_DEAD_LIFECYCLE_DELIVERIES when a lease lifecycle change affecting this period was never delivered to a module that computes posted amounts; supply period_override_reason with the accounting:periods_override scope to close anyway, which records a period.override_close audit row naming every blocker. Call GET :id/close-readiness to see blockers before attempting the close.","operationId":"AccountingPeriods.close","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransitionAccountingPeriodV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AccountingPeriodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PERIOD_OVERRIDE_FORBIDDEN, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT, PERIOD_HAS_DEAD_LIFECYCLE_DELIVERIES, PERIOD_HAS_PENDING_DOCUMENTS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Close accounting period","tags":["Accounting Periods"],"x-error-codes":["NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","PERIOD_HAS_DEAD_LIFECYCLE_DELIVERIES","PERIOD_HAS_PENDING_DOCUMENTS","PERIOD_OVERRIDE_FORBIDDEN","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-high-risk":true,"x-high-risk-reason":"Closes an accounting period.","x-required-scopes":["accounting:write"]}},"/v1/accounting-periods/{id}/close-readiness":{"get":{"description":"Preconditions for closing this period, so blockers are visible while the month is open rather than at the moment someone presses Close. dead_lifecycle_delivery is a lease lifecycle change that was never delivered to a module computing posted amounts; depreciation_not_posted is a period with projected fixed-asset depreciation and no run covering it; pending_documents lists posting_pending documents dated in this period, including incoming intercompany documents from another legal entity; previous_period_not_closed appears only when the org enforces sequential close and the prior period in the same legal entity is still open. warnings never block close: percentage_rent_attention counts percentage rent runs due and lines blocked, held, or approved but not yet invoiced.","operationId":"AccountingPeriods.closeReadiness","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CloseReadinessV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"What would block closing this period","tags":["Accounting Periods"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["accounting:read"]}},"/v1/accounting-periods/{id}/history":{"get":{"description":"Every status change of this period — close, override close, lock, reopen, year-end lock and unlock — newest first, with who made it, when, the status it moved from and to, the reason given and what made it (`source`). A reopen also names who had closed and locked the period before it was reopened. Changes recorded before reasons were kept appear once as `status_change_unrecorded`, with null statuses and reason. Entity-scoped: 404 when the period is not in your org, 403 `LEGAL_ENTITY_NOT_IN_SCOPE` when its legal entity is outside the entities you may act on. Needs only `accounting:read`, not `admin:audit`. `ids` returns exactly those entries of this period and overrides `search`; `search` matches the reason or note. 100 per page; drain `meta.next_cursor` for the rest.","operationId":"AccountingPeriods.history","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: reason, note.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PeriodHistoryEntryV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE, FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List an accounting period's status history","tags":["Accounting Periods"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_CURSOR","VALIDATION_FAILED","FORBIDDEN"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["accounting:read"]}},"/v1/accounting-periods/{id}/lock":{"post":{"operationId":"AccountingPeriods.lock","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransitionAccountingPeriodV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AccountingPeriodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Lock accounting period","tags":["Accounting Periods"],"x-error-codes":["NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-high-risk":true,"x-high-risk-reason":"Locks an accounting period for good.","x-required-scopes":["accounting:write"]}},"/v1/accounting-periods/{id}/reopen":{"post":{"operationId":"AccountingPeriods.reopen","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReopenAccountingPeriodV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AccountingPeriodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, PERIOD_LOCKED_BY_YEAR_END_CLOSE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Reopen accounting period (requires override scope)","tags":["Accounting Periods"],"x-error-codes":["NOT_FOUND","CONFLICT","VALIDATION_FAILED","FORBIDDEN","PERIOD_LOCKED_BY_YEAR_END_CLOSE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-high-risk":true,"x-high-risk-reason":"Reopens a closed accounting period.","x-required-scopes":["accounting:periods_override"]}},"/v1/ap-invoices/upload-url":{"post":{"description":"Step one of an upload. Returns a fresh `storage_path` under the organization and a signed `upload_url` (valid two hours) to PUT the file to, straight to Storage. Then call `POST /v1/ap-files` with the path. The declared type must be PDF, PNG, JPEG or WebP and the size at most 25 MiB; the uploaded bytes are checked again on registration.","operationId":"ApIntake.createUploadUrl","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApUploadUrlRequestV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApUploadUrlV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a signed URL to upload an invoice file","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED"],"x-required-scopes":["accounts-payable:write"]}},"/v1/ap-files":{"post":{"description":"Step two of an upload. Reads the file at `storage_path`, identifies its type from its bytes (the declared type and the extension are not trusted), and stores it with one placeholder `processing` item covering the whole file; reading the file starts in the background. The same bytes already held by the organization answer 409 `AP_FILE_DUPLICATE` naming that file, and the new upload is discarded. A path not issued for this organization is 422 `AP_STORAGE_PATH_INVALID`; a path nothing was uploaded to is 422 `AP_UPLOAD_NOT_FOUND`.","operationId":"ApIntake.createFile","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApFileCreateV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApFileWithItemsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: AP_FILE_DUPLICATE, CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: ATTACHMENT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: ATTACHMENT_TYPE_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: AP_STORAGE_PATH_INVALID, AP_UPLOAD_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Register an uploaded invoice file","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","AP_STORAGE_PATH_INVALID","AP_UPLOAD_NOT_FOUND","ATTACHMENT_TYPE_UNSUPPORTED","ATTACHMENT_TOO_LARGE","AP_FILE_DUPLICATE","CONFLICT"],"x-required-scopes":["accounts-payable:write"]}},"/v1/ap-files/{id}/reread":{"post":{"description":"Starts reading the file again from scratch, in the background: every item of the file goes back to `processing` with `attempt_count` 0 and no `error_message`, and the read may split the file differently (items it no longer finds are removed). Use it on a file whose read failed. Refused with 409 `AP_FILE_HAS_DECIDED_ITEMS` when any item is `accepted`, `rejected` or `archived`, since a new split could duplicate a decided bill.","operationId":"ApIntake.rereadFile","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"202":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApFileWithItemsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: AP_FILE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: AP_FILE_HAS_DECIDED_ITEMS, CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Read an invoice file again","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","AP_FILE_NOT_FOUND","AP_FILE_HAS_DECIDED_ITEMS","CONFLICT"],"x-required-scopes":["accounts-payable:write"]}},"/v1/ap-invoices/{id}/reprocess":{"post":{"description":"Starts processing one item again from scratch, in the background: it goes back to `processing` with `attempt_count` 0 and no `error_message`. The 202 body is the item as restarted; an in-house item read arrives in a later step. Refused with 409 `AP_INVOICE_NOT_REPROCESSABLE` when the item is `accepted`, `rejected` or `archived`, and with 409 `AP_INVOICE_NOT_REVIEWABLE` while it is still `processing`. The reviewer’s header corrections are kept and re-applied to the new extraction; line-level corrections are dropped.","operationId":"ApIntake.reprocessInvoice","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"202":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApItemSummaryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: AP_INVOICE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: AP_INVOICE_NOT_REPROCESSABLE, AP_INVOICE_NOT_REVIEWABLE, CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Process an invoice again","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","AP_INVOICE_NOT_FOUND","AP_INVOICE_NOT_REPROCESSABLE","AP_INVOICE_NOT_REVIEWABLE","CONFLICT"],"x-required-scopes":["accounts-payable:write"]}},"/v1/ap-invoices/{id}/checks/{code}/acknowledge":{"post":{"description":"Marks one `warn` check `acknowledged`, records the decision and re-stages the item: with no other block or warn open it moves on (for example `needs_review` to `ready`). A fraud-class warning needs a `note` (422 `AP_CHECK_NOTE_REQUIRED`). A `block` or `info` check is 422 `AP_CHECK_SEVERITY_MISMATCH`. The acknowledgement stays while the check keeps firing with the same evidence. Refused with 409 `AP_INVOICE_NOT_REVIEWABLE` while the item is `processing`, `not_a_bill` or decided.","operationId":"ApReview.acknowledgeCheck","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"code","required":true,"in":"path","description":"The check to act on, as listed in the item's checks.","schema":{"enum":["payment_details_changed","sender_lookalike","duplicate_invoice","duplicate_probable","duplicate_content","does_not_foot","extraction_low_confidence","extraction_invalid","suggestion_failed","remit_to_new","remit_to_name_mismatch","sender_freemail","vendor_unmatched","new_vendor","vendor_unverified","unusual_amount","unusual_frequency","legal_entity_conflict","closed_period","inactive_record","under_threshold","invoice_number_regression","past_due","missing_w9"],"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApCheckAcknowledgeV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApCheckActionResponseV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: AP_INVOICE_NOT_FOUND, AP_CHECK_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: AP_INVOICE_NOT_REVIEWABLE, AP_INVOICE_CHANGED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: AP_CHECK_SEVERITY_MISMATCH, AP_CHECK_NOTE_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Acknowledge a warning on an invoice","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","AP_INVOICE_NOT_FOUND","AP_CHECK_NOT_FOUND","AP_INVOICE_NOT_REVIEWABLE","AP_CHECK_SEVERITY_MISMATCH","AP_CHECK_NOTE_REQUIRED","AP_INVOICE_CHANGED"],"x-required-scopes":["accounts-payable:write"]}},"/v1/ap-invoices/{id}/checks/{code}/resolve":{"post":{"description":"Marks one `block` check `resolved` with a `note` saying how it was cleared (for bank details: verified by phone with the number on file), records the decision and re-stages the item, which then leaves `flagged` unless another block is open. The fraud risk is recomputed without that check. `duplicate_invoice` is settled with the duplicate routes (422 `AP_CHECK_USE_DUPLICATE_ROUTE`); a `warn` or `info` check is 422 `AP_CHECK_SEVERITY_MISMATCH`; a blank `note` is 422 `AP_CHECK_NOTE_REQUIRED`. Refused with 409 `AP_INVOICE_NOT_REVIEWABLE` while the item is `processing`, `not_a_bill` or decided.","operationId":"ApReview.resolveCheck","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"code","required":true,"in":"path","description":"The check to act on, as listed in the item's checks.","schema":{"enum":["payment_details_changed","sender_lookalike","duplicate_invoice","duplicate_probable","duplicate_content","does_not_foot","extraction_low_confidence","extraction_invalid","suggestion_failed","remit_to_new","remit_to_name_mismatch","sender_freemail","vendor_unmatched","new_vendor","vendor_unverified","unusual_amount","unusual_frequency","legal_entity_conflict","closed_period","inactive_record","under_threshold","invoice_number_regression","past_due","missing_w9"],"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApCheckResolveV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApCheckActionResponseV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: AP_INVOICE_NOT_FOUND, AP_CHECK_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: AP_INVOICE_NOT_REVIEWABLE, AP_INVOICE_CHANGED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: AP_CHECK_SEVERITY_MISMATCH, AP_CHECK_USE_DUPLICATE_ROUTE, AP_CHECK_NOTE_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Resolve a blocking check on an invoice","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","AP_INVOICE_NOT_FOUND","AP_CHECK_NOT_FOUND","AP_INVOICE_NOT_REVIEWABLE","AP_CHECK_SEVERITY_MISMATCH","AP_CHECK_USE_DUPLICATE_ROUTE","AP_CHECK_NOTE_REQUIRED","AP_INVOICE_CHANGED"],"x-required-scopes":["accounts-payable:write"]}},"/v1/ap-invoices/{id}/duplicate/confirm":{"post":{"description":"The item is a copy of a bill or item already received: it is `archived`, keeping `duplicate_of_invoice_id` / `duplicate_of_document_id`, and never becomes a bill. Needs an open duplicate check (`duplicate_invoice`, `duplicate_probable` or `duplicate_content`), else 409 `AP_INVOICE_NOT_A_DUPLICATE`. Refused with 409 `AP_INVOICE_NOT_REVIEWABLE` while the item is `processing`, `not_a_bill` or decided.","operationId":"ApReview.confirmDuplicate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApCheckActionResponseV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: AP_INVOICE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: AP_INVOICE_NOT_REVIEWABLE, AP_INVOICE_NOT_A_DUPLICATE, AP_INVOICE_CHANGED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Confirm an invoice is a duplicate","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","AP_INVOICE_NOT_FOUND","AP_INVOICE_NOT_REVIEWABLE","AP_INVOICE_NOT_A_DUPLICATE","AP_INVOICE_CHANGED"],"x-required-scopes":["accounts-payable:write"]}},"/v1/ap-invoices/{id}/duplicate/dismiss":{"post":{"description":"The item is not a duplicate: `duplicate_invoice` is marked `resolved` and an open `duplicate_probable` / `duplicate_content` `acknowledged`, each with the `reason` as its note, and the item is re-staged (usually to `needs_review` or `ready`). The decision stays while the same match is found again. Needs an open duplicate check, else 409 `AP_INVOICE_NOT_A_DUPLICATE`; a blank `reason` is 422 `AP_CHECK_NOTE_REQUIRED`. Refused with 409 `AP_INVOICE_NOT_REVIEWABLE` while the item is `processing`, `not_a_bill` or decided.","operationId":"ApReview.dismissDuplicate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApDuplicateDismissV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApCheckActionResponseV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: AP_INVOICE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: AP_INVOICE_NOT_REVIEWABLE, AP_INVOICE_NOT_A_DUPLICATE, AP_INVOICE_CHANGED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: AP_CHECK_NOTE_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Dismiss a duplicate match on an invoice","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","AP_INVOICE_NOT_FOUND","AP_INVOICE_NOT_REVIEWABLE","AP_INVOICE_NOT_A_DUPLICATE","AP_CHECK_NOTE_REQUIRED","AP_INVOICE_CHANGED"],"x-required-scopes":["accounts-payable:write"]}},"/v1/ap-invoices":{"get":{"description":"The items found in uploaded invoice files. The default order is `urgency`: fraud risk (high, elevated, low, unchecked), then due date (soonest first, none last), then oldest. The other sorts are `created_at`, `-created_at`, `due_date` (none last) and `-due_date`. Each row carries its open checks and `quick_approvable`. `meta.counts` is the number of items per status over the whole organization, ignoring every filter, for the status tabs. A principal tied to one legal entity sees only that entity’s items.","operationId":"ApInvoices.list","parameters":[{"name":"status","required":false,"in":"query","description":"Only items in these statuses. Repeat or comma-separate; an item is listed when its status is any of them.","schema":{"type":"array","items":{"type":"string","enum":["processing","ready","needs_review","flagged","duplicate","not_a_bill","accepted","rejected","archived"]}}},{"name":"vendor_party_id","required":false,"in":"query","description":"Only items of this vendor party.","schema":{"format":"uuid","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Only items of this legal entity.","schema":{"format":"uuid","type":"string"}},{"name":"check_code","required":false,"in":"query","description":"Only items with this check open (not acknowledged or resolved).","schema":{"type":"string","enum":["payment_details_changed","sender_lookalike","duplicate_invoice","duplicate_probable","duplicate_content","does_not_foot","extraction_low_confidence","extraction_invalid","suggestion_failed","remit_to_new","remit_to_name_mismatch","sender_freemail","vendor_unmatched","new_vendor","vendor_unverified","unusual_amount","unusual_frequency","legal_entity_conflict","closed_period","inactive_record","under_threshold","invoice_number_regression","past_due","missing_w9"]}},{"name":"fraud_risk","required":false,"in":"query","schema":{"type":"string","enum":["low","elevated","high"]}},{"name":"kind","required":false,"in":"query","schema":{"type":"string","enum":["bill","credit_memo","statement","w9","receipt","reminder","other"]}},{"name":"from_date","required":false,"in":"query","description":"Inclusive lower bound on the invoice date.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Inclusive upper bound on the invoice date.","schema":{"format":"date","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: urgency","schema":{"enum":["urgency","-created_at","created_at","due_date","-due_date"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: vendor_name, vendor_invoice_number.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApInvoiceListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/ApInvoiceListMetaV1Dto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List AP invoices","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["accounts-payable:read"]}},"/v1/ap-invoices/{id}":{"get":{"description":"One item with everything the review drawer needs: the working `final_fields`, the `effective_coding` a bill would get (the reviewer’s coding where set, else the classifier’s choice), the `suggestion`, every check with its state and evidence, the extraction result, the file and page range, the other items found in the same file and the bill once accepted.","operationId":"ApInvoices.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApInvoiceDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: AP_INVOICE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get an AP invoice","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","AP_INVOICE_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["accounts-payable:read"]},"patch":{"description":"Merges `final_fields` into the working copy: one correction is recorded per changed field, the typed columns follow, and the item is re-staged (its checks and status follow the new values). Picking another `vendor_party_id` or `legal_entity_id` classifies the item again with that pick kept; if the classifier fails the edit is kept and the item moves to `needs_review` with an open `suggestion_failed` check. Allowed while the item is `ready`, `needs_review`, `flagged` or `duplicate`; other statuses are 409 `AP_INVOICE_NOT_REVIEWABLE`. Answers with the item as `GET` shows it.","operationId":"ApInvoices.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-ap-invoice-version","required":true,"in":"header","description":"The item `version` from the read this edit is based on, as a plain integer. Use this, not If-Match: a CDN in front of this API answers conditional requests itself and never forwards them. Missing is 428 `AP_INVOICE_PRECONDITION_REQUIRED`; not an integer is 422 `AP_INVOICE_PATCH_INVALID`; stale is 409 `AP_INVOICE_CHANGED`.","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApInvoicePatchV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApInvoiceDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: AP_INVOICE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: AP_INVOICE_NOT_REVIEWABLE, AP_INVOICE_CHANGED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: AP_INVOICE_PATCH_INVALID, DOCUMENT_PARTY_IS_LEGAL_ENTITY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"428":{"description":"Possible error codes: AP_INVOICE_PRECONDITION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Edit an AP invoice","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","AP_INVOICE_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","AP_INVOICE_PRECONDITION_REQUIRED","AP_INVOICE_PATCH_INVALID","DOCUMENT_PARTY_IS_LEGAL_ENTITY","AP_INVOICE_NOT_REVIEWABLE","AP_INVOICE_CHANGED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["accounts-payable:write"]}},"/v1/ap-invoices/{id}/reject":{"post":{"description":"The item will not become a bill: it is `rejected` with the reason, the time and the reviewer. `fraud: true` also blocks the sender’s email on the item’s vendor so it is no longer recognized (nothing is blocked when the item has no vendor). Allowed while the item is `ready`, `needs_review`, `flagged`, `duplicate` or `not_a_bill`; `processing`, `accepted`, `rejected` and `archived` are 409 `AP_INVOICE_NOT_REVIEWABLE`. Answers with the item as `GET` shows it.","operationId":"ApInvoices.reject","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApInvoiceRejectV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApInvoiceDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: AP_INVOICE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: AP_INVOICE_NOT_REVIEWABLE, AP_INVOICE_CHANGED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: AP_INVOICE_PATCH_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Reject an AP invoice","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","AP_INVOICE_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","AP_INVOICE_PATCH_INVALID","AP_INVOICE_NOT_REVIEWABLE","AP_INVOICE_CHANGED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["accounts-payable:write"]}},"/v1/ap-invoices/{id}/accept":{"post":{"description":"Turns the item into a bill (a vendor credit for a credit memo) in one step: optional `final_fields` edits are applied first, then the bill is created from the item’s effective coding with its vendor invoice number and the item’s pages attached, and the item becomes `accepted` with `bill_document_id`. The bill then follows the normal path: it posts, or waits in `pending_approval` when an approval rule holds it. Purchase tax becomes one `Tax` line on `tax_account_id` (else the largest line’s account). Allowed only while the item is `ready` or `needs_review` with no open block and no unacknowledged warn. Nothing is created when it is refused, and the reason is kept in the item’s `error_message`. A retried accept of an accepted item is 409 `AP_INVOICE_NOT_REVIEWABLE` naming the bill in `context.bill_document_id`.","operationId":"ApInvoices.accept","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApInvoiceAcceptV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApInvoiceAcceptResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: AP_INVOICE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: AP_INVOICE_NOT_REVIEWABLE, AP_INVOICE_CHANGED, AP_INVOICE_HAS_OPEN_CHECKS, DOCUMENT_VENDOR_INVOICE_NUMBER_TAKEN, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: AP_INVOICE_PATCH_INVALID, DOCUMENT_PARTY_IS_LEGAL_ENTITY, AP_INVOICE_INCOMPLETE, AP_INVOICE_DOES_NOT_FOOT, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Accept an AP invoice","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","AP_INVOICE_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","AP_INVOICE_PATCH_INVALID","DOCUMENT_PARTY_IS_LEGAL_ENTITY","AP_INVOICE_NOT_REVIEWABLE","AP_INVOICE_CHANGED","AP_INVOICE_HAS_OPEN_CHECKS","AP_INVOICE_INCOMPLETE","AP_INVOICE_DOES_NOT_FOOT","DIMENSION_REQUIRED","DOCUMENT_VENDOR_INVOICE_NUMBER_TAKEN","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["accounts-payable:write"]}},"/v1/ap-invoices/{id}/pdf":{"get":{"description":"Redirects (302) to a short-lived signed URL for the stored file the item was found in. The file is the whole upload; use `page_from` and `page_to` of the item to find its pages.","operationId":"ApInvoices.getPdf","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"302":{"description":"Redirects to a signed URL for the stored document, valid for five minutes. Follow it right away; do not store it.","headers":{"Location":{"description":"The signed document URL.","schema":{"type":"string","format":"uri"}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: AP_INVOICE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: SERVICE_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Open the document of an AP invoice","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","AP_INVOICE_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","SERVICE_UNAVAILABLE"],"x-required-scopes":["accounts-payable:read"]}},"/v1/ap-files/{id}/pdf":{"get":{"description":"Redirects (302) to a short-lived signed URL for the stored file. A principal tied to one legal entity may open a file only when none of its items belongs to another entity; otherwise open the item’s own document.","operationId":"ApFiles.getPdf","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"302":{"description":"Redirects to a signed URL for the stored document, valid for five minutes. Follow it right away; do not store it.","headers":{"Location":{"description":"The signed document URL.","schema":{"type":"string","format":"uri"}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: AP_FILE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: SERVICE_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Open an uploaded invoice file","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","AP_FILE_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","SERVICE_UNAVAILABLE"],"x-required-scopes":["accounts-payable:read"]}},"/v1/ap-invoices/{id}/audit":{"get":{"description":"The reviewer’s edits (`kind: correction`, with the suggested and final values) and the actions recorded in the audit log about the item (`kind: audit`), oldest first.","operationId":"ApInvoices.getAudit","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApAuditEntryV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: AP_INVOICE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get the audit trail of an AP invoice","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","AP_INVOICE_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"computed","reason":"Merged per request from two stored sources (reviewer corrections and audit-log actions) for one item, oldest first; search, ids and sort do not apply."},"x-required-scopes":["accounts-payable:read"]}},"/v1/ap-intake-addresses":{"get":{"description":"The organization’s inbound email addresses, oldest first by default; the other sorts are `-created_at` and `address`. A principal tied to one legal entity sees that entity’s addresses and those with no entity.","operationId":"ApIntakeAddresses.list","parameters":[{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: created_at","schema":{"enum":["created_at","-created_at","address"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: address.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApIntakeAddressV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List AP intake addresses","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["accounts-payable:read"]},"post":{"description":"Generates a new inbound address, `ap-<10 characters>@<inbound domain>`, for the organization. The address cannot be chosen. `sender_policy` defaults to `anyone`. A `legal_entity_id` that is not an active legal entity of the organization is 422 `AP_INTAKE_ADDRESS_INVALID`; a deployment with no inbound domain is 503 `AP_INTAKE_DOMAIN_NOT_CONFIGURED`.","operationId":"ApIntakeAddresses.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApIntakeAddressCreateV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApIntakeAddressV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: AP_INTAKE_ADDRESS_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: AP_INTAKE_DOMAIN_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create an AP intake address","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","AP_INTAKE_ADDRESS_INVALID","AP_INTAKE_DOMAIN_NOT_CONFIGURED","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["accounts-payable:write"]}},"/v1/ap-intake-addresses/{id}":{"patch":{"description":"Changes the sender policy, the default legal entity or whether the address is active. Only the keys sent change; `legal_entity_id: null` clears the entity. An inactive address receives nothing: its mail is ignored as an unknown address.","operationId":"ApIntakeAddresses.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApIntakeAddressPatchV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApIntakeAddressV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: AP_INTAKE_ADDRESS_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: AP_INTAKE_ADDRESS_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update an AP intake address","tags":["AP Pipeline"],"x-error-codes":["VALIDATION_FAILED","AP_INTAKE_ADDRESS_NOT_FOUND","AP_INTAKE_ADDRESS_INVALID","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["accounts-payable:write"]}},"/v1/webhooks/accounts-payable/resend-inbound":{"post":{"description":"Resend pushes email.received events here. The guard verifies the Svix signature against RESEND_AP_WEBHOOK_SECRET. Stores a received envelope per org whose intake address the email was sent to and enqueues ap_ingest_message; always answers 202 once the signature is valid.","operationId":"AccountsPayable.resendInboundWebhook.receive","parameters":[],"responses":{"202":{"description":""}},"summary":"Inbound Resend webhook for AP intake (Svix signature-verified)","tags":["Accounts Payable Webhooks"],"x-public":true}},"/v1/dimensions":{"get":{"operationId":"Dimensions.list","parameters":[{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: code","schema":{"enum":["code","-code","name","-name","created_at","-created_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DimensionV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List dimensions","tags":["Dimensions"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["dimensions:read"]},"post":{"operationId":"Dimensions.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDimensionV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DimensionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create dimension","tags":["Dimensions"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","CONFLICT"],"x-plannable":true,"x-required-scopes":["dimensions:write"]}},"/v1/dimensions/applicable":{"get":{"operationId":"Dimensions.applicable","parameters":[{"name":"document_type","required":true,"in":"query","schema":{"type":"string","enum":["invoice","credit_memo","vendor_credit","bill","expense","sales_receipt","payment_in","payment_out","journal_entry","intercompany_transaction","intercompany_settlement","transfer","deposit","refund","owner_distribution","refund_payment","distribution_receipt","distribution_refund","distribution_refund_payable","straight_line_adjustment","debt_service","loan_drawdown","loan_payoff","loan_accrual","depreciation","asset_disposal","asset_reclass","capital_contribution","investment_in_subsidiary","debt_service_bill","debt_service_payment","loan_prepayment","hedge_settlement","hedge_premium","hedge_premium_amortization","hedge_termination"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DimensionV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List active transaction-category dimensions applicable to a document type","tags":["Dimensions"],"x-error-codes":["VALIDATION_FAILED"],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"the dimensions applicable to one document type, tens of rows"},"x-required-scopes":["dimensions:read"]}},"/v1/dimensions/{id}":{"get":{"operationId":"Dimensions.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DimensionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get dimension by id","tags":["Dimensions"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["dimensions:read"]},"put":{"operationId":"Dimensions.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDimensionV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DimensionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, DIMENSION_IN_USE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update dimension","tags":["Dimensions"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT","DIMENSION_IN_USE"],"x-plannable":true,"x-required-scopes":["dimensions:write"]},"delete":{"operationId":"Dimensions.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, DIMENSION_IN_USE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete dimension","tags":["Dimensions"],"x-error-codes":["NOT_FOUND","CONFLICT","DIMENSION_IN_USE"],"x-required-scopes":["dimensions:write"]}},"/v1/dimensions/{id}/options":{"post":{"operationId":"Dimensions.options.create","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDimensionOptionV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DimensionOptionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a dropdown option to a dimension (quick-add)","tags":["Dimensions"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT"],"x-plannable":true,"x-required-scopes":["dimensions:write"]}},"/v1/dimensions/{id}/options/{optionId}":{"patch":{"operationId":"Dimensions.options.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"optionId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDimensionOptionV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DimensionOptionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a dropdown option","tags":["Dimensions"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT"],"x-plannable":true,"x-required-scopes":["dimensions:write"]},"delete":{"operationId":"Dimensions.options.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"optionId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a dropdown option","tags":["Dimensions"],"x-error-codes":["NOT_FOUND","CONFLICT"],"x-required-scopes":["dimensions:write"]}},"/v1/documents/next-number":{"get":{"description":"Read-only preview of the next number. It does not reserve the number: the number is assigned when a document is saved.","operationId":"Documents.nextNumber","parameters":[{"name":"document_type","required":true,"in":"query","schema":{"type":"string"}},{"name":"document_date","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DocumentNumberDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Preview the next document number for a given type and date","tags":["Documents"],"x-required-scopes":["documents:read"]}},"/v1/documents/summary":{"get":{"operationId":"Documents.summary","parameters":[{"name":"document_type","required":true,"in":"query","schema":{"type":"string","enum":["invoice","bill","credit_memo","vendor_credit","journal_entry","intercompany_transaction","transfer","deposit","refund","debt_service","debt_service_bill","debt_service_payment","loan_drawdown","loan_payoff","loan_prepayment","loan_accrual","hedge_settlement","hedge_premium","hedge_premium_amortization","hedge_termination"]}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"recent_days","required":false,"in":"query","description":"Enables the `recent` block over the last N calendar days.","schema":{"minimum":1,"maximum":90,"type":"number"}},{"name":"recent_scope","required":false,"in":"query","description":"Which documents the `recent` block counts. `open_or_draft` = open (posted, balance > 0) plus drafts (AP \"New bills\"); `posted_or_draft` = every posted or draft doc (default); `posted` = posted only (AR \"Collected\" — a draft is not cash received).","schema":{"default":"posted_or_draft","type":"string","enum":["open_or_draft","posted_or_draft","posted"]}},{"name":"from_date","required":false,"in":"query","description":"Enables the `period` block; must be provided together with to_date.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"date_from","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `from_date`; must be provided together with `date_to` or `to_date`.","schema":{"format":"date","type":"string"}},{"name":"date_to","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `to_date`.","schema":{"format":"date","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DocumentsSummaryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Aggregated document summary (open buckets, aging, drafts, recent, period) in one query","tags":["Documents"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["documents:read"]}},"/v1/documents":{"get":{"description":"A search term that reads as money (`1250`, `1,250.00`, `$1 250`, `-1250`, at most two decimals) also matches a document whose absolute `total_amount` or `balance_amount` equals it exactly; zero is never matched as an amount. For intercompany transactions the search also covers the memo and either entity's name. `ids` (up to 100) returns those documents regardless of every filter, the default status exclusions and `search`; the org and the caller’s legal-entity scope still apply. `document_number` sorts a draft with no number as an empty string: first ascending, last descending. `due_date` sorts a document without a due date last ascending, first descending.","operationId":"Documents.list","parameters":[{"name":"document_type","required":false,"in":"query","description":"Narrow the list to a single document type. When omitted, the list returns every document type.","schema":{"type":"string","enum":["invoice","bill","credit_memo","vendor_credit","journal_entry","intercompany_transaction","transfer","deposit","refund","debt_service","debt_service_bill","debt_service_payment","loan_drawdown","loan_payoff","loan_prepayment","loan_accrual","hedge_settlement","hedge_premium","hedge_premium_amortization","hedge_termination"]}},{"name":"document_types","required":false,"in":"query","description":"Narrow the list to a SET of document types — any type a document can be. Repeat the parameter or comma-separate the values. Applied regardless of `all_types`, and in place of the activity-type subset a `property_id`/`space_id` filter otherwise implies. Mutually exclusive with `document_type`. Duplicates are ignored; a value with no non-blank entry is the same as omitting the parameter. An unknown type is refused with VALIDATION_FAILED.","schema":{"maxItems":36,"type":"array","items":{"type":"string","enum":["invoice","credit_memo","vendor_credit","bill","expense","sales_receipt","payment_in","payment_out","journal_entry","intercompany_transaction","intercompany_settlement","transfer","deposit","refund","owner_distribution","refund_payment","distribution_receipt","distribution_refund","distribution_refund_payable","straight_line_adjustment","debt_service","loan_drawdown","loan_payoff","loan_accrual","depreciation","asset_disposal","asset_reclass","capital_contribution","investment_in_subsidiary","debt_service_bill","debt_service_payment","loan_prepayment","hedge_settlement","hedge_premium","hedge_premium_amortization","hedge_termination"]}}},{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["draft","pending_approval","rejected","posting_pending","posting_failed","posted","voided","reversed","deleted"]}},{"name":"document_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"property_id","required":false,"in":"query","description":"Filter to documents tagged with this property. Exact match by default; with `include_descendants=true` it also matches documents tagged with any space in the property, at any depth. Mutually exclusive with `space_id`.","schema":{"format":"uuid","type":"string"}},{"name":"space_id","required":false,"in":"query","description":"Filter to documents tagged with this space. Exact match by default; with `include_descendants=true` it also matches documents tagged with a space nested inside it (a unit within a suite). Mutually exclusive with `property_id`.","schema":{"format":"uuid","type":"string"}},{"name":"include_descendants","required":false,"in":"query","description":"When combined with `property_id` or `space_id`, also returns documents tagged with anything below the named record — every space in the property, or the spaces nested inside the named space — matched at the header or line level. Ignored when neither is set.","schema":{"type":"boolean"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Filter to a single legal entity. Used by apply-credit pickers to scope target invoices/bills to the same LE as the credit being applied.","schema":{"format":"uuid","type":"string"}},{"name":"party_id","required":false,"in":"query","description":"Filter to a single party (customer or vendor). Pairs with legal_entity_id for the apply-credit picker so cross-party targets never appear in the dropdown.","schema":{"format":"uuid","type":"string"}},{"name":"open_only","required":false,"in":"query","schema":{"type":"boolean"}},{"name":"from_date","required":false,"in":"query","description":"Inclusive lower bound for `document_date`. When supplied together with `to_date`, supersedes the exact-match `document_date` param.","schema":{"example":"2026-01-01","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Inclusive upper bound for `document_date`. See `from_date`.","schema":{"example":"2026-03-31","type":"string"}},{"name":"overdue","required":false,"in":"query","description":"When true, returns only posted documents with `due_date` before the org's today (see `orgs.time_zone`) and `balance_amount > 0`. Combine with `document_type=invoice`.","schema":{"example":"true","type":"boolean"}},{"name":"all_types","required":false,"in":"query","description":"Deprecated: omitting `document_type` now returns every document type by default, so this flag is redundant. Kept for compatibility with existing callers; when true it overrides `document_type` and the trackable activity-type subset. It does not override `document_types`.","schema":{"type":"boolean"}},{"name":"contract_id","required":false,"in":"query","description":"Documents generated from this contract. Matches on the generic `source_type`/`source_id` pair the billing engine already stamps. This is a SUPERSET of `GET /v1/billing-schedules/contracts/{id}/documents`: that sub-resource narrows the same underlying pair to `status IN (posted, voided)`, while this filter also returns contract-sourced documents in other non-deleted, non-pending statuses (e.g. `draft`, `posting_failed`, `reversed`). Add `status=posted` to reproduce the sub-resource result set.","schema":{"format":"uuid","type":"string"}},{"name":"is_intercompany","required":false,"in":"query","description":"In-group filter, for every document type. `true` returns an intercompany transaction, or any document naming another legal entity of the org as counterparty; `false` returns every other document.","schema":{"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at","-document_date","document_date","-document_number","document_number","-due_date","due_date","-total_amount","total_amount","-status","status"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: document_number, party name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DocumentListItemDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List documents","tags":["Documents"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["documents:read"]},"post":{"operationId":"Documents.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDocumentV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DocumentCreatedDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DOCUMENT_SOURCE_FIELDS_RESERVED, DOCUMENT_TYPE_NOT_CREATABLE_HERE, DIMENSION_ENTITY_MISMATCH, DIMENSION_REQUIRED, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DOCUMENT_PARTY_IS_LEGAL_ENTITY, DOCUMENT_COUNTERPARTY_IS_OWN_ENTITY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a document (auto-posts asynchronously)","tags":["Documents"],"x-error-codes":["VALIDATION_FAILED","DOCUMENT_SOURCE_FIELDS_RESERVED","DOCUMENT_TYPE_NOT_CREATABLE_HERE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","DIMENSION_ENTITY_MISMATCH","DIMENSION_REQUIRED","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","LEGAL_ENTITY_NOT_IN_SCOPE","DOCUMENT_PARTY_IS_LEGAL_ENTITY","DOCUMENT_COUNTERPARTY_IS_OWN_ENTITY"],"x-plannable":true,"x-required-scopes":["documents:write"]}},"/v1/documents/{id}":{"get":{"operationId":"Documents.getById","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DocumentDetailDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a document by id","tags":["Documents"],"x-error-codes":["DOCUMENT_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["documents:read"]},"put":{"description":"A `draft` is rewritten in place (header, lines, dimensions) and keeps its id; `post: true` also submits it. A `posted` invoice, bill, credit memo, vendor credit or journal entry is never edited in place: it is REISSUED — the original is voided and a replacement with a new number is created from this request, linked by `replaces_document_id`, and its live payment applications move onto the replacement. The response then names the replacement: `id` is the NEW document, `status` is `posted`, or `pending_approval` when an approval rule held it (the original stays posted until the replacement is approved). Other posted types, and engine-generated documents, are refused with 409 POSTED_DOCUMENT_NOT_REISSUABLE.","operationId":"Documents.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDocumentV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DocumentUpdatedDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: POSTED_DOCUMENT_NOT_REISSUABLE, REISSUE_APPLICATIONS_DO_NOT_FIT, REISSUE_PARTY_CHANGE_WITH_APPLICATIONS, REISSUE_FIELD_IMMUTABLE, DOCUMENT_HAS_PENDING_REPLACEMENT, DOCUMENT_BALANCE_OUT_OF_RANGE, APPLICATIONS_EXCEED_TOTAL, DOCUMENT_RECONCILED_CANNOT_EDIT, DOCUMENT_MATCHED_CANNOT_EDIT, DOCUMENT_CHANGED_WHILE_EDITING, DOCUMENT_NETTED_BY_ESCALATION, IDEMPOTENCY_CONFLICT, DOCUMENT_STATUS_FORBIDS_ACTION, DOCUMENT_NOT_SUBMITTABLE, DOCUMENT_COST_CAPITALIZED_CANNOT_EDIT, DOCUMENT_DISPOSAL_INVOICE_CANNOT_EDIT, DOCUMENT_ASSET_TRANSFER_CANNOT_EDIT, CREDIT_HAS_ACTIVE_APPLICATIONS, TARGET_HAS_ACTIVE_APPLICATIONS, DOCUMENT_HELD_BY_PAYMENT_RUN, DOCUMENT_HELD_BY_DISTRIBUTION, DOCUMENT_HELD_BY_DISTRIBUTION_REFUND, DOCUMENT_HELD_BY_IC_SETTLEMENT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DOCUMENT_SOURCE_FIELDS_RESERVED, DOCUMENT_TYPE_NOT_EDITABLE_HERE, DIMENSION_ENTITY_MISMATCH, DIMENSION_REQUIRED, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DOCUMENT_PARTY_IS_LEGAL_ENTITY, DOCUMENT_COUNTERPARTY_IS_OWN_ENTITY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a document","tags":["Documents"],"x-error-codes":["VALIDATION_FAILED","DOCUMENT_SOURCE_FIELDS_RESERVED","DOCUMENT_TYPE_NOT_EDITABLE_HERE","POSTED_DOCUMENT_NOT_REISSUABLE","REISSUE_APPLICATIONS_DO_NOT_FIT","REISSUE_PARTY_CHANGE_WITH_APPLICATIONS","REISSUE_FIELD_IMMUTABLE","DOCUMENT_HAS_PENDING_REPLACEMENT","DOCUMENT_BALANCE_OUT_OF_RANGE","APPLICATIONS_EXCEED_TOTAL","DOCUMENT_NOT_FOUND","DOCUMENT_RECONCILED_CANNOT_EDIT","DOCUMENT_MATCHED_CANNOT_EDIT","DOCUMENT_CHANGED_WHILE_EDITING","DOCUMENT_NETTED_BY_ESCALATION","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","DIMENSION_ENTITY_MISMATCH","DIMENSION_REQUIRED","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","DOCUMENT_STATUS_FORBIDS_ACTION","DOCUMENT_NOT_SUBMITTABLE","LEGAL_ENTITY_NOT_IN_SCOPE","DOCUMENT_COST_CAPITALIZED_CANNOT_EDIT","DOCUMENT_DISPOSAL_INVOICE_CANNOT_EDIT","DOCUMENT_ASSET_TRANSFER_CANNOT_EDIT","CREDIT_HAS_ACTIVE_APPLICATIONS","TARGET_HAS_ACTIVE_APPLICATIONS","DOCUMENT_HELD_BY_PAYMENT_RUN","DOCUMENT_HELD_BY_DISTRIBUTION","DOCUMENT_HELD_BY_DISTRIBUTION_REFUND","DOCUMENT_HELD_BY_IC_SETTLEMENT","DOCUMENT_PARTY_IS_LEGAL_ENTITY","DOCUMENT_COUNTERPARTY_IS_OWN_ENTITY"],"x-high-risk":true,"x-high-risk-reason":"Voids and reissues a posted document.","x-required-scopes":["documents:write"]}},"/v1/documents/{id}/email-pdf-url":{"get":{"operationId":"Documents.emailPdfUrl","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EmailPdfUrlDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a short-lived signed URL to the PDF that was actually emailed for this invoice","tags":["Documents"],"x-error-codes":["DOCUMENT_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["documents:read"]}},"/v1/documents/{id}/post":{"post":{"description":"A `draft` is submitted through the approval engine, exactly as submit is: when no approval rule matches it is posted and the journal entry is created (`status: posted`); when a rule matches it is held with no journal entry (`status: pending_approval`) and an approval request is opened — it posts once that request is approved. A `posting_pending` or `posting_failed` document is (re)posted directly. Any other status is refused with 409 DOCUMENT_STATUS_FORBIDS_ACTION, and a document with an open approval request with 409 DOCUMENT_AWAITING_APPROVAL.","operationId":"Documents.post","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DocumentPostedDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DOCUMENT_STATUS_FORBIDS_ACTION, DOCUMENT_AWAITING_APPROVAL, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DOCUMENT_PARTY_IS_LEGAL_ENTITY, DOCUMENT_TYPE_NOT_POSTABLE_HERE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Post a document, or hold a draft for approval","tags":["Documents"],"x-error-codes":["DOCUMENT_NOT_FOUND","DOCUMENT_STATUS_FORBIDS_ACTION","DOCUMENT_AWAITING_APPROVAL","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","DOCUMENT_PARTY_IS_LEGAL_ENTITY","DOCUMENT_TYPE_NOT_POSTABLE_HERE"],"x-high-risk":true,"x-high-risk-reason":"Posts a document to the ledger.","x-plannable":true,"x-required-scopes":["documents:write"]}},"/v1/documents/{id}/mark-paid":{"post":{"description":"Paying an in-group distribution leg also records the receiving entity's payment on its receipt, and paying a parent's investment in a subsidiary records the subsidiary's payment on its capital contribution, in the same transaction (paired payments): pass paired_payment_date and paired_bank_account_id to choose its date and bank account. When that side cannot be recorded the call fails with PAIRED_PAYMENT_NOT_RECORDABLE and nothing is written.","operationId":"Documents.markBillPaid","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkBillPaidV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MarkBillPaidResponseV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DOCUMENT_STATUS_FORBIDS_ACTION, DOCUMENT_HELD_BY_PAYMENT_RUN, IDEMPOTENCY_CONFLICT, PERIOD_LOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAIRED_PAYMENT_NOT_RECORDABLE, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Manually mark a bill, invoice, distribution leg or investment in a subsidiary as paid — records a manual payment and applies it to the document","tags":["Documents"],"x-error-codes":["DOCUMENT_NOT_FOUND","VALIDATION_FAILED","DOCUMENT_STATUS_FORBIDS_ACTION","DOCUMENT_HELD_BY_PAYMENT_RUN","PAIRED_PAYMENT_NOT_RECORDABLE","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","PERIOD_LOCKED","PERIOD_MISSING","DIMENSION_REQUIRED"],"x-required-scopes":["documents:write"]}},"/v1/documents/{id}/pay-with-spark-pay":{"post":{"description":"Pays a single bill as a payment run of one. `documents:write` may START the payment; RELEASING the money keeps the owner/admin gate the batch rail has, so a shortcut is never an easier way to move money. A caller without that gate gets `approved_awaiting_send`, which is a resting state and not an error.","operationId":"Documents.payWithSparkPay","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayBillSparkPayV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PayBillSparkPayResponseV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_SPARK_PAY_DISTRIBUTION_LEGS, PAYMENT_RUN_BILL_RESERVED, PAYMENT_RUN_GENERATION_STALE_BILLS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_BANK_NOT_MOOV_LINKED, PAYMENT_RUN_BILL_NOT_ELIGIBLE, PAYMENT_RUN_INTERCOMPANY_NOT_SPARK_PAY, PAYMENT_RUN_ENTITY_ACCOUNT_INVALID, PAYMENT_RUN_CURRENCY_MISMATCH, PAYMENT_RUN_BANK_ACCOUNT_MISSING_CASH_ACCOUNT, PAYMENT_RUN_VENDORS_NOT_PAYABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Pay this bill with Spark Pay","tags":["Documents"],"x-error-codes":["PAYMENT_RUN_BANK_NOT_MOOV_LINKED","PAYMENT_RUN_BILL_NOT_ELIGIBLE","PAYMENT_RUN_SPARK_PAY_DISTRIBUTION_LEGS","PAYMENT_RUN_INTERCOMPANY_NOT_SPARK_PAY","PAYMENT_RUN_BILL_RESERVED","PAYMENT_RUN_ENTITY_ACCOUNT_INVALID","PAYMENT_RUN_CURRENCY_MISMATCH","PAYMENT_RUN_BANK_ACCOUNT_MISSING_CASH_ACCOUNT","PAYMENT_RUN_GENERATION_STALE_BILLS","PAYMENT_RUN_VENDORS_NOT_PAYABLE","LEGAL_ENTITY_NOT_IN_SCOPE","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Sends money out of a bank account to pay a bill.","x-required-scopes":["documents:write"]}},"/v1/documents/{id}/submit":{"post":{"operationId":"Documents.submit","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DocumentSubmittedDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DOCUMENT_NOT_SUBMITTABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DOCUMENT_PARTY_IS_LEGAL_ENTITY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Submit a draft document through the approval gate (posts when no rule matches)","tags":["Documents"],"x-error-codes":["DOCUMENT_NOT_FOUND","DOCUMENT_NOT_SUBMITTABLE","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","DOCUMENT_PARTY_IS_LEGAL_ENTITY"],"x-high-risk":true,"x-high-risk-reason":"Posts a document to the ledger when no approval rule applies.","x-required-scopes":["documents:write"]}},"/v1/documents/{id}/reopen":{"post":{"operationId":"Documents.reopen","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DocumentReopenedDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DOCUMENT_NOT_REOPENABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Reopen a rejected document to draft for editing (no re-evaluation)","tags":["Documents"],"x-error-codes":["DOCUMENT_NOT_FOUND","DOCUMENT_NOT_REOPENABLE","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["documents:write"]}},"/v1/documents/{id}/void":{"post":{"description":"Reversing a POSTED document posts a contra journal entry; the original and the contra both stay effective and net to zero, so nothing disappears from a statement. When the original entry’s period is closed or locked the contra entry is dated into the CURRENT open period instead, leaving the closed period’s reported figures unchanged — `reversal_moved_to_current_period` says when that happened. Pass `reverse_in_original_period` (requires accounting:periods_override) to restate the original period in place instead.","operationId":"Documents.void","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoidDocumentV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DocumentVoidedDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PERIOD_OVERRIDE_FORBIDDEN, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DOCUMENT_ALREADY_VOIDED, DOCUMENT_RECONCILED_CANNOT_VOID, DOCUMENT_MATCHED_CANNOT_VOID, DOCUMENT_RETIREMENT_CANNOT_VOID, DOCUMENT_DISPOSAL_INVOICE_CANNOT_VOID, DOCUMENT_RE_TAX_BILL_VOID_AT_SOURCE, DOCUMENT_ASSET_TRANSFER_CANNOT_VOID, DOCUMENT_NETTED_BY_ESCALATION, DOCUMENT_COST_CAPITALIZED_CANNOT_VOID, PERIOD_LOCKED, NO_OPEN_PERIOD_FOR_CORRECTION, IDEMPOTENCY_CONFLICT, DOCUMENT_STATUS_FORBIDS_ACTION, CREDIT_HAS_ACTIVE_APPLICATIONS, TARGET_HAS_ACTIVE_APPLICATIONS, DOCUMENT_REFUNDS_EXCEED_REMAINING_PAYMENTS, DOCUMENT_HELD_BY_PAYMENT_RUN, DOCUMENT_HELD_BY_DISTRIBUTION, DOCUMENT_HELD_BY_DISTRIBUTION_REFUND, DOCUMENT_HELD_BY_IC_SETTLEMENT, PAIRED_PAYMENT_RECONCILED, LOAN_PREPAYMENT_NOT_LATEST, LOAN_PREPAYMENT_PERIOD_ACTED, LOAN_PREPAYMENT_ACCRUED_SINCE, LOAN_ACCRUAL_NOT_LATEST, LOAN_ACCRUAL_PERIOD_BILLED, LOAN_DRAWDOWN_ACTED_SINCE, LOAN_DRAWDOWN_ONLY_FUNDING, LOAN_REGENERATION_BLOCKED_BY_CURTAILMENT, LOAN_ESCROW_CLOSED, DOCUMENT_HAS_PENDING_REPLACEMENT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DOCUMENT_VOID_REQUIRES_MEMO, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Void a document (deletes if pending, reverses if posted)","tags":["Documents"],"x-error-codes":["DOCUMENT_NOT_FOUND","DOCUMENT_ALREADY_VOIDED","DOCUMENT_VOID_REQUIRES_MEMO","DOCUMENT_RECONCILED_CANNOT_VOID","DOCUMENT_MATCHED_CANNOT_VOID","DOCUMENT_RETIREMENT_CANNOT_VOID","DOCUMENT_DISPOSAL_INVOICE_CANNOT_VOID","DOCUMENT_RE_TAX_BILL_VOID_AT_SOURCE","DOCUMENT_ASSET_TRANSFER_CANNOT_VOID","DOCUMENT_NETTED_BY_ESCALATION","DOCUMENT_COST_CAPITALIZED_CANNOT_VOID","PERIOD_LOCKED","PERIOD_MISSING","PERIOD_OVERRIDE_FORBIDDEN","NO_OPEN_PERIOD_FOR_CORRECTION","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","DOCUMENT_STATUS_FORBIDS_ACTION","LEGAL_ENTITY_NOT_IN_SCOPE","CREDIT_HAS_ACTIVE_APPLICATIONS","TARGET_HAS_ACTIVE_APPLICATIONS","DOCUMENT_REFUNDS_EXCEED_REMAINING_PAYMENTS","DOCUMENT_HELD_BY_PAYMENT_RUN","DOCUMENT_HELD_BY_DISTRIBUTION","DOCUMENT_HELD_BY_DISTRIBUTION_REFUND","DOCUMENT_HELD_BY_IC_SETTLEMENT","PAIRED_PAYMENT_RECONCILED","LOAN_PREPAYMENT_NOT_LATEST","LOAN_PREPAYMENT_PERIOD_ACTED","LOAN_PREPAYMENT_ACCRUED_SINCE","LOAN_ACCRUAL_NOT_LATEST","LOAN_ACCRUAL_PERIOD_BILLED","LOAN_DRAWDOWN_ACTED_SINCE","LOAN_DRAWDOWN_ONLY_FUNDING","LOAN_REGENERATION_BLOCKED_BY_CURTAILMENT","LOAN_ESCROW_CLOSED","DOCUMENT_HAS_PENDING_REPLACEMENT"],"x-high-risk":true,"x-high-risk-reason":"Voids a document and reverses its ledger entries.","x-required-scopes-any":["documents:write","documents:delete"]}},"/v1/documents/{id}/send-email":{"post":{"operationId":"Documents.sendEmail","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["payload","pdf"],"properties":{"payload":{"type":"string","description":"JSON: { to, cc?, bcc?, subject, body, send_copy }. Append `payload` before the `pdf` file part."},"pdf":{"type":"string","format":"binary"}}}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SendDocumentEmailResultDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DOCUMENT_NOT_POSTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"502":{"description":"Possible error codes: EMAIL_SEND_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Send an invoice by email with the attached PDF.","tags":["Documents"],"x-error-codes":["DOCUMENT_NOT_FOUND","DOCUMENT_NOT_POSTED","VALIDATION_FAILED","EMAIL_SEND_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["documents:write"]}},"/v1/credit-memos/{id}/apply":{"post":{"operationId":"CreditMemos.apply","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCreditDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CreditApplyResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CREDIT_NOT_FULLY_APPLIED, CREDIT_HAS_ACTIVE_APPLICATIONS, DOCUMENT_STATUS_FORBIDS_ACTION, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEGAL_ENTITY_MISMATCH, PARTY_MISMATCH, CURRENCY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Apply a posted credit memo across one or more invoices — sum of amounts must equal the credit's remaining balance","tags":["Credit Memos"],"x-error-codes":["DOCUMENT_NOT_FOUND","VALIDATION_FAILED","CREDIT_NOT_FULLY_APPLIED","CREDIT_HAS_ACTIVE_APPLICATIONS","LEGAL_ENTITY_MISMATCH","PARTY_MISMATCH","CURRENCY_MISMATCH","DOCUMENT_STATUS_FORBIDS_ACTION","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["documents:write"]}},"/v1/credit-memos/{id}/reverse-apply":{"post":{"operationId":"CreditMemos.reverseApply","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CreditApplyResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DOCUMENT_STATUS_FORBIDS_ACTION, DOCUMENT_RECONCILED_CANNOT_CHANGE, DOCUMENT_REFUNDS_EXCEED_REMAINING_PAYMENTS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Reverse a credit memo's active applications, restoring balances and statuses on the credit and on every target invoice","tags":["Credit Memos"],"x-error-codes":["DOCUMENT_NOT_FOUND","VALIDATION_FAILED","DOCUMENT_STATUS_FORBIDS_ACTION","DOCUMENT_RECONCILED_CANNOT_CHANGE","DOCUMENT_REFUNDS_EXCEED_REMAINING_PAYMENTS","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Reverses a credit memo's posted applications.","x-required-scopes":["documents:write"]}},"/v1/vendor-credits/{id}/apply":{"post":{"operationId":"VendorCredits.apply","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCreditDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CreditApplyResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CREDIT_NOT_FULLY_APPLIED, CREDIT_HAS_ACTIVE_APPLICATIONS, DOCUMENT_STATUS_FORBIDS_ACTION, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEGAL_ENTITY_MISMATCH, PARTY_MISMATCH, CURRENCY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Apply a posted vendor credit across one or more bills — sum of amounts must equal the credit's remaining balance","tags":["Vendor Credits"],"x-error-codes":["DOCUMENT_NOT_FOUND","VALIDATION_FAILED","CREDIT_NOT_FULLY_APPLIED","CREDIT_HAS_ACTIVE_APPLICATIONS","LEGAL_ENTITY_MISMATCH","PARTY_MISMATCH","CURRENCY_MISMATCH","DOCUMENT_STATUS_FORBIDS_ACTION","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["documents:write"]}},"/v1/vendor-credits/{id}/reverse-apply":{"post":{"operationId":"VendorCredits.reverseApply","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CreditApplyResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DOCUMENT_STATUS_FORBIDS_ACTION, DOCUMENT_RECONCILED_CANNOT_CHANGE, DOCUMENT_REFUNDS_EXCEED_REMAINING_PAYMENTS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Reverse a vendor credit's active applications, restoring balances and statuses on the credit and on every target bill","tags":["Vendor Credits"],"x-error-codes":["DOCUMENT_NOT_FOUND","VALIDATION_FAILED","DOCUMENT_STATUS_FORBIDS_ACTION","DOCUMENT_RECONCILED_CANNOT_CHANGE","DOCUMENT_REFUNDS_EXCEED_REMAINING_PAYMENTS","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Reverses a vendor credit's posted applications.","x-required-scopes":["documents:write"]}},"/v1/documents/{documentId}/attachments":{"get":{"description":"Newest first by default. `search` matches the file name. `ids` (up to 100) returns those attachments of this document and ignores `search`; an id from another document returns nothing.","operationId":"Documents.listAttachments","parameters":[{"name":"documentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -uploaded_at","schema":{"enum":["-uploaded_at","uploaded_at","file_name","-file_name"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: file_name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DocumentAttachmentDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List attachments for a document","tags":["Documents"],"x-error-codes":["DOCUMENT_NOT_FOUND","VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["documents:read"]},"post":{"operationId":"Documents.uploadAttachment","parameters":[{"name":"documentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF, PNG, JPEG, or WebP file. Max 25 MiB. Magic-byte sniffed server-side."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DocumentAttachmentDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: ATTACHMENT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: ATTACHMENT_TYPE_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a PDF or image attachment","tags":["Documents"],"x-error-codes":["DOCUMENT_NOT_FOUND","ATTACHMENT_TYPE_UNSUPPORTED","ATTACHMENT_TOO_LARGE","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["documents:write"]}},"/v1/documents/{documentId}/attachments/{attachmentId}/download":{"get":{"operationId":"Documents.getAttachmentDownloadUrl","parameters":[{"name":"documentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"attachmentId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DocumentAttachmentDownloadUrlDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND, DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a short-lived signed download URL for an attachment","tags":["Documents"],"x-error-codes":["ATTACHMENT_NOT_FOUND","DOCUMENT_NOT_FOUND"],"x-required-scopes":["documents:read"]}},"/v1/documents/{documentId}/attachments/{attachmentId}":{"delete":{"operationId":"Documents.deleteAttachment","parameters":[{"name":"documentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"attachmentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND, DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete an attachment","tags":["Documents"],"x-error-codes":["ATTACHMENT_NOT_FOUND","DOCUMENT_NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["documents:write"]}},"/v1/documents/invoices/{id}/refund":{"post":{"operationId":"Invoices.refund","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundInvoiceV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DocumentCreatedDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DOCUMENT_STATUS_FORBIDS_ACTION, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: REFUND_EXCEEDS_REFUNDABLE_AMOUNT, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Refund an invoice (full or partial). Creates a refund document linked to the invoice via refunded_from_document_id.","tags":["Invoices"],"x-error-codes":["DOCUMENT_NOT_FOUND","VALIDATION_FAILED","REFUND_EXCEEDS_REFUNDABLE_AMOUNT","DOCUMENT_STATUS_FORBIDS_ACTION","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","DIMENSION_REQUIRED"],"x-high-risk":true,"x-high-risk-reason":"Refunds money on an invoice and posts it to the ledger.","x-required-scopes":["documents:write"]}},"/v1/payment-applications":{"post":{"operationId":"PaymentApplications.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentApplicationV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentApplicationCreatedDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, PAYMENT_APPLICATION_LEGAL_ENTITY_MISMATCH, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DOCUMENT_STATUS_FORBIDS_ACTION, PERIOD_LOCKED, IDEMPOTENCY_CONFLICT, PERIOD_CLOSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_DEBT_SERVICE_PAYMENT_NOT_APPLICABLE, MISSING_SYSTEM_ROLE_ACCOUNT, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, PAIRED_PAYMENT_NOT_RECORDABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Apply a payment to an invoice/bill","tags":["Payment Applications"],"x-error-codes":["VALIDATION_FAILED","DOCUMENT_NOT_FOUND","PAYMENT_APPLICATION_LEGAL_ENTITY_MISMATCH","LOAN_DEBT_SERVICE_PAYMENT_NOT_APPLICABLE","DOCUMENT_STATUS_FORBIDS_ACTION","LEGAL_ENTITY_NOT_IN_SCOPE","MISSING_SYSTEM_ROLE_ACCOUNT","PERIOD_LOCKED","PERIOD_MISSING","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_CLOSED","PAIRED_PAYMENT_NOT_RECORDABLE"],"x-required-scopes":["documents:write"]}},"/v1/approvals":{"get":{"description":"Default: the approver inbox — the caller’s ACTIVE tasks on PENDING requests, snapshot-matched, on the unified list contract (100 per page, `sort` `-submitted_at` (default) or `submitted_at`, `search`, `ids`). One row per task: `id` equals `task_id`, and `ids` matches the caller’s own task ids only. Each `data` entry (ApprovalInboxItemDto) is subject-polymorphic: `document` is populated for a document-approval request, `payment_run` for a payment-run approval request, `distribution_batch` for a distribution-batch approval request, `portal_package` for an investor-portal package publish request, `portal_publish_run` for a bulk publish-run approval request, and `waterfall_version` for a waterfall version activation request — at most one of these six is non-null per item (a `portal_publish_run` item carries none of the others), and `actionable` is computed off whichever total applies (a portal-package request never requires authority, but is never actionable for its own submitter, nor for a caller without `portal:manage`).\n\nThe `document_id` and `status` switches below are DEPRECATED (use `GET /v1/approvals/requests`); they keep their own shapes, 50-row default and `limit`/`cursor` handling.\n\nWhen `document_id` is supplied this switches to a DIFFERENT, request-level shape: that document’s full approval-request history — ALL requests across ALL statuses (pending/approved/rejected/cancelled), most-recent first, org-scoped. The snapshot match and the active/pending filters are ignored, and the result is unpaginated (`meta.next_cursor` is always null) because a document has few requests. Each `data` entry is an ApprovalRequestSummaryDto: { request_id, document_id, status, current_step_order, submitted_by, submitted_at, resolved_at, rule_id }.\n\nWhen `status` is supplied (and `document_id` is not) this switches to a THIRD shape: the ORG-WIDE history of RESOLVED requests for that terminal status (`approved` or `rejected`), most-recently-resolved first (`resolved_at DESC, id DESC`), cursor-paginated. Each `data` entry is an ApprovalHistoryItemDto: { request_id, status, submitted_by, submitted_at, resolved_at, approved_by, document, payment_run, distribution_batch, portal_package, portal_publish_run, waterfall_version }: the same six fields the default inbox shape carries, covering all six approval subjects — no subject filter is applied here, so a resolved `portal_publish_run` or `waterfall_version` request appears in this list labelled, not with every subject null. `approved_by` is the distinct user ids that recorded an `approve` decision on the request, ordered by their earliest approve-decision time (empty for a request with no approve decisions). An unknown `status` is rejected with 400 VALIDATION_FAILED.","operationId":"Approvals.list","parameters":[{"name":"document_type","required":false,"in":"query","description":"Inbox-only filter. A real document type (e.g. `bill`) restricts to that document type; the special value `payment_run` restricts to payment-run approval requests, `distribution_batch` to distribution-batch approval requests, `portal_package` to investor-portal package publish requests, `portal_publish_run` to bulk publish-run approval requests, and `waterfall_version` to waterfall version activation requests instead.","schema":{"type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"document_id","required":false,"in":"query","deprecated":true,"description":"Deprecated: use `GET /v1/approvals/requests`. A document id switches this route to that document’s request-level history (summary shape, unpaginated).","schema":{"type":"string"}},{"name":"status","required":false,"in":"query","deprecated":true,"description":"Deprecated: use `GET /v1/approvals/requests`. `approved` or `rejected` switches this route to the org-wide resolved-request history. Ignored when `document_id` is present.","schema":{"type":"string","enum":["approved","rejected"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -submitted_at","schema":{"enum":["-submitted_at","submitted_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: document_number, party name, payment run number, legal entity name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalInboxItemDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the approver inbox (active tasks the caller can act on)","tags":["approvals"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["approvals:read"]}},"/v1/approvals/requests":{"get":{"description":"Org-wide approval requests, one row per request (`id` is the request id), on the unified list contract (100 per page). `status` takes a comma list of pending/approved/rejected/cancelled; `document_id` restricts to one document’s requests; `document_type` and `legal_entity_id` filter the subject as in the inbox. Sorts by `submitted_at` or `resolved_at`; a pending request has no resolution time and sorts as the latest by `resolved_at`. `ids` returns those requests regardless of other filters (the org still applies). Each row carries exactly one of document/payment_run/distribution_batch/portal_package/portal_publish_run — a bulk publish-run request (Task 4’s fifth subject) is labelled by its own `portal_publish_run` block, not left with every subject null.","operationId":"Approvals.listRequests","parameters":[{"name":"status","required":false,"in":"query","description":"Comma-separated request statuses: pending, approved, rejected, cancelled.","schema":{"example":"approved,rejected","type":"string"}},{"name":"document_id","required":false,"in":"query","description":"Only the requests of this document.","schema":{"format":"uuid","type":"string"}},{"name":"document_type","required":false,"in":"query","description":"A document type, or `payment_run`, `distribution_batch`, `portal_package`, `portal_publish_run`, `waterfall_version`.","schema":{"type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -submitted_at","schema":{"enum":["-submitted_at","submitted_at","-resolved_at","resolved_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: document_number, party name, payment run number, legal entity name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalRequestListItemDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List approval requests of any status (history and per-document)","tags":["approvals"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["approvals:read"]}},"/v1/approvals/count":{"get":{"description":"`pending` is the caller’s active tasks on pending requests (the inbox membership); `actionable` is those the caller can act on now (the inbox `actionable` flag). A non-member reads as the inbox does.","operationId":"Approvals.count","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApprovalCountDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Count the caller’s inbox (the approvals badge)","tags":["approvals"],"x-pagination":{"mode":"computed","reason":"count of the caller’s inbox"},"x-required-scopes":["approvals:read"]}},"/v1/approvals/{id}":{"get":{"operationId":"Approvals.getById","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApprovalDetailDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a single approval request with its task chain + history","tags":["approvals"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["approvals:read"]}},"/v1/approvals/{id}/decision":{"post":{"operationId":"Approvals.decide","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecideApprovalDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApprovalActionResultDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record an approve/reject decision on an approval request","tags":["approvals"],"x-error-codes":["VALIDATION_FAILED","FORBIDDEN","LEGAL_ENTITY_NOT_IN_SCOPE","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Approves or rejects a request, which can release money.","x-required-scopes":["documents:approve"]}},"/v1/approvals/{id}/withdraw":{"post":{"operationId":"Approvals.withdraw","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApprovalActionResultDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Withdraw (cancel) an open approval request as its submitter","tags":["approvals"],"x-error-codes":["FORBIDDEN","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["documents:write"]}},"/v1/approval-rules":{"post":{"operationId":"ApprovalRules.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApprovalRuleDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApprovalRuleIdDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: APPROVAL_RULE_UNSATISFIABLE, APPROVAL_RULE_APPROVERS_NOT_ALLOWED, APPROVAL_RULE_NOT_ALLOWED_FOR_SUBJECT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create an approval rule (conditions + steps + approvers)","tags":["approval-rules"],"x-error-codes":["VALIDATION_FAILED","APPROVAL_RULE_UNSATISFIABLE","APPROVAL_RULE_APPROVERS_NOT_ALLOWED","APPROVAL_RULE_NOT_ALLOWED_FOR_SUBJECT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Changes who must approve money.","x-required-scopes":["approvals:configure"]},"get":{"description":"Approval rules on the unified list contract (100 per page). `search` matches the rule name. Default sort `subject_type` orders by subject type, then priority descending, then name; `-subject_type` reverses the type order while priority (descending) and name (ascending) keep their order. `ids` returns those rules regardless of `subject_type` and `search` (the org still applies).","operationId":"ApprovalRules.list","parameters":[{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: subject_type","schema":{"enum":["subject_type","-subject_type","priority","-priority","name","-name"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}},{"name":"subject_type","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalRuleDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List approval rules, optionally filtered by subject_type","tags":["approval-rules"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["approvals:read"]}},"/v1/approval-rules/{id}":{"get":{"operationId":"ApprovalRules.getById","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApprovalRuleDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a single approval rule with its conditions + steps","tags":["approval-rules"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["approvals:read"]},"put":{"operationId":"ApprovalRules.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateApprovalRuleDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApprovalRuleIdDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: APPROVAL_RULE_UNSATISFIABLE, APPROVAL_RULE_APPROVERS_NOT_ALLOWED, APPROVAL_RULE_NOT_ALLOWED_FOR_SUBJECT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace an approval rule (full replace of conditions + steps)","tags":["approval-rules"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","APPROVAL_RULE_UNSATISFIABLE","APPROVAL_RULE_APPROVERS_NOT_ALLOWED","APPROVAL_RULE_NOT_ALLOWED_FOR_SUBJECT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Changes who must approve money.","x-required-scopes":["approvals:configure"]},"delete":{"operationId":"ApprovalRules.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApprovalRuleIdDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete an approval rule (children cascade)","tags":["approval-rules"],"x-error-codes":["NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Removes an approval control on money.","x-required-scopes":["approvals:configure"]}},"/v1/legal-entities/{legalEntityId}/equity-classes":{"get":{"description":"Returns the equity classes configured on this legal entity — the GP/LP/common/preferred/co-invest catalog that equity positions are admitted into. Ordered by `seniority_rank`, then `code`. An unknown legal entity id, or one belonging to another organization, is a 404 — an empty list means the entity exists and has no classes configured.","operationId":"EquityClasses.list","parameters":[{"name":"legalEntityId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EquityClassV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_LEGAL_ENTITY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List equity classes for a legal entity","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_LEGAL_ENTITY_NOT_FOUND"],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"a handful of equity classes per legal entity"},"x-required-scopes":["equity:read"]},"post":{"description":"Admits a new class — e.g. Common, Preferred A, GP Interest — under this legal entity. `code` is unique per legal entity and immutable once created.","operationId":"EquityClasses.create","parameters":[{"name":"legalEntityId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEquityClassV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EquityClassV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_LEGAL_ENTITY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EQUITY_CLASS_CODE_TAKEN, CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_CLASS_ACCOUNT_INVALID, EQUITY_PROMOTE_CLASS_COUNTS_TOWARD_OWNERSHIP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create an equity class","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_LEGAL_ENTITY_NOT_FOUND","EQUITY_CLASS_ACCOUNT_INVALID","EQUITY_PROMOTE_CLASS_COUNTS_TOWARD_OWNERSHIP","EQUITY_CLASS_CODE_TAKEN","CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["equity:write"]}},"/v1/legal-entities/{legalEntityId}/equity-classes/standard":{"post":{"description":"Adds the standard classes for the legal entity's type to an entity that has none: Common units for an LLC, General partner and Limited partners for a partnership, Common stock for a corporation, Common otherwise. Each takes the create defaults (seniority 0, not unit-based, capital first). A new entity already gets them when it is created; this is for one created without them. An entity with any class answers 409 `EQUITY_CLASSES_ALREADY_EXIST`.","operationId":"EquityClasses.seedStandard","parameters":[{"name":"legalEntityId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EquityClassV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_LEGAL_ENTITY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EQUITY_CLASSES_ALREADY_EXIST, EQUITY_CLASS_CODE_TAKEN, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add the standard equity classes","tags":["Equity"],"x-error-codes":["LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_LEGAL_ENTITY_NOT_FOUND","EQUITY_CLASSES_ALREADY_EXIST","EQUITY_CLASS_CODE_TAKEN","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["equity:write"]}},"/v1/equity-classes/{id}":{"patch":{"description":"Partial update. `kind` and `unit_based` are editable only until the class has its first equity position — after that, changing either is refused (422) since it would reinterpret every position already on the class. `code` cannot be changed.","operationId":"EquityClasses.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEquityClassV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EquityClassV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_CLASS_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EQUITY_CLASS_SIDE_CHANGE_IN_WATERFALL, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_CLASS_FIELD_FROZEN, EQUITY_PROMOTE_CLASS_COUNTS_TOWARD_OWNERSHIP, EQUITY_CLASS_ACCOUNT_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update an equity class","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_CLASS_NOT_FOUND","EQUITY_CLASS_FIELD_FROZEN","EQUITY_CLASS_SIDE_CHANGE_IN_WATERFALL","EQUITY_PROMOTE_CLASS_COUNTS_TOWARD_OWNERSHIP","EQUITY_CLASS_ACCOUNT_INVALID","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["equity:write"]}},"/v1/legal-entities/{legalEntityId}/waterfalls":{"get":{"description":"One waterfall per distribution type (`operating_income`, `capital_event`, `any`), each with a summary of its active version and of the version currently being designed.","operationId":"Waterfalls.list","parameters":[{"name":"legalEntityId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: distribution_type","schema":{"enum":["distribution_type","-distribution_type","name","-name"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WaterfallListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_LEGAL_ENTITY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the waterfalls of a legal entity","tags":["Equity"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_LEGAL_ENTITY_NOT_FOUND"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["equity:read"]},"post":{"description":"Creates the (empty) waterfall for one distribution type of the legal entity. Design its first version with `POST /v1/waterfalls/{id}/versions`.","operationId":"Waterfalls.create","parameters":[{"name":"legalEntityId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWaterfallV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WaterfallV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY, IDEMPOTENCY_KEY_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_LEGAL_ENTITY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, EQUITY_WATERFALL_TYPE_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a waterfall","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","EQUITY_LEGAL_ENTITY_NOT_FOUND","EQUITY_WATERFALL_TYPE_TAKEN","IDEMPOTENCY_KEY_REQUIRED"],"x-required-scopes":["equity:write"]}},"/v1/waterfalls/{id}":{"get":{"description":"The waterfall and all its versions, oldest first, each with tiers, participants, rate steps and opening state. An open (draft or pending approval) version also carries `issues`: everything validation finds wrong with it today.","operationId":"Waterfalls.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WaterfallDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_WATERFALL_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a waterfall with every version","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_WATERFALL_NOT_FOUND"],"x-required-scopes":["equity:read"]},"patch":{"description":"Partial update; only `name` is editable.","operationId":"Waterfalls.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWaterfallV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WaterfallV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_WATERFALL_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Rename a waterfall","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","EQUITY_WATERFALL_NOT_FOUND"],"x-required-scopes":["equity:write"]},"delete":{"description":"Allowed only while the waterfall has no active or superseded version and none waiting for approval (withdraw or decide it first); its draft versions go with it.","operationId":"Waterfalls.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"204":{"description":"The waterfall is deleted."},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_WATERFALL_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, EQUITY_WATERFALL_HAS_HISTORY, EQUITY_WATERFALL_VERSION_NOT_DRAFT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a waterfall","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","EQUITY_WATERFALL_NOT_FOUND","EQUITY_WATERFALL_HAS_HISTORY","EQUITY_WATERFALL_VERSION_NOT_DRAFT"],"x-required-scopes":["equity:write"]}},"/v1/waterfalls/{id}/versions":{"post":{"description":"Starts a draft. Its tiers (and their `tier_key`s) are copied from `from_version_id`, by default the active version; with neither it starts empty. A waterfall has at most one open version.","operationId":"Waterfalls.createVersion","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWaterfallVersionV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WaterfallVersionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY, IDEMPOTENCY_KEY_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_WATERFALL_NOT_FOUND, EQUITY_WATERFALL_VERSION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, EQUITY_WATERFALL_OPEN_VERSION_EXISTS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Draft a waterfall version","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","EQUITY_WATERFALL_NOT_FOUND","EQUITY_WATERFALL_VERSION_NOT_FOUND","EQUITY_WATERFALL_OPEN_VERSION_EXISTS","IDEMPOTENCY_KEY_REQUIRED"],"x-required-scopes":["equity:write"]}},"/v1/waterfall-versions/{id}":{"patch":{"description":"Partial update of the header fields and the agreement file. Draft versions only.","operationId":"Waterfalls.updateVersion","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWaterfallVersionV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WaterfallVersionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_WATERFALL_VERSION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, EQUITY_WATERFALL_VERSION_NOT_DRAFT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_WATERFALL_AGREEMENT_FILE_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a draft version header","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","EQUITY_WATERFALL_VERSION_NOT_FOUND","EQUITY_WATERFALL_VERSION_NOT_DRAFT","EQUITY_WATERFALL_AGREEMENT_FILE_INVALID"],"x-required-scopes":["equity:write"]},"delete":{"description":"Draft versions only.","operationId":"Waterfalls.deleteVersion","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"204":{"description":"The draft is deleted."},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_WATERFALL_VERSION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, EQUITY_WATERFALL_VERSION_NOT_DRAFT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a draft version","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","EQUITY_WATERFALL_VERSION_NOT_FOUND","EQUITY_WATERFALL_VERSION_NOT_DRAFT"],"x-required-scopes":["equity:write"]}},"/v1/waterfall-versions/{id}/tiers":{"put":{"description":"Full replacement of the version's tiers with their participants, rate steps and opening state. It stores what is well-formed and returns the version with its `issues`; it does not require the version to be valid (submitting does). A request the tables cannot hold is refused with `EQUITY_WATERFALL_VERSION_INVALID`, and `context.issues` names each problem by `code`: `tier_identity_duplicate` (a repeated tier key or sequence), `participant_class_unknown` (a class that is not of this legal entity), `participant_duplicate` (the same class twice in one tier), `opening_on_non_priority` (an opening state on a tier that is not `priority_share`), `rate_step_shape_invalid` (a step without exactly one of from_deal_year/from_date, or exactly one of rate/amount) and `rate_step_duplicate` (two steps starting the same year or date). Draft versions only.","operationId":"Waterfalls.replaceTiers","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplaceWaterfallTiersV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WaterfallVersionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_WATERFALL_VERSION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, EQUITY_WATERFALL_VERSION_NOT_DRAFT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_WATERFALL_VERSION_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace the tiers of a draft version","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","EQUITY_WATERFALL_VERSION_NOT_FOUND","EQUITY_WATERFALL_VERSION_NOT_DRAFT","EQUITY_WATERFALL_VERSION_INVALID"],"x-required-scopes":["equity:write"]}},"/v1/waterfall-versions/{id}/submit":{"post":{"description":"Validates the draft (every issue must be cleared, else `EQUITY_WATERFALL_VERSION_INVALID`), checks it can take effect on its date, and opens an approval request: the version becomes `pending_approval` and, once another owner or admin approves it, `active` (the previous active version becomes `superseded`). While it is pending it cannot be edited. A rejected or withdrawn request returns it to `draft`. When the organization has no matching approval rule the version becomes `active` at once and `request_id` is null. The first submit of an organization with no `waterfall_version` rule seeds the default one (one step, owner or admin).","operationId":"Waterfalls.submitVersion","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SubmitWaterfallVersionResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY, IDEMPOTENCY_KEY_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_WATERFALL_VERSION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, EQUITY_WATERFALL_VERSION_NOT_DRAFT, EQUITY_WATERFALL_ACTIVATION_STALE, EQUITY_WATERFALL_NO_OTHER_APPROVER","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_WATERFALL_VERSION_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Submit a draft version for approval","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","EQUITY_WATERFALL_VERSION_NOT_FOUND","EQUITY_WATERFALL_VERSION_NOT_DRAFT","EQUITY_WATERFALL_VERSION_INVALID","EQUITY_WATERFALL_ACTIVATION_STALE","EQUITY_WATERFALL_NO_OTHER_APPROVER","IDEMPOTENCY_KEY_REQUIRED"],"x-required-scopes":["equity:write"]}},"/v1/waterfall-versions/{id}/reconcile":{"post":{"description":"A version left `pending_approval` although its approval request was decided (the outcome never ran). Looks at its latest request: approved activates the version (its date is checked again; if it can no longer take effect it returns to `draft` with the failure recorded on the request), rejected or withdrawn returns it to `draft`. `status` is the version's new status.","operationId":"Waterfalls.reconcileVersion","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReconcileWaterfallVersionResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY, IDEMPOTENCY_KEY_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_WATERFALL_VERSION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, EQUITY_WATERFALL_RECONCILE_NOT_NEEDED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Repair a version stranded in approval","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","EQUITY_WATERFALL_VERSION_NOT_FOUND","EQUITY_WATERFALL_RECONCILE_NOT_NEEDED","IDEMPOTENCY_KEY_REQUIRED"],"x-required-scopes":["equity:write"]}},"/v1/waterfall-templates":{"get":{"description":"The organization's waterfall templates. `search` matches the name.","operationId":"WaterfallTemplates.list","parameters":[{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: name","schema":{"enum":["name","-name","created_at","-created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WaterfallTemplateV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List waterfall templates","tags":["Equity"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["equity:read"]},"post":{"description":"Snapshots the tiers of `version_id` (any status) under role labels. `roles` maps every class the version names to its label; two classes cannot share a label. Opening state is never copied, and the role labels of the result come from the snapshot.","operationId":"WaterfallTemplates.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWaterfallTemplateV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WaterfallTemplateV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY, IDEMPOTENCY_KEY_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_WATERFALL_VERSION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, EQUITY_WATERFALL_TEMPLATE_NAME_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_WATERFALL_TEMPLATE_ROLE_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Save a waterfall template from a version","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_WATERFALL_VERSION_NOT_FOUND","EQUITY_WATERFALL_TEMPLATE_ROLE_INVALID","EQUITY_WATERFALL_TEMPLATE_NAME_TAKEN","IDEMPOTENCY_KEY_REQUIRED"],"x-required-scopes":["equity:write"]}},"/v1/waterfall-templates/{id}":{"get":{"description":"One template with its tiers, described by role label.","operationId":"WaterfallTemplates.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WaterfallTemplateV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_WATERFALL_TEMPLATE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a waterfall template","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","EQUITY_WATERFALL_TEMPLATE_NOT_FOUND"],"x-required-scopes":["equity:read"]},"patch":{"description":"Partial update of `name` and `description`. The tiers never change, and drafts already made from the template are not affected.","operationId":"WaterfallTemplates.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWaterfallTemplateV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WaterfallTemplateV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_WATERFALL_TEMPLATE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, EQUITY_WATERFALL_TEMPLATE_NAME_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Rename or describe a waterfall template","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","EQUITY_WATERFALL_TEMPLATE_NOT_FOUND","EQUITY_WATERFALL_TEMPLATE_NAME_TAKEN"],"x-required-scopes":["equity:write"]},"delete":{"description":"Versions drafted from it keep their tiers; their `template_id` is only a record of origin.","operationId":"WaterfallTemplates.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"204":{"description":"The template is deleted."},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_WATERFALL_TEMPLATE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a waterfall template","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","EQUITY_WATERFALL_TEMPLATE_NOT_FOUND"],"x-required-scopes":["equity:write"]}},"/v1/waterfall-templates/{id}/apply":{"post":{"description":"Drafts a version of `waterfall_id` (`source = template`) from a copy of the tiers, each with a fresh `tier_key`. `classes` maps every role label of the template to a class of the waterfall's legal entity. Only a waterfall with no active or superseded version and no open one takes a template. Nothing is written on a refusal.","operationId":"WaterfallTemplates.apply","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyWaterfallTemplateV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WaterfallVersionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY, IDEMPOTENCY_KEY_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_WATERFALL_TEMPLATE_NOT_FOUND, EQUITY_WATERFALL_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, EQUITY_WATERFALL_HAS_HISTORY, EQUITY_WATERFALL_OPEN_VERSION_EXISTS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_WATERFALL_TEMPLATE_ROLE_UNMAPPED, EQUITY_WATERFALL_TEMPLATE_CLASS_INVALID, EQUITY_WATERFALL_VERSION_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Apply a template as a draft version","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_WATERFALL_TEMPLATE_NOT_FOUND","EQUITY_WATERFALL_NOT_FOUND","EQUITY_WATERFALL_HAS_HISTORY","EQUITY_WATERFALL_OPEN_VERSION_EXISTS","EQUITY_WATERFALL_TEMPLATE_ROLE_UNMAPPED","EQUITY_WATERFALL_TEMPLATE_CLASS_INVALID","EQUITY_WATERFALL_VERSION_INVALID","IDEMPOTENCY_KEY_REQUIRED"],"x-required-scopes":["equity:write"]}},"/v1/equity-positions":{"post":{"description":"Admits `holder_party_id` into `equity_class_id` on `legal_entity_id` — a position IS the capital account, so this also creates its `capital_account_balances` row in the same transaction (`unfunded_commitment = commitment_amount`, everything else zero) with **no journal entry**; the GL learns nothing until money moves through a future capital event. A holder may have at most one ACTIVE position per class.","operationId":"EquityPositions.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEquityPositionV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EquityPositionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_LEGAL_ENTITY_NOT_FOUND, EQUITY_CLASS_NOT_FOUND, EQUITY_HOLDER_PARTY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EQUITY_POSITION_DUPLICATE_ACTIVE, CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_POSITION_CLASS_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create an equity position","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_LEGAL_ENTITY_NOT_FOUND","EQUITY_CLASS_NOT_FOUND","EQUITY_POSITION_CLASS_LEGAL_ENTITY_MISMATCH","EQUITY_HOLDER_PARTY_NOT_FOUND","EQUITY_POSITION_DUPLICATE_ACTIVE","CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["equity:write"]},"get":{"description":"Returns equity positions across the org — one row per holder per class, unbounded, so this is cursor-paginated (unlike the small, unpaginated equity-class catalog). Filter by `legal_entity_id`, `holder_party_id`, `equity_class_id`, or `status`.","operationId":"EquityPositions.list","parameters":[{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"holder_party_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"equity_class_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["active","transferred","redeemed","defaulted"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EquityPositionV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List equity positions","tags":["Equity"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["equity:read"]}},"/v1/equity-positions/{id}":{"get":{"operationId":"EquityPositions.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EquityPositionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_POSITION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get an equity position","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_POSITION_NOT_FOUND"],"x-required-scopes":["equity:read"]},"patch":{"description":"Partial update, `commitment_amount`, `commitment_date`, `notes`, `status` and `exit_effective_date` only — `holder_party_id`, `equity_class_id` and `legal_entity_id` are immutable; the economics live in `capital_events`, never on the position. `commitment_amount`, `commitment_date` and `notes` accept an explicit `null` to clear them — except that clearing `commitment_amount` on a position with a non-zero `contributed` is refused (422), since `unfunded_commitment` is the materialised `commitment_amount − contributed` and would go negative. Moving `status` back to `active` when the holder already has another active position on the class is refused (409) — the same `equity_positions_active_holder_uq` guard `POST` enforces. When `status` moves to `transferred` or `redeemed`, `exit_effective_date` is stored if given, else defaults to today in the org's time zone (only when the position has none yet); it is cleared when `status` moves back to `active`. An `exit_effective_date` on a resolved status other than `transferred`/`redeemed` is a 400, and so is one earlier than `admission_date` (explicit or defaulted) — a position cannot exit before it existed. A date alone on an already-exited position corrects it.","operationId":"EquityPositions.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEquityPositionV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EquityPositionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_POSITION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EQUITY_POSITION_DUPLICATE_ACTIVE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_POSITION_COMMITMENT_CLEAR_REFUSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: EQUITY_CAPITAL_EVENT_UNFOLDABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update an equity position","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_POSITION_NOT_FOUND","EQUITY_POSITION_DUPLICATE_ACTIVE","EQUITY_POSITION_COMMITMENT_CLEAR_REFUSED","EQUITY_CAPITAL_EVENT_UNFOLDABLE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["equity:write"]}},"/v1/equity-positions/{id}/opening-balances":{"post":{"description":"Records what this capital account already held as of `as_of` — one `opening_balance` capital event per non-zero bucket, in one transaction. This is how an investor who existed before this system gets into it (D7). Full transaction history is a different path (CSV import); this one states balances, not movements.\n\n**`as_of` may precede the legal entity `ledger_start_date`, and normally does.** This is the one write in this module that may — an opening balance is by definition what the books held before they began here — so no `EQUITY_BEFORE_LEDGER_START` is raised. The accounting period is consulted only when `post_offsetting_entry` is set, because only then is there a journal entry to gate.\n\n**By default NOTHING is posted to the general ledger.** The events carry no document, which keeps them outside the tie-out by construction — it counts only capital-account events (the `capital` and `unallocated` buckets) that carry one. That is what stops an operator importing history into books that already contain the capital from breaking their own tie-out on day one. Set `post_offsetting_entry` when converting a LIVE ledger that does not already carry it: a `journal_entry` posts DR opening balance equity (3100) / CR contributed capital for the `capital` bucket, it is returned as `gl_document_id`, and that one event enters the tie-out. The other buckets never do — preferred return is a memo accrual and never a liability, and allocated profit and promote reach the ledger when they are distributed.\n\nGuarded, in the order they refuse: the position exists and is `active`; at least one bucket is non-zero; when the offset is requested, there is a `capital` bucket to offset; and last, inside the transaction, the position has no opening balance already (a position opens once, and `capital_events` cannot delete a duplicate) and the accounting period accepts the post. A request that is both already opened and has nothing to offset reports the missing offset.","operationId":"EquityPositions.recordOpeningBalance","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordOpeningBalanceV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OpeningBalanceV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_POSITION_NOT_FOUND, EQUITY_LEGAL_ENTITY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EQUITY_OPENING_BALANCE_ALREADY_RECORDED, PERIOD_CLOSED, PERIOD_LOCKED, POSTING_BEFORE_LEGAL_ENTITY_START, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_POSITION_NOT_ACTIVE, EQUITY_OPENING_BALANCE_EMPTY, EQUITY_OPENING_BALANCE_OFFSET_EMPTY, MISSING_SYSTEM_ROLE_ACCOUNT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record an opening balance","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_POSITION_NOT_FOUND","EQUITY_POSITION_NOT_ACTIVE","EQUITY_OPENING_BALANCE_EMPTY","EQUITY_OPENING_BALANCE_ALREADY_RECORDED","EQUITY_OPENING_BALANCE_OFFSET_EMPTY","PERIOD_CLOSED","PERIOD_LOCKED","PERIOD_MISSING","POSTING_BEFORE_LEGAL_ENTITY_START","MISSING_SYSTEM_ROLE_ACCOUNT","EQUITY_LEGAL_ENTITY_NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["equity:write"]}},"/v1/legal-entities/{legalEntityId}/equity":{"get":{"description":"The equity classes configured on this legal entity, every equity position on it, and the commitment/contributed/unfunded_commitment totals across its ACTIVE positions — `positions` is a complete history, the totals are not. `positions[].unfunded_commitment` and the `unfunded_commitment` total are read from `capital_account_balances`, never recomputed — so each position carries `stale`, true when that cached balance is behind the position's capital events, and `totals.any_stale` says the same about the ACTIVE positions the totals sum. Staleness is REPORTED here and never repaired: fetch one position through `GET /v1/equity-positions/{id}/capital-account` for a guaranteed-fresh figure. `tie_out` compares the capital subledger against the general ledger: the sum of this entity's capital-account events — the `capital` and `unallocated` buckets — that carry a GL document, against the balance of its `contributed_capital` account, with the signed difference. `tie_out` spans the WHOLE legal entity while the totals span its ACTIVE positions, so `totals.contributed_closed` reports the contributed capital on the closed ones — the bridge between the two, without which a redeemed holder makes the pair read as a contradiction. Opening balances and imported history that carry no GL document are reported separately as `imported_without_gl` and are never part of `difference` — and `unallocated`, the bucket for history an operator cannot split, counts as imported history the same way `capital` does. When the ledger holds a capital event the tie-out refuses to classify, `tie_out` is `null` and `tie_out_unavailable` says why — the cap table is still served, because it is the part an operator needs most when the integrity check cannot run. Exactly one of the two is non-null. An unknown legal entity id, or one belonging to another organization, is a 404 — an empty response means the entity exists and has no equity configured.","operationId":"LegalEntityEquity.get","parameters":[{"name":"legalEntityId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LegalEntityEquityV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_LEGAL_ENTITY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get the equity summary for a legal entity","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_LEGAL_ENTITY_NOT_FOUND"],"x-required-scopes":["equity:read"]}},"/v1/capital-contributions":{"post":{"description":"Records a contribution into `position_id` as a posted `capital_contribution` document carrying its **full amount as an open balance** — the money has not arrived yet. The journal entry is DR contributions receivable / CR contributed capital; when the holder is one of the org's own legal entities the receivable line also names that entity as its counterparty.\n\nNo capital event is written here. The subledger event is born when a payment drives the document's balance down, which is what makes partial funding and un-matching work with no special case: each balance movement writes exactly one event, and a negative movement writes a reversal.\n\nSend `bank_transaction_id` when the money has already arrived and the whole thing happens in one action: a `payment_in` is posted against that deposit's cash account, applied to the contribution, and the balance falls to zero — which is what writes the capital event, for the full amount. The payment is returned as `payment_document_id` and the bank transaction is linked to it. Omit it and the contribution waits open for a bank match, which settles it the same way later.\n\nWhen the holder is one of the org's own legal entities, the parent's matching `investment_in_subsidiary` is written on its books in the SAME transaction and returned as `mirror_document_id` — DR investment in subsidiary / CR contributions payable. Both entities are period-gated, and either side failing refuses the whole request: one side alone would leave the consolidated balance sheet double counting the group's capital.\n\nGuarded, in the order they refuse: the position exists and is `active`; `effective_date` is on or after the legal entity's ledger start; `amount` is within the unfunded commitment unless `acknowledge_over_commitment` says otherwise; the bank transaction, when one is named, is unlinked and able to fund this contribution; and last, inside the transaction, the accounting period accepts the post. So a request that trips an earlier check never reports a period problem.","operationId":"CapitalContributions.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCapitalContributionV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CapitalContributionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_POSITION_NOT_FOUND, EQUITY_BANK_TRANSACTION_NOT_FOUND, EQUITY_LEGAL_ENTITY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PERIOD_CLOSED, PERIOD_LOCKED, POSTING_BEFORE_LEGAL_ENTITY_START, BANK_LINE_REMOVED_BY_PROVIDER, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_POSITION_NOT_ACTIVE, EQUITY_BEFORE_LEDGER_START, EQUITY_CONTRIBUTION_EXCEEDS_COMMITMENT, EQUITY_BANK_TRANSACTION_ALREADY_LINKED, EQUITY_BANK_TRANSACTION_NOT_SETTLEABLE, MISSING_SYSTEM_ROLE_ACCOUNT, EQUITY_POSITION_HOLDER_IS_SELF, EQUITY_SUBSIDIARY_PARTY_NOT_FOUND, EQUITY_MIRROR_COUNTERPARTY_MISSING, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING, EQUITY_CAPITAL_EVENT_UNFOLDABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record a capital contribution","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","EQUITY_POSITION_NOT_FOUND","EQUITY_POSITION_NOT_ACTIVE","EQUITY_BEFORE_LEDGER_START","PERIOD_CLOSED","PERIOD_LOCKED","PERIOD_MISSING","POSTING_BEFORE_LEGAL_ENTITY_START","EQUITY_CAPITAL_EVENT_UNFOLDABLE","EQUITY_CONTRIBUTION_EXCEEDS_COMMITMENT","EQUITY_BANK_TRANSACTION_NOT_FOUND","EQUITY_BANK_TRANSACTION_ALREADY_LINKED","EQUITY_BANK_TRANSACTION_NOT_SETTLEABLE","BANK_LINE_REMOVED_BY_PROVIDER","EQUITY_LEGAL_ENTITY_NOT_FOUND","MISSING_SYSTEM_ROLE_ACCOUNT","EQUITY_POSITION_HOLDER_IS_SELF","EQUITY_SUBSIDIARY_PARTY_NOT_FOUND","EQUITY_MIRROR_COUNTERPARTY_MISSING","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","LEGAL_ENTITY_NOT_IN_SCOPE","DIMENSION_REQUIRED"],"x-plannable":true,"x-required-scopes":["equity:write"]}},"/v1/capital-contributions/{id}/reverse":{"post":{"description":"Reverses a contribution and everything written with it, in ONE transaction: the `capital_contribution` document, the `payment_in` that settled it when one exists, and the parent's `investment_in_subsidiary` when the holder is one of the org's own legal entities. `voided_document_count` says how many. When the parent mirror was paid by a `payment_out`, that payment is voided with it.\n\n**Nothing is deleted and nothing is edited.** Each document is voided through the standard void path, which writes a reversing journal entry rather than touching the original — and the capital subledger reverses as a ROW too: voiding the payment drives the contribution balance back up, and that negative movement writes a `reversal` event pointing at the original through `reverses_event_id`. The position's events then sum to zero with both rows still standing, so the as-recorded view of any earlier date is unchanged.\n\nA bank transaction that funded the contribution is returned to `imported` and unlinked, so it can be matched again.\n\nGuarded, in order: the id names a `capital_contribution` in this org; it is not already voided, reversed or deleted; no payment settling it is also applied to another document; and every accounting period involved accepts the reversal. The last runs across ALL the documents before any of them is touched, and the refusal names the legal entity, the document and the date — a contribution spans two sets of books that can sit in different periods. A CLOSED period is not a refusal: `memo` is the override reason, and a `period.override_post` audit row is recorded against each reversing entry it authorised.","operationId":"CapitalContributions.reverse","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReverseCapitalContributionV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CapitalContributionReversalV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_CONTRIBUTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EQUITY_CONTRIBUTION_ALREADY_REVERSED, EQUITY_CONTRIBUTION_PAYMENT_SHARED, PERIOD_LOCKED, DOCUMENT_RECONCILED_CANNOT_VOID, DOCUMENT_MATCHED_CANNOT_VOID, DOCUMENT_ALREADY_VOIDED, DOCUMENT_CHANGED_WHILE_EDITING, IDEMPOTENCY_CONFLICT, DOCUMENT_STATUS_FORBIDS_ACTION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_CONTRIBUTION_POSITION_NOT_FOUND, EQUITY_REVERSAL_TARGET_NOT_FOUND, EQUITY_REVERSAL_PERIOD_BLOCKED, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Reverse a capital contribution","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","EQUITY_CONTRIBUTION_NOT_FOUND","EQUITY_CONTRIBUTION_POSITION_NOT_FOUND","EQUITY_CONTRIBUTION_ALREADY_REVERSED","EQUITY_CONTRIBUTION_PAYMENT_SHARED","EQUITY_REVERSAL_TARGET_NOT_FOUND","EQUITY_REVERSAL_PERIOD_BLOCKED","PERIOD_LOCKED","PERIOD_MISSING","DOCUMENT_RECONCILED_CANNOT_VOID","DOCUMENT_MATCHED_CANNOT_VOID","DOCUMENT_ALREADY_VOIDED","DOCUMENT_CHANGED_WHILE_EDITING","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","DOCUMENT_STATUS_FORBIDS_ACTION","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-high-risk":true,"x-high-risk-reason":"Reverses a posted capital contribution.","x-required-scopes":["equity:write"]}},"/v1/equity-positions/{id}/capital-account":{"get":{"description":"The position's capital account: nine running totals plus a roll-forward of every `capital_events` row folded into them, in `recorded_at, id` order.\n\n**With neither `as_of` nor `as_recorded`**, this is the CURRENT balance, read from the `capital_account_balances` cache. If the cache's `last_event_id` disagrees with the position's actual newest event, it is refolded synchronously and the repair is written back before answering — `stale: true` says this happened; the number is always fresh regardless.\n\n**With either bound given**, this folds `capital_events` directly and NEVER reads the cache — `as_of` filters `effective_date`, `as_recorded` filters `recorded_at`, and both filter the SAME query when both are given. That combination is what answers \"what did the statement we sent in April say about June 30\", even when a correction with a June effective date was recorded afterward — neither bound alone can answer it. `stale` is always `false` on this path.","operationId":"EquityPositions.getCapitalAccount","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"as_of","required":false,"in":"query","description":"Fold only events effective on or before this calendar date. Omit both bounds for the position's current balance, read from the materialised cache (refolded first if it is stale).","schema":{"format":"date","type":"string"}},{"name":"as_recorded","required":false,"in":"query","description":"Fold only events recorded on or before this instant. Combined with `as_of`, answers \"what did the statement we sent then say\" even when a later correction carries an effective date inside the `as_of` window. Must be a full ISO 8601 instant WITH a timezone offset (`Z` or `±HH:MM`) — a date-only value is refused rather than read as that day's midnight, which would silently exclude everything recorded that day.","schema":{"format":"date-time","example":"2026-04-07T23:59:59Z","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CapitalAccountV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_POSITION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: EQUITY_CAPITAL_ACCOUNT_BALANCE_MISSING, EQUITY_CAPITAL_EVENT_UNFOLDABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Read a capital account on either time axis","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_POSITION_NOT_FOUND","EQUITY_CAPITAL_ACCOUNT_BALANCE_MISSING","EQUITY_CAPITAL_EVENT_UNFOLDABLE"],"x-required-scopes":["equity:read"]}},"/v1/equity-positions/{id}/capital-events":{"get":{"description":"The drill-down beside `GET .../capital-account`: every `capital_events` row on this position, newest first (`recorded_at DESC, id DESC`) — the drill-down opens on what just happened. Unlike the capital account's roll-forward, each row here carries only the event's own columns, no running balance. `gl_document_id` lets a reader jump from an event to the journal entry behind it; `reverses_event_id` / `reversed_by_event_id` let the UI mark a reversed row and its reversal instead of showing two contradictory lines; `transfer_counterparty` names the other holder of a transfer.","operationId":"EquityPositions.listCapitalEvents","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CapitalEventV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_POSITION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the raw capital events behind a capital account","tags":["Equity"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_POSITION_NOT_FOUND"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["equity:read"]}},"/v1/parties/{id}/capital-accounts":{"get":{"description":"Every equity position this party holds, across every legal entity in the org — the investor's own \"where do I stand now\" view. One row per position: its legal entity (id and name), its class name, and the CURRENT folded balance read from the `capital_account_balances` cache. No `as_of`/`as_recorded` axis here — that is the per-position read's job (`GET /v1/equity-positions/{id}/capital-account`). Unlike that read, a stale cached row here is reported via `stale: true`, NEVER refolded — refolding an investor's whole portfolio inside this read is the wrong trade. An unknown party id is a 404; a party that exists and holds nothing is a `200` with an empty array.","operationId":"Parties.listCapitalAccounts","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PartyCapitalAccountRowV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_PARTY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a party's capital accounts across legal entities","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","EQUITY_PARTY_NOT_FOUND"],"x-pagination":{"mode":"none","reason":"an investor's own holdings, resolved by holder party id","bound":"a handful of positions across a few legal entities in the same group"},"x-required-scopes":["equity:read"]}},"/v1/non-cash-contributions":{"post":{"description":"Records one holder contributing something other than cash, at book value (no gain or loss, no fixed asset created). The entity posts a `journal_entry` with the voucher's `lines` (assets and expenses at debit, assumed debt and accumulated depreciation at credit) and a credit to contributed capital for what they leave over, which must be greater than zero. A `contribution_in_kind` capital event in the `capital` bucket goes to the holder's position (none for a holder without a position, an entity without equity, or a date before its ledger start). When the holder is one of the org's own legal entities its side is recorded too: a `journal_entry` on its books, dated `holder_date`, with its `holder_lines` and a debit to its investment; `holder_side: false` records only the entity's side. Ownership never changes. Refused on an entity whose waterfall applies.","operationId":"NonCashContributions.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateNonCashContributionV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/NonCashMovementV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EXTERNAL_REF_TAKEN, PERIOD_CLOSED, PERIOD_LOCKED, POSTING_BEFORE_LEGAL_ENTITY_START, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_NON_CASH_LINES_INVALID, EQUITY_MOVEMENT_POSITION_AMBIGUOUS, EQUITY_MOVEMENT_POSITION_NOT_HELD, DISTRIBUTION_WATERFALL_ENTITY, MISSING_SYSTEM_ROLE_ACCOUNT, ACCOUNT_LEGAL_ENTITY_MISMATCH, LEDGER_ENTRY_REFUSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record a non-cash contribution","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","EXTERNAL_REF_TAKEN","EQUITY_NON_CASH_LINES_INVALID","EQUITY_MOVEMENT_POSITION_AMBIGUOUS","EQUITY_MOVEMENT_POSITION_NOT_HELD","DISTRIBUTION_WATERFALL_ENTITY","MISSING_SYSTEM_ROLE_ACCOUNT","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_CLOSED","PERIOD_LOCKED","PERIOD_MISSING","POSTING_BEFORE_LEGAL_ENTITY_START","LEDGER_ENTRY_REFUSED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["equity:write"]},"get":{"description":"Non-cash contributions, newest first, voided ones included (`voided_at` set). Filter by `legal_entity_id`, `party_id` or the exact `external_ref`. 100 per page; drain `meta.next_cursor`.","operationId":"NonCashContributions.list","parameters":[{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"party_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"external_ref","required":false,"in":"query","description":"Exact match on the record's `external_ref` (another system's key); returns 0 or 1 row. Combines with the other filters.","schema":{"minLength":1,"maxLength":200,"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -movement_date","schema":{"enum":["movement_date","-movement_date"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: memo, external_ref.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/NonCashMovementV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List non-cash contributions","tags":["Equity"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["equity:read"]}},"/v1/non-cash-contributions/{id}":{"get":{"operationId":"NonCashContributions.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/NonCashMovementV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_NON_CASH_MOVEMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a non-cash contribution","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","EQUITY_NON_CASH_MOVEMENT_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["equity:read"]}},"/v1/non-cash-contributions/{id}/void":{"post":{"description":"Voids the contribution as a whole: both entries (each reverses its own) and its capital event. Refused while a payment is applied to either document.","operationId":"NonCashContributions.void","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/NonCashMovementV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_NON_CASH_MOVEMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EQUITY_MOVEMENT_ALREADY_VOIDED, TARGET_HAS_ACTIVE_APPLICATIONS, DOCUMENT_HELD_BY_EQUITY_MOVEMENT, DOCUMENT_CHANGED_WHILE_EDITING, DOCUMENT_STATUS_FORBIDS_ACTION, DOCUMENT_RECONCILED_CANNOT_VOID, DOCUMENT_MATCHED_CANNOT_VOID, PERIOD_LOCKED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Void a non-cash contribution","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","EQUITY_NON_CASH_MOVEMENT_NOT_FOUND","EQUITY_MOVEMENT_ALREADY_VOIDED","TARGET_HAS_ACTIVE_APPLICATIONS","DOCUMENT_HELD_BY_EQUITY_MOVEMENT","DOCUMENT_CHANGED_WHILE_EDITING","DOCUMENT_STATUS_FORBIDS_ACTION","DOCUMENT_RECONCILED_CANNOT_VOID","DOCUMENT_MATCHED_CANNOT_VOID","PERIOD_LOCKED","PERIOD_MISSING","LEDGER_ENTRY_REFUSED","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Voids a posted non-cash contribution and reverses its entries.","x-required-scopes":["equity:write"]}},"/v1/non-cash-distributions":{"post":{"description":"Records a distribution to one holder paid with something other than cash, at book value (no gain or loss). The entity posts a `journal_entry` with the voucher's `lines` (the accounts credited: an intercompany balance, Loan Clearing, a mortgage) and a debit to owner distributions for what they leave over, which must be greater than zero. A `distribution` capital event goes to the holder's position in the `bucket`: `capital` for a return of capital, `profit` for a distribution of profit. When the holder is one of the org's own legal entities its side is recorded too: a `journal_entry` on its books, dated `holder_date`, with its `holder_lines` and a credit to its investment for `capital` (always, whatever its treatment) or per its received-distribution treatment for `profit`; `holder_side: false` records only the entity's side. Ownership never changes. Refused on an entity whose waterfall applies.","operationId":"NonCashDistributions.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateNonCashDistributionV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/NonCashMovementV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EXTERNAL_REF_TAKEN, PERIOD_CLOSED, PERIOD_LOCKED, POSTING_BEFORE_LEGAL_ENTITY_START, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_NON_CASH_LINES_INVALID, EQUITY_MOVEMENT_POSITION_AMBIGUOUS, EQUITY_MOVEMENT_POSITION_NOT_HELD, DISTRIBUTION_WATERFALL_ENTITY, MISSING_SYSTEM_ROLE_ACCOUNT, ACCOUNT_LEGAL_ENTITY_MISMATCH, LEDGER_ENTRY_REFUSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record a non-cash distribution","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","EXTERNAL_REF_TAKEN","EQUITY_NON_CASH_LINES_INVALID","EQUITY_MOVEMENT_POSITION_AMBIGUOUS","EQUITY_MOVEMENT_POSITION_NOT_HELD","DISTRIBUTION_WATERFALL_ENTITY","MISSING_SYSTEM_ROLE_ACCOUNT","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_CLOSED","PERIOD_LOCKED","PERIOD_MISSING","POSTING_BEFORE_LEGAL_ENTITY_START","LEDGER_ENTRY_REFUSED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["equity:write"]},"get":{"description":"Non-cash distributions, newest first, voided ones included (`voided_at` set). Filter by `legal_entity_id`, `party_id` or the exact `external_ref`. 100 per page; drain `meta.next_cursor`.","operationId":"NonCashDistributions.list","parameters":[{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"party_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"external_ref","required":false,"in":"query","description":"Exact match on the record's `external_ref` (another system's key); returns 0 or 1 row. Combines with the other filters.","schema":{"minLength":1,"maxLength":200,"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -movement_date","schema":{"enum":["movement_date","-movement_date"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: memo, external_ref.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/NonCashMovementV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List non-cash distributions","tags":["Equity"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["equity:read"]}},"/v1/non-cash-distributions/{id}":{"get":{"operationId":"NonCashDistributions.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/NonCashMovementV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_NON_CASH_MOVEMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a non-cash distribution","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","EQUITY_NON_CASH_MOVEMENT_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["equity:read"]}},"/v1/non-cash-distributions/{id}/void":{"post":{"description":"Voids the distribution as a whole: both entries (each reverses its own) and its capital event. Refused while a payment is applied to either document.","operationId":"NonCashDistributions.void","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/NonCashMovementV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_NON_CASH_MOVEMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EQUITY_MOVEMENT_ALREADY_VOIDED, TARGET_HAS_ACTIVE_APPLICATIONS, DOCUMENT_HELD_BY_EQUITY_MOVEMENT, DOCUMENT_CHANGED_WHILE_EDITING, DOCUMENT_STATUS_FORBIDS_ACTION, DOCUMENT_RECONCILED_CANNOT_VOID, DOCUMENT_MATCHED_CANNOT_VOID, PERIOD_LOCKED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Void a non-cash distribution","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","EQUITY_NON_CASH_MOVEMENT_NOT_FOUND","EQUITY_MOVEMENT_ALREADY_VOIDED","TARGET_HAS_ACTIVE_APPLICATIONS","DOCUMENT_HELD_BY_EQUITY_MOVEMENT","DOCUMENT_CHANGED_WHILE_EDITING","DOCUMENT_STATUS_FORBIDS_ACTION","DOCUMENT_RECONCILED_CANNOT_VOID","DOCUMENT_MATCHED_CANNOT_VOID","PERIOD_LOCKED","PERIOD_MISSING","LEDGER_ENTRY_REFUSED","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Voids a posted non-cash distribution and reverses its entries.","x-required-scopes":["equity:write"]}},"/v1/equity-transfers":{"post":{"description":"Moves an amount of capital from one position to another of the same entity: a `transfer_out` on the first and a `transfer_in` on the second, in the `capital` bucket. No document and no journal entry (the entity's capital does not change), and ownership percentages never change — those move through `/v1/entity-ownerships`. The transferor may go negative. Both positions must be active; refused on an entity whose waterfall applies, without equity positions, or before its capital ledger starts.","operationId":"EquityTransfers.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEquityTransferV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EquityTransferV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EXTERNAL_REF_TAKEN, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_TRANSFER_INVALID, DISTRIBUTION_WATERFALL_ENTITY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Transfer capital between positions","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","EXTERNAL_REF_TAKEN","EQUITY_TRANSFER_INVALID","DISTRIBUTION_WATERFALL_ENTITY","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Moves capital from one holder's capital account to another's.","x-required-scopes":["equity:write"]},"get":{"description":"Transfers, newest first, voided ones included (`voided_at` set). Filter by `legal_entity_id`, `position_id` (either side) or the exact `external_ref`. 100 per page; drain `meta.next_cursor`.","operationId":"EquityTransfers.list","parameters":[{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"position_id","required":false,"in":"query","description":"Transfers in or out of this position.","schema":{"format":"uuid","type":"string"}},{"name":"external_ref","required":false,"in":"query","description":"Exact match on the record's `external_ref` (another system's key); returns 0 or 1 row. Combines with the other filters.","schema":{"minLength":1,"maxLength":200,"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -effective_date","schema":{"enum":["effective_date","-effective_date"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: memo, external_ref.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EquityTransferV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List equity transfers","tags":["Equity"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["equity:read"]}},"/v1/equity-transfers/{id}":{"get":{"operationId":"EquityTransfers.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EquityTransferV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_TRANSFER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get an equity transfer","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","EQUITY_TRANSFER_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["equity:read"]}},"/v1/equity-transfers/{id}/void":{"post":{"description":"Writes the reversal of both capital events.","operationId":"EquityTransfers.void","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EquityTransferV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_TRANSFER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EQUITY_MOVEMENT_ALREADY_VOIDED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Void an equity transfer","tags":["Equity"],"x-error-codes":["VALIDATION_FAILED","EQUITY_TRANSFER_NOT_FOUND","EQUITY_MOVEMENT_ALREADY_VOIDED","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Voids an equity transfer and reverses both capital events.","x-required-scopes":["equity:write"]}},"/v1/entity-ownerships":{"get":{"operationId":"EntityOwnerships.list","parameters":[{"name":"parent_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"owner_party_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"active_on","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"include_closed","required":false,"in":"query","description":"Include closed (superseded) rows. When true and `active_on` is omitted, the full history of the parent entity is returned instead of only the currently-open rows — used to reconstruct historical cap-table snapshots.","schema":{"default":false,"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -effective_from","schema":{"enum":["-effective_from","effective_from","-created_at","created_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EntityOwnershipListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List entity ownerships (look-through cap table)","tags":["EntityOwnerships"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["ownership:read"]},"post":{"operationId":"EntityOwnerships.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEntityOwnershipV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityOwnershipCreatedDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, OWNERSHIP_SUM_NOT_100, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: OWNERSHIP_CYCLE_DETECTED, PERIOD_LOCKED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a single entity ownership row (convenience — refuses if active set would not sum to 100)","tags":["EntityOwnerships"],"x-error-codes":["VALIDATION_FAILED","OWNERSHIP_CYCLE_DETECTED","OWNERSHIP_SUM_NOT_100","PERIOD_LOCKED","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["ownership:write"]}},"/v1/entity-ownerships/{id}":{"get":{"operationId":"EntityOwnerships.getById","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityOwnershipV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get an entity ownership by id","tags":["EntityOwnerships"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["ownership:read"]}},"/v1/entity-ownerships/batch":{"post":{"operationId":"EntityOwnerships.createBatch","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEntityOwnershipBatchV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityOwnershipBatchCreatedDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, OWNERSHIP_SUM_NOT_100, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: OWNERSHIP_CYCLE_DETECTED, PERIOD_LOCKED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create the full active ownership set for a parent entity in one transaction","tags":["EntityOwnerships"],"x-error-codes":["VALIDATION_FAILED","OWNERSHIP_CYCLE_DETECTED","OWNERSHIP_SUM_NOT_100","PERIOD_LOCKED","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["ownership:write"]}},"/v1/entity-ownerships/transfer":{"post":{"operationId":"EntityOwnerships.transfer","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferEntityOwnershipV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityOwnershipTransferResultDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, OWNERSHIP_INSUFFICIENT_STAKE, OWNERSHIP_SUM_NOT_100, OWNERSHIP_CHANGE_REASON_REQUIRED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: OWNERSHIP_CYCLE_DETECTED, PERIOD_LOCKED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Transfer a percentage of ownership from one owner to another (atomic; the active set stays at 100%)","tags":["EntityOwnerships"],"x-error-codes":["VALIDATION_FAILED","OWNERSHIP_CYCLE_DETECTED","OWNERSHIP_INSUFFICIENT_STAKE","OWNERSHIP_SUM_NOT_100","OWNERSHIP_CHANGE_REASON_REQUIRED","PERIOD_LOCKED","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Moves ownership of an entity, which decides who gets distributions.","x-plannable":true,"x-required-scopes":["ownership:write"]}},"/v1/entity-ownerships/{id}/close-and-replace":{"post":{"operationId":"EntityOwnerships.closeAndReplace","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseAndReplaceEntityOwnershipV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityOwnershipReplacedDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, OWNERSHIP_CHANGE_REASON_REQUIRED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: OWNERSHIP_CYCLE_DETECTED, PERIOD_LOCKED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Close an entity ownership row and insert its successor in one transaction","tags":["EntityOwnerships"],"x-error-codes":["VALIDATION_FAILED","OWNERSHIP_CYCLE_DETECTED","NOT_FOUND","OWNERSHIP_CHANGE_REASON_REQUIRED","PERIOD_LOCKED","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Replaces an owner of an entity, which decides who gets distributions.","x-plannable":true,"x-required-scopes":["ownership:write"]}},"/v1/internal/owner-allocations/replay":{"post":{"operationId":"OwnerAllocationsInternal.replay","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplayV1Dto"}}}},"responses":{"202":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReplayResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replay owner-allocations materialization for a scope","tags":["Internal — Owner Allocations"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-internal":true,"x-required-scopes":["ownership:write"]}},"/v1/internal/owner-allocations/status":{"get":{"operationId":"OwnerAllocationsInternal.status","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StatusV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Recent materialization runs (last 100, aggregated per outcome)","tags":["Internal — Owner Allocations"],"x-error-codes":[],"x-internal":true,"x-required-scopes":["ownership:read"]}},"/v1/legal-entities":{"get":{"operationId":"LegalEntities.list","parameters":[{"name":"ownership_kind","required":false,"in":"query","description":"Which entities to list by ownership. Defaults to 'owned' — managed (externally-owned, fee-managed) entities are opt-in.","schema":{"type":"string","enum":["owned","managed","all"]}},{"name":"search","required":false,"in":"query","schema":{"type":"string"}},{"name":"entity_type","required":false,"in":"query","schema":{"type":"string","enum":["llc","corp","partnership","trust","other"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: name","schema":{"enum":["name","-name","created_at","-created_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LegalEntityV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List legal entities","tags":["Legal Entities"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["legal-entities:read"]},"post":{"operationId":"LegalEntities.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLegalEntityV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LegalEntityV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, LEGAL_ENTITY_CODE_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create legal entity","tags":["Legal Entities"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_CODE_TAKEN","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-plannable":true,"x-required-scopes":["legal-entities:write"]}},"/v1/legal-entities/options":{"get":{"operationId":"LegalEntities.options","parameters":[{"name":"ownership_kind","required":false,"in":"query","description":"Which entities to list by ownership. Defaults to 'owned' — managed (externally-owned, fee-managed) entities are opt-in.","schema":{"type":"string","enum":["owned","managed","all"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LegalEntityOptionV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List legal entity options (id + name, single response)","tags":["Legal Entities"],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"tens of legal entities per org"},"x-required-scopes":["legal-entities:read"]}},"/v1/legal-entities/owned-expansion":{"get":{"description":"Given seed legal-entity ids, returns every legal entity transitively OWNED by them (via `entity_ownerships`, current-effective only, at any `ownership_percentage > 0`) — reusing `SecurityGroupRepository.expandOwnedLegalEntities`, the single source of truth for the look-through walk that per-legal-entity scope enforcement also uses. Does NOT apply the caller's own allow-list: this is a look-up helper for an admin configuring a security group’s scope, who needs to see the full ownership implication of the queried ids regardless of their own scope.","operationId":"LegalEntities.ownedExpansion","parameters":[{"name":"ids","required":false,"in":"query","description":"Comma-separated legal-entity ids to expand via ownership look-through.","schema":{"example":"11111111-1111-1111-1111-111111111111,22222222-2222-2222-2222-222222222222","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LegalEntityOwnedExpansionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Expand legal-entity ids via ownership look-through","tags":["Legal Entities"],"x-error-codes":["VALIDATION_FAILED"],"x-required-scopes":["legal-entities:read"]}},"/v1/legal-entities/{id}":{"get":{"operationId":"LegalEntities.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LegalEntityV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get legal entity by id","tags":["Legal Entities"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["legal-entities:read"]},"put":{"operationId":"LegalEntities.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateLegalEntityV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LegalEntityV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LEGAL_ENTITY_CODE_TAKEN, LEGAL_ENTITY_CURRENCY_LOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update legal entity","tags":["Legal Entities"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","LEGAL_ENTITY_CODE_TAKEN","LEGAL_ENTITY_CURRENCY_LOCKED"],"x-plannable":true,"x-required-scopes":["legal-entities:write"]}},"/v1/org/current":{"get":{"operationId":"Org.current","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OrgCurrentV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Get current org id","tags":["Org"],"x-error-codes":[],"x-required-scopes-any":["auth:read","org:read"]}},"/v1/org/provision":{"post":{"operationId":"Org.provision","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvisionOrgV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ProvisionOrgResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Provision org reference data","tags":["Org"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["org:write"]}},"/v1/org":{"get":{"operationId":"Org.get","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OrgV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get current org settings","tags":["Org"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["org:read"]},"put":{"operationId":"Org.update","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOrgV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OrgV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ORG_AP_STRAIGHT_THROUGH_NEGATIVE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update org settings","tags":["Org"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","ORG_AP_STRAIGHT_THROUGH_NEGATIVE"],"x-high-risk":true,"x-high-risk-reason":"Changes org settings.","x-required-scopes":["org:write"]}},"/v1/org/period-config":{"get":{"operationId":"Org.getPeriodConfig","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PeriodConfigV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get org fiscal-period config","tags":["Org"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["org:read"]},"patch":{"operationId":"Org.updatePeriodConfig","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePeriodConfigV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PeriodConfigV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update org fiscal-period config (blocked once activity begins)","tags":["Org"],"x-error-codes":["VALIDATION_FAILED","CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Changes the org's fiscal period setup.","x-required-scopes":["org:write"]}},"/v1/org/mcp-settings":{"get":{"description":"Returns the ceiling on what an AI connector (an MCP OAuth token) may do in this org: off, read, write or full.","operationId":"Org.getMcpSettings","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/McpSettingsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Get the org AI-connector access level","tags":["Org"],"x-error-codes":[],"x-required-scopes":["org:read"]},"patch":{"description":"Sets the ceiling on what an AI connector may do in this org. Takes effect at once on this instance and within a minute elsewhere. Not callable through an AI connector.","operationId":"Org.updateMcpSettings","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMcpSettingsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/McpSettingsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Set the org AI-connector access level","tags":["Org"],"x-connector-forbidden":true,"x-error-codes":["VALIDATION_FAILED"],"x-required-scopes":["org:write"]}},"/v1/org/members":{"get":{"operationId":"Org.listMembers","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OrgMemberV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List org members with identity + approval limit","tags":["Org"],"x-error-codes":[],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"org headcount"},"x-required-scopes":["org:read"]}},"/v1/internal/orgs":{"post":{"description":"Creates an org, seeds its reference data for `industry` (as `POST /v1/internal/orgs/{id}/provision` does) and makes `owner` its owner, in the seeded Owner security group. A new or never-signed-in owner gets the branded invitation email; one who has signed in is added without one. Refused when the owner already belongs to an org, live or deactivated, unless the owner is Spark staff — a customer belongs to one org. The org, its seed data and the membership are written in one transaction. The email is sent after those writes but inside the transaction of the request, which commits last: a commit failure after the send can leave an email for an org that does not exist, and a retry or the re-send endpoint recovers it. An email failure is reported in `owner.email_status` without undoing the org. The fiscal-period config of the org is set too — optional `fiscal_year_start_month` and `period_cadence`, default January and monthly — and returned in `fiscal_calendar`, so the owner can create legal entities at once; it stands in for the owner confirmation and freezes at the first posted journal. Optional `chart_of_accounts` — `standard` (default) or `empty`, which seeds no accounts for a customer who brings their own chart — is kept on the org and returned.","operationId":"OrgInternal.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrgV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CreateOrgResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, ORG_OWNER_IN_ANOTHER_ORG","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"502":{"description":"Possible error codes: ORG_USER_STAFF_CHECK_FAILED, ORG_USER_INVITE_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create an org with an invited owner","tags":["Internal — Orgs"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","ORG_OWNER_IN_ANOTHER_ORG","ORG_USER_STAFF_CHECK_FAILED","ORG_USER_INVITE_FAILED"],"x-internal":true,"x-required-scopes":["admin:*"]}},"/v1/internal/orgs/{id}/provision":{"post":{"description":"Seeds an org's reference data — security groups, chart of accounts (unless the org's `chart_of_accounts` is `empty`), party/contract/term catalogs, asset classes, dimensions and system items (a system item only once its role has an account) — and puts each member that has no security group in the system group matching their role. For orgs created outside the app, which are never provisioned. The industry is what the org already is — the catalog its system (seeded) party role types came from, else a recognised stored `industry` — and `industry` in the body is required only when neither exists; a request that contradicts it is refused rather than merging a second catalog, and the decision is stored on the org. A custom group holding a system group's name is refused. One transaction, holding the org row's lock: a failure leaves the org unchanged. The org's fiscal-period config is set when it has none — optional `fiscal_year_start_month` and `period_cadence`, else the values stored on the org — so legal entities can be created; a set config is kept and a different request is ORG_FISCAL_CONFIG_CONFLICT. Idempotent: provisioning an already-provisioned org whose fiscal config is set changes nothing. `dry_run` reports the current counts, the members that would be grouped and whether the industry and the fiscal config would be stored, without writing. `industry`, `dry_run`, `fiscal_year_start_month` and `period_cadence` must be absent or valid — `null` is refused (400).","operationId":"OrgInternal.provision","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvisionOrgByIdV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ProvisionOrgByIdResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ORG_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, ORG_INDUSTRY_CONFLICT, ORG_SYSTEM_GROUP_NAME_TAKEN, ORG_FISCAL_CONFIG_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ORG_INDUSTRY_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Provision any org by id","tags":["Internal — Orgs"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","ORG_NOT_FOUND","ORG_INDUSTRY_REQUIRED","ORG_INDUSTRY_CONFLICT","ORG_SYSTEM_GROUP_NAME_TAKEN","ORG_FISCAL_CONFIG_CONFLICT"],"x-internal":true,"x-required-scopes":["admin:*"]}},"/v1/internal/orgs/{id}/owner/resend-invite":{"post":{"description":"Generates a fresh invite link for a pending (never signed-in) owner of the org and sends the invitation email. For a new org whose owner's link expired or never arrived: its only member is that owner, so no one inside the org can re-send it. The email must belong to a live owner of THIS org.","operationId":"OrgInternal.resendOwnerInvite","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResendOwnerInviteV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ResendOwnerInviteResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ORG_NOT_FOUND, ORG_USER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, ORG_USER_NOT_PENDING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"502":{"description":"Possible error codes: ORG_USER_INVITE_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Re-send an org owner's invite","tags":["Internal — Orgs"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","ORG_NOT_FOUND","ORG_USER_NOT_FOUND","ORG_USER_NOT_PENDING","ORG_USER_INVITE_FAILED"],"x-internal":true,"x-required-scopes":["admin:*"]}},"/v1/fixed-asset-classes":{"get":{"description":"Returns the org-configured catalog of depreciation defaults (kind, method, convention, default life/salvage, GL account slots) used to seed a new fixed asset. Excludes deactivated classes unless `include_inactive=true`.","operationId":"FixedAssetClasses.list","parameters":[{"name":"include_inactive","required":false,"in":"query","description":"Include deactivated asset classes in the list.","schema":{"default":false,"type":"boolean"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AssetClassV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List asset classes","tags":["Fixed Assets"],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"a handful of asset classes per org"},"x-required-scopes":["fixed-assets:read"]},"post":{"description":"Each of `asset_account_id`, `accumulated_account_id`, and `expense_account_id`, when provided, must reference an account of a compatible type: `asset` for the first two, `expense` or `income` (above-market lease amortization credits income) for the third.","operationId":"FixedAssetClasses.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAssetClassV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AssetClassV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ASSET_CLASS_ACCOUNT_TYPE_MISMATCH, ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create an asset class","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED","CONFLICT","ASSET_CLASS_ACCOUNT_TYPE_MISMATCH","ACCOUNT_LEGAL_ENTITY_MISMATCH","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["fixed-assets:write"]}},"/v1/fixed-asset-classes/{id}":{"get":{"operationId":"FixedAssetClasses.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AssetClassV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get an asset class","tags":["Fixed Assets"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["fixed-assets:read"]},"patch":{"description":"Partial update. Send `is_active: false` to deactivate the class — classes are never hard-deleted once created, since a fixed asset may still reference one.","operationId":"FixedAssetClasses.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAssetClassV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AssetClassV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ASSET_CLASS_ACCOUNT_TYPE_MISMATCH, ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update an asset class","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","CONFLICT","ASSET_CLASS_ACCOUNT_TYPE_MISMATCH","ACCOUNT_LEGAL_ENTITY_MISMATCH","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["fixed-assets:write"]}},"/v1/fixed-assets/imports/template":{"get":{"description":"The header row every upload must carry, plus one example row. UTF-8 with a BOM and CRLF line endings so Excel opens it correctly; the upload accepts either.","operationId":"FixedAssets.importTemplate","parameters":[],"responses":{"200":{"description":"The CSV template.","content":{"text/csv":{"schema":{"type":"string"}}}}},"security":[{"access-token":[]}],"summary":"Download the legacy asset import CSV template","tags":["Fixed Assets"],"x-required-scopes":["fixed-assets:write"]}},"/v1/fixed-assets/imports":{"post":{"description":"Parses and validates every row against the organization’s classes, legal entities, properties, spaces, existing `legacy_ref`s and accounting calendar, and stages the result: each row is `accepted` or `rejected` with one complete-sentence reason per offending column. Nothing is created in the asset register. Uploading the exact same bytes again returns the existing live import with 200 instead of creating a second one; a discarded import frees its file to be uploaded again. An entity-scoped user may only import into their entities, and only sees their own imports.","operationId":"FixedAssets.importUpload","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"The CSV, built from the template endpoint."}}}}}},"responses":{"200":{"description":"The same file is already staged or committed: that import.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FixedAssetImportV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FixedAssetImportV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, EMPTY_FILE, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: FIXED_ASSET_IMPORT_ALREADY_STAGED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: FIXED_ASSET_IMPORT_FILE_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: FIXED_ASSET_IMPORT_FILE_INVALID, FIXED_ASSET_IMPORT_TOO_MANY_ROWS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a legacy asset CSV and stage it for review","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED","EMPTY_FILE","FIXED_ASSET_IMPORT_FILE_TOO_LARGE","FIXED_ASSET_IMPORT_FILE_INVALID","FIXED_ASSET_IMPORT_TOO_MANY_ROWS","FIXED_ASSET_IMPORT_ALREADY_STAGED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["fixed-assets:write"]}},"/v1/fixed-assets/imports/{id}":{"get":{"description":"The rows are in `data`, cursor-paged: rejected rows first, then by `row_number`; `?status=` narrows to `rejected` or `accepted` (default `all`). The import’s own summary, with its totals per legal entity and asset account over the accepted rows, rides in `meta.import`.","operationId":"FixedAssets.importGet","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"status","required":false,"in":"query","description":"Which rows to return. Whatever the filter, rejected rows come first, then by `row_number`.","schema":{"default":"all","type":"string","enum":["rejected","accepted","all"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 100","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FixedAssetImportRowV1Dto"}},"meta":{"$ref":"#/components/schemas/FixedAssetImportListMetaV1Dto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: FIXED_ASSET_IMPORT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Read a staged legacy asset import: summary, totals and rows","tags":["Fixed Assets"],"x-error-codes":["FIXED_ASSET_IMPORT_NOT_FOUND","INVALID_CURSOR"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["fixed-assets:write"]}},"/v1/fixed-assets/imports/{id}/commit":{"post":{"description":"Checks every row again against the current data and, when none is rejected, creates all the assets in ONE transaction: each with its opening balance cost source, an `migrated_opening` event carrying the accumulated depreciation, and the schedule from the first day after the cutover. If any row is now rejected (a class deactivated, a `legacy_ref` taken, a calendar changed since the upload) nothing is created, the rows are re-staged with their current reasons, and the call answers `FIXED_ASSET_IMPORT_HAS_REJECTED_ROWS`. Committing an import that is already committed answers 200 with `already_committed: true` and the stored result.","operationId":"FixedAssets.importCommit","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"Already committed: the stored result.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FixedAssetImportCommitV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FixedAssetImportCommitV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: FIXED_ASSET_IMPORT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: FIXED_ASSET_IMPORT_NOT_STAGED, FIXED_ASSET_IMPORT_HAS_REJECTED_ROWS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Commit a staged legacy asset import","tags":["Fixed Assets"],"x-error-codes":["FIXED_ASSET_IMPORT_NOT_FOUND","FIXED_ASSET_IMPORT_NOT_STAGED","FIXED_ASSET_IMPORT_HAS_REJECTED_ROWS","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["fixed-assets:write"]}},"/v1/fixed-assets/imports/{id}/discard":{"post":{"description":"Marks a `staged` import `discarded`; it can no longer be committed and its file can be uploaded again. Refused once the import is committed or already discarded.","operationId":"FixedAssets.importDiscard","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FixedAssetImportV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: FIXED_ASSET_IMPORT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: FIXED_ASSET_IMPORT_NOT_STAGED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Discard a staged legacy asset import","tags":["Fixed Assets"],"x-error-codes":["FIXED_ASSET_IMPORT_NOT_FOUND","FIXED_ASSET_IMPORT_NOT_STAGED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["fixed-assets:write"]}},"/v1/fixed-assets":{"get":{"description":"Returns the org asset register. Filter by `status`, `legal_entity_id`, `property_id`, `class_id`, or `contract_id`; `q` matches (case-insensitively) against code, name, and serial number. `document_id` answers which assets a document came from: the assets with an event whose disposal or impairment document, or proceeds invoice, is that document — an empty page for a document no asset event names. `net_book_value` is computed as `cost_basis − accumulated_depreciation`.","operationId":"FixedAssets.list","parameters":[{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["pending","cip","active","suspended","fully_depreciated","disposed","transferred"]}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"property_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"class_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"contract_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"document_id","required":false,"in":"query","description":"The assets behind a document: those with an event whose `document_id` (the disposal, impairment or transfer document), `invoice_document_id` (the invoice that bills the disposal proceeds) or `intercompany_document_id` (the intercompany transaction of a transfer, which returns both assets) is this id. A bulk disposal’s document or invoice returns every asset of its legal entity in the batch. A document no asset event names — an ordinary invoice, a depreciation run’s document — returns an empty page, not an error.","schema":{"format":"uuid","type":"string"}},{"name":"q","required":false,"in":"query","description":"Case-insensitive search on code, name, and serial number.","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FixedAssetV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List fixed assets","tags":["Fixed Assets"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["fixed-assets:read"]},"post":{"description":"Manual create: mints `code`, sets `status` to `cip` when `as_cip` is true or `pending` otherwise, and `origin` to `manual`. Each entry in `cost_sources` claims a fraction of a journal line’s signed (debit − credit) amount; `cost_basis` is the sum of the resulting claimed amounts. Claiming more than 100% of one line across its cost sources is rejected with `ASSET_COST_FRACTION_EXCEEDED`.","operationId":"FixedAssets.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFixedAssetV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FixedAssetV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ASSET_COST_FRACTION_EXCEEDED, ASSET_COST_SOURCE_INVALID, ASSET_LEGAL_ENTITY_INVALID, ASSET_CLASS_UNRESOLVED, ASSET_LOCATION_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a fixed asset","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED","ASSET_COST_FRACTION_EXCEEDED","ASSET_COST_SOURCE_INVALID","ASSET_LEGAL_ENTITY_INVALID","ASSET_CLASS_UNRESOLVED","ASSET_LOCATION_INVALID","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["fixed-assets:write"]}},"/v1/fixed-assets/document-locks/{document_id}":{"get":{"description":"The fixed assets whose cost comes from this document and which therefore refuse its edit and its void (`DOCUMENT_COST_CAPITALIZED_CANNOT_EDIT` / `_VOID`) — the same set the refusal is computed from, read without a lock, so a screen can disable the action before the user tries it. An untouched auto-created asset is not listed: it follows the document. `release` names what lets an asset go: `undo_placement` or `remove_cost` (with the `cost_source_ids` to remove), else null. An LE-scoped caller sees only its own entity's assets. A document nothing holds, or one this org does not have, answers an empty list.","operationId":"FixedAssets.documentLocks","parameters":[{"name":"document_id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FixedAssetDocumentLockV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the fixed assets that lock a document","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED"],"x-required-scopes":["fixed-assets:read"]}},"/v1/fixed-assets/summary":{"get":{"description":"Per-status asset counts and money totals for the register, under the same filters as the list (`legal_entity_id`, `property_id`, `class_id`, `contract_id`, `q`) except `status` and `document_id`. `counts` has every status, zero-filled. `totals` sum the assets still on the books (pending, cip, active, suspended, fully_depreciated); `net_book_value` is `cost_basis − accumulated_depreciation`.","operationId":"FixedAssets.summary","parameters":[{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"property_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"class_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"contract_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"q","required":false,"in":"query","description":"Case-insensitive search on code, name, and serial number.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FixedAssetsSummaryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Summarize the fixed asset register","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["fixed-assets:read"]}},"/v1/fixed-assets/claimable-lines":{"get":{"description":"Posted, effective journal lines on a CAPITALIZABLE account, minus the fraction already claimed by `fixed_asset_cost_sources` rows. An account is capitalizable two ways: it is an active asset class's `asset_account_id`, or it holds the `fixed_assets` system role for the entry’s legal entity — which is the account a class with a null `asset_account_id` falls back to, so the picker offers exactly what the write path accepts. A line drops off this list once its claimed fractions sum to 1. Each line is returned exactly once even when several active classes share its GL account; `class_codes` then lists all of them, and is empty for a line offered only on the system-role account. Filter by `legal_entity_id` and `account_id`; ordered newest `entry_date` first, `journal_line_id` breaking ties.","operationId":"FixedAssets.claimableLines","parameters":[{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"account_id","required":false,"in":"query","description":"Narrow to journal lines on one GL account — the account a picker is capitalizing from.","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ClaimableLineV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List claimable journal lines","tags":["Fixed Assets"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["fixed-assets:read"]}},"/v1/fixed-assets/{id}":{"get":{"description":"One asset from the register, by id, with the same fields the list returns: its class and location, its depreciation settings (`life_months`, `method`, `convention`, `salvage_amount` — all null until it is placed in service), its `cost_basis` and `accumulated_depreciation`, and `net_book_value` computed as `cost_basis − accumulated_depreciation`. The schedule, the event log and the cost sources behind the basis are separate reads under this same id (`/schedule`, `/events`, `/cost-sources`). Answers 404 for an id in another org.","operationId":"FixedAssets.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FixedAssetV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a fixed asset","tags":["Fixed Assets"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["fixed-assets:read"]},"patch":{"description":"Partial update of descriptive fields only — `name`, `description`, `serial_number`, `tag_number`, `warranty_expires_on`, `attributes`, `vendor_party_id`. Financial and linkage fields (`cost_basis`, `class_id`, `property_id`, …) are not part of this DTO and are rejected as unknown fields.","operationId":"FixedAssets.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchFixedAssetV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FixedAssetV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a fixed asset’s descriptive fields","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["fixed-assets:write"]}},"/v1/fixed-assets/{id}/place-in-service":{"post":{"description":"Starts the asset’s depreciation clock: resolves its effective settings (each of `life_months`, `method`, `convention` and `salvage_amount` from the body, else the asset class’s default — salvage defaults to `cost_basis × default_salvage_pct`), projects the whole depreciation schedule onto the legal entity’s accounting periods as `projected` rows, flips `status` to `active`, and records a `place_in_service` event. Backdating is supported: the charge for the closed periods at the head of the timeline is folded into the first open period’s row and attributed there as `catch_up_amount`. Nothing posts to the general ledger — the periodic depreciation run does that, and every row this writes is `projected`. Only a `pending` or `cip` asset can be placed, and only into an active class that is not the construction-in-progress class it is leaving. A land class is placed `active` with no schedule rows at all; every other class needs a resolvable life, from `life_months` or the class default.\n\nOverriding a class default (`life_months`, `method`, `convention`, `salvage_amount`) REQUIRES a `reason`, which is stored on the event — spec §2 makes those settings \"overridable with a reason\". A placement that takes every default needs none. The entity’s accounting-period calendar must cover the in-service month and run without gaps from there; it may stop before the life ends, and the schedule read projects the rest.","operationId":"FixedAssets.placeInService","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaceInServiceV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FixedAssetV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ASSET_NOT_PLACEABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ASSET_CLASS_UNRESOLVED, ASSET_CLASS_INACTIVE, ASSET_LOCATION_INVALID, ASSET_STILL_IN_CONSTRUCTION, ASSET_CLASS_NOT_DEPRECIABLE, ASSET_LIFE_UNRESOLVED, ASSET_SALVAGE_EXCEEDS_COST, ASSET_EVENT_BEFORE_TRANSFER_IN, ASSET_EVENT_REASON_REQUIRED, NO_OPEN_PERIOD_FOR_PLACEMENT, ALL_PERIODS_CLOSED, ASSET_ACCOUNTS_UNRESOLVED, DEPRECIATION_SCHEDULE_NOT_COMPUTABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Place a fixed asset in service","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","ASSET_NOT_PLACEABLE","ASSET_CLASS_UNRESOLVED","ASSET_CLASS_INACTIVE","ASSET_LOCATION_INVALID","ASSET_STILL_IN_CONSTRUCTION","ASSET_CLASS_NOT_DEPRECIABLE","ASSET_LIFE_UNRESOLVED","ASSET_SALVAGE_EXCEEDS_COST","ASSET_EVENT_BEFORE_TRANSFER_IN","ASSET_EVENT_REASON_REQUIRED","NO_OPEN_PERIOD_FOR_PLACEMENT","ALL_PERIODS_CLOSED","ASSET_ACCOUNTS_UNRESOLVED","DEPRECIATION_SCHEDULE_NOT_COMPUTABLE","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["fixed-assets:write"]}},"/v1/fixed-assets/{id}/place-in-service/preview":{"post":{"description":"Runs the placement’s own planning with the same body and returns the first 12 schedule rows it would persist, the catch-up it would fold into the first open period, the regular monthly charge after it and the total over the whole schedule. Writes nothing. Refuses exactly as `place-in-service` does — an asset that is not `pending` or `cip` is `ASSET_NOT_PLACEABLE`, an unusable class, life, salvage or period calendar has the same code the write returns — so a preview that succeeds is a placement that would.","operationId":"FixedAssets.previewPlacement","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaceInServiceV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PlacementPreviewV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ASSET_NOT_PLACEABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ASSET_CLASS_UNRESOLVED, ASSET_CLASS_INACTIVE, ASSET_LOCATION_INVALID, ASSET_STILL_IN_CONSTRUCTION, ASSET_CLASS_NOT_DEPRECIABLE, ASSET_LIFE_UNRESOLVED, ASSET_SALVAGE_EXCEEDS_COST, ASSET_EVENT_BEFORE_TRANSFER_IN, ASSET_EVENT_REASON_REQUIRED, NO_OPEN_PERIOD_FOR_PLACEMENT, ALL_PERIODS_CLOSED, ASSET_ACCOUNTS_UNRESOLVED, DEPRECIATION_SCHEDULE_NOT_COMPUTABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview the schedule a placement would write","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","ASSET_NOT_PLACEABLE","ASSET_CLASS_UNRESOLVED","ASSET_CLASS_INACTIVE","ASSET_LOCATION_INVALID","ASSET_STILL_IN_CONSTRUCTION","ASSET_CLASS_NOT_DEPRECIABLE","ASSET_LIFE_UNRESOLVED","ASSET_SALVAGE_EXCEEDS_COST","ASSET_EVENT_BEFORE_TRANSFER_IN","ASSET_EVENT_REASON_REQUIRED","NO_OPEN_PERIOD_FOR_PLACEMENT","ALL_PERIODS_CLOSED","ASSET_ACCOUNTS_UNRESOLVED","DEPRECIATION_SCHEDULE_NOT_COMPUTABLE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["fixed-assets:read"]}},"/v1/fixed-assets/{id}/merge":{"post":{"description":"Folds the pending asset `source_asset_id` into the pending asset in the path, which survives. The source’s cost sources move to the survivor (two rows on the same journal line fold into one, fractions and amounts summed), the survivor’s `cost_basis` becomes the sum of its cost sources, the source is deleted and its pending-setup work item resolved. The survivor keeps its class and location and takes the source’s when it has none; two different classes, or two different property/space pairs, are refused. Both assets must be `pending`, in the same legal entity, and the source must have no history beyond a placement and its undo.","operationId":"FixedAssets.merge","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeFixedAssetV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FixedAssetV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ASSET_MERGE_SAME_ASSET, ASSET_MERGE_NOT_PENDING, ASSET_MERGE_ENTITY_MISMATCH, ASSET_MERGE_SOURCE_HAS_HISTORY, ASSET_MERGE_CLASS_CONFLICT, ASSET_MERGE_LOCATION_CONFLICT, ASSET_MERGE_STALE_COST, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Merge a pending asset into this one","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","ASSET_MERGE_SAME_ASSET","ASSET_MERGE_NOT_PENDING","ASSET_MERGE_ENTITY_MISMATCH","ASSET_MERGE_SOURCE_HAS_HISTORY","ASSET_MERGE_CLASS_CONFLICT","ASSET_MERGE_LOCATION_CONFLICT","ASSET_MERGE_STALE_COST","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["fixed-assets:write"]}},"/v1/fixed-assets/{id}/undo-placement":{"post":{"description":"Takes an `active` asset back to `pending`: its projected schedule rows are deleted, its `in_service_date`, `life_months`, `method`, `convention` and `salvage_amount` are cleared, an `undo_placement` event is recorded and, for an auto-created asset only (a manual one never had one), its pending-setup work item is raised again. Name, class, location, cost and cost sources are kept. Refused when the asset is not `active`, when any schedule row is `posted`, or when it has any event beyond its placement (and earlier undos). Nothing posts to the general ledger. The request has no body.","operationId":"FixedAssets.undoPlacement","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FixedAssetV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ASSET_UNDO_PLACEMENT_NOT_PLACED, ASSET_UNDO_PLACEMENT_DEPRECIATED, ASSET_UNDO_PLACEMENT_HAS_HISTORY, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Undo the placement of an asset nothing has depreciated","tags":["Fixed Assets"],"x-error-codes":["NOT_FOUND","ASSET_UNDO_PLACEMENT_NOT_PLACED","ASSET_UNDO_PLACEMENT_DEPRECIATED","ASSET_UNDO_PLACEMENT_HAS_HISTORY","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["fixed-assets:write"]}},"/v1/fixed-assets/{id}/cost-sources/{cost_source_id}":{"delete":{"description":"Deletes one ledger cost source (`bill_line` or `journal_line`) of a `pending` or `cip` asset and sets its `cost_basis` to the sum of the cost sources that remain. The freed line goes back to its document: when nothing claims it any more it gets a new pending auto-created asset, and the document stops being locked by this asset. Refused when the asset is placed, when the cost source is a `migrated` or `transfer_in` basis, or when it is the last cost line of an auto-created (`auto_shell`) asset, which keeps its one line and follows its bill. Answers the asset; 404 when the cost source is not one of this asset's. The request has no body.","operationId":"FixedAssets.removeCostSource","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cost_source_id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FixedAssetV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ASSET_COST_REMOVE_NOT_PENDING, ASSET_COST_REMOVE_NOT_A_LINE, ASSET_COST_REMOVE_LAST_LINE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Remove a cost line from a pending asset","tags":["Fixed Assets"],"x-error-codes":["NOT_FOUND","ASSET_COST_REMOVE_NOT_PENDING","ASSET_COST_REMOVE_NOT_A_LINE","ASSET_COST_REMOVE_LAST_LINE","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["fixed-assets:write"]}},"/v1/fixed-assets/{id}/events":{"post":{"description":"Records one dated, reasoned event against an asset and re-generates its projected depreciation schedule from it. No `posted` schedule row is ever rewritten.\n\n**Three of these events POST to the general ledger** and additionally require `accounting:write`: `dispose` retires the asset, `dispose_partial` retires a share of it, and `impair` writes its carrying amount down. A disposal first charges the depreciation it still owes between the last posted period and the disposal date — that charge CONSUMES the schedule row it pays for, so the nightly run never books those months again — then removes cost and accumulated depreciation against the proceeds, with the difference landing in gain or loss. When `proceeds_amount` is above zero, `bill_to_party_id` is required and the event also posts an `invoice` billing that party — DR accounts receivable, CR the `asset_disposal_clearing` account the proceeds landed on — returned as `invoice_document_id`. The documents a disposal posts — the disposal document itself, and, with proceeds, the invoice — are subject to the org’s required dimensions like any document: a required dimension that cannot be supplied refuses the disposal with a 422 `DIMENSION_REQUIRED` whose `context.dimension_code` names the dimension. Unlike the nightly run, none of the three overrides a CLOSED period: the caller chose the date, so a closed period is refused with two remedies rather than a silent override marker. The other five events post nothing.\n\n`add_cost` capitalizes more cost, and is the one event also accepted on a `pending` or `cip` asset: there it raises `cost_basis`, records the event, and touches NO schedule row — neither status has a depreciation clock, which is how a construction-in-progress asset accumulates cost before it is placed in service. On an `active` asset: each entry in `cost_sources` claims a fraction of a posted journal line’s signed (debit − credit) amount, and `cost_basis` rises by the claimed amounts. How the schedule is re-spread then depends on whether any of the asset’s schedule rows has already POSTED — two branches, and `add_cost` never refuses on either.\n\n⑴ **Nothing posted yet.** The schedule is re-spread over the asset’s life at the new basis, anchored at the asset’s own `in_service_date`. Catch-up is decided by the CLOSED-PERIOD PREFIX of the entity’s calendar, not by `effective_date`: the charge for whichever periods at the head of the schedule are already closed folds into the earliest open period’s row as `catch_up_amount`, whether or not `effective_date` itself falls in a closed period.\n\n⑵ **Any row already posted.** A posted row is in the general ledger and is never rewritten, so the re-spread is PROSPECTIVE and carries NO catch-up. It is anchored internally, at the day after the last period a depreciation run has posted — stepped further past a lifted suspension’s `skipped` months if any of them would otherwise sit inside the window — and spreads `cost_basis − salvage_amount` less what has already posted and less the rows retained outside the window. Total lifetime depreciation is conserved. The caller does not choose this anchor and cannot move it.\n\nOn both branches `effective_date` is this event’s record-keeping date only — it never opens the window. A land asset takes `add_cost` too — its cost basis rises and it still has no schedule rows.\n\n`revise` records a change in estimate and needs a `reason` plus at least one of `life_months`, `remaining_life_months`, `salvage_amount` or `method` (`life_months` and `remaining_life_months` are mutually exclusive: the new TOTAL life, or the months left to spread over). The remaining book value (`cost_basis − salvage_amount − accumulated depreciation`) is spread forward over the life remaining from `effective_date` — `life_months` is the new TOTAL life, so the remaining life is that minus the months already elapsed. It is prospective: no catch-up, and `effective_date` may not precede the asset’s `in_service_date`. The entity’s period calendar does NOT have to reach the end of the remaining life — the months it covers are written and the tail is projected by the schedule read; only a HOLE inside the window is refused. It IS refused when the window reaches a period that already carries a posted row (`ASSET_SCHEDULE_NOT_REGENERABLE`): that would rewrite the general ledger, so void that run first. `revise` is refused for a land asset, which has no depreciation estimate to change.\n\n`suspend` takes an idle or held-for-sale asset out of service and needs a `reason`. Every projected period STARTING on or after `effective_date` becomes `skipped` and carries nothing at all — no amount and no months-weight — so the remaining life is NOT consumed while the asset is suspended, and the rows stay in place so the timeline is continuous. `resume` restarts depreciation: the remaining book value is spread forward from its `effective_date` over the life that was not consumed, which pushes the end of the schedule out by exactly the months that were skipped rather than losing that depreciation. A `resume` may not predate the suspension it ends, and the rows before it are left untouched. A land asset takes both — its status changes and it has no rows to move either way. Neither a `suspend` nor a `resume` may reach back over a period a depreciation run has already POSTED (`ASSET_SCHEDULE_NOT_REGENERABLE`): the suspension would cover a month the asset demonstrably depreciated. Suspend from the first period that has not posted, or void that run first.\n\n`transfer` moves the asset to another property or space and needs `property_id`, `space_id`, or both (send `space_id: null` to move it up to property level). It is METADATA ONLY in this release: it writes no document and no journal entry — the GL reclass between property dimensions is deferred — and it changes no schedule row, because property is not on a schedule row at all (the depreciation run groups its document lines by property, so later depreciation simply lands at the new one). The named location must exist in this org, the space must belong to the property, and the property must belong to the asset’s own legal entity — an asset moves to another legal entity of the group only through `POST /v1/fixed-assets/{id}/intercompany-transfer`, never through this event. Any asset that is still on the books can be transferred, including a `pending` shell being assigned to a building — only a `disposed` or `transferred` one is refused, and an asset that went to another entity is acted on through its successor there.","operationId":"FixedAssets.recordEvent","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAssetEventV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AssetEventV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ASSET_EVENT_NOT_APPLICABLE, ASSET_SCHEDULE_NOT_REGENERABLE, ASSET_DISPOSAL_PERIOD_NOT_OPEN, ASSET_DISPOSAL_HELD_FOR_APPROVAL, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ASSET_EVENT_BEFORE_TRANSFER_IN, ASSET_EVENT_REASON_REQUIRED, ASSET_CLASS_NOT_DEPRECIABLE, ASSET_STILL_IN_CONSTRUCTION, ASSET_COST_FRACTION_EXCEEDED, ASSET_COST_SOURCE_INVALID, ASSET_SALVAGE_EXCEEDS_COST, ASSET_REVISED_LIFE_ELAPSED, ASSET_REVISE_BEFORE_IN_SERVICE, ASSET_DISPOSE_BEFORE_IN_SERVICE, ASSET_DISPOSAL_SHARE_INVALID, ASSET_DISPOSAL_PROCEEDS_ACCOUNT_DEPRECATED, ASSET_DISPOSAL_BILL_TO_REQUIRED, ASSET_DISPOSAL_BILL_TO_INVALID, ASSET_DISPOSAL_BILL_TO_WITHOUT_PROCEEDS, ASSET_IMPAIRMENT_INVALID, ASSET_ACCOUNTS_UNRESOLVED, ASSET_SUSPENSION_WINDOW_INVALID, ASSET_LOCATION_INVALID, NO_OPEN_PERIOD_FOR_PLACEMENT, ALL_PERIODS_CLOSED, DEPRECIATION_SCHEDULE_NOT_COMPUTABLE, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record a lifecycle event on a fixed asset","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","ASSET_EVENT_NOT_APPLICABLE","ASSET_EVENT_BEFORE_TRANSFER_IN","ASSET_EVENT_REASON_REQUIRED","ASSET_CLASS_NOT_DEPRECIABLE","ASSET_STILL_IN_CONSTRUCTION","ASSET_COST_FRACTION_EXCEEDED","ASSET_COST_SOURCE_INVALID","ASSET_SALVAGE_EXCEEDS_COST","ASSET_REVISED_LIFE_ELAPSED","ASSET_REVISE_BEFORE_IN_SERVICE","ASSET_SCHEDULE_NOT_REGENERABLE","ASSET_DISPOSE_BEFORE_IN_SERVICE","ASSET_DISPOSAL_SHARE_INVALID","ASSET_DISPOSAL_PROCEEDS_ACCOUNT_DEPRECATED","ASSET_DISPOSAL_BILL_TO_REQUIRED","ASSET_DISPOSAL_BILL_TO_INVALID","ASSET_DISPOSAL_BILL_TO_WITHOUT_PROCEEDS","ASSET_IMPAIRMENT_INVALID","ASSET_DISPOSAL_PERIOD_NOT_OPEN","ASSET_DISPOSAL_HELD_FOR_APPROVAL","INSUFFICIENT_SCOPE","ASSET_ACCOUNTS_UNRESOLVED","ASSET_SUSPENSION_WINDOW_INVALID","ASSET_LOCATION_INVALID","NO_OPEN_PERIOD_FOR_PLACEMENT","ALL_PERIODS_CLOSED","DEPRECIATION_SCHEDULE_NOT_COMPUTABLE","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","DIMENSION_REQUIRED"],"x-required-scopes":["fixed-assets:write"]},"get":{"description":"Every dated, reasoned event recorded against the asset, in lifecycle order — `sequence_no` ascending, so `place_in_service` first and the latest event last. This is the asset’s history: the register is an event log rather than an edit form, so what changed and why is here rather than reconstructed from the asset row. `before` / `after` are the asset’s setup on either side of each event, and `catch_up_amount` is what that event folded forward into the earliest open period.","operationId":"FixedAssets.listEvents","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 200","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AssetEventV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a fixed asset’s event log","tags":["Fixed Assets"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["fixed-assets:read"]}},"/v1/fixed-assets/{id}/intercompany-transfer":{"post":{"description":"Moves the asset to another legal entity of this organization at its net book value on `effective_date`. **No gain and no loss is booked, no proceeds and no invoice** — a transfer inside the group is not a sale.\n\n**The source asset closes and a successor opens.** The asset becomes `transferred` (terminal: every event refuses it) with cost and accumulated depreciation at zero; its posted schedule rows, cost sources and events stay as its history. A new asset with its own code opens in the receiving entity at the property / space sent, inheriting the cost basis, the accumulated depreciation, the class, life, method, convention, salvage and in-service date — but NOT the lease link (`figures.dropped_contract_id`).\n\n**What posts.** In the sending entity, an `asset_reclass` charges the depreciation it still owes through `effective_date` (consuming those schedule rows, so no run books them again), then DR accumulated depreciation · DR the transfer clearing account (net book value) · CR the asset account. In the receiving entity, an `asset_reclass` posts DR the asset account · CR accumulated depreciation · CR the clearing account. One `intercompany_transaction` then carries the net book value — the sending entity due from the receiving one, both lines naming the counterparty, so consolidation eliminates them — due on `effective_date`, and is settled like any other. With a net book value of zero no intercompany transaction is created. The clearing account (`fixed_asset_transfer_clearing`, 1596) nets to zero in each entity.\n\n**Depreciation across the hand-over.** The sending entity charges through the effective date by the disposal rule; the receiving entity continues from its first period after the one containing the date, spreading `cost − salvage − accumulated` over the life left.\n\nBoth periods must be open; nothing overrides a closed one. A document held for approval refuses the whole transfer. The intercompany transaction cannot be voided or edited, and neither can the two asset documents — undo a transfer by transferring the successor back. Call `/preview` with the same body to see the figures without writing anything; it is a separate route so it cannot consume this route’s `Idempotency-Key`.","operationId":"FixedAssets.transferIntercompany","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferAssetIntercompanyV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/IntercompanyTransferResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ASSET_EVENT_NOT_APPLICABLE, ASSET_TRANSFER_PERIOD_NOT_OPEN, ASSET_SCHEDULE_NOT_REGENERABLE, ASSET_TRANSFER_DESTINATION_PERIOD_DEPRECIATED, ASSET_TRANSFER_HELD_FOR_APPROVAL, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ASSET_EVENT_BEFORE_TRANSFER_IN, ASSET_TRANSFER_DESTINATION_INVALID, ASSET_LOCATION_INVALID, ASSET_TRANSFER_BEFORE_IN_SERVICE, DEPRECIATION_SCHEDULE_NOT_COMPUTABLE, ASSET_ACCOUNTS_UNRESOLVED, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Transfer a fixed asset to another legal entity at net book value","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","INSUFFICIENT_SCOPE","ASSET_EVENT_NOT_APPLICABLE","ASSET_EVENT_BEFORE_TRANSFER_IN","ASSET_TRANSFER_DESTINATION_INVALID","ASSET_LOCATION_INVALID","LEGAL_ENTITY_NOT_IN_SCOPE","ASSET_TRANSFER_BEFORE_IN_SERVICE","ASSET_TRANSFER_PERIOD_NOT_OPEN","ASSET_SCHEDULE_NOT_REGENERABLE","ASSET_TRANSFER_DESTINATION_PERIOD_DEPRECIATED","DEPRECIATION_SCHEDULE_NOT_COMPUTABLE","ASSET_ACCOUNTS_UNRESOLVED","ASSET_TRANSFER_HELD_FOR_APPROVAL","DIMENSION_REQUIRED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Moves a fixed asset between entities and posts it to the ledger.","x-required-scopes":["fixed-assets:write","accounting:write","intercompany:write"]}},"/v1/fixed-assets/{id}/intercompany-transfer/preview":{"post":{"description":"Runs every check `POST /v1/fixed-assets/{id}/intercompany-transfer` runs and returns what it would move — the final depreciation, the accumulated depreciation and net book value AT the effective date, the life the successor keeps and where its schedule starts — and writes nothing: it creates no account (the intercompany accounts are only looked up), so a refusal it cannot foresee — a default account code already taken by an unrelated account — surfaces on the commit. A separate route rather than a flag, deliberately: the two would otherwise share one `Idempotency-Key`, and a commit reusing the preview’s key would replay the preview and transfer nothing.","operationId":"FixedAssets.previewIntercompanyTransfer","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferAssetIntercompanyV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TransferFiguresV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ASSET_EVENT_NOT_APPLICABLE, ASSET_TRANSFER_PERIOD_NOT_OPEN, ASSET_SCHEDULE_NOT_REGENERABLE, ASSET_TRANSFER_DESTINATION_PERIOD_DEPRECIATED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ASSET_EVENT_BEFORE_TRANSFER_IN, ASSET_TRANSFER_DESTINATION_INVALID, ASSET_LOCATION_INVALID, ASSET_TRANSFER_BEFORE_IN_SERVICE, DEPRECIATION_SCHEDULE_NOT_COMPUTABLE, ASSET_ACCOUNTS_UNRESOLVED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview an intercompany transfer without writing anything","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","INSUFFICIENT_SCOPE","ASSET_EVENT_NOT_APPLICABLE","ASSET_EVENT_BEFORE_TRANSFER_IN","ASSET_TRANSFER_DESTINATION_INVALID","ASSET_LOCATION_INVALID","LEGAL_ENTITY_NOT_IN_SCOPE","ASSET_TRANSFER_BEFORE_IN_SERVICE","ASSET_TRANSFER_PERIOD_NOT_OPEN","ASSET_SCHEDULE_NOT_REGENERABLE","ASSET_TRANSFER_DESTINATION_PERIOD_DEPRECIATED","DEPRECIATION_SCHEDULE_NOT_COMPUTABLE","ASSET_ACCOUNTS_UNRESOLVED"],"x-required-scopes":["fixed-assets:write","accounting:write","intercompany:write"]}},"/v1/fixed-assets/{id}/regenerate-schedule":{"post":{"description":"Re-spreads ONE asset’s `projected` depreciation schedule from its CURRENT setup — spec §7.1’s second manual trigger, beside Run now. It records no event and changes no field on the asset: `cost_basis`, `life_months`, `method`, `convention` and `in_service_date` are read as they stand and the rows are rebuilt from them, onto the legal entity’s accounting periods, with the closed periods at the head of the schedule folded forward into the first open one as `catch_up_amount`.\n\nUse it when the schedule is stale through no fault of the asset: the entity’s period calendar has grown since placement and the months it now reaches carry no rows yet, or a depreciation run was voided and its rows went back to `projected`. A change of ESTIMATE is NOT this — that is a `revise` event, which is prospective and carries a reason.\n\n**Refused once any row has posted** (`ASSET_SCHEDULE_NOT_REGENERABLE`). A posted row is accounting truth and is never rewritten, and a re-spread from the in-service date would fold its already-closed period forward as catch-up a second time — charging depreciation that is already in the general ledger twice. Record a `revise` instead, or void the run first. Refused the same way on an asset transferred in from another entity (not construction in progress when it travelled — land included) or imported from a legacy register, whose accumulated depreciation was recorded before it arrived, with no posted row behind it here. A successor that travelled as construction in progress carried no clock, so once placed it regenerates like any other asset.\n\nAny other asset with no depreciation clock — land, one with no class, one not yet placed in service — is a no-op, not a failure: it answers `rows_written: 0`. `posted` and `skipped` rows are never touched on any path; a suspension’s months stay out of the window and keep consuming none of the life.","operationId":"FixedAssets.regenerateSchedule","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RegeneratedScheduleV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ASSET_SCHEDULE_NOT_REGENERABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: NO_OPEN_PERIOD_FOR_PLACEMENT, ALL_PERIODS_CLOSED, DEPRECIATION_SCHEDULE_NOT_COMPUTABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Regenerate a fixed asset’s depreciation schedule","tags":["Fixed Assets"],"x-error-codes":["NOT_FOUND","ASSET_SCHEDULE_NOT_REGENERABLE","NO_OPEN_PERIOD_FOR_PLACEMENT","ALL_PERIODS_CLOSED","DEPRECIATION_SCHEDULE_NOT_COMPUTABLE","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["fixed-assets:write"]}},"/v1/fixed-assets/{id}/schedule":{"get":{"description":"The asset’s depreciation, period by period, from its in-service date to the end of its life. Ordered oldest first; `sequence_no` is the entry’s position in the asset’s life, counted in calendar months from the in-service month.\n\nEntries come in two kinds, and `source` says which. A `persisted` entry is a stored schedule row with an `id`, a `period_id` and a `status` (`projected` — computed, not yet in the general ledger; `posted` — booked by a depreciation run and never rewritten; `skipped` — the asset was suspended for that period, so it carries no depreciation and consumes none of the life). A `projection` entry is computed at read time for a calendar month the legal entity’s period calendar does not reach yet: it is stored nowhere, so its `id`, `period_id`, `status` and `basis_snapshot` are all null — a projected month has no accounting period, and none is invented for it. Those months become persisted rows on the next event once the calendar reaches them, which the daily top-up job does on its own — there is no endpoint to force it. Pass `persisted_only=true` to get only the stored rows.\n\nSumming `amount` over the whole schedule equals the depreciable basis (`cost_basis − salvage_amount`): `amount` already includes any `catch_up_amount` rather than sitting beside it. The projection continues the schedule the stored rows actually follow — the basis in force on them, and the months a suspension deferred — so persisted and projected entries always add up to one schedule.\n\nThe one exception is an asset that is SUSPENDED right now. Its skipped months carry 0.00 and the share of the basis they were holding is unallocated until a `resume` spreads it forward, so while the suspension stands the sum need not tie: it falls short by that unallocated share whenever the life ends inside the period calendar, and where a `revise` or a `resume` had already re-spread the schedule before the suspension it can differ in either direction, because the projected months are priced from the asset’s own life rather than from that re-spread. Record the `resume` and the schedule ties again to the basis exactly. A land asset never depreciates and returns an empty schedule.","operationId":"FixedAssets.getSchedule","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"persisted_only","required":false,"in":"query","description":"Set `true` to return ONLY stored `depreciation_schedule_entries` rows and omit the projection past the end of the entity’s period calendar. Use it when you need what a depreciation run could act on rather than the asset’s whole remaining life.","schema":{"type":"string","enum":["true","false"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 200","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ScheduleEntryV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DEPRECIATION_SCHEDULE_NOT_COMPUTABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a fixed asset’s depreciation schedule","tags":["Fixed Assets"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED","DEPRECIATION_SCHEDULE_NOT_COMPUTABLE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["fixed-assets:read"]}},"/v1/fixed-assets/{id}/cost-sources":{"get":{"description":"The claims this asset holds on posted journal lines — the audit trail between its `cost_basis` and the general ledger. Each row names the journal line, its entry and account, the document the entry was posted from (when it came from one), the `fraction` of the line this asset claims and the resulting `amount`. Summing `amount` gives what the cost basis was built from; an imported basis has no journal line behind it and leaves the journal fields null. Ordered oldest first, the order the cost was capitalized.","operationId":"FixedAssets.listCostSources","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 200","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CostSourceV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a fixed asset’s cost sources","tags":["Fixed Assets"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["fixed-assets:read"]}},"/v1/fixed-assets/disposals":{"post":{"description":"Retires every selected asset in one decision — a theft, a casualty, a write-off — recording one `dispose` event per asset that share a `batch_id`, and posting one summary `asset_disposal` document PER LEGAL ENTITY in the selection, because a document belongs to one entity.\n\nEach asset is charged the depreciation it still owes between its last posted period and `effective_date` before its cost and accumulated depreciation leave the books, so the result of the disposal is the real one. That charge consumes the schedule row it pays for, which is why the nightly depreciation run never books those months again.\n\nAn optional recovery is allocated pro rata to each asset’s net book value at the disposal date, or asset by asset through `allocations`. With neither, the batch disposes at zero proceeds — the everyday case, one stolen laptop.\n\n**Proceeds are billed.** Every recovery lands on the entity’s `asset_disposal_clearing` account, and when it is above zero `bill_to_party_id` is required: the batch then posts one `invoice` per legal entity that recovered something, billed to that party (DR accounts receivable, CR the same clearing account), in the same transaction, and returns them in `invoice_document_ids`. The clearing account nets to zero and the receivable is collected like any invoice. The invoice cannot be voided or edited — correct it with a credit memo. `proceeds_account_id` is deprecated and refused. The documents a disposal posts — each entity’s `asset_disposal` document, and, with proceeds, its invoice — are subject to the org’s required dimensions like any document: a required dimension that cannot be supplied refuses the whole batch with a 422 `DIMENSION_REQUIRED` whose `context.dimension_code` names the dimension.\n\n**All or nothing.** If any selected asset is refused, none is disposed and `ASSET_DISPOSAL_BATCH_REFUSED` names every offender with its own cause in `context.rejected`: half a casualty write-off leaves the register tying to a ledger that reflects part of one decision.\n\nTo see what a selection would post WITHOUT writing anything, call `POST /v1/fixed-assets/disposals/preview` with the same body — the dialog needs it, because net book value AT the disposal date is not the value the register shows today. The preview is a separate route rather than a flag on this one, so it takes no `Idempotency-Key` and cannot consume the key meant for the commit.","operationId":"FixedAssets.disposeBatch","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DisposeAssetsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DisposeAssetsResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ASSET_DISPOSAL_HELD_FOR_APPROVAL, ASSET_DISPOSAL_PERIOD_NOT_OPEN, ASSET_SCHEDULE_NOT_REGENERABLE, ASSET_EVENT_NOT_APPLICABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ASSET_DISPOSAL_BATCH_REFUSED, ASSET_DISPOSAL_ALLOCATION_INVALID, ASSET_DISPOSAL_PROCEEDS_ACCOUNT_DEPRECATED, ASSET_DISPOSAL_BILL_TO_REQUIRED, ASSET_DISPOSAL_BILL_TO_INVALID, ASSET_DISPOSAL_BILL_TO_WITHOUT_PROCEEDS, ASSET_ACCOUNTS_UNRESOLVED, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Dispose several fixed assets at once","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED","ASSET_DISPOSAL_BATCH_REFUSED","ASSET_DISPOSAL_ALLOCATION_INVALID","ASSET_DISPOSAL_HELD_FOR_APPROVAL","ASSET_DISPOSAL_PERIOD_NOT_OPEN","ASSET_DISPOSAL_PROCEEDS_ACCOUNT_DEPRECATED","ASSET_DISPOSAL_BILL_TO_REQUIRED","ASSET_DISPOSAL_BILL_TO_INVALID","ASSET_DISPOSAL_BILL_TO_WITHOUT_PROCEEDS","ASSET_SCHEDULE_NOT_REGENERABLE","ASSET_EVENT_NOT_APPLICABLE","ASSET_ACCOUNTS_UNRESOLVED","LEGAL_ENTITY_NOT_IN_SCOPE","DIMENSION_REQUIRED"],"x-required-scopes":["fixed-assets:write","accounting:write"]}},"/v1/fixed-assets/disposals/preview":{"post":{"description":"Computes exactly what `POST /v1/fixed-assets/disposals` would do — each asset’s net book value AT the disposal date, the depreciation the disposal still owes, its share of the recovery and the resulting gain or loss — and writes nothing.\n\nThe dialog needs this because net book value at the disposal date is NOT the value the register shows today: the disposal charges the months no depreciation run reached.\n\nA separate route rather than a flag on the commit, deliberately: they would otherwise share one `Idempotency-Key`, and a commit that reused the preview’s key would replay the preview — answering 200 with the same numbers and disposing nothing at all.","operationId":"FixedAssets.previewDisposeBatch","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DisposeAssetsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DisposeAssetsResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ASSET_DISPOSAL_PERIOD_NOT_OPEN, ASSET_SCHEDULE_NOT_REGENERABLE, ASSET_EVENT_NOT_APPLICABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ASSET_DISPOSAL_BATCH_REFUSED, ASSET_DISPOSAL_ALLOCATION_INVALID, ASSET_DISPOSAL_PROCEEDS_ACCOUNT_DEPRECATED, ASSET_DISPOSAL_BILL_TO_REQUIRED, ASSET_DISPOSAL_BILL_TO_INVALID, ASSET_DISPOSAL_BILL_TO_WITHOUT_PROCEEDS, ASSET_ACCOUNTS_UNRESOLVED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview a bulk disposal without writing anything","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED","ASSET_DISPOSAL_BATCH_REFUSED","ASSET_DISPOSAL_ALLOCATION_INVALID","ASSET_DISPOSAL_PERIOD_NOT_OPEN","ASSET_DISPOSAL_PROCEEDS_ACCOUNT_DEPRECATED","ASSET_DISPOSAL_BILL_TO_REQUIRED","ASSET_DISPOSAL_BILL_TO_INVALID","ASSET_DISPOSAL_BILL_TO_WITHOUT_PROCEEDS","ASSET_SCHEDULE_NOT_REGENERABLE","ASSET_EVENT_NOT_APPLICABLE","ASSET_ACCOUNTS_UNRESOLVED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["fixed-assets:write","accounting:write"]}},"/v1/depreciation-runs":{"post":{"description":"Depreciates one legal entity for one accounting period immediately, instead of waiting for the nightly `depreciation_run_generation` job: the period’s `projected` schedule rows are grouped by property × account into one `depreciation` document dated period end, that document posts, and the rows it covered are stamped `posted`.\n\n**Idempotent, and the database is what makes it so.** A partial unique index holds at most one live run per `(legal_entity_id, period_id)` (every status except `voided`), so a second call — a double-click, a retry, or a race with the nightly job — returns the run that already exists rather than starting a second one or answering a conflict. A `posted`, `empty` or `pending_approval` run comes back untouched; a `failed` one, and a `generating` one whose process died, are REUSED for the retry rather than duplicated. Send an `Idempotency-Key` as well: it dedupes the HTTP request, while the index dedupes the run itself.\n\nA period with nothing to depreciate records an `empty` run — unlike the nightly job, which records nothing at all (§7.3: a period with no depreciating assets shows no close blocker). An explicit trigger always gets a run back, so the caller can see that its Run-now did something. A period whose charges all net to zero records `empty` too, with the assets it examined counted.\n\nIf the attempt raises — an unresolvable account, a refusing period gate — the error is returned AND the run is left `failed` with the message on it, which is what makes it retryable: the next call reuses that row. `GET /v1/depreciation-runs?legal_entity_id=&period_id=` shows it.\n\n**The period must have ENDED.** A pair whose `end_date` is today or later in the organization’s own time zone is refused with `DEPRECIATION_PERIOD_NOT_ENDED` before any run is recorded — the same rule the nightly job applies. Running a period early would post a document dated in the future and freeze that month’s schedule rows `posted`, after which an `add_cost`, `revise`, `suspend` or `resume` recorded later in the same month could no longer rewrite them.\n\n**A period whose `depreciation` document is already POSTED cannot receive a second one**, whatever state its run row is in: the request is refused with `DEPRECIATION_ALREADY_POSTED`, naming the document to void. The check is a read of the documents table rather than a flag on the run, because a retry clears the run’s `document_id`, `error_message` and `failure_kind` — so the posted document is the only record of the charge that survives one. `voided` and `reversed` documents do not count.\n\nCorrecting a posted run is void-and-redo, never an edit: void the document, which resets the rows to `projected` and frees the period’s slot, fix the asset with an event, then Run now again (§7.4).","operationId":"DepreciationRuns.runNow","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunDepreciationV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DepreciationRunV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEPRECIATION_ALREADY_POSTED, PERIOD_CLOSED, PERIOD_LOCKED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ASSET_ACCOUNTS_UNRESOLVED, DEPRECIATION_PERIOD_NOT_ENDED, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Run depreciation now for one entity and period","tags":["Fixed Assets"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","ASSET_ACCOUNTS_UNRESOLVED","DEPRECIATION_PERIOD_NOT_ENDED","DEPRECIATION_ALREADY_POSTED","PERIOD_CLOSED","PERIOD_LOCKED","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_MISSING","DIMENSION_REQUIRED"],"x-required-scopes":["fixed-assets:write","accounting:write"]},"get":{"description":"The org’s depreciation runs, newest first, one per legal entity × accounting period. Filter by `legal_entity_id`, `period_id` or `status`.\n\nA period shows more than one run only when an earlier one was `voided`: the partial unique index behind Run-now’s idempotency holds at most one LIVE run per entity × period, and voiding is what frees that slot for a redo. Runs are never deleted, so a `failed` or `voided` row stays as the record of the attempt.","operationId":"DepreciationRuns.list","parameters":[{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"period_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["generating","posted","pending_approval","failed","voided","empty"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DepreciationRunV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List depreciation runs","tags":["Fixed Assets"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["fixed-assets:read"]}},"/v1/depreciation-runs/{id}":{"get":{"description":"One run by id, with the same fields the list returns — its status, its totals, and `document_id`, the `depreciation` document it posted through. Follow that id to `GET /v1/documents/:id` for the lines and the journal entry behind them; for the per-asset breakdown use `GET /v1/depreciation-runs/:id/entries`, which returns one cursor-paged row per asset with the asset’s name and code already joined in. (`GET /v1/fixed-assets/:id/schedule` is the same rows seen from ONE asset across periods — a request per asset, which is what the entries route exists to replace.) A `voided` run is still readable and keeps its `document_id` — it is the record of what was posted and then reversed. Answers 404 for an id in another org.","operationId":"DepreciationRuns.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DepreciationRunV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a depreciation run","tags":["Fixed Assets"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["fixed-assets:read"]}},"/v1/depreciation-runs/{id}/entries":{"get":{"description":"The per-asset breakdown behind a run's `total_amount` / `catch_up_total`: one row per asset, cursor-paged because a single run can cover the whole register. This is NOT the general ledger — the run's GL lines live on the document it posted (`document_id` on the run itself, followed to `GET /v1/documents/:id`); this read exists so a caller can see what each asset contributed to that document's total without re-deriving it from the schedule. Answers 404 for a run id in another org.\n\n**What a row IS depends on the run’s `status`, and the difference matters.** A `posted` run owns its rows: they carry its `run_id` and this page is a permanent record of what it booked. A run that charged NOTHING — `empty`, `pending_approval` (with one caveat, below), `generating`, or `failed` with `failure_kind` null or `approval_rejected` — stamped no rows, so this answers with the period’s still `projected` rows for the run’s legal entity: the assets it EXAMINED. ⚠️ **That page is a LIVE view, not history.** Those rows carry no link to this run, and an `add_cost`, `revise`, `suspend` or `resume` recorded afterwards can re-spread them, so the same run can answer different numbers tomorrow. That is honest for a run that booked nothing, and it is why an `empty` run — which can carry a real `asset_count` even though its charges netted to zero and it posted NO document — shows its assets here instead of an empty table.\n\n**Two runs answer EMPTY on purpose, and both have a posted document behind them.** Render each with its own message, never as a bare empty table; the run’s `document_id` is what explains it.\n\n- A `voided` run — voiding returned its rows to `projected` and handed them to whichever run posts them next, so they are no longer its. Say “voided — its rows returned to projected”. The `document_id` still shows what it posted and what reversed it.\n- A `failed` run whose `failure_kind` is `posted_not_stamped` — its document POSTED and only the stamp failed, so the general ledger carries this period’s depreciation while the rows rolled back to `projected`. Those rows are NOT this run’s breakdown and do not tie to the document’s totals, so they are withheld rather than shown under a header that would make them look authoritative. Follow `document_id` to `GET /v1/documents/:id` for what was actually charged, and read `error_message`: the document has to be voided before the period is run again.\n\n⚠️ **One gap, stated rather than hidden.** A `pending_approval` run whose document has since POSTED — a rare but durable state, when the handler that should move the run to `posted` never ran — is served the `projected` rows like any other held run, and those rows do not tie to the posted document. Such a run is already wedged and needs operator attention; treat a `pending_approval` run whose `document_id` resolves to a `posted` document as unreliable here and read the document instead.","operationId":"DepreciationRuns.listEntries","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RunEntryV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a run's per-asset entries","tags":["Fixed Assets"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["fixed-assets:read"]}},"/v1/items":{"get":{"operationId":"Items.list","parameters":[{"name":"item_type","required":false,"in":"query","schema":{"type":"string","enum":["income","expense","asset","liability"]}},{"name":"is_active","required":false,"in":"query","schema":{"type":"boolean"}},{"name":"include_archived","required":false,"in":"query","description":"Include archived items in the response. Default false (archived items are hidden).","schema":{"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: code","schema":{"enum":["code","-code","name","-name","created_at","-created_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List items","tags":["Items"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["items:read"]},"post":{"operationId":"Items.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateItemV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ItemV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create item","tags":["Items"],"x-error-codes":["VALIDATION_FAILED","CONFLICT","ACCOUNT_LEGAL_ENTITY_MISMATCH","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["items:write"]}},"/v1/items/{id}":{"patch":{"operationId":"Items.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateItemV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ItemV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update item","tags":["Items"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT","ACCOUNT_LEGAL_ENTITY_MISMATCH","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["items:write"]}},"/v1/items/{id}/archive":{"post":{"operationId":"Items.archive","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ItemV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Archive item","tags":["Items"],"x-error-codes":["NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["items:write"]}},"/v1/items/{id}/unarchive":{"post":{"operationId":"Items.unarchive","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ItemV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Unarchive item","tags":["Items"],"x-error-codes":["NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["items:write"]}},"/v1/org-users":{"get":{"operationId":"OrgUsers.list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OrgUserResponseDto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List members of the current org","tags":["Org Users"],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"org headcount"},"x-required-scopes":["admin:users"]}},"/v1/org-users/invite":{"post":{"operationId":"OrgUsers.invite","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteOrgUserDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InviteOrgUserResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: SECURITY_HIERARCHY_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: SECURITY_GROUP_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ORG_USER_ALREADY_MEMBER, ORG_USER_IN_ANOTHER_ORG, ORG_USER_DEACTIVATED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"502":{"description":"Possible error codes: ORG_USER_STAFF_CHECK_FAILED, ORG_USER_INVITE_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Invite a user to the org by email","tags":["Org Users"],"x-connector-forbidden":true,"x-error-codes":["ORG_USER_ALREADY_MEMBER","ORG_USER_IN_ANOTHER_ORG","ORG_USER_STAFF_CHECK_FAILED","ORG_USER_INVITE_FAILED","ORG_USER_DEACTIVATED","SECURITY_HIERARCHY_FORBIDDEN","SECURITY_GROUP_NOT_FOUND"],"x-required-scopes":["admin:users"]}},"/v1/org-users/{userId}":{"patch":{"operationId":"OrgUsers.updateRole","parameters":[{"name":"userId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOrgUserDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OrgUserResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: ORG_USER_SELF_MUTATION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: ORG_USER_OWNER_PROTECTED, SECURITY_HIERARCHY_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ORG_USER_NOT_FOUND, SECURITY_GROUP_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ORG_USER_LAST_ADMIN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SECURITY_LOCKOUT_PREVENTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a member's profile, role, and/or security group","tags":["Org Users"],"x-connector-forbidden":true,"x-error-codes":["ORG_USER_SELF_MUTATION","ORG_USER_OWNER_PROTECTED","ORG_USER_LAST_ADMIN","ORG_USER_NOT_FOUND","SECURITY_GROUP_NOT_FOUND","SECURITY_HIERARCHY_FORBIDDEN","SECURITY_LOCKOUT_PREVENTED"],"x-required-scopes":["admin:users"]},"delete":{"operationId":"OrgUsers.remove","parameters":[{"name":"userId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OrgUserResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: ORG_USER_SELF_MUTATION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: ORG_USER_OWNER_PROTECTED, SECURITY_HIERARCHY_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ORG_USER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ORG_USER_LAST_ADMIN, ORG_USER_NOT_PENDING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SECURITY_LOCKOUT_PREVENTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Remove a member from the org (auth user survives)","tags":["Org Users"],"x-error-codes":["ORG_USER_SELF_MUTATION","ORG_USER_OWNER_PROTECTED","ORG_USER_LAST_ADMIN","ORG_USER_NOT_FOUND","ORG_USER_NOT_PENDING","SECURITY_HIERARCHY_FORBIDDEN","SECURITY_LOCKOUT_PREVENTED"],"x-high-risk":true,"x-high-risk-reason":"Removes a member from the org.","x-required-scopes":["admin:users"]}},"/v1/org-users/{userId}/approval-limit":{"put":{"description":"Replaces the cap the approvals engine and payment-run release check. Needs `admin:users` or `approvals:configure`. You may not set your own limit, nor the limit of a member ranked at or above you; the one exception is that an owner may set any limit, their own included. Below owner rank the new limit may not exceed your own, and with no limit of your own you cannot raise one. Removing authority is always allowed: null clears the cap (no approval authority), and lowering a member's cap to at most its current value needs no authority of your own.","operationId":"OrgUsers.setApprovalLimit","parameters":[{"name":"userId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetApprovalLimitDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApprovalLimitResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: ORG_USER_SELF_MUTATION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: SECURITY_HIERARCHY_FORBIDDEN, ORG_USER_APPROVAL_LIMIT_ABOVE_OWN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ORG_USER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Set or clear a member's document-approval limit","tags":["Org Users"],"x-connector-forbidden":true,"x-error-codes":["ORG_USER_NOT_FOUND","ORG_USER_SELF_MUTATION","SECURITY_HIERARCHY_FORBIDDEN","ORG_USER_APPROVAL_LIMIT_ABOVE_OWN"],"x-required-scopes-any":["admin:users","approvals:configure"]}},"/v1/org-users/{userId}/permissions":{"get":{"operationId":"OrgUsers.getPermissions","parameters":[{"name":"userId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/UserPermissionsResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: ORG_USER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a member's assigned security group, per-user overrides, and effective permission matrix","tags":["Org Users"],"x-error-codes":["ORG_USER_NOT_FOUND"],"x-required-scopes":["admin:roles"]},"put":{"operationId":"OrgUsers.putPermissions","parameters":[{"name":"userId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutPermissionOverridesDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/UserPermissionsResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: SECURITY_HIERARCHY_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ORG_USER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SECURITY_GROUP_INVALID_RESOURCE, SECURITY_LOCKOUT_PREVENTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace a member's per-user permission overrides (replace-set) and return the refreshed effective matrix","tags":["Org Users"],"x-connector-forbidden":true,"x-error-codes":["ORG_USER_NOT_FOUND","SECURITY_GROUP_INVALID_RESOURCE","SECURITY_HIERARCHY_FORBIDDEN","SECURITY_LOCKOUT_PREVENTED"],"x-required-scopes":["admin:roles"]}},"/v1/org-users/{userId}/deactivate":{"post":{"description":"Moves the membership out of the live set: the member is refused on every request with ORG_MEMBER_DEACTIVATED, and activation restores role, security group, per-user overrides, approval limit and legal-entity scope exactly. Guarded like removal: not self, owners only by an owner, strictly-lower rank, last-admin floor, anti-lockout.","operationId":"OrgUsers.deactivate","parameters":[{"name":"userId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OrgUserResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: ORG_USER_SELF_MUTATION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: ORG_USER_OWNER_PROTECTED, SECURITY_HIERARCHY_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ORG_USER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ORG_USER_LAST_ADMIN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SECURITY_LOCKOUT_PREVENTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Deactivate a member (keeps role, group and overrides)","tags":["Org Users"],"x-error-codes":["ORG_USER_SELF_MUTATION","ORG_USER_OWNER_PROTECTED","ORG_USER_LAST_ADMIN","ORG_USER_NOT_FOUND","SECURITY_HIERARCHY_FORBIDDEN","SECURITY_LOCKOUT_PREVENTED"],"x-high-risk":true,"x-high-risk-reason":"Turns off a member's access.","x-required-scopes":["admin:users"]}},"/v1/org-users/{userId}/activate":{"post":{"description":"Returns the member to the live set with everything they had. The caller must be able to assign the rank the member comes back with.","operationId":"OrgUsers.activate","parameters":[{"name":"userId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OrgUserResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: ORG_USER_OWNER_PROTECTED, SECURITY_HIERARCHY_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ORG_USER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Reactivate a deactivated member","tags":["Org Users"],"x-connector-forbidden":true,"x-error-codes":["ORG_USER_NOT_FOUND","ORG_USER_OWNER_PROTECTED","SECURITY_HIERARCHY_FORBIDDEN"],"x-required-scopes":["admin:users"]}},"/v1/org-users/{userId}/password-reset":{"post":{"description":"Generates a one-time recovery link and sends the branded reset email. The admin never sees or sets the password. Not available for pending invites (resend the invite instead).","operationId":"OrgUsers.sendPasswordReset","parameters":[{"name":"userId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PasswordResetResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: SECURITY_HIERARCHY_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ORG_USER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ORG_USER_PENDING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"502":{"description":"Possible error codes: ORG_USER_INVITE_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Email a member a password-reset link","tags":["Org Users"],"x-error-codes":["ORG_USER_NOT_FOUND","ORG_USER_PENDING","SECURITY_HIERARCHY_FORBIDDEN","ORG_USER_INVITE_FAILED"],"x-required-scopes":["admin:users"]}},"/v1/me/profile":{"get":{"operationId":"Auth.getMyProfile","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OrgUserResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: ORG_USER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get the caller's own org-membership profile","tags":["Auth"],"x-error-codes":["ORG_USER_NOT_FOUND"],"x-required-scopes":["auth:read"]},"patch":{"operationId":"Auth.updateMyProfile","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMyProfileDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OrgUserResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: ORG_USER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update the caller's own name and phone","tags":["Auth"],"x-error-codes":["ORG_USER_NOT_FOUND"],"x-required-scopes":["profile:write"]}},"/v1/auth/password-reset":{"post":{"description":"Answers 202 with an empty envelope for every valid address. The request is queued and the account lookup runs in a background job, so neither status nor timing reveals whether an account exists; the email usually arrives within a minute or two. A link is emailed only to a user with a live membership, and repeat requests for an address are collapsed while its earlier request is still queued.","operationId":"Auth.requestPasswordReset","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestPasswordResetDto"}}}},"responses":{"202":{"description":"Accepted; empty envelope."},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"summary":"Request a password-reset email (self-service)","tags":["Auth"],"x-error-codes":["VALIDATION_FAILED"],"x-public":true}},"/v1/internal/users":{"get":{"description":"Every user with an email, ordered by email, on the unified list contract (100 per page). `search` matches email, first name and last name. Each row carries the Spark-staff flag, every org the user belongs to (live or deactivated membership) and `eligible_as_owner`: false with `ineligible_reason` `IN_ANOTHER_ORG` when the user belongs to an org and is not Spark staff — the single-home rule `POST /v1/internal/orgs` enforces, which stays the authority.","operationId":"UsersInternal.list","parameters":[{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: email","schema":{"enum":["email"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: email, first_name, last_name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/UserDirectoryRowV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List app users with their orgs, for the owner picker (staff)","tags":["Internal — Users"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-internal":true,"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["admin:*"]}},"/v1/deal-stages":{"get":{"description":"Ordered by sort_order then code, so open stages come first in pipeline order and Closed / Dead last. Turned-off stages are hidden unless `include_inactive=true`.","operationId":"DealStages.list","parameters":[{"name":"kind","required":false,"in":"query","description":"Only stages whose kind scope contains this kind.","schema":{"type":"string","enum":["acquisition","disposition","internal_transfer"]}},{"name":"include_inactive","required":false,"in":"query","description":"Include turned-off stages. Default false.","schema":{"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: sort_order","schema":{"enum":["sort_order"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: label.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DealStageCatalogV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the deal stage catalog","tags":["Deal stages"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["deals:read"]},"post":{"operationId":"DealStages.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDealStageV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealStageCatalogV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_STAGE_IN_USE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DEAL_STAGE_FIXED, DEAL_STAGE_CATALOG_INCOMPLETE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a stage (lands last among the open stages)","tags":["Deal stages"],"x-error-codes":["VALIDATION_FAILED","DEAL_STAGE_FIXED","DEAL_STAGE_IN_USE","DEAL_STAGE_CATALOG_INCOMPLETE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["deals:admin"]}},"/v1/deal-stages/requirement-keys":{"get":{"operationId":"DealStages.requirementKeys","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DealStageRequirementKeyV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"The requirement keys a stage can carry","tags":["Deal stages"],"x-pagination":{"mode":"computed","reason":"A fixed vocabulary of a dozen keys defined in code; nothing to page."},"x-required-scopes":["deals:read"]}},"/v1/deal-stages/order":{"post":{"description":"`stage_ids` must list every non-terminal stage (active and inactive) exactly once; open stages are renumbered 10, 20, … and Closed / Dead stay last. A stale `expected_stage_ids` is a 409.","operationId":"DealStages.reorder","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderDealStagesV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealStageOrderV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_STAGE_ORDER_CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Reorder the open stages","tags":["Deal stages"],"x-error-codes":["VALIDATION_FAILED","DEAL_STAGE_ORDER_CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["deals:admin"]}},"/v1/deal-stages/{id}":{"patch":{"operationId":"DealStages.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDealStageV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealStageCatalogV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_STAGE_IN_USE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DEAL_STAGE_FIXED, DEAL_STAGE_CATALOG_INCOMPLETE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Edit a stage (any subset of fields)","tags":["Deal stages"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","DEAL_STAGE_FIXED","DEAL_STAGE_IN_USE","DEAL_STAGE_CATALOG_INCOMPLETE"],"x-required-scopes":["deals:admin"]},"delete":{"operationId":"DealStages.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_STAGE_IN_USE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DEAL_STAGE_FIXED, DEAL_STAGE_CATALOG_INCOMPLETE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a custom stage nothing references","tags":["Deal stages"],"x-error-codes":["NOT_FOUND","DEAL_STAGE_FIXED","DEAL_STAGE_IN_USE","DEAL_STAGE_CATALOG_INCOMPLETE"],"x-required-scopes":["deals:admin"]}},"/v1/deal-lost-reasons":{"get":{"description":"Ordered by sort_order then code. Turned-off reasons are hidden unless `include_inactive=true`.","operationId":"DealLostReasons.list","parameters":[{"name":"include_inactive","required":false,"in":"query","description":"Include turned-off reasons. Default false.","schema":{"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: sort_order","schema":{"enum":["sort_order"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: label.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DealLostReasonV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the deal lost reasons","tags":["Deal lost reasons"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["deals:read"]},"post":{"operationId":"DealLostReasons.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDealLostReasonV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealLostReasonV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a lost reason (lands last)","tags":["Deal lost reasons"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["deals:admin"]}},"/v1/deal-lost-reasons/order":{"post":{"description":"`reason_ids` must list every reason (active and inactive) exactly once; they are renumbered 10, 20, …. A stale `expected_reason_ids` is a 409.","operationId":"DealLostReasons.reorder","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderDealLostReasonsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealLostReasonOrderV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_LOST_REASON_ORDER_CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Reorder the lost reasons","tags":["Deal lost reasons"],"x-error-codes":["VALIDATION_FAILED","DEAL_LOST_REASON_ORDER_CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["deals:admin"]}},"/v1/deal-lost-reasons/{id}":{"patch":{"operationId":"DealLostReasons.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDealLostReasonV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealLostReasonV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Edit a lost reason (label, is_active)","tags":["Deal lost reasons"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED"],"x-required-scopes":["deals:admin"]},"delete":{"operationId":"DealLostReasons.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_LOST_REASON_IN_USE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DEAL_LOST_REASON_FIXED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a custom lost reason no deal uses","tags":["Deal lost reasons"],"x-error-codes":["NOT_FOUND","DEAL_LOST_REASON_FIXED","DEAL_LOST_REASON_IN_USE"],"x-required-scopes":["deals:admin"]}},"/v1/org-holidays":{"get":{"description":"Ordered by holiday_date. The first read of a year seeds that year's US federal holidays; a seeded year is never seeded again. Without `from_date`/`to_date`, the current year of the org time zone. A range may touch at most 10 years. `ids` returns those holidays regardless of `search` and the range.","operationId":"OrgHolidays.list","parameters":[{"name":"from_date","required":false,"in":"query","description":"First day of the range. Without `from_date` and `to_date`, the current year of the org time zone.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Last day of the range. A range may touch at most 10 calendar years.","schema":{"format":"date","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: holiday_date","schema":{"enum":["holiday_date"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OrgHolidayV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the org holidays","tags":["Org holidays"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["deals:read"]},"post":{"description":"Created with source `custom`. A taken day is a 409.","operationId":"OrgHolidays.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrgHolidayV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OrgHolidayV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ORG_HOLIDAY_DATE_TAKEN, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a custom holiday","tags":["Org holidays"],"x-error-codes":["VALIDATION_FAILED","ORG_HOLIDAY_DATE_TAKEN","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["deals:admin"]}},"/v1/org-holidays/{id}":{"patch":{"description":"Changes `name` and/or `holiday_date`; `source` is kept. Deal dates already computed do not move until the deal is recomputed.","operationId":"OrgHolidays.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOrgHolidayV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OrgHolidayV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ORG_HOLIDAY_DATE_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Rename or move a holiday","tags":["Org holidays"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","ORG_HOLIDAY_DATE_TAKEN"],"x-required-scopes":["deals:admin"]},"delete":{"description":"A deleted federal holiday stays deleted: its year is already seeded.","operationId":"OrgHolidays.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a holiday","tags":["Org holidays"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["deals:admin"]}},"/v1/audit-log":{"get":{"operationId":"AuditLog.list","parameters":[{"name":"from_date","required":false,"in":"query","description":"Inclusive lower bound on the audit entry creation date.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Inclusive upper bound on the audit entry creation date.","schema":{"format":"date","type":"string"}},{"name":"from","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `from_date` (inclusive lower bound on the audit entry creation date).","schema":{"format":"date","type":"string"}},{"name":"to","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `to_date` (inclusive upper bound on the audit entry creation date).","schema":{"format":"date","type":"string"}},{"name":"actor_principal_id","required":false,"in":"query","schema":{"type":"string"}},{"name":"actor_kind","required":false,"in":"query","schema":{"type":"string","enum":["user","api_key","sparkiq_internal"]}},{"name":"action","required":false,"in":"query","description":"Exact action match, e.g. documents.create","schema":{"type":"string"}},{"name":"resource_type","required":false,"in":"query","description":"Exact resource_type match, e.g. documents","schema":{"type":"string"}},{"name":"resource_id","required":false,"in":"query","description":"Exact resource_id (uuid) match — scopes to a single resource","schema":{"type":"string"}},{"name":"via_client","required":false,"in":"query","description":"Exact via_client match, e.g. mcp:Claude — the changes made through an AI connector client.","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AuditLogRowV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List audit log entries","tags":["Audit Log"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","FORBIDDEN"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["admin:audit"]}},"/v1/audit-log/facets":{"get":{"operationId":"AuditLog.facets","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AuditLogFacetsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Distinct audit-log filter values for the org","tags":["Audit Log"],"x-error-codes":["FORBIDDEN"],"x-required-scopes":["admin:audit"]}},"/v1/portal/me":{"get":{"description":"Investor-portal logins only. Returns the sponsor (with its portal slug and sign-in branding), the contacts this login acts as, and the other sponsors it can switch to, each with its slug, and whether to show the sponsor's terms (`terms`): show them, by calling `GET /v1/portal/terms` (which records the view), when `terms.terms_updated_at` is non-null and `terms.last_viewed_at` is null or earlier than it. This route itself never records a view. No financial data.","operationId":"Portal.me","parameters":[{"name":"X-Org-Id","in":"header","description":"Sponsor org to act in. Optional when the login has exactly one sponsor.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalMeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: PORTAL_ORG_CONTEXT_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"401":{"description":"Possible error codes: UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PORTAL_ACCESS_DENIED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PORTAL_AUTH_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Current portal login","tags":["Portal"],"x-error-codes":["UNAUTHORIZED","PORTAL_ACCESS_DENIED","PORTAL_ORG_CONTEXT_REQUIRED","PORTAL_AUTH_NOT_CONFIGURED"],"x-required-scopes":["portal:read"]}},"/v1/parties/{id}/portal-access":{"get":{"description":"Every login link on the party's contacts, in any status.","operationId":"Portal.listAccess","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PortalAccessV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List portal access on a party","tags":["Portal"],"x-error-codes":["NOT_FOUND","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"none","reason":"one login link per contact on one party, granted by hand","bound":"the party's contacts, a handful of people"},"x-required-scopes":["portal:manage"]},"post":{"description":"Creates or reuses the contact's one login link and emails them. Every grant issues an invited link, regardless of whether the person already has a portal login elsewhere — it activates on their first portal sign-in. Re-granting a pending link re-sends. An entity-restricted caller must be allowed every legal entity the party holds a position or ownership stake in, or is named in a portal package of, and the party must have at least one (403 LEGAL_ENTITY_NOT_IN_SCOPE otherwise, before anything is written or sent).","operationId":"Portal.grantAccess","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantPortalAccessV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalAccessV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PORTAL_GRANTS_DISABLED, INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, CONTACT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PORTAL_SCOPE_ENTITY_NOT_EXPOSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"502":{"description":"Possible error codes: ORG_USER_INVITE_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PORTAL_AUTH_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Grant a contact portal access","tags":["Portal"],"x-error-codes":["NOT_FOUND","CONTACT_NOT_FOUND","VALIDATION_FAILED","ORG_USER_INVITE_FAILED","PORTAL_GRANTS_DISABLED","PORTAL_AUTH_NOT_CONFIGURED","PORTAL_SCOPE_ENTITY_NOT_EXPOSED","CONFLICT","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-high-risk":true,"x-high-risk-reason":"Gives a contact access to the investor portal.","x-required-scopes":["portal:manage"]}},"/v1/parties/{id}/portal-access/exposure":{"get":{"description":"The legal entities this party is exposed to — equity positions in any status, ownership stakes direct and by look-through, and package statements in any status — for the entity-scope checklist shown when granting or editing portal access. The same list for every grant on this party; carries no ticked/in_scope flag, since that is a property of one grant, not the party (see GET /v1/parties/:id/portal-access, which carries each grant's own entity_scope_mode and legal_entity_ids). An entity-restricted caller must be allowed every legal entity the party is exposed to.","operationId":"Portal.listAccessExposure","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PortalAccessExposureV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a party's exposed legal entities","tags":["Portal"],"x-error-codes":["NOT_FOUND","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"none","reason":"the exposed-entity checklist for one party, a handful of entities","bound":"the party's exposure set"},"x-required-scopes":["portal:manage"]}},"/v1/parties/{id}/portal-access/{linkId}":{"patch":{"description":"Takes effect within about a minute on other servers. Omitting entity_scope_mode leaves the grant's stored entity scope unchanged; sending it replaces the scope (and its entity set) in the same request. An entity-restricted caller must be allowed every legal entity the party holds a position or ownership stake in, or is named in a portal package of, and the party must have at least one (403 LEGAL_ENTITY_NOT_IN_SCOPE otherwise).","operationId":"Portal.updateAccess","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"linkId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePortalAccessV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalAccessV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PORTAL_SCOPE_ENTITY_NOT_EXPOSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Change a contact's portal access role","tags":["Portal"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","PORTAL_SCOPE_ENTITY_NOT_EXPOSED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-high-risk":true,"x-high-risk-reason":"Changes a contact's investor portal role.","x-required-scopes":["portal:manage"]},"delete":{"description":"Idempotent. The person is locked out within about a minute (the auth cache TTL). The login itself is not deleted; it may belong to other sponsors. An entity-restricted caller must be allowed every legal entity the party holds a position or ownership stake in, or is named in a portal package of, and the party must have at least one (403 LEGAL_ENTITY_NOT_IN_SCOPE otherwise).","operationId":"Portal.revokeAccess","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"linkId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalAccessV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Revoke a contact's portal access","tags":["Portal"],"x-error-codes":["NOT_FOUND","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["portal:manage"]}},"/v1/org/portal-settings":{"get":{"description":"Whether the investor portal is enabled for this organization (switched only by Acreum staff), the statement cadence packages follow, the sponsor's portal slug and the investor terms. An org that was never enabled reads as `enabled: false`, cadence `quarterly`, `id: null`, slug and terms `null`. Also reports `grants_available`: whether this deployment can issue a portal login at all — true only when it both permits portal grants (`PORTAL_GRANTS_ENABLED`) and has portal auth configured. Offer an invite only when `enabled` and `grants_available` are both true; a grant attempted while `grants_available` is false is refused with 403 `PORTAL_GRANTS_DISABLED` or 503 `PORTAL_AUTH_NOT_CONFIGURED`.","operationId":"Portal.getSettings","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalSettingsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get the org's investor-portal settings","tags":["Portal"],"x-error-codes":["INSUFFICIENT_SCOPE"],"x-required-scopes":["portal:manage"]},"patch":{"description":"Sets any of `statement_cadence`, `portal_slug` and `terms_text`; at least one is required, and a field left out is unchanged. `statement_cadence` — `quarterly` (fiscal quarters) or `monthly` (fiscal months) — is the length of every package window drafted from now on. Packages already drafted keep their windows, and a new window that overlaps any existing package of the same legal entity is refused at draft (PORTAL_PACKAGE_EXISTS, naming the package). So after monthly → quarterly, a quarter in which monthly packages already exist cannot be drafted (discard those drafts first; a published month blocks that quarter for good), and after quarterly → monthly, no month inside an existing quarterly package can be drafted. `portal_slug` is the address of the sponsor's investor sign-in page: unique across organizations and not a reserved host name (else PORTAL_SLUG_UNAVAILABLE); `null` clears it, and a changed slug frees the old one at once, so old sign-in links stop working. `terms_text` is plain text shown to investors; `null` or blank text clears it, and `terms_updated_at` moves whenever the text changes. Never changes `enabled`, which only Acreum staff switch, nor `grants_available`, which is deployment configuration and is echoed back with the same value a GET would report.","operationId":"Portal.updateSettings","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePortalSettingsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalSettingsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PORTAL_SLUG_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update the org's investor-portal settings","tags":["Portal"],"x-error-codes":["VALIDATION_FAILED","INSUFFICIENT_SCOPE","PORTAL_SLUG_UNAVAILABLE"],"x-high-risk":true,"x-high-risk-reason":"Changes the org's investor portal settings.","x-required-scopes":["portal:manage"]}},"/v1/internal/portal/orgs/{orgId}/enable":{"post":{"description":"Staff only. Turns the org's portal switch on. Idempotent: an org already enabled keeps its original `enabled_at`. The cadence is untouched. Each legal entity must still be opted in by the sponsor before a package can be drafted for it. Also seeds the org's default publish-approval rule (one step, owner/admin, P19) the first time it is needed, and refuses with `APPROVAL_RULE_UNSATISFIABLE` if the org has no owner/admin member to seed it for.","operationId":"Portal.enableOrg","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalSettingsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: APPROVAL_RULE_UNSATISFIABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Enable the investor portal for an org","tags":["Portal"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","APPROVAL_RULE_UNSATISFIABLE"],"x-internal":true,"x-required-scopes":["admin:*"]}},"/v1/internal/portal/orgs/{orgId}/disable":{"post":{"description":"Staff only. Turns the org's portal switch off: no new package can be drafted. Existing packages and the cadence are kept. Idempotent.","operationId":"Portal.disableOrg","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalSettingsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Disable the investor portal for an org","tags":["Portal"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE"],"x-internal":true,"x-required-scopes":["admin:*"]}},"/v1/legal-entities/{id}/portal":{"get":{"description":"Whether this legal entity is opted in to the investor portal. An entity never opted in reads as `enabled: false`, `id: null`. Drafting a package also needs the org to be enabled (`GET /v1/org/portal-settings`). An unknown legal entity, or another organization's, is a 404. A caller who may not act on this legal entity (a member restricted to other entities, or a key bound to another) is refused 403 LEGAL_ENTITY_NOT_IN_SCOPE before any lookup, so for that caller an unknown entity is a 403 too.","operationId":"Portal.getEntity","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalEntityV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a legal entity's investor-portal opt-in","tags":["Portal"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["portal:manage"]},"put":{"description":"Replaces the opt-in state with `enabled`. Opting out keeps the record and every package already drafted, and stops new drafts; per the investor-portal reads spec O12, once the investor reads ship (reads-3a), opting out WILL remove everything of this entity (its published packages, positions, capital account, distributions and the entity itself) from every investor read, and the portal email job WILL send nothing for it, until it is opted back in. Nothing in this API enforces that yet. Nothing is deleted, and opting back in restores them. Idempotent: sending the current state changes nothing. Allowed while the org itself is not yet enabled.","operationId":"Portal.setEntity","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetPortalEntityV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalEntityV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Opt a legal entity in or out of the investor portal","tags":["Portal"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["portal:manage"]}},"/v1/legal-entities/{id}/portal/visible-through":{"get":{"description":"The last date this legal entity's books are closed through, contiguously from its ledger start, and what stops them reaching further: an open period, a month no period covers, or no periods at all. Computed on every call, never cached. A package window must end on or before `visible_through` and start on or after `anchor`. An unknown legal entity, or another organization's, is a 404. A caller who may not act on this legal entity (a member restricted to other entities, or a key bound to another) is refused 403 LEGAL_ENTITY_NOT_IN_SCOPE before any lookup, so for that caller an unknown entity is a 403 too.","operationId":"Portal.visibleThrough","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalVisibleThroughV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get how far the books are closed for the portal","tags":["Portal"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["portal:manage"]}},"/v1/legal-entities/{id}/portal/packages":{"get":{"description":"Every statement package for this legal entity, in any status, latest window first (a backfilled older window sorts by its window, not by when it was drafted). An unknown legal entity, or another organization's, is a 404. A caller who may not act on this legal entity (a member restricted to other entities, or a key bound to another) is refused 403 LEGAL_ENTITY_NOT_IN_SCOPE before any lookup, so for that caller an unknown entity is a 403 too.","operationId":"Portal.listPackages","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PortalPackageV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a legal entity's statement packages","tags":["Portal"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["portal:manage"]},"post":{"description":"Drafts the one package for the window that opens on `window_start` (a fiscal quarter or month, per the org's cadence). An unknown legal entity, or another organization's, is a 404. A caller who may not act on this legal entity (a member restricted to other entities, or a key bound to another) is refused 403 LEGAL_ENTITY_NOT_IN_SCOPE before any lookup, so for that caller an unknown entity is a 403 too. Refused unless the org and the legal entity are both enabled (PORTAL_NOT_ENABLED), the window lies inside the closed books — on or after `anchor` and on or before `visible_through` (PORTAL_PERIOD_NOT_CLOSED, naming what to close) — no package of this entity covers any day of it (PORTAL_PACKAGE_EXISTS, with `context.existing_package_id`, its window and its `period_label`), and someone would receive a statement (PORTAL_NO_AUDIENCE). Builds every recipient's statement at one instant, in one transaction: an equity entity gets a capital statement per position with a balance or activity in the window; otherwise each ultimate owner gets an income statement. An ownership-world draft is refused (CONFLICT) when ownership has never been materialized, or while this entity's ownership data is being rebuilt or its last rebuild failed — `context.reason` says which (`rebuild_in_progress`, `rebuild_pending`: retry shortly; `rebuild_failed`: re-run a full ownership rebuild for the entity, or the exact rebuild that failed, first). A capital history that cannot be folded fails the whole draft (EQUITY_CAPITAL_EVENT_UNFOLDABLE, 500); nothing is written.","operationId":"Portal.createPackage","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePortalPackageV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalPackageDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PORTAL_NOT_ENABLED, INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, EQUITY_POSITION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PORTAL_PACKAGE_EXISTS, CONFLICT, OWNERSHIP_CYCLE_DETECTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PORTAL_PERIOD_NOT_CLOSED, PORTAL_NO_AUDIENCE, OWNERSHIP_MAX_DEPTH, EQUITY_CAPITAL_STATEMENT_INPUT_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: EQUITY_CAPITAL_EVENT_UNFOLDABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Draft a statement package for a window","tags":["Portal"],"x-error-codes":["NOT_FOUND","PORTAL_NOT_ENABLED","PORTAL_PERIOD_NOT_CLOSED","PORTAL_PACKAGE_EXISTS","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE","PORTAL_NO_AUDIENCE","CONFLICT","OWNERSHIP_CYCLE_DETECTED","OWNERSHIP_MAX_DEPTH","EQUITY_CAPITAL_EVENT_UNFOLDABLE","EQUITY_CAPITAL_STATEMENT_INPUT_INVALID","EQUITY_POSITION_NOT_FOUND"],"x-required-scopes":["portal:manage"]}},"/v1/legal-entities/{id}/portal/packages/{packageId}":{"get":{"description":"The package with every recipient (one per statement; excluded parties stay listed with `excluded: true`), its shared documents and its exclusions. Statement contents are not inlined — preview as a recipient to read them. A package not under this legal entity is a 404.","operationId":"Portal.getPackage","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"packageId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalPackageDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a statement package","tags":["Portal"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["portal:manage"]},"delete":{"description":"Deletes a DRAFT package with its statements, documents, exclusions and previews. A package awaiting approval or published is PORTAL_PACKAGE_LOCKED.","operationId":"Portal.discardPackage","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"packageId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":"Discarded."},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PORTAL_PACKAGE_LOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Discard a draft package","tags":["Portal"],"x-error-codes":["PORTAL_PACKAGE_LOCKED","NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["portal:manage"]}},"/v1/legal-entities/{id}/portal/packages/{packageId}/refresh":{"post":{"description":"Re-resolves the audience and rebuilds every statement at a new instant, keeping the documents and exclusions. `package_sha256` changes whenever the content does, which makes earlier previews stale (an ownership refresh over unchanged data keeps it). Refused (CONFLICT) when the entity's world has changed since the draft — it gained or lost equity positions; discard and draft again — and for the same ownership-materialization and fold reasons as the draft. An exclusion whose party is no longer in the rebuilt audience is removed; if everyone the refresh resolves to is excluded it is refused (PORTAL_NO_AUDIENCE) and nothing changes. Draft only.","operationId":"Portal.refreshPackage","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"packageId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalPackageDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, EQUITY_POSITION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PORTAL_PACKAGE_LOCKED, CONFLICT, OWNERSHIP_CYCLE_DETECTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PORTAL_NO_AUDIENCE, OWNERSHIP_MAX_DEPTH, EQUITY_CAPITAL_STATEMENT_INPUT_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: EQUITY_CAPITAL_EVENT_UNFOLDABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Rebuild a draft package's statements","tags":["Portal"],"x-error-codes":["PORTAL_PACKAGE_LOCKED","NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE","PORTAL_NO_AUDIENCE","CONFLICT","OWNERSHIP_CYCLE_DETECTED","OWNERSHIP_MAX_DEPTH","EQUITY_CAPITAL_EVENT_UNFOLDABLE","EQUITY_CAPITAL_STATEMENT_INPUT_INVALID","EQUITY_POSITION_NOT_FOUND"],"x-required-scopes":["portal:manage"]}},"/v1/legal-entities/{id}/portal/packages/{packageId}/documents":{"post":{"description":"Adds one of this legal entity's files; every recipient receives it. Its name, type, size and SHA-256 are copied now. Another entity's file is ATTACHMENT_NOT_FOUND; the same file twice is CONFLICT. Changes `package_sha256`. Draft only.","operationId":"Portal.addDocument","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"packageId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddPortalPackageDocumentV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalPackageDocumentV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PORTAL_PACKAGE_LOCKED, CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a shared document to a draft package","tags":["Portal"],"x-error-codes":["PORTAL_PACKAGE_LOCKED","NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE","ATTACHMENT_NOT_FOUND","CONFLICT"],"x-required-scopes":["portal:manage"]}},"/v1/legal-entities/{id}/portal/packages/{packageId}/documents/{docId}":{"delete":{"description":"Removes the document from the package (the source file is untouched). A document not in this package is NOT_FOUND. Changes `package_sha256`. Draft only.","operationId":"Portal.removeDocument","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"packageId","required":true,"in":"path","schema":{"type":"string"}},{"name":"docId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":"Removed."},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PORTAL_PACKAGE_LOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Remove a document from a draft package","tags":["Portal"],"x-error-codes":["PORTAL_PACKAGE_LOCKED","NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["portal:manage"]}},"/v1/legal-entities/{id}/portal/packages/{packageId}/exclusions":{"post":{"description":"Withholds the package from one party, with a written reason. Their statement stays in the package; they just will not receive it. A party outside the audience is VALIDATION_FAILED; one already excluded is CONFLICT; excluding the last remaining recipient is PORTAL_NO_AUDIENCE. Changes `package_sha256`. Draft only.","operationId":"Portal.excludeHolder","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"packageId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExcludePortalHolderV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalPackageExclusionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PORTAL_PACKAGE_LOCKED, CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PORTAL_NO_AUDIENCE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Exclude a recipient from a draft package","tags":["Portal"],"x-error-codes":["PORTAL_PACKAGE_LOCKED","NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE","CONFLICT","PORTAL_NO_AUDIENCE"],"x-required-scopes":["portal:manage"]}},"/v1/legal-entities/{id}/portal/packages/{packageId}/exclusions/{partyId}":{"delete":{"description":"Removes the exclusion; the party receives the package again. A party not excluded is NOT_FOUND. Changes `package_sha256`. Draft only.","operationId":"Portal.includeHolder","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"packageId","required":true,"in":"path","schema":{"type":"string"}},{"name":"partyId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":"Re-included."},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PORTAL_PACKAGE_LOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Re-include an excluded recipient","tags":["Portal"],"x-error-codes":["PORTAL_PACKAGE_LOCKED","NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["portal:manage"]}},"/v1/legal-entities/{id}/portal/packages/{packageId}/readiness":{"get":{"description":"The six readiness checks, computed now and never stored: the window is inside the closed books (red), the package was previewed as it stands (red), equity ties to the general ledger (red; amber when it cannot be computed), no stale capital balances (red), owner distributions in the window are posted (amber), every recipient has an active portal contact (amber). Each names its blockers. `can_publish` is true when nothing is red; publishing past an amber needs a reason. The `previewed` check also names the last review — as whom, by whom, when, and whether it is still current (`data.last_review`, `PortalReadinessPreviewedDataV1Dto`). `approval_required` says whether publishing now, as the caller, would go to approval.","operationId":"Portal.readiness","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"packageId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalReadinessV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Check whether a package is ready to publish","tags":["Portal"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["portal:manage"]}},"/v1/legal-entities/{id}/portal/packages/{packageId}/previews":{"post":{"description":"Returns exactly what `party_id` would receive — their statements as stored, plus the shared documents — and records the preview at the package's current `package_sha256`, which is what readiness's `previewed` check looks for. A POST because it writes that record and an audit row. The party must be an INCLUDED recipient: one outside the audience or excluded is VALIDATION_FAILED. Allowed in any status.","operationId":"Portal.previewAs","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"packageId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewPortalPackageV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalPackagePreviewV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview a package as one recipient","tags":["Portal"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["portal:manage"]}},"/v1/legal-entities/{id}/portal/packages/{packageId}/statements/{partyId}":{"get":{"description":"Returns exactly what `partyId` would receive — their statements as stored, plus the shared documents — the body `Portal.previewAs` returns, without its preview record. Records nothing and writes no audit row: a review counts for readiness only when made with `POST …/previews`. The party must be an INCLUDED recipient: one outside the audience, or excluded, is NOT_FOUND, as is a package not under this legal entity. Allowed in any status.","operationId":"Portal.getStatements","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"packageId","required":true,"in":"path","schema":{"type":"string"}},{"name":"partyId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalPackageStatementsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Read one recipient's frozen statements","tags":["Portal"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["portal:manage"]}},"/v1/legal-entities/{id}/portal/packages/{packageId}/publish":{"post":{"description":"Asks to publish a DRAFT package to its recipients. Refused, in this order, with nothing written: a legal entity the caller may not act on — a member restricted to other entities, or a key bound to another (LEGAL_ENTITY_NOT_IN_SCOPE); a package not under this legal entity (NOT_FOUND); not a draft (PORTAL_PACKAGE_LOCKED); the org's or the entity's portal off (PORTAL_NOT_ENABLED); no included recipient (PORTAL_NO_AUDIENCE); statements built before the current statement shape (PORTAL_PACKAGE_STALE_SHAPE — refresh the draft); the books moved since the statements were built (PORTAL_BOOKS_CHANGED — refresh the draft); a red readiness check, or an amber one without a reason in `amber_reasons` (PORTAL_READINESS_FAILED, naming them). Then the approval rules decide: when a `portal_package` rule matches, an approval request opens and the package becomes `pending_approval`, locked until the request is decided (approving publishes it inside the approver's request; rejecting or withdrawing returns it to draft). The requester may never approve their own publish, so a rule whose steps no one else in the organization can satisfy is refused (PORTAL_PUBLISH_NO_OTHER_APPROVER). When no rule matches, the package publishes now: the window is re-checked against the closed books, each document is frozen into private storage and the package becomes `published` and immutable. A publish that fails (PORTAL_PERIOD_NOT_CLOSED, PORTAL_BOOKS_CHANGED, PORTAL_PUBLISH_DOCUMENT_MISMATCH, PORTAL_PUBLISH_SOURCE_MISSING, PORTAL_PUBLISH_STORAGE_FAILED) leaves the package in draft with `publish_failure_reason` recorded; the next request clears it. An organization enabled before approval rules existed gets its default rule (owners and admins approve) on its first request. Requires an `Idempotency-Key`.","operationId":"Portal.requestPublish","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"packageId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestPortalPublishV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalPackageDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PORTAL_NOT_ENABLED, INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PORTAL_PACKAGE_LOCKED, PORTAL_PACKAGE_STALE_SHAPE, PORTAL_BOOKS_CHANGED, PORTAL_PUBLISH_NO_OTHER_APPROVER, PORTAL_PUBLISH_DOCUMENT_MISMATCH, PORTAL_PUBLISH_SOURCE_MISSING, CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PORTAL_NO_AUDIENCE, PORTAL_READINESS_FAILED, PORTAL_PERIOD_NOT_CLOSED, APPROVAL_RULE_UNSATISFIABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PORTAL_PUBLISH_STORAGE_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Request publishing a draft package","tags":["Portal"],"x-error-codes":["NOT_FOUND","PORTAL_PACKAGE_LOCKED","PORTAL_NOT_ENABLED","PORTAL_NO_AUDIENCE","PORTAL_PACKAGE_STALE_SHAPE","PORTAL_BOOKS_CHANGED","PORTAL_READINESS_FAILED","PORTAL_PUBLISH_NO_OTHER_APPROVER","PORTAL_PERIOD_NOT_CLOSED","PORTAL_PUBLISH_DOCUMENT_MISMATCH","PORTAL_PUBLISH_SOURCE_MISSING","PORTAL_PUBLISH_STORAGE_FAILED","CONFLICT","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE","APPROVAL_RULE_UNSATISFIABLE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["portal:manage"]}},"/v1/legal-entities/{id}/portal/packages/{packageId}/publish/retry":{"post":{"description":"Recovers a package still `pending_approval` whose approval outcome never reached it. When its latest approval request was APPROVED, re-runs the publish. When it was REJECTED or WITHDRAWN, returns the package to draft instead (nothing is published; the response shows it in draft). Refused, with nothing written: a legal entity the caller may not act on — a member restricted to other entities, or a key bound to another (LEGAL_ENTITY_NOT_IN_SCOPE), checked first; a package not under this legal entity (NOT_FOUND); a draft, a published package, or one whose latest approval request is still pending (PORTAL_PUBLISH_NOT_RETRYABLE), nothing changed. The publish re-checks the window, the books and the statements exactly as on approval; a failure returns the package to draft with the reason recorded (request publishing again, which opens a new approval request). Safe to race the approval's own publish: the package publishes exactly once. Requires an `Idempotency-Key`.","operationId":"Portal.retryPublish","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"packageId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalPackageDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PORTAL_NOT_ENABLED, INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PORTAL_PACKAGE_LOCKED, PORTAL_PACKAGE_STALE_SHAPE, PORTAL_BOOKS_CHANGED, PORTAL_PUBLISH_NO_OTHER_APPROVER, PORTAL_PUBLISH_DOCUMENT_MISMATCH, PORTAL_PUBLISH_SOURCE_MISSING, CONFLICT, IDEMPOTENCY_CONFLICT, PORTAL_PUBLISH_NOT_RETRYABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PORTAL_NO_AUDIENCE, PORTAL_READINESS_FAILED, PORTAL_PERIOD_NOT_CLOSED, APPROVAL_RULE_UNSATISFIABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PORTAL_PUBLISH_STORAGE_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Retry a package stuck awaiting approval","tags":["Portal"],"x-error-codes":["NOT_FOUND","PORTAL_PACKAGE_LOCKED","PORTAL_NOT_ENABLED","PORTAL_NO_AUDIENCE","PORTAL_PACKAGE_STALE_SHAPE","PORTAL_BOOKS_CHANGED","PORTAL_READINESS_FAILED","PORTAL_PUBLISH_NO_OTHER_APPROVER","PORTAL_PERIOD_NOT_CLOSED","PORTAL_PUBLISH_DOCUMENT_MISMATCH","PORTAL_PUBLISH_SOURCE_MISSING","PORTAL_PUBLISH_STORAGE_FAILED","CONFLICT","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE","APPROVAL_RULE_UNSATISFIABLE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","PORTAL_PUBLISH_NOT_RETRYABLE"],"x-required-scopes":["portal:manage"]}},"/v1/org/portal-publish-runs":{"post":{"description":"Commits a selection of legal entities and a window_start, then fans out one durable job per entity (or waits for approval first, D2) that drafts, refreshes and evaluates each entity against the window before publishing it. window_start derives the full window the SAME way POST …/preflight does — never caller text for the end date — so the two can never disagree about which month or quarter is being published. Refused, in this order, with nothing written: the selection is empty or exceeds the cap (VALIDATION_FAILED), the investor portal is off for the org (PORTAL_NOT_ENABLED), a selected id is not this org's (VALIDATION_FAILED), the portal is off for one of the selected entities (PORTAL_NOT_ENABLED), or another run already holds the org's single active slot (PORTAL_PUBLISH_RUN_ALREADY_ACTIVE, naming it). When a portal_publish_run approval rule matches, the run starts pending that approval instead of fanning out immediately, and is refused outright when nobody else in the org could decide it (PORTAL_PUBLISH_NO_OTHER_APPROVER). This route derives the window TWICE — once to compute the window_end it hands to the create call, once again inside that call to verify it — so a cadence change landing in the instant between the two (VALIDATION_FAILED) is possible in principle though not reachable by any test here.","operationId":"Portal.createPublishRun","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePortalPublishRunV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalPublishRunV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PORTAL_NOT_ENABLED, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PORTAL_PUBLISH_RUN_ALREADY_ACTIVE, PORTAL_PUBLISH_NO_OTHER_APPROVER, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Start a bulk investor-portal publish run","tags":["Portal Publish Runs"],"x-error-codes":["VALIDATION_FAILED","PORTAL_NOT_ENABLED","PORTAL_PUBLISH_RUN_ALREADY_ACTIVE","PORTAL_PUBLISH_NO_OTHER_APPROVER","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["portal:manage"]},"get":{"description":"Newest first. `ids` returns exactly those rows and overrides `search`; `search` matches `status`, the only low-cardinality column a run has.","operationId":"Portal.listPublishRuns","parameters":[{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: status.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PortalPublishRunV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List bulk publish runs","tags":["Portal Publish Runs"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["portal:manage"]}},"/v1/org/portal-publish-runs/preflight":{"post":{"description":"A pure read — writes nothing, drafts no package, creates no run. window_start derives the window the IDENTICAL way POST …/publish-runs does (R37-carry): this route never takes a caller-supplied window end, so a preview and the run it previews can never describe different months or quarters. The result has THREE buckets, not two — clean (nothing stands in the way), exceptions (a named kind and count per known blocker: a readiness check key, window_mismatch, or the run-level shape guard), and not_yet_assessed (no package is drafted for this entity and window yet, so there is nothing to evaluate — this is the run's own job to draft and then evaluate; it is neither a pass nor a failure, and reading only clean and exceptions undercounts the real total). shape_guard_armed says whether the statement shape changed since the last run anyone actually created in this org — an informational signal to preview a sample before approving, independent of whether this particular preview would itself read the shape as changed. An existing draft package with every recipient excluded counts as clean here (it has no readiness check that answers 'no audience'); the run itself will except such an entity at publish time (PORTAL_NO_AUDIENCE) rather than publish to nobody — this preview and the run agree with each other, but an approver reading 'clean' should not assume every clean entity is guaranteed to publish.","operationId":"Portal.previewPublishRun","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreflightPortalPublishRunV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PreflightResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PORTAL_NOT_ENABLED, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview a bulk publish run before approving or creating one","tags":["Portal Publish Runs"],"x-error-codes":["VALIDATION_FAILED","PORTAL_NOT_ENABLED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["portal:manage"]}},"/v1/org/portal-publish-runs/{id}":{"get":{"description":"The run's own fields — its entity rows are a separate, paged endpoint (GET …/entities), since a run can select up to 500 of them. Another organization's run id answers 404, the same as an unknown one.","operationId":"Portal.getPublishRun","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalPublishRunV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: PORTAL_PUBLISH_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a bulk publish run","tags":["Portal Publish Runs"],"x-error-codes":["PORTAL_PUBLISH_RUN_NOT_FOUND"],"x-required-scopes":["portal:manage"]}},"/v1/org/portal-publish-runs/{id}/preflight":{"get":{"description":"The same three buckets as POST …/preflight, over the window and selection the RUN already owns rather than a caller-supplied body. Spec §6: the approver sees the preflight before deciding, which is what makes one click informed rather than a rubber stamp. It has to be read here because a run awaiting approval has assessed nothing — create validates the selection, derives the window and writes the rows, so every entity row is still result: null with no exception_kind, and the rows carry the entity list and nothing else. A pure read: writes nothing, drafts no package, changes no run. Another organization's run id answers 404, the same as an unknown one. Requires portal:manage — the same scope deciding a portal_publish_run request already requires, so any approver who can act on the run can read this.","operationId":"Portal.previewExistingPublishRun","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PreflightResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE, PORTAL_NOT_ENABLED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PORTAL_PUBLISH_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview an EXISTING run, for the approver deciding it","tags":["Portal Publish Runs"],"x-error-codes":["PORTAL_PUBLISH_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PORTAL_NOT_ENABLED"],"x-required-scopes":["portal:manage"]}},"/v1/org/portal-publish-runs/{id}/entities":{"get":{"description":"One page of the run's entity rows, in a stable but ARBITRARY order (`id`, a random uuid, not time-ordered — every child row of one run is inserted in a single statement, so nothing else distinguishes them either). `result` filters to one outcome (`published`, `excepted`, `failed`, `skipped`); omit it to see every entity, including still-pending ones (`result: null`). `ids` returns exactly those entity rows and overrides `search`; `search` matches `result`'s text.","operationId":"Portal.listPublishRunEntities","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"result","required":false,"in":"query","description":"Return only entities with this result. Omit for every entity (including still-pending ones, whose result is null and so never match any value here).","schema":{"type":"string","enum":["published","excepted","failed","skipped"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: id","schema":{"enum":["id"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: result.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PortalPublishRunEntityV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PORTAL_PUBLISH_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"A run's selected entities and their outcomes","tags":["Portal Publish Runs"],"x-error-codes":["PORTAL_PUBLISH_RUN_NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["portal:manage"]}},"/v1/org/portal-publish-runs/{id}/cancel":{"post":{"description":"Cooperative cancel: stamps cancel_requested_at, and the run comes back TERMINAL — status is set to 'cancelled' and finished_at is stamped in this same call, which is what releases the org's single active-run slot. Entities already mid-flight keep recording their own outcome; one about to publish checks the stamp immediately before that irreversible step and records itself skipped instead — cancel means \"stop starting new work\", never \"undo\". Cancelling a run that is already terminal (completed, cancelled or failed) is a NO-OP: it returns the run unchanged, rather than an error, because there is no work left to stop.","operationId":"Portal.cancelPublishRun","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalPublishRunV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: PORTAL_PUBLISH_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Cancel a bulk publish run","tags":["Portal Publish Runs"],"x-error-codes":["PORTAL_PUBLISH_RUN_NOT_FOUND"],"x-required-scopes":["portal:manage"]}},"/v1/org/portal-publish-runs/{id}/retry":{"post":{"description":"Reopens every entity whose result is 'excepted' or 'failed' for a fresh attempt (a fresh attempts counter too, so a retried entity gets this run's own ceiling rather than immediately re-failing on a stale count) and re-enqueues one job per reopened entity; the run returns to 'running'. Entities that already published or were skipped are left alone. Refused outright — never a silent no-op — when the run is still queued or running (PORTAL_PUBLISH_RUN_NOT_RETRYABLE, reason 'active': nothing final to re-run yet) or was cancelled (reason 'cancelled': a deliberate stop, never silently reversed — start a new run instead). A TERMINAL run with nothing to retry (every entity published or was skipped, or the run's own fan-out failed before any entity ever ran) is a NO-OP that returns the run unchanged, the same shape POST …/cancel already uses for an already-terminal run. Re-applies R18's portal-enabled gate to the entities being reopened — the investor portal switched off since the run was created (for the org, or for one of these entities) refuses the retry outright (PORTAL_NOT_ENABLED) rather than fanning out doomed jobs. Can itself answer PORTAL_PUBLISH_RUN_ALREADY_ACTIVE if another run has since taken the org's single active slot.","operationId":"Portal.retryPublishRun","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalPublishRunV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: PORTAL_NOT_ENABLED, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PORTAL_PUBLISH_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PORTAL_PUBLISH_RUN_NOT_RETRYABLE, PORTAL_PUBLISH_RUN_ALREADY_ACTIVE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Re-run a bulk publish run's exceptions and failures","tags":["Portal Publish Runs"],"x-error-codes":["PORTAL_PUBLISH_RUN_NOT_FOUND","PORTAL_PUBLISH_RUN_NOT_RETRYABLE","PORTAL_PUBLISH_RUN_ALREADY_ACTIVE","PORTAL_NOT_ENABLED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["portal:manage"]}},"/v1/org/portal-publish-runs/{id}/entities/{legalEntityId}/resolve":{"post":{"description":"The amber mechanism (R26): only applies to an entity whose result is 'excepted' (PORTAL_PUBLISH_RUN_ENTITY_NOT_EXCEPTED otherwise, naming its actual result — a 'failed' entity is retried, not resolved; one still pending has not been attempted yet). Exactly one of amber_reasons or exclude (VALIDATION_FAILED otherwise). amber_reasons stores the reason on the entity's drafted package — merged with any reason a prior resolve already recorded for a DIFFERENT amber key — so a LATER POST …/retry can publish past it; this call does not publish anything itself and the entity's result stays 'excepted' until retry re-attempts it and records a real outcome. exclude moves the entity's result straight to 'skipped' for good, so a later retry leaves it alone. Both answer PORTAL_PUBLISH_RUN_ENTITY_NOT_FOUND when the legal entity is not part of this run's selection; the amber path answers PORTAL_PUBLISH_RUN_ENTITY_NOT_EXCEPTED instead when the entity excepted before any package was drafted (nothing to attach a reason to) — a distinct `reason` on that same error, not a 404.","operationId":"Portal.resolvePublishRunEntity","parameters":[{"name":"id","required":true,"in":"path","description":"The bulk publish run id.","schema":{"format":"uuid","type":"string"}},{"name":"legalEntityId","required":true,"in":"path","description":"The legal entity id the run selected — NOT the entity row id `GET …/entities` returns as `id` (that row's own `legal_entity_id` field is this same value; its `id` will 404 here).","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolvePortalPublishRunEntityV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalPublishRunEntityV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PORTAL_PUBLISH_RUN_NOT_FOUND, PORTAL_PUBLISH_RUN_ENTITY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PORTAL_PUBLISH_RUN_ENTITY_NOT_EXCEPTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Resolve one excepted entity — an amber reason, or exclude it","tags":["Portal Publish Runs"],"x-error-codes":["VALIDATION_FAILED","PORTAL_PUBLISH_RUN_NOT_FOUND","PORTAL_PUBLISH_RUN_ENTITY_NOT_FOUND","PORTAL_PUBLISH_RUN_ENTITY_NOT_EXCEPTED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["portal:manage"]}},"/v1/public/portal-branding/{slug}":{"get":{"description":"Public, no credential. The display name, logo URL and two colours a sponsor's investor sign-in page themes itself with, by the sponsor's portal slug. Answers only when the slug exists and the sponsor's portal is switched on; every other case is the same PORTAL_BRANDING_NOT_FOUND. Never returns an org id: after sign-in the app takes the org from `GET /v1/portal/me`. Cached at the edge (`Cache-Control: public, max-age=60, s-maxage=300` on both answers), so a change shows within five minutes.","operationId":"Portal.publicBranding","parameters":[{"name":"slug","required":true,"in":"path","description":"The sponsor's portal slug; matched case-insensitively.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalBrandingV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: PORTAL_BRANDING_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"summary":"A sponsor's investor sign-in branding","tags":["Portal"],"x-error-codes":["PORTAL_BRANDING_NOT_FOUND"],"x-public":true}},"/v1/portal/terms":{"get":{"description":"Investor-portal logins only, any access role. The sponsor's plain-text terms, when they last changed, and when this login was last shown them (before this request). All null when the sponsor's portal is switched off. Each fetch of non-null terms is recorded as shown, with device and IP, without delaying the response.","operationId":"Portal.terms","parameters":[{"name":"X-Org-Id","in":"header","description":"Sponsor org to act in. Optional when the login has exactly one sponsor.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalTermsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: PORTAL_ORG_CONTEXT_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"401":{"description":"Possible error codes: UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PORTAL_ACCESS_DENIED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PORTAL_AUTH_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"The sponsor's investor terms","tags":["Portal"],"x-error-codes":["UNAUTHORIZED","PORTAL_ACCESS_DENIED","PORTAL_ORG_CONTEXT_REQUIRED","PORTAL_AUTH_NOT_CONFIGURED"],"x-required-scopes":["portal:read"]}},"/v1/portal/documents":{"get":{"description":"Investor-portal logins only, any access role. Documents of the published packages any of my parties receive, each listed once, latest period first. A party left out of a package does not see its documents. `party_id` must be a party this login acts for.","operationId":"Portal.listDocuments","parameters":[{"name":"party_id","required":false,"in":"query","description":"Only this party's documents. Must be a party this login acts for.","schema":{"format":"uuid","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"X-Org-Id","in":"header","description":"Sponsor org to act in. Optional when the login has exactly one sponsor.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PortalInvestorDocumentV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: PORTAL_ORG_CONTEXT_REQUIRED, INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"401":{"description":"Possible error codes: UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PORTAL_ACCESS_DENIED, PORTAL_ROLE_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PORTAL_PARTY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PORTAL_AUTH_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the documents published to me","tags":["Portal"],"x-error-codes":["UNAUTHORIZED","PORTAL_ACCESS_DENIED","PORTAL_ORG_CONTEXT_REQUIRED","PORTAL_AUTH_NOT_CONFIGURED","PORTAL_ROLE_FORBIDDEN","PORTAL_PARTY_NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["portal:read"]}},"/v1/portal/documents/{id}/download":{"get":{"description":"Investor-portal logins only, any access role. A link valid for 300 seconds that saves the file under its own name; this route never redirects. Each link issued is recorded as a download, with device and IP, without delaying the response.","operationId":"Portal.documentDownload","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"X-Org-Id","in":"header","description":"Sponsor org to act in. Optional when the login has exactly one sponsor.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalInvestorDocumentDownloadV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: PORTAL_ORG_CONTEXT_REQUIRED, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"401":{"description":"Possible error codes: UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PORTAL_ACCESS_DENIED, PORTAL_ROLE_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PORTAL_DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PORTAL_AUTH_NOT_CONFIGURED, PORTAL_DOCUMENT_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a download link for a document","tags":["Portal"],"x-error-codes":["UNAUTHORIZED","PORTAL_ACCESS_DENIED","PORTAL_ORG_CONTEXT_REQUIRED","PORTAL_AUTH_NOT_CONFIGURED","PORTAL_ROLE_FORBIDDEN","PORTAL_DOCUMENT_NOT_FOUND","PORTAL_DOCUMENT_UNAVAILABLE","VALIDATION_FAILED"],"x-required-scopes":["portal:read"]}},"/v1/portal/statements":{"get":{"description":"Investor-portal logins only, any access role. Every published statement of my parties, latest period first. Statements are frozen when published and never change. Filter by kind, party (one this login acts for), entity, position, or the window's last day (`from_date`/`to_date`).","operationId":"Portal.listStatements","parameters":[{"name":"kind","required":false,"in":"query","schema":{"type":"string","enum":["capital_statement","income_statement"]}},{"name":"party_id","required":false,"in":"query","description":"Must be a party this login acts for.","schema":{"format":"uuid","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"position_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"from_date","required":false,"in":"query","description":"Inclusive lower bound on the window's last day.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Inclusive upper bound on the window's last day.","schema":{"format":"date","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"X-Org-Id","in":"header","description":"Sponsor org to act in. Optional when the login has exactly one sponsor.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PortalInvestorStatementListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: PORTAL_ORG_CONTEXT_REQUIRED, INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"401":{"description":"Possible error codes: UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PORTAL_ACCESS_DENIED, PORTAL_ROLE_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PORTAL_PARTY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PORTAL_SNAPSHOT_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PORTAL_AUTH_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List my published statements","tags":["Portal"],"x-error-codes":["UNAUTHORIZED","PORTAL_ACCESS_DENIED","PORTAL_ORG_CONTEXT_REQUIRED","PORTAL_AUTH_NOT_CONFIGURED","PORTAL_ROLE_FORBIDDEN","PORTAL_PARTY_NOT_FOUND","INVALID_CURSOR","PORTAL_SNAPSHOT_INVALID","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["portal:read"]}},"/v1/portal/statements/{id}":{"get":{"description":"Investor-portal logins only, any access role. The statement as published: a capital statement's three columns (period, fiscal year to date, inception to date) with the period column's trace, or an income statement's monthly rows; the holder's frozen ownership percentage and notes; the entity's `visible_through`; and the package's documents. Each read is recorded, with device and IP, without delaying the response.","operationId":"Portal.getStatement","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"X-Org-Id","in":"header","description":"Sponsor org to act in. Optional when the login has exactly one sponsor.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalInvestorStatementV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: PORTAL_ORG_CONTEXT_REQUIRED, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"401":{"description":"Possible error codes: UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PORTAL_ACCESS_DENIED, PORTAL_ROLE_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PORTAL_STATEMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PORTAL_SNAPSHOT_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PORTAL_AUTH_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get one of my published statements","tags":["Portal"],"x-error-codes":["UNAUTHORIZED","PORTAL_ACCESS_DENIED","PORTAL_ORG_CONTEXT_REQUIRED","PORTAL_AUTH_NOT_CONFIGURED","PORTAL_ROLE_FORBIDDEN","PORTAL_STATEMENT_NOT_FOUND","PORTAL_SNAPSHOT_INVALID","VALIDATION_FAILED"],"x-required-scopes":["portal:read"]}},"/v1/portal/positions":{"get":{"description":"Investor-portal logins with primary or advisor access only. One row per equity position and per ownership interest that has a published statement, with the figures of its latest published statement (never a live balance) and the entity's `visible_through`. Parties where this login is a viewer are left out; asking for only such parties is `PORTAL_ROLE_FORBIDDEN`.","operationId":"Portal.positions","parameters":[{"name":"party_id","required":false,"in":"query","description":"Must be a party this login acts for, with primary or advisor access.","schema":{"format":"uuid","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"X-Org-Id","in":"header","description":"Sponsor org to act in. Optional when the login has exactly one sponsor.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PortalInvestorPositionV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: PORTAL_ORG_CONTEXT_REQUIRED, INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"401":{"description":"Possible error codes: UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PORTAL_ACCESS_DENIED, PORTAL_ROLE_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PORTAL_PARTY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PORTAL_SNAPSHOT_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PORTAL_AUTH_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List my positions","tags":["Portal"],"x-error-codes":["UNAUTHORIZED","PORTAL_ACCESS_DENIED","PORTAL_ORG_CONTEXT_REQUIRED","PORTAL_AUTH_NOT_CONFIGURED","PORTAL_ROLE_FORBIDDEN","PORTAL_PARTY_NOT_FOUND","PORTAL_SNAPSHOT_INVALID","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["portal:read"]}},"/v1/portal/positions/{id}/capital-account":{"get":{"description":"Investor-portal logins only, any access role. The published capital statement of this position whose window contains `as_of` (default today), else the latest one ending before it — never later than the entity's `visible_through` or the position's latest published window, whichever is later; `clamped` says when the date was moved. Same body as `Portal.getStatement`. Each read is recorded, with device and IP, without delaying the response.","operationId":"Portal.capitalAccount","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"as_of","required":false,"in":"query","description":"Serve the published statement whose window contains this date, else the latest one ending before it. Omit for today.","schema":{"format":"date","type":"string"}},{"name":"X-Org-Id","in":"header","description":"Sponsor org to act in. Optional when the login has exactly one sponsor.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortalInvestorCapitalAccountV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: PORTAL_ORG_CONTEXT_REQUIRED, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"401":{"description":"Possible error codes: UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PORTAL_ACCESS_DENIED, PORTAL_ROLE_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PORTAL_POSITION_NOT_FOUND, PORTAL_NO_PUBLISHED_STATEMENT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PORTAL_SNAPSHOT_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PORTAL_AUTH_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get my capital account as of a date","tags":["Portal"],"x-error-codes":["UNAUTHORIZED","PORTAL_ACCESS_DENIED","PORTAL_ORG_CONTEXT_REQUIRED","PORTAL_AUTH_NOT_CONFIGURED","PORTAL_ROLE_FORBIDDEN","PORTAL_POSITION_NOT_FOUND","PORTAL_NO_PUBLISHED_STATEMENT","PORTAL_SNAPSHOT_INVALID","VALIDATION_FAILED"],"x-required-scopes":["portal:read"]}},"/v1/reports/pl":{"get":{"operationId":"Reports.pl","parameters":[{"name":"from_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"search","required":false,"in":"query","schema":{"type":"string"}},{"name":"pivot_by","required":false,"in":"query","description":"Tagged pivot axis. Use `dimension:<uuid>` for a user-defined dimension or `system:<key>` for a built-in axis (e.g. `system:legal_entity`, `system:month`, `system:party`). When set, the response includes `pivot_axis` plus `totals_by_column` on each group and account.","schema":{"pattern":"^(dimension|system):[A-Za-z0-9_-]+$","example":"system:legal_entity","type":"string"}},{"name":"basis","required":false,"in":"query","description":"Reporting basis (default accrual)","schema":{"type":"string","enum":["accrual","cash"]}},{"name":"consolidation_group_id","required":false,"in":"query","description":"Report the group's member legal entities together: with intercompany eliminations for a group whose `consolidation_basis` is 'consolidated', as a plain sum for a 'combined' one. Mutually exclusive with legal_entity_id and pivot_by.","schema":{"format":"uuid","type":"string"}},{"name":"compare","required":false,"in":"query","description":"When `budget`, each account/group node carries `budget`/`variance`/`variance_pct` sourced from the org's active budget version for the report's period. Defaults to `none` (no budget/variance fields).","schema":{"type":"string","enum":["none","budget"]}},{"name":"property_id","required":false,"in":"query","description":"Restrict the budget comparison to a single property — both the actuals (journal lines tagged with it) and the budget it is compared against. Only meaningful together with `compare=budget`. Mutually exclusive with `space_id`.","schema":{"format":"uuid","type":"string"}},{"name":"space_id","required":false,"in":"query","description":"Restrict the budget comparison to a single space. Scopes the ACTUALS only: budget lines are property-only (`budget_lines.property_id`), so there is no space-level budget to compare against and every account carries the property-less budget for the request. Only meaningful together with `compare=budget`. Mutually exclusive with `property_id`.","schema":{"format":"uuid","type":"string"}},{"name":"ownership_kind","required":false,"in":"query","description":"Which legal entities the org-wide aggregate covers. Defaults to 'owned' — managed (externally-owned, fee-managed) entities are opt-in, same contract as GET /v1/legal-entities. Ignored when legal_entity_id or consolidation_group_id names the entities explicitly.","schema":{"type":"string","enum":["owned","managed","all"]}},{"name":"filter","required":false,"in":"query","description":"Report axis filter, repeatable: `filter=<op>:<axis>[:<value>]`, e.g. `filter=is:dimension:<uuid>:<value>` or `filter=empty:system:party`. Operators: `is` (value in the set), `is_not` (value not in the set; lines with no value are KEPT), `empty` and `not_empty` (no value). `<axis>` is a `pivot_by` wire key (`dimension:<uuid>` or `system:<key>`); the value is everything after the third colon. Several `is` (or `is_not`) on one axis form one set; different conditions are ANDed. At most 50 `filter` params. `system:month` is not filterable, and `filter` cannot be combined with `consolidation_group_id` (400 `REPORT_FILTER_INVALID`). An unknown axis is 422 `REPORT_FILTER_AXIS_UNKNOWN`. Recognition lines without a source line count as unassigned.","schema":{"example":["is:system:party:<uuid>","empty:dimension:<uuid>"],"type":"array","items":{"type":"string"}}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PlReportV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, REPORT_FILTER_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ENTITY_GROUP_WRONG_TYPE, REPORT_FILTER_AXIS_UNKNOWN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Profit & Loss report","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","NOT_FOUND","ENTITY_GROUP_WRONG_TYPE","REPORT_FILTER_INVALID","REPORT_FILTER_AXIS_UNKNOWN"],"x-required-scopes":["reports:read"]}},"/v1/reports/pivot-axes":{"get":{"description":"Returns the union of built-in (`system:*`) and user-defined (`dimension:<uuid>`) pivot axes. Pass any `wire_key` verbatim as the `pivot_by` query param. The P&L (`/v1/reports/pl`) serves every axis; the Balance Sheet (`/v1/reports/balance-sheet`) serves `system:legal_entity` and `system:month`.","operationId":"Reports.pivotAxes","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PivotAxesV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List pivot axes available to the current org","tags":["Reports"],"x-required-scopes":["reports:read"]}},"/v1/reports/axis-values":{"get":{"description":"Returns the distinct values a text, number, date or boolean dimension takes on the accrual ledger lines the P&L reads (no cash recognition rows), within the given window and entity scope, so a report filter can offer them. Scoped exactly like `/v1/reports/pl`: role allow-list applies and the org-wide default is 'owned' entities. Axes with a catalog (system axes, entity and dropdown dimensions) are refused with `REPORT_FILTER_INVALID` (`axis_has_catalog`).","operationId":"Reports.axisValues","parameters":[{"name":"axis","required":true,"in":"query","description":"Wire key of a catalog-less axis: `dimension:<uuid>` of a text, number, date or boolean dimension.","schema":{"example":"dimension:7c1f0a52-3d1e-4c6b-9a43-0e5d6f1b2a10","type":"string"}},{"name":"from_date","required":false,"in":"query","description":"Start of the window (inclusive). When both `from_date` and `to_date` are omitted the window defaults to the org fiscal year containing today in the org time zone.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"End of the window (inclusive). When both `from_date` and `to_date` are omitted the window defaults to the org fiscal year containing today in the org time zone.","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"ownership_kind","required":false,"in":"query","description":"Which legal entities are covered. Defaults to 'owned', like the P&L. Ignored when legal_entity_id names an entity.","schema":{"type":"string","enum":["owned","managed","all"]}},{"name":"search","required":false,"in":"query","description":"Case-insensitive contains on the value. Empty is ignored.","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Maximum number of values returned.","schema":{"minimum":1,"maximum":200,"default":50,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReportAxisValuesV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, REPORT_FILTER_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: REPORT_FILTER_AXIS_UNKNOWN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the values used on a catalog-less report axis","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","REPORT_FILTER_INVALID","REPORT_FILTER_AXIS_UNKNOWN"],"x-required-scopes":["reports:read"]}},"/v1/reports/balance-sheet":{"get":{"operationId":"Reports.balanceSheet","parameters":[{"name":"as_of_date","required":true,"in":"query","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"pivot_by","required":false,"in":"query","description":"Pivot the balance sheet into columns, each a balance sheet of its own. Supported: `system:legal_entity` (one column per entity) and `system:month` (month-end balances from the fiscal-year start through the as-of month). Other axes are refused: they do not balance per column.","schema":{"pattern":"^(dimension|system):[A-Za-z0-9_-]+$","example":"system:legal_entity","type":"string"}},{"name":"basis","required":false,"in":"query","description":"Reporting basis (default accrual)","schema":{"type":"string","enum":["accrual","cash"]}},{"name":"consolidation_group_id","required":false,"in":"query","description":"Report the group's member legal entities together: with intercompany eliminations for a group whose `consolidation_basis` is 'consolidated', as a plain sum for a 'combined' one. Mutually exclusive with legal_entity_id.","schema":{"format":"uuid","type":"string"}},{"name":"ownership_kind","required":false,"in":"query","description":"Which legal entities the org-wide aggregate covers. Defaults to 'owned' — managed (externally-owned, fee-managed) entities are opt-in, same contract as GET /v1/legal-entities. Ignored when legal_entity_id or consolidation_group_id names the entities explicitly.","schema":{"type":"string","enum":["owned","managed","all"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BalanceSheetV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, BALANCE_SHEET_PIVOT_AXIS_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ENTITY_GROUP_WRONG_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Balance Sheet report","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","NOT_FOUND","BALANCE_SHEET_PIVOT_AXIS_UNSUPPORTED","ENTITY_GROUP_WRONG_TYPE"],"x-required-scopes":["reports:read"]}},"/v1/reports/trial-balance":{"get":{"description":"Every account with its opening balance, debits, credits and ending balance for a window, and the proof that the ledger balances. Balances are debit-positive. Income and expense accounts open at the fiscal-year start; earlier years land on retained earnings, per entity. Accrual basis. Drill any row with GET /v1/reports/trial-balance/lines.","operationId":"Reports.trialBalance","parameters":[{"name":"mode","required":true,"in":"query","description":"`as_of`: fiscal-year-to-date through `as_of_date`. `period`: `from_date`..`to_date`, inside one fiscal year.","schema":{"type":"string","enum":["as_of","period"]}},{"name":"as_of_date","required":false,"in":"query","description":"Required with mode=as_of; not allowed with mode=period.","schema":{"format":"date","type":"string"}},{"name":"from_date","required":false,"in":"query","description":"Required with mode=period; not allowed with mode=as_of.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Required with mode=period; not allowed with mode=as_of.","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Legal entities to combine. Repeat or comma-separate. Omit for every entity the caller can read.","schema":{"type":"array","items":{"type":"string","format":"uuid"}}},{"name":"ownership_kind","required":false,"in":"query","description":"Which legal entities the all-entities view covers. Defaults to 'owned', as on the balance sheet. Ignored when legal_entity_id names the entities.","schema":{"type":"string","enum":["owned","managed","all"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TrialBalanceV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: TRIAL_BALANCE_PERIOD_SPANS_FISCAL_YEARS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Trial Balance report","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","TRIAL_BALANCE_PERIOD_SPANS_FISCAL_YEARS"],"x-required-scopes":["reports:read"]}},"/v1/reports/trial-balance/lines":{"get":{"description":"The journal lines behind one trial balance row (and its descendants by default), oldest first, with a running balance that starts at meta.opening and ends at meta.ending. Same window and scope parameters as GET /v1/reports/trial-balance.","operationId":"Reports.trialBalanceLines","parameters":[{"name":"mode","required":true,"in":"query","description":"`as_of`: fiscal-year-to-date through `as_of_date`. `period`: `from_date`..`to_date`, inside one fiscal year.","schema":{"type":"string","enum":["as_of","period"]}},{"name":"as_of_date","required":false,"in":"query","description":"Required with mode=as_of; not allowed with mode=period.","schema":{"format":"date","type":"string"}},{"name":"from_date","required":false,"in":"query","description":"Required with mode=period; not allowed with mode=as_of.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Required with mode=period; not allowed with mode=as_of.","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Legal entities to combine. Repeat or comma-separate. Omit for every entity the caller can read.","schema":{"type":"array","items":{"type":"string","format":"uuid"}}},{"name":"ownership_kind","required":false,"in":"query","description":"Which legal entities the all-entities view covers. Defaults to 'owned', as on the balance sheet. Ignored when legal_entity_id names the entities.","schema":{"type":"string","enum":["owned","managed","all"]}},{"name":"account_id","required":true,"in":"query","description":"The account to drill.","schema":{"format":"uuid","type":"string"}},{"name":"include_descendants","required":false,"in":"query","description":"Include every descendant of the account (default true).","schema":{"default":true,"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TrialBalanceLineV1Dto"}},"meta":{"$ref":"#/components/schemas/TrialBalanceLinesMetaV1Dto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: TRIAL_BALANCE_PERIOD_SPANS_FISCAL_YEARS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Trial Balance lines (drill-down)","tags":["Reports"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","TRIAL_BALANCE_PERIOD_SPANS_FISCAL_YEARS"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["reports:read"]}},"/v1/reports/cash-flow":{"get":{"operationId":"Reports.cashFlow","parameters":[{"name":"from_date","required":true,"in":"query","schema":{"format":"date","type":"string"}},{"name":"to_date","required":true,"in":"query","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"consolidation_group_id","required":false,"in":"query","description":"Consolidate the group members. Mutually exclusive with legal_entity_id.","schema":{"format":"uuid","type":"string"}},{"name":"pivot_by","required":false,"in":"query","description":"Pivot axis key, e.g. system:legal_entity or dimension:<uuid>. Groups flows into columns.","schema":{"type":"string"}},{"name":"search","required":false,"in":"query","description":"Free-text filter over the non-cash account code/name and journal line description of each activity line. Narrows only the activity lines shown — the reconciliation totals (beginning/net_change/ending cash) are NOT filtered, mirroring the P&L search behavior.","schema":{"type":"string"}},{"name":"ownership_kind","required":false,"in":"query","description":"Which legal entities the org-wide aggregate covers. Defaults to 'owned' — managed (externally-owned, fee-managed) entities are opt-in, same contract as GET /v1/legal-entities. Ignored when legal_entity_id or consolidation_group_id names the entities explicitly.","schema":{"type":"string","enum":["owned","managed","all"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CashFlowV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ENTITY_GROUP_WRONG_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Cash Flow report","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","NOT_FOUND","ENTITY_GROUP_WRONG_TYPE"],"x-required-scopes":["reports:read"]}},"/v1/reports/beneficial-owner-income":{"get":{"operationId":"Reports.beneficialOwnerIncome","parameters":[{"name":"from_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"party_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BeneficialOwnerIncomeReportV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Beneficial-owner income allocation report","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["reports:read"]}},"/v1/reports/investor-statement":{"get":{"operationId":"Reports.investorStatement","parameters":[{"name":"owner_party_id","required":true,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"from_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InvestorStatementV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Investor statement: P&L share, cash distributed, balance due","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["reports:read"]}},"/v1/reports/rent-roll":{"get":{"operationId":"Reports.rentRoll","parameters":[{"name":"as_of_date","required":false,"in":"query","description":"Rent-roll as-of date. Defaults to today.","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Mutually exclusive with consolidation_group_id.","schema":{"format":"uuid","type":"string"}},{"name":"consolidation_group_id","required":false,"in":"query","description":"Consolidate the group's member legal entities. Mutually exclusive with legal_entity_id.","schema":{"format":"uuid","type":"string"}},{"name":"property_id","required":false,"in":"query","description":"Scope to one property subtree.","schema":{"format":"uuid","type":"string"}},{"name":"include_vacant","required":false,"in":"query","description":"Include vacant-space rows (default true).","schema":{"default":true,"type":"boolean"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RentRollV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ENTITY_GROUP_WRONG_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Rent roll as of a date","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","NOT_FOUND","ENTITY_GROUP_WRONG_TYPE"],"x-required-scopes":["reports:read"]}},"/v1/reports/portfolio-summary":{"get":{"description":"Occupancy, WALT, scheduled rent and 12-month expiry for the properties matching the same filters as `GET /v1/properties`, plus the property count. Returns the identical summary object `GET /v1/reports/rent-roll` carries, without the lease and vacancy rows. Defaults to the org's current day.","operationId":"Reports.portfolioSummary","parameters":[{"name":"as_of_date","required":false,"in":"query","description":"Portfolio as-of date. Defaults to the org's current day.","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["active","inactive","archived"]}},{"name":"property_type","required":false,"in":"query","schema":{"type":"string","enum":["office","retail","industrial","multifamily","land","mixed_use","other"]}},{"name":"is_leasable","required":false,"in":"query","description":"Restrict to properties that can be rented whole.","schema":{"type":"boolean"}},{"name":"search","required":false,"in":"query","description":"Substring match on code or name.","schema":{"type":"string"}},{"name":"ownership_kind","required":false,"in":"query","description":"Matches the list default. `owned` keeps properties with no legal entity visible — those are the customer's own, not managed.","schema":{"default":"owned","type":"string","enum":["owned","managed","all"]}},{"name":"attribute_filters","required":false,"in":"query","description":"Caller-defined attribute equality filters, validated against the built-in property attribute schema. Max 16 keys.","schema":{"example":"{\"country\":\"US\"}","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PortfolioSummaryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Portfolio KPI summary","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["properties:read","reports:read"]}},"/v1/reports/lease-expirations":{"get":{"operationId":"Reports.leaseExpirations","parameters":[{"name":"as_of_date","required":false,"in":"query","description":"Lease-expirations as-of date. Defaults to today.","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Mutually exclusive with consolidation_group_id.","schema":{"format":"uuid","type":"string"}},{"name":"consolidation_group_id","required":false,"in":"query","description":"Consolidate the group's member legal entities. Mutually exclusive with legal_entity_id.","schema":{"format":"uuid","type":"string"}},{"name":"property_id","required":false,"in":"query","description":"Scope to one property subtree.","schema":{"format":"uuid","type":"string"}},{"name":"bucket","required":false,"in":"query","schema":{"default":"year","type":"string","enum":["year","quarter"]}},{"name":"horizon_years","required":false,"in":"query","description":"Years of horizon before an expiry rolls into the trailing \"Thereafter\" bucket.","schema":{"minimum":1,"maximum":15,"default":10,"type":"number"}},{"name":"assume_options","required":false,"in":"query","description":"`committed` uses each lease's contractual end date; `all_options` extends a lease through the max end date of its available (not yet exercised) option periods.","schema":{"default":"committed","type":"string","enum":["committed","all_options"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LeaseExpirationsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ENTITY_GROUP_WRONG_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Lease expiration schedule buckets","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","NOT_FOUND","ENTITY_GROUP_WRONG_TYPE"],"x-required-scopes":["reports:read"]}},"/v1/reports/stacking-plan":{"get":{"operationId":"Reports.stackingPlan","parameters":[{"name":"property_id","required":true,"in":"query","description":"The property to render a stacking plan for.","schema":{"format":"uuid","type":"string"}},{"name":"as_of_date","required":false,"in":"query","description":"Stacking-plan as-of date. Defaults to today.","schema":{"format":"date","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StackingPlanV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ENTITY_GROUP_WRONG_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Stacking plan for one property","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","NOT_FOUND","ENTITY_GROUP_WRONG_TYPE"],"x-required-scopes":["reports:read"]}},"/v1/reports/leasing-snapshots":{"get":{"operationId":"Reports.listLeasingSnapshots","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LeasingSnapshotListV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List frozen leasing snapshots","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED"],"x-required-scopes":["reports:read"]},"post":{"operationId":"Reports.freezeLeasingSnapshot","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreezeLeasingSnapshotBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FreezeLeasingSnapshotResultDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LEASING_SNAPSHOT_ALREADY_FROZEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Freeze the leasing snapshot for a month","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","LEASING_SNAPSHOT_ALREADY_FROZEN"],"x-required-scopes":["reports:write"]}},"/v1/reports/leasing-snapshots/{period_month}":{"get":{"operationId":"Reports.getLeasingSnapshot","parameters":[{"name":"period_month","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LeasingSnapshotV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get one frozen leasing snapshot","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND"],"x-required-scopes":["reports:read"]}},"/v1/reports/occupancy-trend":{"get":{"operationId":"Reports.occupancyTrend","parameters":[{"name":"from_date","required":true,"in":"query","schema":{"format":"date","example":"2026-01-01","type":"string"}},{"name":"to_date","required":true,"in":"query","schema":{"format":"date","example":"2026-08-31","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OccupancyTrendV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Monthly occupancy trend, snapshot-first with reconstruction","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED"],"x-required-scopes":["reports:read"]}},"/v1/reports/aging":{"get":{"operationId":"Reports.apArAging","parameters":[{"name":"side","required":true,"in":"query","description":"Payables (ap) or receivables (ar).","schema":{"type":"string","enum":["ap","ar"]}},{"name":"as_of_date","required":false,"in":"query","description":"Aging as-of date. Defaults to today.","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Mutually exclusive with consolidation_group_id.","schema":{"format":"uuid","type":"string"}},{"name":"consolidation_group_id","required":false,"in":"query","description":"Consolidate the group's member legal entities. Mutually exclusive with legal_entity_id.","schema":{"format":"uuid","type":"string"}},{"name":"party_ids","required":false,"in":"query","description":"Comma-separated party ids. Narrows to these parties only.","schema":{"type":"array","items":{"type":"string"}}},{"name":"bucket","required":false,"in":"query","description":"Narrows the report to a single aging bucket.","schema":{"type":"string","enum":["current","b1_30","b31_60","b61_90","b91_plus"]}},{"name":"property_id","required":false,"in":"query","description":"Scope to one property, matched exactly (no descendant expansion) on either the document header or a document line dimension.","schema":{"format":"uuid","type":"string"}},{"name":"ownership_kind","required":false,"in":"query","description":"Which legal entities the org-wide aggregate covers. Defaults to 'owned' — managed (externally-owned, fee-managed) entities are opt-in, same contract as GET /v1/legal-entities. Ignored when legal_entity_id or consolidation_group_id names the entities explicitly.","schema":{"type":"string","enum":["owned","managed","all"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApArAgingV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ENTITY_GROUP_WRONG_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"AP/AR aging as of a date","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","NOT_FOUND","ENTITY_GROUP_WRONG_TYPE"],"x-required-scopes":["reports:read"]}},"/v1/reports/statements":{"get":{"description":"The open documents a vendor (side=ap) or customer (side=ar) still has with the org as of a date, grouped by party and then by legal entity, each document carrying its original, applied and open amounts. Omitting party_ids returns every party holding an open balance.","operationId":"Reports.partyStatement","parameters":[{"name":"side","required":true,"in":"query","description":"Vendor statements (ap) or customer statements (ar).","schema":{"type":"string","enum":["ap","ar"]}},{"name":"as_of_date","required":false,"in":"query","description":"Statement as-of date. Defaults to today.","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Mutually exclusive with consolidation_group_id.","schema":{"format":"uuid","type":"string"}},{"name":"consolidation_group_id","required":false,"in":"query","description":"Consolidate the group's member legal entities. Mutually exclusive with legal_entity_id.","schema":{"format":"uuid","type":"string"}},{"name":"party_ids","required":false,"in":"query","description":"Comma-separated party ids. Omitted means every party holding an open balance — the month-end run. One id is the single-counterparty statement.","schema":{"type":"array","items":{"type":"string"}}},{"name":"property_id","required":false,"in":"query","description":"Scope to one property, matched exactly (no descendant expansion) on either the document header or a document line dimension.","schema":{"format":"uuid","type":"string"}},{"name":"ownership_kind","required":false,"in":"query","description":"Which legal entities the org-wide aggregate covers. Defaults to 'owned' — managed (externally-owned, fee-managed) entities are opt-in, same contract as GET /v1/legal-entities. Ignored when legal_entity_id or consolidation_group_id names the entities explicitly.","schema":{"type":"string","enum":["owned","managed","all"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PartyStatementV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ENTITY_GROUP_WRONG_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Vendor/customer statements: open documents by party and entity","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","NOT_FOUND","ENTITY_GROUP_WRONG_TYPE"],"x-required-scopes":["reports:read"]}},"/v1/reports/statements/activity":{"get":{"description":"The balance a vendor (side=ap) or customer (side=ar) carried into the period, every invoice/bill, credit and payment in it with a running balance, and the balance carried out, grouped by party and then by legal entity. Voids and returned payments appear as reversing lines on the date they landed. property_id is not supported.","operationId":"Reports.partyActivityStatement","parameters":[{"name":"side","required":true,"in":"query","description":"Vendor statements (ap) or customer statements (ar).","schema":{"type":"string","enum":["ap","ar"]}},{"name":"from_date","required":false,"in":"query","description":"First day of the period, inclusive. Defaults to the first day of to_date's month.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Last day of the period, inclusive. Defaults to today in the org's time zone.","schema":{"format":"date","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Mutually exclusive with consolidation_group_id.","schema":{"format":"uuid","type":"string"}},{"name":"consolidation_group_id","required":false,"in":"query","description":"Consolidate the group's member legal entities. Mutually exclusive with legal_entity_id.","schema":{"format":"uuid","type":"string"}},{"name":"party_ids","required":false,"in":"query","description":"Comma-separated party ids. Omitted means every party with an opening balance or activity in the period.","schema":{"type":"array","items":{"type":"string"}}},{"name":"property_id","required":false,"in":"query","description":"Not supported on activity statements; sending it is a 400. Payments carry no property, so a property filter would drop them and overstate the balance.","schema":{"format":"uuid","type":"string"}},{"name":"ownership_kind","required":false,"in":"query","description":"Which legal entities the org-wide aggregate covers. Defaults to 'owned'. Ignored when legal_entity_id or consolidation_group_id names the entities explicitly.","schema":{"type":"string","enum":["owned","managed","all"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PartyActivityStatementV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ENTITY_GROUP_WRONG_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Vendor/customer statements: every movement in a period","tags":["Reports"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","NOT_FOUND","ENTITY_GROUP_WRONG_TYPE"],"x-required-scopes":["reports:read"]}},"/v1/billing-schedules/contracts/{contractId}/initialize":{"post":{"operationId":"BillingSchedules.initialize","parameters":[{"name":"contractId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BillingScheduleInitializeResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Ensure the 12-event horizon is filled for an active contract","tags":["Billing Schedules"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["billing-schedules:write"]}},"/v1/billing-schedules/contracts/{contractId}/recalculate":{"post":{"operationId":"BillingSchedules.recalculate","parameters":[{"name":"contractId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BillingScheduleRecalculateResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Recalculate billing: rebuild the horizon, re-create missing months, reconcile billed months","tags":["Billing Schedules"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["billing-schedules:write"]}},"/v1/billing-schedules/contracts/{contractId}/drafts":{"get":{"operationId":"BillingSchedules.listDrafts","parameters":[{"name":"contractId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BillingScheduleDocumentV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List scheduled drafts for the contract","tags":["Billing Schedules"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["billing-schedules:read"]}},"/v1/billing-schedules/contracts/{contractId}/documents":{"get":{"operationId":"BillingSchedules.listDocuments","parameters":[{"name":"contractId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BillingScheduleDocumentV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List emitted documents for the contract (posted/voided)","tags":["Billing Schedules"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["billing-schedules:read"]}},"/v1/billing-schedules/contracts/{contractId}/events":{"get":{"operationId":"BillingSchedules.listEvents","parameters":[{"name":"contractId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BillingScheduleEventV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List contract financial events (with hasOverride flag)","tags":["Billing Schedules"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["billing-schedules:read"]}},"/v1/billing-schedules/contracts/{contractId}/events/{eventId}/suggestion":{"get":{"operationId":"BillingSchedules.eventSuggestion","parameters":[{"name":"contractId","required":true,"in":"path","schema":{"type":"string"}},{"name":"eventId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BillingScheduleEventSuggestionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Suggested replace_lines payload computed from contract_terms (starting point)","tags":["Billing Schedules"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["billing-schedules:read"]}},"/v1/billing-schedules/contracts/{contractId}/activation-preview":{"get":{"operationId":"BillingSchedules.activationPreview","parameters":[{"name":"contractId","required":true,"in":"path","schema":{"type":"string"}},{"name":"projection_months","required":false,"in":"query","description":"Length of the projection window in months, measured from the contract's billing start (not from today). Clamped by the contract end date when it falls sooner.","schema":{"minimum":1,"maximum":60,"default":12,"type":"integer"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ActivationPreviewV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Activation readiness checklist + projected events over a configurable window (default 12 months) for a draft contract (read-only)","tags":["Billing Schedules"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["billing-schedules:read"]}},"/v1/billing-schedules/contracts/{contractId}/events/{eventId}/override":{"put":{"description":"Body: { v: 2, strategy: \"replace_lines\", items: [...] }. Each item is a document line and may name a tax_rate_id (uuid or null); the server calculates each line's tax when the invoice is written, so there is no total_tax. v1 payloads are rejected with VALIDATION_FAILED.","operationId":"BillingSchedules.eventOverrideSet","parameters":[{"name":"contractId","required":true,"in":"path","schema":{"type":"string"}},{"name":"eventId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BillingScheduleOkV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upsert generic override (v2 replace_lines: items, each with its own tax_rate_id). Pending/ready only.","tags":["Billing Schedules"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["billing-schedules:write"]},"delete":{"operationId":"BillingSchedules.eventOverrideClear","parameters":[{"name":"contractId","required":true,"in":"path","schema":{"type":"string"}},{"name":"eventId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BillingScheduleDeletedV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Remove event override (pending/ready only)","tags":["Billing Schedules"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["billing-schedules:write"]}},"/v1/billing-schedules/contracts/{contractId}/events/{eventId}/retry":{"post":{"description":"A re-bill whose own period is closed or locked is dated in the current open period; send period_override_reason (accounting:periods_override) to post into its own closed period instead. The body is optional. A 200 returns the event as the run left it, which is not always `generated`: it is `blocked` when the posting still cannot happen (no open period, a rejected document, an invoice edited by hand, a credit waiting on a taxed invoice that has not posted, a term whose tax rate is missing or deactivated — see `blocked_reason`), `cancelled` when generation failed for another reason (see `error_message`), and `pending` when the event is future-dated and was only requeued. An invoice or straight-line event whose month the lease no longer bills is refused with FINANCIAL_EVENT_MONTH_NOT_BILLED and nothing is posted.","operationId":"BillingSchedules.eventRetry","parameters":[{"name":"contractId","required":true,"in":"path","schema":{"type":"string"}},{"name":"eventId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetryFinancialEventV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BillingScheduleEventV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PERIOD_OVERRIDE_FORBIDDEN, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: FINANCIAL_EVENT_PERIOD_ALREADY_COVERED, FINANCIAL_EVENT_MONTH_NOT_BILLED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Run now: generate a blocked or cancelled event immediately (a future-dated one is requeued)","tags":["Billing Schedules"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","FINANCIAL_EVENT_PERIOD_ALREADY_COVERED","FINANCIAL_EVENT_MONTH_NOT_BILLED","PERIOD_OVERRIDE_FORBIDDEN","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["billing-schedules:write"]}},"/v1/billing-schedules/contracts/{contractId}/events/{eventId}/waive":{"post":{"description":"Only a blocked event. A month that already billed is waived with a credit memo instead (spec 2026-10-10 §1.4).","operationId":"BillingSchedules.eventWaive","parameters":[{"name":"contractId","required":true,"in":"path","schema":{"type":"string"}},{"name":"eventId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaiveFinancialEventV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BillingScheduleEventV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: FINANCIAL_EVENT_NOT_WAIVABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Waive a blocked event: complete it with no document","tags":["Billing Schedules"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","FINANCIAL_EVENT_NOT_WAIVABLE","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["admin:billing-schedules"]}},"/v1/billing-schedules/diagnostics":{"get":{"operationId":"BillingSchedules.diagnostics","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BillingScheduleDiagnosticsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Diagnostics: pending event counts and motor wiring notes","tags":["Billing Schedules"],"x-error-codes":[],"x-required-scopes":["billing-schedules:read"]}},"/v1/billing-schedules/process-events":{"post":{"operationId":"BillingSchedules.processEvents","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BillingScheduleProcessEventsResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Process the caller org’s pending events now (turn events into documents)","tags":["Billing Schedules"],"x-error-codes":["INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["billing-schedules:write"]}},"/v1/billing-schedules/run":{"post":{"operationId":"BillingSchedules.run","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BillingScheduleRunResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Run horizon maintenance for every active contract","tags":["Billing Schedules"],"x-error-codes":["INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["billing-schedules:write"]}},"/v1/billing-schedules/late-fees/run":{"post":{"description":"Runs the daily late-fee assessment for the caller’s org as of `as_of` (default: the org’s today), over the legal entities the caller may act on. A real run refuses an `as_of` after the org’s today (400 VALIDATION_FAILED) or in a closed or locked period of a legal entity it would bill (one with an overdue invoice in scope; 409 LATE_FEE_AS_OF_IN_CLOSED_PERIOD); a dry run may preview either. `dry_run: true` lists the overdue invoices it would assess and writes nothing. A real run creates pending late_fee events (idempotent per invoice and period); process-events turns them into invoices.","operationId":"BillingSchedules.runLateFees","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunLateFeesV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RunLateFeesResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LATE_FEE_AS_OF_IN_CLOSED_PERIOD, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Assess late fees now, or preview them","tags":["Billing Schedules"],"x-error-codes":["VALIDATION_FAILED","LATE_FEE_AS_OF_IN_CLOSED_PERIOD","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["billing-schedules:write"]}},"/v1/billing-schedules/late-fees/{eventId}/waive":{"post":{"operationId":"BillingSchedules.waiveLateFee","parameters":[{"name":"eventId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaiveLateFeeV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WaiveLateFeeResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT, DOCUMENT_STATUS_FORBIDS_ACTION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Waive a late-fee assessment (credit-memos a charged fee to zero, or holds a not-yet-generated window closed); optionally exempt the source invoice","tags":["Billing Schedules"],"x-error-codes":["NOT_FOUND","CONFLICT","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","DOCUMENT_STATUS_FORBIDS_ACTION","LEGAL_ENTITY_NOT_IN_SCOPE","DIMENSION_REQUIRED"],"x-required-scopes":["admin:billing-schedules"]}},"/v1/billing-schedules/invoices/{documentId}/late-fee-exemption":{"post":{"operationId":"BillingSchedules.createLateFeeExemption","parameters":[{"name":"documentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLateFeeExemptionV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LateFeeExemptionResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Exempt a source invoice from future late fees (idempotent); also waives its pending late-fee events","tags":["Billing Schedules"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["admin:billing-schedules"]},"delete":{"operationId":"BillingSchedules.removeLateFeeExemption","parameters":[{"name":"documentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LateFeeExemptionResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Remove a source invoice late-fee exemption (idempotent — absent is a no-op)","tags":["Billing Schedules"],"x-error-codes":["LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["admin:billing-schedules"]}},"/v1/billing-schedules/contracts/{contractId}/late-fees":{"get":{"operationId":"BillingSchedules.listLateFees","parameters":[{"name":"contractId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LateFeeAssessmentV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List late-fee assessments for a contract (source/fee invoice, derived status, exemption state) — newest first","tags":["Billing Schedules"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["billing-schedules:read"]}},"/v1/intercompany/account-mappings":{"get":{"operationId":"Intercompany.listAccountMappings","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/IcAccountMappingV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List intercompany account mappings","tags":["Intercompany"],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"tens of intercompany account mappings per org"},"x-required-scopes":["intercompany:read"]},"post":{"operationId":"Intercompany.createAccountMapping","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIcAccountMappingV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/IcAccountMappingV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create intercompany account mapping","tags":["Intercompany"],"x-error-codes":["VALIDATION_FAILED","LEDGER_ENTRY_REFUSED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["intercompany:write"]}},"/v1/intercompany/account-mappings/{id}":{"delete":{"operationId":"Intercompany.deleteAccountMapping","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete intercompany account mapping","tags":["Intercompany"],"x-error-codes":["NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["intercompany:write"]}},"/v1/intercompany/transactions":{"get":{"operationId":"Intercompany.listTransactions","parameters":[{"name":"from_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"to_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"open_only","required":false,"in":"query","schema":{"type":"boolean"}},{"name":"document_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"status","required":false,"in":"query","schema":{"type":"string"}},{"name":"search","required":false,"in":"query","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -document_date","schema":{"enum":["-document_date","document_date","-created_at","created_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/IcTransactionListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List intercompany transactions","tags":["Intercompany"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["intercompany:read"]},"post":{"operationId":"Intercompany.createTransaction","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIcTransactionV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/IcTransactionCreatedV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DIMENSION_REQUIRED, MISSING_SYSTEM_ROLE_ACCOUNT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create intercompany transaction","tags":["Intercompany"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","DIMENSION_REQUIRED","MISSING_SYSTEM_ROLE_ACCOUNT"],"x-required-scopes":["intercompany:write"]}},"/v1/intercompany/transactions/{id}/credits":{"post":{"description":"A seller credit (a dispute or a correction), always mirrored on both entities: a credit transaction from the buyer to the seller on the original lines' accounts swapped, netted against the original by a zero-cash settlement. The original's open balance drops by the credit. Each line credits at most its original line; the total at most the open balance.","operationId":"Intercompany.creditTransaction","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIcCreditV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/IcCreditCreatedV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Credit an intercompany transaction","tags":["Intercompany"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","LEDGER_ENTRY_REFUSED"],"x-required-scopes":["intercompany:write"]},"get":{"description":"The seller credits issued against this transaction, oldest first.","operationId":"Intercompany.listTransactionCredits","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/IcCreditV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the credits on an intercompany transaction","tags":["Intercompany"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"none","reason":"the credits on one document, not a collection","bound":"a document carries a handful of credits at most"},"x-required-scopes":["intercompany:read"]}},"/v1/intercompany/transactions/{id}/settlements":{"get":{"description":"The live settlements (waiting to post, posted or failed to post) that drew this document down, oldest first. `:id` is an intercompany transaction. Voided settlements are not listed. 404 for any other document.","operationId":"Intercompany.listTransactionSettlements","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/IcDocumentSettlementV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the settlements applied to an intercompany document","tags":["Intercompany"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"none","reason":"the settlements applied to one document, not a collection","bound":"a document is drawn down by a handful of settlements, each at most once per settlement"},"x-required-scopes":["intercompany:read"]}},"/v1/intercompany/open-transactions":{"get":{"operationId":"Intercompany.openTransactionsBucket","parameters":[{"name":"from_entity_id","required":true,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"to_entity_id","required":true,"in":"query","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/IcOpenTransactionsBucketV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Open intercompany transactions bucket between two entities","tags":["Intercompany"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["intercompany:read"]}},"/v1/intercompany/settlements":{"get":{"operationId":"Intercompany.listSettlements","parameters":[{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -document_date","schema":{"enum":["-document_date","document_date","-created_at","created_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/IcSettlementListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List intercompany settlements","tags":["Intercompany"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["intercompany:read"]},"post":{"operationId":"Intercompany.createSettlement","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIcSettlementV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/IcSettlementCreatedV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY, BANK_TX_PENDING_NOT_MATCHABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, PERIOD_LOCKED, PERIOD_CLOSED, IC_SETTLEMENT_BANK_TRANSACTION_ALREADY_PROCESSED, BANK_LINE_REMOVED_BY_PROVIDER","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, IC_SETTLEMENT_BANK_TRANSACTION_INVALID, IC_SETTLEMENT_PAIRED_TRANSACTION_INVALID, IC_SETTLEMENT_DATED_BEFORE_SOURCE, IC_SETTLEMENT_NOTHING_TO_SETTLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create intercompany settlement","tags":["Intercompany"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","PERIOD_LOCKED","PERIOD_CLOSED","PERIOD_MISSING","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","BANK_TX_PENDING_NOT_MATCHABLE","IC_SETTLEMENT_BANK_TRANSACTION_ALREADY_PROCESSED","IC_SETTLEMENT_BANK_TRANSACTION_INVALID","IC_SETTLEMENT_PAIRED_TRANSACTION_INVALID","IC_SETTLEMENT_DATED_BEFORE_SOURCE","IC_SETTLEMENT_NOTHING_TO_SETTLE","BANK_LINE_REMOVED_BY_PROVIDER"],"x-required-scopes":["intercompany:write"]}},"/v1/intercompany/settlements/{id}":{"get":{"operationId":"Intercompany.getSettlement","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/IcSettlementDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get intercompany settlement detail","tags":["Intercompany"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["intercompany:read"]}},"/v1/intercompany/settlements/{id}/approve":{"post":{"operationId":"Intercompany.approveSettlement","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/IcSettlementStatusV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, DOCUMENT_STATUS_FORBIDS_ACTION, IC_SETTLEMENT_INVALID_TRANSITION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Approve intercompany settlement","tags":["Intercompany"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","DOCUMENT_STATUS_FORBIDS_ACTION","IC_SETTLEMENT_INVALID_TRANSITION"],"x-high-risk":true,"x-high-risk-reason":"Approves an intercompany settlement for posting.","x-required-scopes":["intercompany:write"]}},"/v1/intercompany/settlements/{id}/dispute":{"post":{"operationId":"Intercompany.disputeSettlement","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DisputeIcSettlementV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/IcSettlementStatusV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, DOCUMENT_STATUS_FORBIDS_ACTION, IC_SETTLEMENT_INVALID_TRANSITION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Dispute intercompany settlement","tags":["Intercompany"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","DOCUMENT_STATUS_FORBIDS_ACTION","IC_SETTLEMENT_INVALID_TRANSITION"],"x-required-scopes":["intercompany:write"]}},"/v1/intercompany/settlements/{id}/post":{"post":{"operationId":"Intercompany.postSettlement","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/IcSettlementPostedV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DOCUMENT_STATUS_FORBIDS_ACTION, IDEMPOTENCY_CONFLICT, PERIOD_LOCKED, PERIOD_CLOSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Post approved intercompany settlement","tags":["Intercompany"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","DOCUMENT_STATUS_FORBIDS_ACTION","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","PERIOD_LOCKED","PERIOD_CLOSED","PERIOD_MISSING","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH"],"x-high-risk":true,"x-high-risk-reason":"Posts an intercompany settlement to the ledger.","x-required-scopes":["intercompany:write"]}},"/v1/intercompany/settlements/{id}/void":{"post":{"operationId":"Intercompany.voidSettlement","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoidIcSettlementV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/IcSettlementVoidedV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DOCUMENT_ALREADY_VOIDED, DOCUMENT_STATUS_FORBIDS_ACTION, DOCUMENT_RECONCILED_CANNOT_VOID, DOCUMENT_MATCHED_CANNOT_VOID, IDEMPOTENCY_CONFLICT, PERIOD_LOCKED, DOCUMENT_COST_CAPITALIZED_CANNOT_VOID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Void posted intercompany settlement","tags":["Intercompany"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","DOCUMENT_ALREADY_VOIDED","DOCUMENT_STATUS_FORBIDS_ACTION","DOCUMENT_RECONCILED_CANNOT_VOID","DOCUMENT_MATCHED_CANNOT_VOID","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","PERIOD_LOCKED","PERIOD_MISSING","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","DOCUMENT_NOT_FOUND","DOCUMENT_COST_CAPITALIZED_CANNOT_VOID"],"x-high-risk":true,"x-high-risk-reason":"Voids a posted intercompany settlement.","x-required-scopes":["intercompany:write"]}},"/v1/intercompany/statement":{"get":{"description":"One entity's activity with one counterparty, from its own books: every posted journal entry with Due From / Due To lines naming the counterparty, with an opening balance, a running balance and a closing balance. Positive is what the counterparty owes the entity. On demand only: nothing is ever emailed to an own entity.","operationId":"Intercompany.statement","parameters":[{"name":"legal_entity_id","required":true,"in":"query","description":"The entity whose books are read.","schema":{"format":"uuid","type":"string"}},{"name":"counterparty_legal_entity_id","required":true,"in":"query","description":"The other entity. Must differ from `legal_entity_id`.","schema":{"format":"uuid","type":"string"}},{"name":"from_date","required":false,"in":"query","description":"Defaults to the first day of `to_date`'s month.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Defaults to the org's today.","schema":{"format":"date","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/IcStatementV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Intercompany statement between two entities","tags":["Intercompany"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["intercompany:read"]}},"/v1/intercompany/position":{"get":{"description":"At most one row per (creditor, debtor): the net balance across the intercompany due-from and due-to accounts, tagged with the counterparty, over posted, effective journal lines. Lines with no counterparty are not included. Each entity books its own view; a row carries the creditor's own number, and the debtor's books are used only when the creditor's books show no receivable for the pair. When both books claim a receivable, or both a payable, both rows show. `balance` is always positive: the debtor owes the creditor that amount.","operationId":"Intercompany.position","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/IcPositionRowV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Intercompany position by entity pair","tags":["Intercompany"],"x-pagination":{"mode":"none","reason":"a computed balance per legal-entity pair, not raw transaction rows","bound":"legal-entity pairs configured for the org, at most low hundreds"},"x-required-scopes":["intercompany:read"]}},"/v1/intercompany/aging":{"get":{"operationId":"Intercompany.aging","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/IcAgingRowV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Intercompany aging buckets","tags":["Intercompany"],"x-pagination":{"mode":"none","reason":"a computed aging bucket per legal-entity pair, not raw transaction rows","bound":"legal-entity pairs times a fixed set of aging buckets"},"x-required-scopes":["intercompany:read"]}},"/v1/contracts":{"get":{"operationId":"Contracts.list","parameters":[{"name":"property_id","required":false,"in":"query","description":"Filter to leases at this property. Returns every lease at the property — the ones on the property itself AND the ones on any space within it, at any depth — because a lease link always records its property (spec D8). `include_descendants` therefore cannot widen this and is ignored. Mutually exclusive with `space_id`.","schema":{"format":"uuid","type":"string"}},{"name":"space_id","required":false,"in":"query","description":"Filter to leases on this space. Exact match by default; with `include_descendants=true` it also matches leases on spaces nested inside it (a unit within a suite). Mutually exclusive with `property_id`.","schema":{"format":"uuid","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Filter to a single legal entity. A caller restricted to a subset of legal entities (Advanced User Roles Phase 2) gets 403 LEGAL_ENTITY_NOT_IN_SCOPE when this targets an entity outside their allowed set.","schema":{"format":"uuid","type":"string"}},{"name":"include_descendants","required":false,"in":"query","description":"When `true` and `space_id` is set, the filter also matches leases on spaces nested inside the named space, walking `parent_space_id` to any depth. **Ignored with `property_id`**, which already covers the whole property: a lease link stores its property at every depth (spec D8), so there is nothing below a property this flag could add. Default `false` (exact match only).","schema":{"default":false,"type":"boolean"}},{"name":"status","required":false,"in":"query","description":"Exact lifecycle status. Enumerated rather than free text so a caller can learn the vocabulary from the contract, and so a typo is a 400 rather than an empty page.","schema":{"type":"string","enum":["draft","active","terminated","expired","assigned"]}},{"name":"contract_type_id","required":false,"in":"query","description":"Exact contract type. Pair with `GET /v1/contract-types`.","schema":{"format":"uuid","type":"string"}},{"name":"counterparty_party_id","required":false,"in":"query","description":"Exact counterparty party — the tenant on a lease. Does NOT match `counterparty_legal_entity_id`; an intercompany lease names an entity on that side, not a party, and conflating them would silently widen the filter.","schema":{"format":"uuid","type":"string"}},{"name":"end_date_from","required":false,"in":"query","description":"Inclusive lower bound on `end_date`. An open-ended lease has a NULL `end_date` and is therefore NOT returned by any `end_date` range — it has no end to compare, which is a different fact from ending late.","schema":{"format":"date","type":"string"}},{"name":"end_date_to","required":false,"in":"query","description":"Inclusive upper bound on `end_date`. See `end_date_from` for how an open-ended lease behaves.","schema":{"format":"date","type":"string"}},{"name":"start_date_from","required":false,"in":"query","description":"Inclusive lower bound on `start_date`.","schema":{"format":"date","type":"string"}},{"name":"start_date_to","required":false,"in":"query","description":"Inclusive upper bound on `start_date`.","schema":{"format":"date","type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on `title` OR `external_ref`. Spelled `search` to match every other v1 list; there is no `q`.","schema":{"maxLength":200,"type":"string"}},{"name":"as_of","required":false,"in":"query","description":"Leases IN FORCE on this date: `start_date <= as_of` and `end_date` either null or `>= as_of`. This is a valid-time filter on the ROW SET — it does NOT resolve each lease's terms as of the date, which is what `as_of` means on `GET /v1/contracts/:id`. The list item carries no terms to resolve.","schema":{"format":"date","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at","title","-title","start_date","-start_date","end_date","-end_date"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ContractListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List contracts","tags":["Contracts"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["contracts:read"]},"post":{"operationId":"Contracts.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContractV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY, CONTRACT_INITIAL_PERIOD_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH, CONTRACT_ENTITY_NOT_PROPERTY_OWNER, CONTRACT_COUNTERPARTY_LEGAL_ENTITY_NOT_ALLOWED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create contract","tags":["Contracts"],"x-error-codes":["VALIDATION_FAILED","ACCOUNT_LEGAL_ENTITY_MISMATCH","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","CONTRACT_INITIAL_PERIOD_REQUIRED","CONTRACT_ENTITY_NOT_PROPERTY_OWNER","CONTRACT_COUNTERPARTY_LEGAL_ENTITY_NOT_ALLOWED"],"x-plannable":true,"x-required-scopes":["contracts:write"]}},"/v1/contracts/lease-overlap":{"get":{"description":"The live leases that already cover `location_id` — a property id or a space id — for part of `[from_date, to_date)`. Intended as a WARNING while a lease is being drafted, never as a block: double-booking a space is usually an error and occasionally a deliberate holdover or a mid-term assignment, and only the operator knows which. Both ranges are half-open, so a lease ending on `from_date` and a lease starting on `to_date` are NOT reported. Omit `to_date` for an open-ended new lease; an existing lease with a null `end_date` is likewise unbounded on the right. Pass `exclude_contract_id` when editing so the contract does not report itself. An empty range (`to_date` on or before `from_date`) matches nothing.","operationId":"Contracts.leaseOverlap","parameters":[{"name":"location_id","required":true,"in":"query","description":"The location to check — a property id OR a space id. The two tables hold disjoint ids, so the caller does not say which it sent.","schema":{"format":"uuid","type":"string"}},{"name":"from_date","required":true,"in":"query","description":"First day the new lease would cover. Inclusive: a lease that ends on this date does not overlap.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Day the new lease would stop covering the location, EXCLUSIVE: a lease starting on this date does not overlap. Omit for an open-ended new lease, which then overlaps every later lease.","schema":{"format":"date","type":"string"}},{"name":"exclude_contract_id","required":false,"in":"query","description":"The contract being edited, so it does not report itself as its own conflict.","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LeaseOverlapV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Leases already covering a location in a date range","tags":["Contracts"],"x-error-codes":["VALIDATION_FAILED"],"x-pagination":{"mode":"none","reason":"the conflicts for one location over one drafting window, shown as a banner an operator reads in full","bound":"a handful of rows — the leases ever written on a single location"},"x-required-scopes":["contracts:read"]}},"/v1/contracts/{id}":{"get":{"operationId":"Contracts.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"as_of","required":false,"in":"query","description":"Resolve `terms` as of this valid-time date instead of returning every stored term. Filters to the terms the lease-resolution port has in force on this date; it does not rewrite any amount. Decision time (`knownAt`) is not settable here — it defaults to today inside the port.","schema":{"format":"date","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEASE_RESOLUTION_UNRESOLVABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get contract by id","tags":["Contracts"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","LEASE_RESOLUTION_UNRESOLVABLE"],"x-required-scopes":["contracts:read"]},"patch":{"operationId":"Contracts.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-contract-version","required":false,"in":"header","description":"The contract's `version`, as returned by GET /v1/contracts/{id}. Send this, not If-Match: a CDN in front of this API answers conditional requests itself and never forwards them. Exactly one of this header or If-Match is required — omitting both is refused with 428, because a PATCH that does not say which version it read is exactly the one that silently overwrites someone else's edit.","schema":{"type":"string"}},{"name":"if-match","required":false,"in":"header","description":"DEPRECATED fallback for clients that have not migrated: the ETag returned by GET /v1/contracts/{id}. Prefer `x-contract-version` — see its description for why this one cannot be relied on.","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateContractV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, CONTRACT_INITIAL_PERIOD_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, CONTRACT_VERSION_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH, CONTRACT_ENTITY_NOT_PROPERTY_OWNER, ESCALATION_CONTRACT_HAS_NO_PROPERTY, CONTRACT_COUNTERPARTY_LEGAL_ENTITY_NOT_ALLOWED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update draft contract","tags":["Contracts"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","ACCOUNT_LEGAL_ENTITY_MISMATCH","LEGAL_ENTITY_NOT_IN_SCOPE","CONTRACT_INITIAL_PERIOD_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","CONTRACT_VERSION_MISMATCH","CONTRACT_ENTITY_NOT_PROPERTY_OWNER","ESCALATION_CONTRACT_HAS_NO_PROPERTY","CONTRACT_COUNTERPARTY_LEGAL_ENTITY_NOT_ALLOWED"],"x-plannable":true,"x-required-scopes":["contracts:write"]}},"/v1/contracts/{id}/rent-schedule":{"get":{"description":"The rent the billing engine will bill, period by period, from `LeaseResolutionPort.resolveSchedule` — the same read path that generates the invoices. This endpoint computes nothing itself; that is the point. A client that projects rent from `terms` will disagree with the invoices (spec D-08), which is what this replaces.","operationId":"Contracts.rentSchedule","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"from_date","required":false,"in":"query","description":"Start of the series. Defaults to the lease's billing window start.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"End of the series. Defaults to the billing window's capped end.","schema":{"format":"date","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractRentScheduleV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEASE_RESOLUTION_UNRESOLVABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"A lease's billed rent series","tags":["Contracts"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","LEASE_RESOLUTION_UNRESOLVABLE"],"x-required-scopes":["contracts:read"]}},"/v1/contracts/{id}/activate":{"post":{"operationId":"Contracts.activate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: CONTRACT_ACTIVATION_NOT_READY, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONTRACT_INVALID_TRANSITION, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ESCALATION_CONTRACT_HAS_NO_PROPERTY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Activate a draft contract","tags":["Contracts"],"x-error-codes":["NOT_FOUND","CONTRACT_INVALID_TRANSITION","CONTRACT_ACTIVATION_NOT_READY","ESCALATION_CONTRACT_HAS_NO_PROPERTY","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["contracts:write"]}},"/v1/contracts/{id}/lifecycle-deliveries/{deliveryId}/redeliver":{"post":{"description":"A lease change (end, termination, amendment) that never reached one module after every retry is `dead`, and it blocks closing the period when it affects postings. This puts it back in the queue with its attempts reset; it runs within a minute. Its `lease_lifecycle.delivery_dead` work item resolves when it goes through.","operationId":"Contracts.redeliverLifecycleEvent","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"deliveryId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"202":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LifecycleRedeliveryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LEASE_LIFECYCLE_DELIVERY_NOT_DEAD, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Send a failed lease lifecycle delivery again","tags":["Contracts"],"x-error-codes":["NOT_FOUND","LEASE_LIFECYCLE_DELIVERY_NOT_DEAD","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["contracts:write"]}},"/v1/contracts/{id}/amendments":{"post":{"description":"Records an executed change to an ACTIVE lease. The outgoing terms are stamped as superseded — never edited — and the incoming ones are inserted from effective_on. Drafts are edited with PATCH instead. An effective_on inside a closed accounting period is rejected rather than caught up.","operationId":"Contracts.amend","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-contract-version","required":false,"in":"header","description":"The contract's `version`, as returned by GET /v1/contracts/{id}. Send this, not If-Match: a CDN in front of this API answers conditional requests itself and never forwards them. Exactly one of this header or If-Match is required — omitting both is refused with 428, because an amendment that does not say which version it read is exactly the one that silently overwrites someone else's edit.","schema":{"type":"string"}},{"name":"if-match","required":false,"in":"header","description":"DEPRECATED fallback for clients that have not migrated: the ETag returned by GET /v1/contracts/{id}. Prefer `x-contract-version` — see its description for why this one cannot be relied on.","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAmendmentDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AmendmentV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: CONTRACT_AMENDMENT_EMPTY, CONTRACT_AMENDMENT_PERIOD_CHANGES_NOT_ALLOWED, CONTRACT_AMENDMENT_OPTION_FIELDS_NOT_ALLOWED, CONTRACT_AMENDMENT_NEW_PERIOD_INDEX_INVALID, CONTRACT_PERIOD_OVERLAP, CONTRACT_PERIOD_ORDER_INVALID, CONTRACT_PERIOD_DATES_INVALID, CONTRACT_OPTION_REQUIRES_BOUNDED_INITIAL, CONTRACT_AMENDMENT_TYPE_DIRECTION_MISMATCH, CONTRACT_AMENDMENT_EFFECTIVE_BEFORE_START, CONTRACT_AMENDMENT_INVALID_SUPERSEDE_TERMS, CONTRACT_AMENDMENT_PERIOD_NOT_ON_CONTRACT, CONTRACT_AMENDMENT_TERM_BEFORE_EFFECTIVE_ON","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONTRACT_VERSION_MISMATCH, CONTRACT_OPTION_PERIOD_HAS_DEPENDENTS, CONTRACT_PERIOD_INVALID_TRANSITION, CONTRACT_PERIOD_TRANSITION_CONFLICT, CONTRACT_AMENDMENT_NOT_AMENDABLE, CONTRACT_AMENDMENT_EFFECTIVE_IN_CLOSED_PERIOD, CONTRACT_TERM_OVERLAP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH, CONTRACT_AMENDMENT_AREA_NOT_YET_EFFECTIVE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"428":{"description":"Possible error codes: PRECONDITION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Amend a live lease","tags":["Contracts"],"x-error-codes":["NOT_FOUND","ACCOUNT_LEGAL_ENTITY_MISMATCH","LEGAL_ENTITY_NOT_IN_SCOPE","PRECONDITION_REQUIRED","CONTRACT_VERSION_MISMATCH","CONTRACT_AMENDMENT_AREA_NOT_YET_EFFECTIVE","CONTRACT_AMENDMENT_EMPTY","CONTRACT_AMENDMENT_PERIOD_CHANGES_NOT_ALLOWED","CONTRACT_AMENDMENT_OPTION_FIELDS_NOT_ALLOWED","CONTRACT_AMENDMENT_NEW_PERIOD_INDEX_INVALID","CONTRACT_OPTION_PERIOD_HAS_DEPENDENTS","CONTRACT_PERIOD_INVALID_TRANSITION","CONTRACT_PERIOD_TRANSITION_CONFLICT","CONTRACT_PERIOD_OVERLAP","CONTRACT_PERIOD_ORDER_INVALID","CONTRACT_PERIOD_DATES_INVALID","CONTRACT_OPTION_REQUIRES_BOUNDED_INITIAL","CONTRACT_AMENDMENT_TYPE_DIRECTION_MISMATCH","CONTRACT_AMENDMENT_NOT_AMENDABLE","CONTRACT_AMENDMENT_EFFECTIVE_BEFORE_START","CONTRACT_AMENDMENT_EFFECTIVE_IN_CLOSED_PERIOD","CONTRACT_AMENDMENT_INVALID_SUPERSEDE_TERMS","CONTRACT_AMENDMENT_PERIOD_NOT_ON_CONTRACT","CONTRACT_AMENDMENT_TERM_BEFORE_EFFECTIVE_ON","CONTRACT_TERM_OVERLAP"],"x-plannable":true,"x-required-scopes":["contracts:write"]},"get":{"description":"Returns the contract's amendment chain in sequence_no order (oldest first).","operationId":"Contracts.listAmendments","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AmendmentV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a contract's amendments","tags":["Contracts"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"none","reason":"each amendment is a deliberate, manually-executed lease change","bound":"tens of rows per contract's lifetime"},"x-required-scopes":["contracts:read"]}},"/v1/contracts/{id}/amendments/preview":{"post":{"description":"Takes the same body and version headers as POST /v1/contracts/{id}/amendments and answers what recording it would do to billing, without recording it: the catch-up adjustments for months already invoiced, the accounting period they would post in, and the next invoice before and after. It runs the real amendment and the real billing recalculation in a transaction that is always rolled back, so every validation error is the one the record route would return, and nothing is saved.","operationId":"Contracts.previewAmendment","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-contract-version","required":false,"in":"header","description":"The contract's `version`, as returned by GET /v1/contracts/{id} — the same header the record route takes. Exactly one of this header or If-Match is required.","schema":{"type":"string"}},{"name":"if-match","required":false,"in":"header","description":"DEPRECATED fallback: the ETag returned by GET /v1/contracts/{id}. Prefer `x-contract-version`.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAmendmentDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AmendmentPreviewV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: CONTRACT_AMENDMENT_EMPTY, CONTRACT_AMENDMENT_PERIOD_CHANGES_NOT_ALLOWED, CONTRACT_AMENDMENT_OPTION_FIELDS_NOT_ALLOWED, CONTRACT_AMENDMENT_NEW_PERIOD_INDEX_INVALID, CONTRACT_PERIOD_OVERLAP, CONTRACT_PERIOD_ORDER_INVALID, CONTRACT_PERIOD_DATES_INVALID, CONTRACT_OPTION_REQUIRES_BOUNDED_INITIAL, CONTRACT_AMENDMENT_TYPE_DIRECTION_MISMATCH, CONTRACT_AMENDMENT_EFFECTIVE_BEFORE_START, CONTRACT_AMENDMENT_INVALID_SUPERSEDE_TERMS, CONTRACT_AMENDMENT_PERIOD_NOT_ON_CONTRACT, CONTRACT_AMENDMENT_TERM_BEFORE_EFFECTIVE_ON","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONTRACT_VERSION_MISMATCH, CONTRACT_OPTION_PERIOD_HAS_DEPENDENTS, CONTRACT_PERIOD_INVALID_TRANSITION, CONTRACT_PERIOD_TRANSITION_CONFLICT, CONTRACT_AMENDMENT_NOT_AMENDABLE, CONTRACT_AMENDMENT_EFFECTIVE_IN_CLOSED_PERIOD, CONTRACT_TERM_OVERLAP, TRANSACTION_RETRYABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH, CONTRACT_AMENDMENT_AREA_NOT_YET_EFFECTIVE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"428":{"description":"Possible error codes: PRECONDITION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview an amendment's billing impact","tags":["Contracts"],"x-error-codes":["NOT_FOUND","ACCOUNT_LEGAL_ENTITY_MISMATCH","LEGAL_ENTITY_NOT_IN_SCOPE","PRECONDITION_REQUIRED","CONTRACT_VERSION_MISMATCH","CONTRACT_AMENDMENT_AREA_NOT_YET_EFFECTIVE","CONTRACT_AMENDMENT_EMPTY","CONTRACT_AMENDMENT_PERIOD_CHANGES_NOT_ALLOWED","CONTRACT_AMENDMENT_OPTION_FIELDS_NOT_ALLOWED","CONTRACT_AMENDMENT_NEW_PERIOD_INDEX_INVALID","CONTRACT_OPTION_PERIOD_HAS_DEPENDENTS","CONTRACT_PERIOD_INVALID_TRANSITION","CONTRACT_PERIOD_TRANSITION_CONFLICT","CONTRACT_PERIOD_OVERLAP","CONTRACT_PERIOD_ORDER_INVALID","CONTRACT_PERIOD_DATES_INVALID","CONTRACT_OPTION_REQUIRES_BOUNDED_INITIAL","CONTRACT_AMENDMENT_TYPE_DIRECTION_MISMATCH","CONTRACT_AMENDMENT_NOT_AMENDABLE","CONTRACT_AMENDMENT_EFFECTIVE_BEFORE_START","CONTRACT_AMENDMENT_EFFECTIVE_IN_CLOSED_PERIOD","CONTRACT_AMENDMENT_INVALID_SUPERSEDE_TERMS","CONTRACT_AMENDMENT_PERIOD_NOT_ON_CONTRACT","CONTRACT_AMENDMENT_TERM_BEFORE_EFFECTIVE_ON","CONTRACT_TERM_OVERLAP","TRANSACTION_RETRYABLE"],"x-required-scopes":["contracts:write"]}},"/v1/contracts/{id}/periods":{"post":{"description":"Draft contracts only. On a live lease an option is added by an option_addition amendment; this route refuses with CONTRACT_PERIOD_CHANGE_REQUIRES_AMENDMENT.","operationId":"Contracts.addPeriod","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddContractPeriodV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractPeriodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY, CONTRACT_PERIOD_CHANGE_REQUIRES_AMENDMENT, CONTRACT_PERIOD_DATES_INVALID, CONTRACT_OPTION_REQUIRES_BOUNDED_INITIAL, CONTRACT_PERIOD_ORDER_INVALID, CONTRACT_PERIOD_OVERLAP, CONTRACT_INITIAL_PERIOD_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT, CONTRACT_PERIODS_NOT_MUTABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a renewal option period to a contract","tags":["Contracts"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","CONTRACT_PERIODS_NOT_MUTABLE","CONTRACT_PERIOD_CHANGE_REQUIRES_AMENDMENT","CONTRACT_PERIOD_DATES_INVALID","CONTRACT_OPTION_REQUIRES_BOUNDED_INITIAL","CONTRACT_PERIOD_ORDER_INVALID","CONTRACT_PERIOD_OVERLAP","CONTRACT_INITIAL_PERIOD_REQUIRED"],"x-plannable":true,"x-required-scopes":["contracts:write"]}},"/v1/contracts/{id}/periods/{periodId}":{"patch":{"operationId":"Contracts.updatePeriod","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateContractPeriodV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractPeriodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY, CONTRACT_PERIOD_DATES_INVALID, CONTRACT_PERIOD_OVERLAP, CONTRACT_TERM_STEPS_INSUFFICIENT, CONTRACT_TERM_STEPPED_REQUIRES_END","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT, CONTRACT_PERIODS_NOT_MUTABLE, CONTRACT_PERIOD_NOT_EDITABLE, CONTRACT_PERIOD_DATES_REQUIRE_AMENDMENT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a contract period","tags":["Contracts"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","CONTRACT_PERIODS_NOT_MUTABLE","CONTRACT_PERIOD_NOT_EDITABLE","CONTRACT_PERIOD_DATES_REQUIRE_AMENDMENT","CONTRACT_PERIOD_DATES_INVALID","CONTRACT_PERIOD_OVERLAP","CONTRACT_TERM_STEPS_INSUFFICIENT","CONTRACT_TERM_STEPPED_REQUIRES_END"],"x-plannable":true,"x-required-scopes":["contracts:write"]},"delete":{"description":"Deletes an available option period. A period with terms attached is refused with CONTRACT_OPTION_PERIOD_HAS_DEPENDENTS, whose `context` lists the terms, escalation clauses and reset events that would go with it — enough to render a confirmation without a second request. Retry with ?cascade=true to delete all of it in one transaction. An escalation reset that was already accepted or overridden is refused even with cascade=true: reverse it first. Draft contracts only: on a live lease an option is removed by an option_removal amendment, and this route refuses with CONTRACT_PERIOD_CHANGE_REQUIRES_AMENDMENT.","operationId":"Contracts.deletePeriod","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cascade","required":false,"in":"query","description":"Delete the period together with its terms, their escalation clauses and the undecided reset events derived from them, in one transaction. Omitted or false, a period with anything attached is refused with CONTRACT_OPTION_PERIOD_HAS_DEPENDENTS, whose `context` lists exactly what would be deleted. An accepted or overridden escalation event is refused even with cascade=true.","schema":{"type":"boolean"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY, CONTRACT_PERIOD_CHANGE_REQUIRES_AMENDMENT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, CONTRACT_OPTION_PERIOD_HAS_DEPENDENTS, IDEMPOTENCY_CONFLICT, CONTRACT_PERIODS_NOT_MUTABLE, CONTRACT_PERIOD_NOT_DELETABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete an available option period","tags":["Contracts"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT","CONTRACT_OPTION_PERIOD_HAS_DEPENDENTS","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","CONTRACT_PERIODS_NOT_MUTABLE","CONTRACT_PERIOD_CHANGE_REQUIRES_AMENDMENT","CONTRACT_PERIOD_NOT_DELETABLE"],"x-required-scopes":["contracts:write"]}},"/v1/contracts/{id}/periods/{periodId}/exercise":{"post":{"operationId":"Contracts.exercisePeriod","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractPeriodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, CONTRACT_AMENDMENT_EFFECTIVE_IN_CLOSED_PERIOD, IDEMPOTENCY_CONFLICT, CONTRACT_PERIODS_NOT_MUTABLE, CONTRACT_PERIOD_INVALID_TRANSITION, CONTRACT_PERIOD_TRANSITION_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Exercise a renewal option period","tags":["Contracts"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT","CONTRACT_AMENDMENT_EFFECTIVE_IN_CLOSED_PERIOD","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","CONTRACT_PERIODS_NOT_MUTABLE","CONTRACT_PERIOD_INVALID_TRANSITION","CONTRACT_PERIOD_TRANSITION_CONFLICT"],"x-plannable":true,"x-required-scopes":["contracts:write"]}},"/v1/contracts/{id}/periods/{periodId}/waive":{"post":{"description":"Waives an available option and records an option_waiver amendment in the lease's history, on draft and active leases alike. executed_on defaults to today in the org's time zone; effective_on is the same date. The option's terms are retired with it: their undecided escalation resets and clauses are deleted, and the waive is refused with CONTRACT_OPTION_PERIOD_HAS_DEPENDENTS when a reset on them was already accepted or overridden.","operationId":"Contracts.waivePeriod","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaivePeriodV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractPeriodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT, CONTRACT_PERIODS_NOT_MUTABLE, CONTRACT_PERIOD_INVALID_TRANSITION, CONTRACT_PERIOD_TRANSITION_CONFLICT, CONTRACT_OPTION_PERIOD_HAS_DEPENDENTS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Waive a renewal option period","tags":["Contracts"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","CONTRACT_PERIODS_NOT_MUTABLE","CONTRACT_PERIOD_INVALID_TRANSITION","CONTRACT_PERIOD_TRANSITION_CONFLICT","CONTRACT_OPTION_PERIOD_HAS_DEPENDENTS"],"x-plannable":true,"x-required-scopes":["contracts:write"]}},"/v1/contracts/{id}/terminate":{"post":{"operationId":"Contracts.terminate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TerminateContractV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Schedule (or move) an effective-dated termination","tags":["Contracts"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["contracts:write"]},"delete":{"operationId":"Contracts.revokeTermination","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Revoke a pending termination","tags":["Contracts"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["contracts:write"]}},"/v1/contract-types":{"get":{"operationId":"ContractTypes.list","parameters":[{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: code","schema":{"enum":["code","-code","name","-name"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ContractTypeV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List contract types","tags":["Contract Types"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["contracts:read"]},"post":{"operationId":"ContractTypes.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContractTypeV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractTypeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create contract type","tags":["Contract Types"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","CONFLICT"],"x-required-scopes":["contracts:write"]}},"/v1/contract-types/{id}":{"get":{"operationId":"ContractTypes.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractTypeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get contract type by id","tags":["Contract Types"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["contracts:read"]},"put":{"operationId":"ContractTypes.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateContractTypeV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractTypeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update contract type","tags":["Contract Types"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["contracts:write"]},"delete":{"operationId":"ContractTypes.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete contract type","tags":["Contract Types"],"x-error-codes":["NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["contracts:write"]}},"/v1/term-types":{"get":{"operationId":"TermTypes.list","parameters":[{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: code","schema":{"enum":["code","-code","name","-name"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TermTypeV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List term types","tags":["Term Types"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["contracts:read"]},"post":{"operationId":"TermTypes.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTermTypeV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TermTypeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create term type","tags":["Term Types"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","CONFLICT"],"x-required-scopes":["contracts:write"]}},"/v1/term-types/{id}":{"get":{"operationId":"TermTypes.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TermTypeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get term type by id","tags":["Term Types"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["contracts:read"]},"put":{"operationId":"TermTypes.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTermTypeV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TermTypeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update term type","tags":["Term Types"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["contracts:write"]},"delete":{"operationId":"TermTypes.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete term type","tags":["Term Types"],"x-error-codes":["NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["contracts:write"]}},"/v1/loans":{"get":{"operationId":"Loans.list","parameters":[{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["pending","active","matured","paid_off","defaulted","cancelled"]}},{"name":"loan_side","required":false,"in":"query","schema":{"type":"string","enum":["borrower","lender"]}},{"name":"counterparty_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"legal_entity_ids","required":false,"in":"query","description":"Narrow to loans of any of these legal entities. Comma-separated, or the parameter repeated.","schema":{"type":"array","items":{"type":"string","format":"uuid"}}},{"name":"view","required":false,"in":"query","description":"A preset view. `due_30`: the next payment is due on or before the org's today + 30 days (overdue ones included). `needs_attention`: a period is past due or not billed, or the loan is in default. `maturing_12m`: the loan matures on or before the org's today + 12 months and is not finished (matured, paid off, defaulted or cancelled).","schema":{"type":"string","enum":["due_30","needs_attention","maturing_12m"]}},{"name":"property_id","required":false,"in":"query","description":"Narrow to loans that have a participant row on this property. Matches whether or not the participant is current: a window that has already ended, and a participant whose release_status is released, both still match. This filter is deliberately not an as-of-today question, so its result set does not change with the calendar.","schema":{"format":"uuid","type":"string"}},{"name":"search","required":false,"in":"query","description":"Search loan name, loan number or counterparty name","schema":{"type":"string"}},{"name":"external_ref","required":false,"in":"query","description":"Exact match on the record's `external_ref` (another system's key); returns 0 or 1 row. Combines with the other filters.","schema":{"minLength":1,"maxLength":200,"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: next_payment_date","schema":{"enum":["created_at","-created_at","maturity_date","-maturity_date","loan_number","-loan_number","name","-name","next_payment_date","-next_payment_date","next_payment_amount","-next_payment_amount","counterparty_name","-counterparty_name"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List loans","tags":["Loans"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["loans:read"]},"post":{"operationId":"Loans.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLoanV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanIdV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: LOAN_PARTICIPANT_PROPERTY_NOT_ACTIVE, VALIDATION_FAILED, LOAN_COLLATERAL_REQUIRED, LOAN_COLLATERAL_CHOICE_INVALID, LOAN_COLLATERAL_LENDER_SIDE, LOAN_COLLATERAL_OWNER_MISMATCH, LOAN_CO_BORROWER_SHARES_NOT_HUNDRED, LOAN_CO_BORROWER_DUPLICATE, LOAN_CO_BORROWER_PAYING_BORROWER_MISSING, LOAN_CO_BORROWERS_LENDER_SIDE, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EXTERNAL_REF_TAKEN, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: MISSING_SYSTEM_ROLE_ACCOUNT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a loan","tags":["Loans"],"x-error-codes":["LOAN_PARTICIPANT_PROPERTY_NOT_ACTIVE","VALIDATION_FAILED","LOAN_COLLATERAL_REQUIRED","LOAN_COLLATERAL_CHOICE_INVALID","LOAN_COLLATERAL_LENDER_SIDE","LOAN_COLLATERAL_OWNER_MISMATCH","EXTERNAL_REF_TAKEN","LOAN_CO_BORROWER_SHARES_NOT_HUNDRED","LOAN_CO_BORROWER_DUPLICATE","LOAN_CO_BORROWER_PAYING_BORROWER_MISSING","LOAN_CO_BORROWERS_LENDER_SIDE","MISSING_SYSTEM_ROLE_ACCOUNT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["loans:write"]}},"/v1/loans/summary":{"get":{"description":"The five debt page cards over the loans the list filters select, finished loans (matured, paid off, defaulted, cancelled) excluded: cash to pay and to receive in the next 30 days (open periods due on or before the org's today + 30 that are not past due), past due, principal maturing within 12 months, and outstanding principal by side.","operationId":"Loans.summary","parameters":[{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["pending","active","matured","paid_off","defaulted","cancelled"]}},{"name":"loan_side","required":false,"in":"query","schema":{"type":"string","enum":["borrower","lender"]}},{"name":"legal_entity_ids","required":false,"in":"query","description":"Narrow to loans of any of these legal entities. Comma-separated, or the parameter repeated.","schema":{"type":"array","items":{"type":"string","format":"uuid"}}},{"name":"search","required":false,"in":"query","description":"Search loan name, loan number or counterparty name","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoansSummaryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Summarise loans for the debt page","tags":["Loans"],"x-error-codes":["VALIDATION_FAILED"],"x-required-scopes":["loans:read"]}},"/v1/loans/{id}":{"get":{"operationId":"Loans.getById","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a loan by id","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND"],"x-required-scopes":["loans:read"]},"patch":{"operationId":"Loans.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateLoanV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanIdV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: LOAN_COLLATERAL_RELEASED_NEEDS_END_DATE, LOAN_COLLATERAL_UNSECURED_CONFLICT, VALIDATION_FAILED, LOAN_PRINCIPAL_BASIS_IMMUTABLE, LOAN_COLLATERAL_LENDER_SIDE, LOAN_COLLATERAL_COVERAGE_GAP, LOAN_COLLATERAL_WINDOW_OUTSIDE_LOAN, LOAN_COLLATERAL_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_TERMS_REQUIRE_AMENDMENT, EXTERNAL_REF_TAKEN, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a loan","tags":["Loans"],"x-error-codes":["LOAN_COLLATERAL_RELEASED_NEEDS_END_DATE","LOAN_COLLATERAL_UNSECURED_CONFLICT","LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_PRINCIPAL_BASIS_IMMUTABLE","LOAN_TERMS_REQUIRE_AMENDMENT","LOAN_COLLATERAL_LENDER_SIDE","LOAN_COLLATERAL_COVERAGE_GAP","LOAN_COLLATERAL_WINDOW_OUTSIDE_LOAN","LOAN_COLLATERAL_REQUIRED","EXTERNAL_REF_TAKEN","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["loans:write"]},"delete":{"description":"Deletes a pending loan. A loan with swaps or caps is refused unless `?cascade=true`, which deletes them with it (marks and settlement schedules included); a hedge holding a recorded settlement blocks the delete either way.","operationId":"Loans.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cascade","required":false,"in":"query","description":"Delete the loan together with its swaps and caps, their fair-value marks and their settlement schedules, in one transaction. Omitted or false, a loan with any hedge is refused with LOAN_HAS_ACTIVE_HEDGES, whose `context.hedge_ids` names them. A hedge holding a recorded settlement is refused even with cascade=true (`context.cascade_allowed` false).","schema":{"type":"boolean"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_HAS_ACTIVE_HEDGES, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a loan","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_HAS_ACTIVE_HEDGES","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/activate":{"post":{"operationId":"Loans.activate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanScheduleCountV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, LOAN_COLLATERAL_REQUIRED, LOAN_COLLATERAL_NOT_LIVE_ON_DATE, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, PERIOD_LOCKED, PERIOD_CLOSED, NO_OPEN_PERIOD_FOR_CORRECTION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: MISSING_SYSTEM_ROLE_ACCOUNT, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Activate a loan and generate amortization schedule","tags":["Loans"],"x-error-codes":["MISSING_SYSTEM_ROLE_ACCOUNT","LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_COLLATERAL_REQUIRED","LOAN_COLLATERAL_NOT_LIVE_ON_DATE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_LOCKED","PERIOD_CLOSED","PERIOD_MISSING","NO_OPEN_PERIOD_FOR_CORRECTION","DIMENSION_REQUIRED"],"x-plannable":true,"x-required-scopes":["loans:activate"]}},"/v1/loans/{id}/drawdown":{"post":{"operationId":"Loans.drawdown","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DrawdownLoanV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanDrawdownResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, LOAN_COLLATERAL_REQUIRED, LOAN_COLLATERAL_NOT_LIVE_ON_DATE, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_REGENERATION_BLOCKED_BY_CURTAILMENT, IDEMPOTENCY_CONFLICT, PERIOD_LOCKED, PERIOD_CLOSED, NO_OPEN_PERIOD_FOR_CORRECTION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: MISSING_SYSTEM_ROLE_ACCOUNT, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record a loan drawdown (disbursement)","tags":["Loans"],"x-error-codes":["MISSING_SYSTEM_ROLE_ACCOUNT","LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_REGENERATION_BLOCKED_BY_CURTAILMENT","LOAN_COLLATERAL_REQUIRED","LOAN_COLLATERAL_NOT_LIVE_ON_DATE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_LOCKED","PERIOD_CLOSED","PERIOD_MISSING","NO_OPEN_PERIOD_FOR_CORRECTION","DIMENSION_REQUIRED"],"x-plannable":true,"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/payoff":{"post":{"operationId":"Loans.payoff","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayoffLoanV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanPayoffResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: LOAN_COLLATERAL_NOT_LIVE_ON_DATE, VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY, LOAN_PREPAYMENT_LOAN_NOT_ACTIVE, LOAN_PREPAYMENT_NOTHING_OUTSTANDING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_PREPAYMENT_LOCKED_OUT, IDEMPOTENCY_CONFLICT, PERIOD_LOCKED, PERIOD_CLOSED, LOAN_PERIOD_NOT_ACTIONABLE, LOAN_HAS_ACTIVE_HEDGES","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: MISSING_SYSTEM_ROLE_ACCOUNT, LOAN_PAYMENT_DATE_IN_FUTURE, LOAN_PREPAYMENT_BEFORE_ACCRUED_THROUGH, LOAN_PREPAYMENT_YIELD_REQUIRED, LOAN_PREPAYMENT_DEFEASANCE_COST_REQUIRED, LOAN_RATE_TERMS_MISSING, LOAN_PRINCIPAL_BASIS_UNAVAILABLE, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Pay off a loan (remaining principal + accrued interest + prepayment penalty)","tags":["Loans"],"x-error-codes":["LOAN_COLLATERAL_NOT_LIVE_ON_DATE","MISSING_SYSTEM_ROLE_ACCOUNT","LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_PAYMENT_DATE_IN_FUTURE","LOAN_PREPAYMENT_BEFORE_ACCRUED_THROUGH","LOAN_PREPAYMENT_LOCKED_OUT","LOAN_PREPAYMENT_YIELD_REQUIRED","LOAN_PREPAYMENT_DEFEASANCE_COST_REQUIRED","LOAN_RATE_TERMS_MISSING","LOAN_PRINCIPAL_BASIS_UNAVAILABLE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_LOCKED","PERIOD_CLOSED","PERIOD_MISSING","DIMENSION_REQUIRED","LOAN_PREPAYMENT_LOAN_NOT_ACTIVE","LOAN_PREPAYMENT_NOTHING_OUTSTANDING","LOAN_PERIOD_NOT_ACTIONABLE","LOAN_HAS_ACTIVE_HEDGES"],"x-plannable":true,"x-required-scopes":["loans:write"]}},"/v1/loans/accrual-events/generate":{"post":{"operationId":"Loans.generateAccruals","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanAccrualRunResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"summary":"Generate pending loan interest-accrual events for closed accounting periods","tags":["Loans"],"x-error-codes":["INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-internal":true,"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/participants":{"get":{"description":"Every participant configured on the loan, whatever its effective window — including windows that have already ended and ones that have not opened yet. This is deliberately not an as-of-today view: the PUT replaces the whole set, so a filtered read would make a read-modify-write silently delete the windows it could not see; for the same reason a caller that writes the set back must read it without `search` or `ids` and drain `meta.next_cursor`. Ordered by `effective_from`, then by id, by default.","operationId":"Loans.listParticipants","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: effective_from","schema":{"enum":["effective_from","-effective_from"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: participant_type, allocation_basis.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanParticipantV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a loan's participants","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["loans:read"]},"put":{"description":"REPLACES the whole set of collateral properties in one transaction — a row left out of the payload is removed — and, with `is_unsecured`, sets or clears the unsecured mark. Refused as a whole, leaving the existing set untouched, when: the loan is a lender loan; a property is not `active` or is owned by a legal entity other than the borrower; the live shares do not total exactly 100% wherever a row is live; the rows leave a day uncovered between the first window and maturity (or the last end date on an unsecured loan) — only days after the loan's `collateral_locked_through` count, so a loan made unsecured is secured again with a new window after the lock and `is_unsecured: false`; a window starts outside the loan's life; a `released` row has no `effective_to`; an unsecured loan keeps an open-ended row; or the set would rewrite a billed period or posted accrued interest (a new window starting on or before the loan's `collateral_locked_through`, or an end date before a locked due date the row was part of). An empty array on a borrower loan that is no longer pending needs `is_unsecured: true` in the same request. A participant a posted period froze cannot be removed, and its `share_pct`, `effective_from` and reference cannot change — close its window with `effective_to` instead. Returns the committed set.","operationId":"Loans.replaceParticipants","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutLoanParticipantsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanParticipantV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, LOAN_PARTICIPANT_FROZEN_ROW_REMOVED, LOAN_PARTICIPANT_FROZEN_ROW_IMMUTABLE, LOAN_PARTICIPANT_PROPERTY_NOT_ACTIVE, LOAN_COLLATERAL_OWNER_MISMATCH, LOAN_COLLATERAL_REQUIRED, LOAN_COLLATERAL_LENDER_SIDE, LOAN_COLLATERAL_COVERAGE_GAP, LOAN_COLLATERAL_WINDOW_OUTSIDE_LOAN, LOAN_COLLATERAL_RELEASED_NEEDS_END_DATE, LOAN_COLLATERAL_UNSECURED_CONFLICT, LOAN_COLLATERAL_BILLED_HISTORY, LOAN_CO_BORROWER_SHARES_NOT_HUNDRED, LOAN_CO_BORROWER_DUPLICATE, LOAN_CO_BORROWER_PAYING_BORROWER_MISSING, LOAN_CO_BORROWERS_LENDER_SIDE, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_CO_BORROWERS_LOCKED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: MISSING_SYSTEM_ROLE_ACCOUNT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace a loan's participants","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_PARTICIPANT_FROZEN_ROW_REMOVED","LOAN_PARTICIPANT_FROZEN_ROW_IMMUTABLE","LOAN_PARTICIPANT_PROPERTY_NOT_ACTIVE","LOAN_COLLATERAL_OWNER_MISMATCH","LOAN_COLLATERAL_REQUIRED","LOAN_COLLATERAL_LENDER_SIDE","LOAN_COLLATERAL_COVERAGE_GAP","LOAN_COLLATERAL_WINDOW_OUTSIDE_LOAN","LOAN_COLLATERAL_RELEASED_NEEDS_END_DATE","LOAN_COLLATERAL_UNSECURED_CONFLICT","LOAN_COLLATERAL_BILLED_HISTORY","LOAN_CO_BORROWER_SHARES_NOT_HUNDRED","LOAN_CO_BORROWER_DUPLICATE","LOAN_CO_BORROWER_PAYING_BORROWER_MISSING","LOAN_CO_BORROWERS_LOCKED","LOAN_CO_BORROWERS_LENDER_SIDE","MISSING_SYSTEM_ROLE_ACCOUNT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/prepayment-terms":{"get":{"description":"The windows, ordered by start_date by default. The PUT replaces the whole set: read it without `search` or `ids` and drain `meta.next_cursor` before writing it back.","operationId":"Loans.listPrepaymentTerms","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: start_date","schema":{"enum":["start_date","-start_date"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: description, provision_type.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanPrepaymentTermV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a loan's prepayment terms","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["loans:read"]},"put":{"description":"REPLACES the whole set in one transaction; an empty array clears it. Windows are inclusive of both dates and may not overlap (422 LOAN_PREPAYMENT_TERMS_OVERLAP). step_down needs penalty_pct (a percent: 2.0 = 2%); lockout and open must not carry one. Returns the committed set.","operationId":"Loans.replacePrepaymentTerms","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutLoanPrepaymentTermsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanPrepaymentTermV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_PREPAYMENT_TERMS_OVERLAP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace a loan's prepayment terms","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_PREPAYMENT_TERMS_OVERLAP","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/prepayment-quote":{"post":{"description":"Read-only. Prices the penalty from the loan prepayment terms and previews the regenerated schedule in memory. Refuses with the same codes the write would, except a lockout, which is reported as locked_out.","operationId":"Loans.prepaymentQuote","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoanPrepaymentQuoteV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanPrepaymentQuoteResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, LOAN_PREPAYMENT_LOAN_NOT_ACTIVE, LOAN_PREPAYMENT_NOTHING_OUTSTANDING, LOAN_PREPAYMENT_PRINCIPAL_NOT_POSITIVE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_PERIOD_NOT_ACTIONABLE, LOAN_ESCROW_DIMENSION_MISSING, LOAN_ESCROW_ROLE_ACCOUNT_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_PAYMENT_DATE_IN_FUTURE, LOAN_PREPAYMENT_BEFORE_ACCRUED_THROUGH, LOAN_PREPAYMENT_EXCEEDS_OUTSTANDING, LOAN_PREPAYMENT_YIELD_REQUIRED, LOAN_PREPAYMENT_DEFEASANCE_COST_REQUIRED, LOAN_PRINCIPAL_BASIS_UNAVAILABLE, LOAN_RATE_TERMS_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Quote a curtailment or a payoff","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_PAYMENT_DATE_IN_FUTURE","LOAN_PREPAYMENT_BEFORE_ACCRUED_THROUGH","LOAN_PERIOD_NOT_ACTIONABLE","LOAN_PREPAYMENT_EXCEEDS_OUTSTANDING","LOAN_PREPAYMENT_YIELD_REQUIRED","LOAN_PREPAYMENT_DEFEASANCE_COST_REQUIRED","LOAN_PRINCIPAL_BASIS_UNAVAILABLE","LOAN_RATE_TERMS_MISSING","LOAN_PREPAYMENT_LOAN_NOT_ACTIVE","LOAN_PREPAYMENT_NOTHING_OUTSTANDING","LOAN_PREPAYMENT_PRINCIPAL_NOT_POSITIVE","LOAN_ESCROW_DIMENSION_MISSING","LOAN_ESCROW_ROLE_ACCOUNT_MISSING"],"x-required-scopes":["loans:read"]}},"/v1/loans/{id}/prepayment":{"post":{"description":"Accrues interest through the date, posts a loan_prepayment (principal + penalty), regenerates the schedule (reduce_term by default) and records the prepayment. Interest to the date is billed on the next statement. Inside a lockout window it is refused (409 LOAN_PREPAYMENT_LOCKED_OUT) unless lockout_override_reason is sent; the reason is stored.","operationId":"Loans.prepay","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLoanPrepaymentV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanPrepaymentResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY, LOAN_PREPAYMENT_LOAN_NOT_ACTIVE, LOAN_PREPAYMENT_NOTHING_OUTSTANDING, LOAN_PREPAYMENT_PRINCIPAL_NOT_POSITIVE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_PERIOD_NOT_ACTIONABLE, LOAN_PREPAYMENT_LOCKED_OUT, IDEMPOTENCY_CONFLICT, PERIOD_LOCKED, PERIOD_CLOSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: MISSING_SYSTEM_ROLE_ACCOUNT, LOAN_PAYMENT_DATE_IN_FUTURE, LOAN_PREPAYMENT_BEFORE_ACCRUED_THROUGH, LOAN_PREPAYMENT_EXCEEDS_OUTSTANDING, LOAN_PREPAYMENT_YIELD_REQUIRED, LOAN_PREPAYMENT_DEFEASANCE_COST_REQUIRED, LOAN_PRINCIPAL_BASIS_UNAVAILABLE, LOAN_RATE_TERMS_MISSING, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record a curtailment (extra principal payment)","tags":["Loans"],"x-error-codes":["MISSING_SYSTEM_ROLE_ACCOUNT","LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_PAYMENT_DATE_IN_FUTURE","LOAN_PREPAYMENT_BEFORE_ACCRUED_THROUGH","LOAN_PERIOD_NOT_ACTIONABLE","LOAN_PREPAYMENT_EXCEEDS_OUTSTANDING","LOAN_PREPAYMENT_YIELD_REQUIRED","LOAN_PREPAYMENT_DEFEASANCE_COST_REQUIRED","LOAN_PREPAYMENT_LOCKED_OUT","LOAN_PRINCIPAL_BASIS_UNAVAILABLE","LOAN_RATE_TERMS_MISSING","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_LOCKED","PERIOD_CLOSED","PERIOD_MISSING","DIMENSION_REQUIRED","LOAN_PREPAYMENT_LOAN_NOT_ACTIVE","LOAN_PREPAYMENT_NOTHING_OUTSTANDING","LOAN_PREPAYMENT_PRINCIPAL_NOT_POSITIVE"],"x-plannable":true,"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/amendments":{"get":{"description":"Amendments on the loan, 100 per page; drain `meta.next_cursor` for the rest. Default sort is newest first (`-amendment_number`); ties break on id.","operationId":"Loans.listAmendments","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -amendment_number","schema":{"enum":["-amendment_number","amendment_number","effective_date","-effective_date"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: description, amendment_type.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanAmendmentV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a loan's amendments","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["loans:read"]},"post":{"description":"Records an amendment and, unless it is covenant_waiver or other, rebuilds the schedule from effective_date (billed or paid periods are kept). Amendments are immutable: undo one by recording another that restores the old values. effective_date must be on or before the org's today.","operationId":"Loans.createAmendment","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLoanAmendmentV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanAmendmentResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_AMENDMENT_LOAN_NOT_ACTIVE, LOAN_AMENDMENT_BEFORE_ACCRUED_THROUGH, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_AMENDMENT_EFFECTIVE_DATE_INVALID, LOAN_AMENDMENT_TERMS_INVALID, LOAN_RATE_TERMS_MISSING, LOAN_PRINCIPAL_BASIS_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record a loan amendment","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_AMENDMENT_LOAN_NOT_ACTIVE","LOAN_AMENDMENT_EFFECTIVE_DATE_INVALID","LOAN_AMENDMENT_TERMS_INVALID","LOAN_AMENDMENT_BEFORE_ACCRUED_THROUGH","LOAN_RATE_TERMS_MISSING","LOAN_PRINCIPAL_BASIS_UNAVAILABLE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/rate-history":{"get":{"description":"One row per interest period a rate reset priced: the period, the reading it was fixed from (`fix_date`, `index_type`), the index, spread and all-in rate, and the `basis` — `fixed` (a reading on or before the fix date, final), `projected` (in-arrears, the latest overnight reading held flat until the period closes) or `overnight_proxy` (a term-rate loan priced from overnight SOFR because no tenor reading was usable). Period 1 is never a reset, so its starting rate is not listed. 100 per page; drain `meta.next_cursor` for the rest. Default sort is oldest period first (`period_start`); ties break on id.","operationId":"Loans.listRateHistory","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: period_start","schema":{"enum":["period_start","-period_start"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: basis, index_type.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanRateHistoryV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a loan's rate resets","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["loans:read"]}},"/v1/loans/{id}/extension-options":{"get":{"description":"The options with derived state, is_live and notice dates, ordered by option_number by default. Only the lowest-numbered option that is neither exercised nor waived is live, judged across the whole set whatever `search` or `ids` narrows the page to. The PUT replaces the whole set: read it unfiltered and drain `meta.next_cursor` first.","operationId":"Loans.listExtensionOptions","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: option_number","schema":{"enum":["option_number","-option_number"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: conditions.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanExtensionOptionV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a loan's extension options","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["loans:read"]},"put":{"description":"REPLACES the whole set in one transaction; at most 10. Exercised and waived options are history: re-send them unchanged or get 409 LOAN_EXTENSION_OPTION_LOCKED. extended_maturity_date must increase with option_number and exceed the loan maturity (422 LOAN_EXTENSION_OPTIONS_INVALID). fee_rate is a decimal rate and informational. Returns the committed set.","operationId":"Loans.replaceExtensionOptions","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutLoanExtensionOptionsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanExtensionOptionV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_EXTENSION_OPTION_LOCKED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_EXTENSION_OPTIONS_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace a loan's extension options","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_EXTENSION_OPTIONS_INVALID","LOAN_EXTENSION_OPTION_LOCKED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/extension-options/{optionId}/exercise":{"post":{"description":"Records a maturity_extension amendment to the option extended_maturity_date, rebuilds the schedule and marks the option exercised, atomically. Only the live option can be exercised (409 LOAN_EXTENSION_OPTION_NOT_LIVE); a lapsed live option can still be exercised. An option whose extended_maturity_date is no longer after the loan maturity is refused (409 LOAN_EXTENSION_OPTION_NO_LONGER_EXTENDS); waive it to move on. Any refusal from the amendment path leaves the option unexercised.","operationId":"Loans.exerciseExtensionOption","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"optionId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExerciseLoanExtensionOptionV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanExtensionOptionExerciseResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_EXTENSION_OPTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_EXTENSION_OPTION_NOT_LIVE, LOAN_EXTENSION_OPTION_NO_LONGER_EXTENDS, LOAN_AMENDMENT_LOAN_NOT_ACTIVE, LOAN_AMENDMENT_BEFORE_ACCRUED_THROUGH, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_AMENDMENT_EFFECTIVE_DATE_INVALID, LOAN_AMENDMENT_TERMS_INVALID, LOAN_RATE_TERMS_MISSING, LOAN_PRINCIPAL_BASIS_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Exercise the live extension option","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_EXTENSION_OPTION_NOT_FOUND","LOAN_EXTENSION_OPTION_NOT_LIVE","LOAN_EXTENSION_OPTION_NO_LONGER_EXTENDS","LOAN_AMENDMENT_LOAN_NOT_ACTIVE","LOAN_AMENDMENT_EFFECTIVE_DATE_INVALID","LOAN_AMENDMENT_TERMS_INVALID","LOAN_AMENDMENT_BEFORE_ACCRUED_THROUGH","LOAN_RATE_TERMS_MISSING","LOAN_PRINCIPAL_BASIS_UNAVAILABLE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/extension-options/{optionId}/waive":{"post":{"description":"Marks the live option waived with a reason; the loan is unchanged and the next option becomes live. Only the live option can be waived (409 LOAN_EXTENSION_OPTION_NOT_LIVE).","operationId":"Loans.waiveExtensionOption","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"optionId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaiveLoanExtensionOptionV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanExtensionOptionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_EXTENSION_OPTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_EXTENSION_OPTION_NOT_LIVE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Waive the live extension option","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_EXTENSION_OPTION_NOT_FOUND","LOAN_EXTENSION_OPTION_NOT_LIVE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/delinquency-terms":{"get":{"description":"Grace days, the payment waterfall, the late fee and the default-rate uplift. A loan that never had terms set answers the defaults: grace_days 0; fees, interest, principal; late_fee_basis none with late_fee_cadence once; no default_rate_uplift.","operationId":"Loans.getDelinquencyTerms","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanDelinquencyTermsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a loan's delinquency terms","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND"],"x-required-scopes":["loans:read"]},"put":{"description":"Replaces the whole object (late_fee_basis and late_fee_cadence are required). payment_waterfall must name fees, interest and principal once each; late_fee_value is required for a fee basis and must be null for none (a pct_* value is a decimal fraction from 0 to 1, flat is money above 0); late_fee_cadence must be once when there is no fee; default_rate_uplift is from 0 to 1. Anything else is 400 VALIDATION_FAILED. Returns the stored terms.","operationId":"Loans.replaceDelinquencyTerms","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoanDelinquencyTermsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanDelinquencyTermsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace a loan's delinquency terms","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["loans:write"]}},"/v1/loans/{loanId}/schedule":{"get":{"description":"The hybrid ledger-and-projection view, served from the loan event spine. Rows left of the organization’s today carry the actual document that filled them and its variance; rows from today forward are projection. Live rows only unless `include_superseded` is set.","operationId":"Loans.getSchedule","parameters":[{"name":"loanId","required":true,"in":"path","schema":{"type":"string"}},{"name":"include_superseded","required":false,"in":"query","description":"Include rows a later schedule version replaced — the version toggle behind the interest-saved comparison. Default false.","schema":{"default":false,"type":"boolean"}},{"name":"include_hedges","required":false,"in":"query","description":"Also return the loan's hedge settlement rows (`source_instrument_type` `hedge`), interleaved by due date. Off by default: every other row is debt service. A hedge row is `paid` once a settlement is recorded, otherwise `scheduled` or `missed`; its debt-service figures (owed, settled, outstanding) are 0.00. Default false.","schema":{"default":false,"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanScheduleEntryV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get the amortization schedule for a loan","tags":["Loan Schedules"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["loans:read"]}},"/v1/loans/{loanId}/events":{"get":{"description":"One row per expected obligation — principal, interest, escrow and fees for each period — with a derived `state` saying where the slot stands. Live rows only unless `include_superseded` is set; `ids` returns those rows whether superseded or not. 100 per page, ordered by `due_date` then id; drain `meta.next_cursor` for the rest.","operationId":"Loans.getEvents","parameters":[{"name":"loanId","required":true,"in":"path","schema":{"type":"string"}},{"name":"include_superseded","required":false,"in":"query","description":"Include rows a later schedule version replaced. Default false — the live spine is what a caller almost always wants.","schema":{"default":false,"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: due_date","schema":{"enum":["due_date","-due_date"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: event_type.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanEventV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the event spine for a loan","tags":["Loan Schedules"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["loans:read"]}},"/v1/loans/{loanId}/schedule/regenerate":{"post":{"operationId":"Loans.regenerateSchedule","parameters":[{"name":"loanId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanScheduleCountV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_REGENERATION_BLOCKED_BY_CURTAILMENT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_PRINCIPAL_BASIS_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Regenerate amortization schedule from last processed period","tags":["Loan Schedules"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_PRINCIPAL_BASIS_UNAVAILABLE","LOAN_REGENERATION_BLOCKED_BY_CURTAILMENT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["loans:write"]}},"/v1/loans/documents/{documentId}/link":{"get":{"description":"The loan behind one document — a drawdown, an accrual, a debt-service bill or payment, or a co-borrower allocation — and its role on that loan. A co_borrower_allocation document also names the source document it allocates. 404 when the document is attached to no loan, or when the loan's or the document's legal entity is outside the caller's scope.","operationId":"Loans.getDocumentLink","parameters":[{"name":"documentId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanDocumentLinkV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_DOCUMENT_LINK_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get the loan a document belongs to","tags":["Loan Schedules"],"x-error-codes":["LOAN_DOCUMENT_LINK_NOT_FOUND","VALIDATION_FAILED"],"x-required-scopes":["loans:read"]}},"/v1/loans/{loanId}/documents":{"get":{"operationId":"Loans.listDocuments","parameters":[{"name":"loanId","required":true,"in":"path","schema":{"type":"string"}},{"name":"role","required":false,"in":"query","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanDocumentV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List documents linked to a loan","tags":["Loan Schedules"],"x-error-codes":["LOAN_NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["loans:read"]}},"/v1/loans/{id}/periods/{dueDate}":{"get":{"description":"The spine event for this due date, its actuals, the frozen participant shares it was actually split by, the accrual leg, the period's attention items and a read-time slot-integrity flag.","operationId":"Loans.getPeriod","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"dueDate","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanPeriodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get the period workspace for one due date","tags":["Loan Periods"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED"],"x-required-scopes":["loans:read"]}},"/v1/loans/{id}/periods/{dueDate}/bill":{"post":{"description":"Posts a debt_service_bill carrying the statement interest (once the period is due, the catch-up accrual posts first). The bill relieves accrued interest by exactly the statement figure: when it differs from what accrued for the period, the difference posts first as a loan_accrual statement adjustment against what accrued (to interest expense/income), dated no later than the due date. Voiding the bill voids that adjustment too. The payment is recorded with POST /v1/loans/{id}/payments. Refused while an earlier period is missed (no bill yet). Escrow posts per escrow at the statement's figures (escrow[]) or each escrow's deposit letter.","operationId":"Loans.recordPeriodStatement","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"dueDate","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordLoanStatementV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanPeriodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, LOAN_COLLATERAL_NOT_LIVE_ON_DATE, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_PERIOD_NOT_ACTIONABLE, LOAN_ESCROW_DIMENSION_MISSING, LOAN_ESCROW_ROLE_ACCOUNT_MISSING, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_PERIOD_HAS_NOTHING_TO_BILL, LOAN_ESCROW_STATEMENT_UNKNOWN_ESCROW","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record the lender statement for a period","tags":["Loan Periods"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_PERIOD_NOT_ACTIONABLE","LOAN_PERIOD_HAS_NOTHING_TO_BILL","LOAN_ESCROW_STATEMENT_UNKNOWN_ESCROW","LOAN_ESCROW_DIMENSION_MISSING","LOAN_ESCROW_ROLE_ACCOUNT_MISSING","LOAN_COLLATERAL_NOT_LIVE_ON_DATE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/actuals/{actualId}/void":{"post":{"description":"Voids the document behind one of the period's live actuals (the bill holding the slot, or a linked payment). A bill a payment still applies to is refused (TARGET_HAS_ACTIVE_APPLICATIONS): void the payment first.","operationId":"Loans.voidPeriodActual","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"actualId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoidLoanActualV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanPeriodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_ACTUAL_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_ACTUAL_NOT_ACTIVE, TARGET_HAS_ACTIVE_APPLICATIONS, DOCUMENT_ALREADY_VOIDED, DOCUMENT_RECONCILED_CANNOT_VOID, DOCUMENT_MATCHED_CANNOT_VOID, LOAN_ESCROW_CLOSED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DOCUMENT_VOID_REQUIRES_MEMO","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Void a period's live actual","tags":["Loan Periods"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_ACTUAL_NOT_FOUND","LOAN_ACTUAL_NOT_ACTIVE","TARGET_HAS_ACTIVE_APPLICATIONS","DOCUMENT_VOID_REQUIRES_MEMO","DOCUMENT_ALREADY_VOIDED","DOCUMENT_RECONCILED_CANNOT_VOID","DOCUMENT_MATCHED_CANNOT_VOID","LOAN_ESCROW_CLOSED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Voids a loan period's posted actual.","x-required-scopes":["loans:write"]}},"/v1/loans/{id}/payments":{"post":{"description":"Spreads one remittance oldest first over the periods due on or before today, each filled in the loan's payment-waterfall order (or by the lender's splits), and posts one debt_service_payment per period touched, in one transaction. A due period the nightly run has not billed is billed first, at the interest that accrued. Interest follows principal to payment_date: a later date accrues through it first; an earlier one posts a correcting accrual, voided with the payment. A period whose outstanding reaches 0 is settled. Periods not yet due are never touched: more than the due periods owe is refused — record extra principal as a prepayment. Refused when the payment reaches a due period that is moot (its documents were voided): re-record its statement first. A moot period the payment does not reach refuses nothing.","operationId":"Loans.recordPayment","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordLoanPaymentV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanPaymentResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, LOAN_COLLATERAL_NOT_LIVE_ON_DATE, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_PERIOD_NOT_ACTIONABLE, PERIOD_CLOSED, PERIOD_LOCKED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: MISSING_SYSTEM_ROLE_ACCOUNT, LOAN_PAYMENT_EXCEEDS_OUTSTANDING, LOAN_PAYMENT_SPLIT_INVALID, LOAN_PAYMENT_DATE_IN_FUTURE, LOAN_PAYMENT_BEFORE_ORIGINATION, LOAN_RATE_TERMS_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record a loan payment","tags":["Loans"],"x-error-codes":["MISSING_SYSTEM_ROLE_ACCOUNT","LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_PERIOD_NOT_ACTIONABLE","LOAN_PAYMENT_EXCEEDS_OUTSTANDING","LOAN_PAYMENT_SPLIT_INVALID","LOAN_PAYMENT_DATE_IN_FUTURE","LOAN_PAYMENT_BEFORE_ORIGINATION","LOAN_RATE_TERMS_MISSING","PERIOD_CLOSED","PERIOD_LOCKED","PERIOD_MISSING","LOAN_COLLATERAL_NOT_LIVE_ON_DATE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/payments/preview":{"get":{"description":"Read-only: the allocation POST /payments would post for this amount and date, with what the due periods still owe — the payment dialog pre-fill. Refuses with the same codes the write would. A due period with no bill yet is priced at its scheduled interest (expected_interest); recording bills it at the interest that accrued.","operationId":"Loans.previewPayment","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"amount","required":true,"in":"query","description":"The remittance to allocate.","schema":{"example":"1234.50","type":"string"}},{"name":"payment_date","required":true,"in":"query","description":"Cash value date: on or after the loan's origination date and on or before the org's today. It may be before a due date (cash paid early): the periods filled are those due on or before the org's today, and interest is corrected to this date.","schema":{"format":"date","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanPaymentPreviewV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_PERIOD_NOT_ACTIONABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_PAYMENT_EXCEEDS_OUTSTANDING, LOAN_PAYMENT_DATE_IN_FUTURE, LOAN_PAYMENT_BEFORE_ORIGINATION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview how a loan payment would be allocated","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_PERIOD_NOT_ACTIONABLE","LOAN_PAYMENT_EXCEEDS_OUTSTANDING","LOAN_PAYMENT_DATE_IN_FUTURE","LOAN_PAYMENT_BEFORE_ORIGINATION"],"x-required-scopes":["loans:read"]}},"/v1/loans/{id}/periods/{dueDate}/late-fee":{"post":{"description":"Posts a late fee (a debt_service_bill in the late_fee role) for the period's CURRENT window — `once`, the latest month (`m<k>`) or the latest billing period (`p0` / `p:<due date>`), per the loan’s late_fee_cadence — dated that window’s date. The period must be past due. Refused when the window already has a charged fee (waive it first); a window that was waived may be charged again this way. Answers the reloaded period.","operationId":"Loans.recordLateFee","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"dueDate","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordLoanLateFeeV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanPeriodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_PERIOD_NOT_ACTIONABLE, LOAN_PERIOD_NOT_PAST_DUE, LOAN_LATE_FEE_WINDOW_CHARGED, PERIOD_CLOSED, PERIOD_LOCKED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Enter the lender's late fee for a period","tags":["Loan Periods"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_PERIOD_NOT_ACTIONABLE","LOAN_PERIOD_NOT_PAST_DUE","LOAN_LATE_FEE_WINDOW_CHARGED","PERIOD_CLOSED","PERIOD_LOCKED","PERIOD_MISSING","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/late-fees/{documentId}/waive":{"post":{"description":"Needs admin:loans — org owners/admins and Spark staff; an accountant, clerk or viewer is refused. Waiving voids the fee document — it stays in history with its reversal — and marks its assessment waived; a waived window is never charged again by the daily job. This is the only way a late fee is cancelled: every void door refuses a fee with LOAN_LATE_FEE_WAIVE_REQUIRED. A fee a payment applies to is refused (TARGET_HAS_ACTIVE_APPLICATIONS): void the payment first. `stop_future: true` also stops every later window for this one period (the exemption). Answers the reloaded period.","operationId":"Loans.waiveLateFee","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"documentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaiveLoanLateFeeV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanPeriodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_LATE_FEE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_LATE_FEE_ALREADY_WAIVED, TARGET_HAS_ACTIVE_APPLICATIONS, DOCUMENT_ALREADY_VOIDED, DOCUMENT_RECONCILED_CANNOT_VOID, DOCUMENT_MATCHED_CANNOT_VOID, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Waive a late fee","tags":["Loan Periods"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","LOAN_LATE_FEE_NOT_FOUND","LOAN_LATE_FEE_ALREADY_WAIVED","TARGET_HAS_ACTIVE_APPLICATIONS","DOCUMENT_ALREADY_VOIDED","DOCUMENT_RECONCILED_CANNOT_VOID","DOCUMENT_MATCHED_CANNOT_VOID","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["admin:loans"]}},"/v1/loans/{id}/periods/{dueDate}/late-fee-exemption":{"post":{"description":"Needs admin:loans — org owners/admins and Spark staff; an accountant, clerk or viewer is refused. Stops every later late-fee window for this one period; fees already charged stay (waive them separately). Repeating it replaces the note.","operationId":"Loans.createLateFeeExemption","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"dueDate","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLoanLateFeeExemptionV1Dto"}}}},"responses":{"204":{"description":"The period is exempt."},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Stop later late fees for a period","tags":["Loan Periods"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["admin:loans"]},"delete":{"description":"Needs admin:loans — org owners/admins and Spark staff; an accountant, clerk or viewer is refused. Removes the period's exemption: the daily job charges from the NEXT window not yet assessed. A waived window is never charged again.","operationId":"Loans.removeLateFeeExemption","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"dueDate","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"204":{"description":"The exemption is removed (or there was none)."},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Resume late fees for a period","tags":["Loan Periods"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","INSUFFICIENT_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["admin:loans"]}},"/v1/loans/{id}/default":{"post":{"description":"Opens a default window from declared_on. From that day every accrual adds principal × the default uplift × days; the uplift comes from the loan's delinquency terms (default_rate_uplift) at declaration and stays with the window. declared_on may be in the past — a catch-up loan_accrual is posted at once for the days already accrued, on the principal outstanding on each day, dated the accrued-through date — but not in the future, not before origination, and not before the loan's latest cure (windows never overlap). Refused while the loan is already in default, when the terms carry no uplift, and for a loan that is not active.","operationId":"Loans.declareDefault","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeclareLoanDefaultV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanDefaultStatusV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_DEFAULT_LOAN_NOT_ACTIVE, PERIOD_CLOSED, PERIOD_LOCKED, IDEMPOTENCY_CONFLICT, LOAN_ALREADY_IN_DEFAULT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_DEFAULT_DATE_INVALID, LOAN_RATE_TERMS_MISSING, LOAN_DEFAULT_UPLIFT_NOT_SET","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Declare a loan in default","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_DEFAULT_LOAN_NOT_ACTIVE","LOAN_DEFAULT_DATE_INVALID","LOAN_RATE_TERMS_MISSING","PERIOD_CLOSED","PERIOD_LOCKED","PERIOD_MISSING","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LOAN_ALREADY_IN_DEFAULT","LOAN_DEFAULT_UPLIFT_NOT_SET"],"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/default/cure":{"post":{"description":"Closes the open default window on cured_on, the first day no longer in default. cured_on may be in the past — the uplift already accrued for the days from it is taken back at once (a negative loan_accrual at the window's own uplift, dated the accrued-through date) — but not in the future and not before declared_on; equal to declared_on withdraws the default (no uplift at all). Refused when the loan is not in default and for a loan that is not active.","operationId":"Loans.cureDefault","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CureLoanDefaultV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanDefaultStatusV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_DEFAULT_LOAN_NOT_ACTIVE, PERIOD_CLOSED, PERIOD_LOCKED, IDEMPOTENCY_CONFLICT, LOAN_NOT_IN_DEFAULT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_DEFAULT_DATE_INVALID, LOAN_RATE_TERMS_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Cure a loan default","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_DEFAULT_LOAN_NOT_ACTIVE","LOAN_DEFAULT_DATE_INVALID","LOAN_RATE_TERMS_MISSING","PERIOD_CLOSED","PERIOD_LOCKED","PERIOD_MISSING","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LOAN_NOT_IN_DEFAULT"],"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/escrows":{"get":{"description":"Every escrow (active and closed) with its current deposit, letters, balance from the GL, funded balance (deposits whose bill is paid) and shortfall flag. Oldest first (`created_at`) by default.","operationId":"Loans.listEscrows","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: created_at","schema":{"enum":["created_at","-created_at","name","-name"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: name, escrow_type.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanEscrowV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_ESCROW_DIMENSION_MISSING, LOAN_ESCROW_ROLE_ACCOUNT_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a loan's escrows","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","LOAN_ESCROW_DIMENSION_MISSING","LOAN_ESCROW_ROLE_ACCOUNT_MISSING","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["loans:read"]},"post":{"description":"Creates the escrow with its first deposit letter and re-prices every unbilled period due on or after the letter's effective_date (repriced_periods says how many changed). Billed periods keep the escrow their bill carried.","operationId":"Loans.createEscrow","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLoanEscrowV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanEscrowChangeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_ESCROW_DIMENSION_MISSING, LOAN_ESCROW_ROLE_ACCOUNT_MISSING, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_ESCROW_DEPOSIT_BEFORE_BILLED, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, LOAN_ESCROW_ACCOUNT_NOT_ALLOWED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add an escrow to a loan","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_ESCROW_DIMENSION_MISSING","LOAN_ESCROW_ROLE_ACCOUNT_MISSING","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LOAN_ESCROW_DEPOSIT_BEFORE_BILLED","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","LOAN_ESCROW_ACCOUNT_NOT_ALLOWED"],"x-plannable":true,"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/escrows/{escrowId}":{"patch":{"description":"Name, minimum balance, and the account override — the account only while no journal line carries the escrow. Deposits change through POST …/deposits.","operationId":"Loans.updateEscrow","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"escrowId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateLoanEscrowV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanEscrowChangeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_ESCROW_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_ESCROW_DIMENSION_MISSING, LOAN_ESCROW_ROLE_ACCOUNT_MISSING, IDEMPOTENCY_CONFLICT, LOAN_ESCROW_CLOSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, LOAN_ESCROW_ACCOUNT_NOT_ALLOWED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Edit an escrow","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_ESCROW_DIMENSION_MISSING","LOAN_ESCROW_ROLE_ACCOUNT_MISSING","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LOAN_ESCROW_NOT_FOUND","LOAN_ESCROW_CLOSED","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","LOAN_ESCROW_ACCOUNT_NOT_ALLOWED"],"x-plannable":true,"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/escrows/{escrowId}/deposits":{"post":{"description":"The lender's new monthly deposit from effective_date on (the annual escrow analysis). Re-prices every unbilled period due on or after it; refused before the latest billed due date. A letter for a date that already has one replaces it.","operationId":"Loans.addEscrowDeposit","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"escrowId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddLoanEscrowDepositV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanEscrowChangeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_ESCROW_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_ESCROW_DIMENSION_MISSING, LOAN_ESCROW_ROLE_ACCOUNT_MISSING, IDEMPOTENCY_CONFLICT, LOAN_ESCROW_CLOSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_ESCROW_DEPOSIT_BEFORE_BILLED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record a new escrow deposit letter","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_ESCROW_DIMENSION_MISSING","LOAN_ESCROW_ROLE_ACCOUNT_MISSING","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LOAN_ESCROW_NOT_FOUND","LOAN_ESCROW_CLOSED","LOAN_ESCROW_DEPOSIT_BEFORE_BILLED"],"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/escrows/{escrowId}/close":{"post":{"description":"Only at a zero balance (409 LOAN_ESCROW_NOT_EMPTY), and closed_at must fall strictly after the latest billed due date (422 LOAN_ESCROW_CLOSE_BEFORE_BILLED), and no unbilled period due before closed_at may still owe it a deposit (422 LOAN_ESCROW_CLOSE_LEAVES_UNBILLED_DEPOSIT). Prices no deposit from closed_at; unbilled periods from that date are re-priced.","operationId":"Loans.closeEscrow","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"escrowId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseLoanEscrowV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanEscrowChangeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_ESCROW_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_ESCROW_DIMENSION_MISSING, LOAN_ESCROW_ROLE_ACCOUNT_MISSING, IDEMPOTENCY_CONFLICT, LOAN_ESCROW_CLOSED, LOAN_ESCROW_NOT_EMPTY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_ESCROW_CLOSE_BEFORE_BILLED, LOAN_ESCROW_CLOSE_LEAVES_UNBILLED_DEPOSIT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Close an escrow","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_ESCROW_DIMENSION_MISSING","LOAN_ESCROW_ROLE_ACCOUNT_MISSING","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LOAN_ESCROW_NOT_FOUND","LOAN_ESCROW_CLOSED","LOAN_ESCROW_NOT_EMPTY","LOAN_ESCROW_CLOSE_BEFORE_BILLED","LOAN_ESCROW_CLOSE_LEAVES_UNBILLED_DEPOSIT"],"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/escrows/{escrowId}/disbursements":{"post":{"description":"The lender paid a tax or insurance bill from escrow: with bill_document_id a payment from the escrow account is applied to that AP bill (the bill closes, the expense stays where the bill booked it); with expense_account_id (no bill in the books) DR expense / CR escrow. Recorded after the fact, so it skips approval. Refused when it would take the escrow below zero. A lender records its disbursement through …/movements.","operationId":"Loans.recordEscrowDisbursement","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"escrowId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLoanEscrowDisbursementV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanEscrowMovementResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PERIOD_OVERRIDE_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_ESCROW_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_ESCROW_DIMENSION_MISSING, LOAN_ESCROW_ROLE_ACCOUNT_MISSING, IDEMPOTENCY_CONFLICT, LOAN_ESCROW_CLOSED, PERIOD_CLOSED, PERIOD_LOCKED, DOCUMENT_HELD_BY_PAYMENT_RUN, DOCUMENT_STATUS_FORBIDS_ACTION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_ESCROW_INSUFFICIENT_BALANCE, LOAN_ESCROW_MOVEMENT_KIND_NOT_ALLOWED, LOAN_ESCROW_OFFSET_ACCOUNT_INVALID, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, LOAN_ESCROW_BILL_NOT_PAYABLE, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record a disbursement from a borrower escrow","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_ESCROW_DIMENSION_MISSING","LOAN_ESCROW_ROLE_ACCOUNT_MISSING","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LOAN_ESCROW_NOT_FOUND","LOAN_ESCROW_CLOSED","LOAN_ESCROW_INSUFFICIENT_BALANCE","LOAN_ESCROW_MOVEMENT_KIND_NOT_ALLOWED","LOAN_ESCROW_OFFSET_ACCOUNT_INVALID","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_CLOSED","PERIOD_LOCKED","PERIOD_MISSING","PERIOD_OVERRIDE_FORBIDDEN","LOAN_ESCROW_BILL_NOT_PAYABLE","DOCUMENT_HELD_BY_PAYMENT_RUN","DOCUMENT_STATUS_FORBIDS_ACTION","DIMENSION_REQUIRED"],"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/escrows/{escrowId}/movements":{"post":{"description":"draw / refund (cash back from a reserve or a surplus), interest, opening_balance, adjustment (either direction, may go negative), and a lender's disbursement. A draw, refund or lender disbursement on a bank's cash account must send bank_transaction_id: the entry posts on that bank's cash account and the bank line is matched by the same act. Recorded after the fact, so it skips approval.","operationId":"Loans.recordEscrowMovement","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"escrowId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLoanEscrowMovementV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanEscrowMovementResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: PERIOD_OVERRIDE_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_ESCROW_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_ESCROW_DIMENSION_MISSING, LOAN_ESCROW_ROLE_ACCOUNT_MISSING, IDEMPOTENCY_CONFLICT, LOAN_ESCROW_CLOSED, PERIOD_CLOSED, PERIOD_LOCKED, BANK_LINE_EXCLUDED, BANK_LINE_ALREADY_MATCHED, BANK_LINE_REMOVED_BY_PROVIDER","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_ESCROW_INSUFFICIENT_BALANCE, LOAN_ESCROW_MOVEMENT_KIND_NOT_ALLOWED, LOAN_ESCROW_OFFSET_ACCOUNT_INVALID, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, LOAN_ESCROW_BANK_LINE_REQUIRED, LOAN_ESCROW_BANK_LINE_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record an escrow movement","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_ESCROW_DIMENSION_MISSING","LOAN_ESCROW_ROLE_ACCOUNT_MISSING","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LOAN_ESCROW_NOT_FOUND","LOAN_ESCROW_CLOSED","LOAN_ESCROW_INSUFFICIENT_BALANCE","LOAN_ESCROW_MOVEMENT_KIND_NOT_ALLOWED","LOAN_ESCROW_OFFSET_ACCOUNT_INVALID","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_CLOSED","PERIOD_LOCKED","PERIOD_MISSING","PERIOD_OVERRIDE_FORBIDDEN","LOAN_ESCROW_BANK_LINE_REQUIRED","LOAN_ESCROW_BANK_LINE_INVALID","BANK_LINE_EXCLUDED","BANK_LINE_ALREADY_MATCHED","BANK_LINE_REMOVED_BY_PROVIDER"],"x-required-scopes":["loans:write"]},"get":{"description":"Every document that moved the escrow (its tagged lines on the escrow's account): deposits from period bills and recorded movements, newest first, signed (+ in), with the running balance after each (a voided movement counts zero) and whether it can be voided here.","operationId":"Loans.listEscrowMovements","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"escrowId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanEscrowMovementV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_ESCROW_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_ESCROW_DIMENSION_MISSING, LOAN_ESCROW_ROLE_ACCOUNT_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List an escrow's movements","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","LOAN_ESCROW_NOT_FOUND","LOAN_ESCROW_DIMENSION_MISSING","LOAN_ESCROW_ROLE_ACCOUNT_MISSING","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["loans:read"]}},"/v1/loans/{id}/escrows/{escrowId}/movements/{movementId}/void":{"post":{"description":"Reverses a recorded movement (movementId = its document_id from …/movements). Its bank line, if any, goes back to the bank feed; a payment of a bill is unapplied and the bill reopens. A deposit is voided with its period bill, not here. The void may leave the escrow negative. The generic POST /v1/documents/{id}/void refuses these documents (LOAN_ESCROW_MOVEMENT_HELD).","operationId":"Loans.voidEscrowMovement","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"escrowId","required":true,"in":"path","schema":{"type":"string"}},{"name":"movementId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoidLoanEscrowMovementV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanEscrowMovementResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_ESCROW_NOT_FOUND, LOAN_ESCROW_MOVEMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: LOAN_ESCROW_DIMENSION_MISSING, LOAN_ESCROW_ROLE_ACCOUNT_MISSING, IDEMPOTENCY_CONFLICT, DOCUMENT_ALREADY_VOIDED, DOCUMENT_RECONCILED_CANNOT_VOID, PERIOD_LOCKED, NO_OPEN_PERIOD_FOR_CORRECTION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Void an escrow movement","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","LOAN_ESCROW_DIMENSION_MISSING","LOAN_ESCROW_ROLE_ACCOUNT_MISSING","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LOAN_ESCROW_NOT_FOUND","LOAN_ESCROW_MOVEMENT_NOT_FOUND","DOCUMENT_ALREADY_VOIDED","DOCUMENT_RECONCILED_CANNOT_VOID","PERIOD_LOCKED","NO_OPEN_PERIOD_FOR_CORRECTION"],"x-high-risk":true,"x-high-risk-reason":"Voids an escrow movement and its ledger entry.","x-required-scopes":["loans:write"]}},"/v1/loans/{id}/escrows/{escrowId}/payable-bills":{"get":{"description":"Open, posted AP bills of the loan's legal entity and currency, for paying from escrow. Bills tagged with one of the loan's collateral properties come first, then by due date. source_hint names the property-tax or insurance module that raised a bill.","operationId":"Loans.listEscrowPayableBills","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"escrowId","required":true,"in":"path","schema":{"type":"string"}},{"name":"search","required":false,"in":"query","description":"Matches the bill number or the vendor name.","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanEscrowPayableBillV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_ESCROW_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List bills an escrow can pay","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","LOAN_ESCROW_NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["loans:read"]}},"/v1/loans/{id}/hedges":{"get":{"description":"Every swap and cap on the loan (active, terminated and expired) with its latest fair-value mark. Oldest first (`created_at`) by default.","operationId":"Loans.listHedges","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: created_at","schema":{"enum":["created_at","-created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: reference, instrument_type.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanHedgeV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a loan's hedges","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["loans:read"]},"post":{"description":"Floating-rate borrower loans only (422 LOAN_HEDGE_NOT_SUPPORTED otherwise, with the reason). On an active loan the hedge's settlement periods are written to the loan's event spine at once, projected at the latest index reading; on a pending loan at activation. settlement_day defaults to the loan payment day; tracking_start_date to effective_date, or the start of the legal entity's first open period after it.","operationId":"Loans.createHedge","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLoanHedgeV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanHedgeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_HEDGE_NOT_SUPPORTED, LOAN_HEDGE_INVALID_TERMS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a swap or cap to a loan","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LOAN_HEDGE_NOT_SUPPORTED","LOAN_HEDGE_INVALID_TERMS"],"x-plannable":true,"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/hedges/{hedgeId}":{"patch":{"description":"reference, counterparty_id and notes are always editable. Any economic term only while the hedge is active and no settlement has been recorded against it (409 LOAN_HEDGE_TERMS_LOCKED); such a change re-projects every unfilled settlement row. The cancellation terms (cancellation_style, cancellation_holder, first_call_date, call_frequency, notice_business_days) are not economic: editable while the hedge is active, even after settlements, and they re-project nothing. Setting cancellation_style 'none' clears the other four.","operationId":"Loans.updateHedge","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"hedgeId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateLoanHedgeV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanHedgeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_HEDGE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, LOAN_HEDGE_TERMS_LOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_HEDGE_NOT_SUPPORTED, LOAN_HEDGE_INVALID_TERMS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Edit a hedge","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LOAN_HEDGE_NOT_FOUND","LOAN_HEDGE_NOT_SUPPORTED","LOAN_HEDGE_INVALID_TERMS","LOAN_HEDGE_TERMS_LOCKED"],"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/hedges/{hedgeId}/move":{"post":{"description":"The refinance case: re-points an active hedge at another active floating borrower loan of the same legal entity. Unfilled settlement rows due after effective_on leave this loan and are regenerated on the new one; recorded settlements stay where they were booked.","operationId":"Loans.moveHedge","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"hedgeId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveLoanHedgeV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanHedgeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_HEDGE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, LOAN_HEDGE_TERMS_LOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_HEDGE_NOT_SUPPORTED, LOAN_HEDGE_INVALID_TERMS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Move a hedge to another loan","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LOAN_HEDGE_NOT_FOUND","LOAN_HEDGE_NOT_SUPPORTED","LOAN_HEDGE_INVALID_TERMS","LOAN_HEDGE_TERMS_LOCKED"],"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/hedges/{hedgeId}/settlements":{"post":{"description":"Books one settlement period from the bank's advice: a hedge_settlement document (+ amount: DR hedge expense / CR loan clearing; − amount: the reverse), split across the securing properties, on the loan that holds the period. The period then reads filled; variance = amount − expected_amount. Void it through the document void endpoint to record it again.","operationId":"Loans.recordHedgeSettlement","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"hedgeId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordLoanHedgeSettlementV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanHedgeSettlementV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_HEDGE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, LOAN_HEDGE_SETTLEMENT_ALREADY_RECORDED, PERIOD_CLOSED, PERIOD_LOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_HEDGE_INVALID_TERMS, LOAN_HEDGE_SETTLEMENT_ROW_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record a hedge settlement","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LOAN_HEDGE_NOT_FOUND","LOAN_HEDGE_INVALID_TERMS","LOAN_HEDGE_SETTLEMENT_ROW_INVALID","LOAN_HEDGE_SETTLEMENT_ALREADY_RECORDED","PERIOD_CLOSED","PERIOD_LOCKED","PERIOD_MISSING"],"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/hedges/{hedgeId}/terminate":{"post":{"description":"Ends an active hedge on terminated_on. A cap first amortizes its premium through that date, then one hedge_termination document books the termination amount against the termination gain/loss account and writes off the unamortized premium. Unfilled settlement rows due after terminated_on are superseded; recorded ones stay. Refused while amortization is posted for a month ending after terminated_on (void it first). Void the termination document to restore the hedge.","operationId":"Loans.terminateHedge","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"hedgeId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TerminateLoanHedgeV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanHedgeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_HEDGE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, LOAN_HEDGE_TERMS_LOCKED, PERIOD_CLOSED, PERIOD_LOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_HEDGE_INVALID_TERMS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Terminate a hedge early","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LOAN_HEDGE_NOT_FOUND","LOAN_HEDGE_INVALID_TERMS","LOAN_HEDGE_TERMS_LOCKED","PERIOD_CLOSED","PERIOD_LOCKED","PERIOD_MISSING"],"x-required-scopes":["loans:write"]}},"/v1/loans/{id}/hedges/{hedgeId}/marks":{"get":{"description":"One mark per as_of_date, newest first (`-as_of_date`) by default. fair_value is signed: + an asset, − a liability.","operationId":"Loans.listHedgeMarks","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"hedgeId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -as_of_date","schema":{"enum":["-as_of_date","as_of_date"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: note, source.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LoanHedgeMarkV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_HEDGE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a hedge's fair-value marks","tags":["Loans"],"x-error-codes":["LOAN_HEDGE_NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["loans:read"]},"post":{"description":"The bank's mark-to-market on as_of_date (signed: + an asset, − a liability). A second mark for the same date replaces the first. Informational: nothing posts.","operationId":"Loans.recordHedgeMark","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"hedgeId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertLoanHedgeMarkV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LoanHedgeMarkV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: LOAN_NOT_FOUND, LOAN_HEDGE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOAN_HEDGE_INVALID_TERMS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record a hedge's fair value","tags":["Loans"],"x-error-codes":["LOAN_NOT_FOUND","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LOAN_HEDGE_NOT_FOUND","LOAN_HEDGE_INVALID_TERMS"],"x-required-scopes":["loans:write"]}},"/v1/reference-rates":{"get":{"operationId":"ReferenceRates.list","parameters":[{"name":"index_type","required":false,"in":"query","schema":{"type":"string","enum":["sofr","sofr_1m","sofr_3m","sofr_6m","prime","treasury","cpi","other"]}},{"name":"from_date","required":false,"in":"query","description":"Filter rates on or after this date.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Filter rates on or before this date.","schema":{"format":"date","type":"string"}},{"name":"date_from","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `from_date` (filter rates on or after this date).","schema":{"format":"date","type":"string"}},{"name":"date_to","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `to_date` (filter rates on or before this date).","schema":{"format":"date","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -rate_date","schema":{"enum":["rate_date","-rate_date","index_type","-index_type","created_at","-created_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ReferenceRateV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List reference rates","tags":["Reference Rates"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["loans:rates"]},"post":{"description":"Records a manually-entered reading for an index series. Refused with 403 REFERENCE_SERIES_FEED_OWNED when the series is catalogued with an automated-feed source (for example CPI from the BLS): reference rates have no org_id, so one org writing a feed-owned reading would move every other org's proposals. A series with no catalog row, or a catalog row whose source is `manual`, still accepts a hand entry.","operationId":"ReferenceRates.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateReferenceRateV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReferenceRateIdV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY, REFERENCE_RATE_OUT_OF_RANGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: REFERENCE_SERIES_FEED_OWNED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record a reference rate","tags":["Reference Rates"],"x-error-codes":["VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","REFERENCE_SERIES_FEED_OWNED","REFERENCE_RATE_OUT_OF_RANGE"],"x-required-scopes":["loans:rates"]}},"/v1/reference-rate-series":{"get":{"description":"The catalog of published indexes an escalation clause can reference. Use a row's `id` (a UUID) as a clause's `series_id`; the row's own `series_id` field is the publisher code and is for display only. Retired series are included and carry `retired_at`.","operationId":"ReferenceRateSeries.list","parameters":[{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: display_name","schema":{"enum":["display_name","-display_name"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ReferenceRateSeriesV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List reference rate series","tags":["Reference Rates"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["contracts:read"]}},"/v1/budgets":{"post":{"operationId":"createBudget","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBudgetV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BudgetV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a budget and its version 1 (original, draft)","tags":["budgets"],"x-error-codes":["VALIDATION_FAILED","CONFLICT","NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["budgets:write"]},"get":{"operationId":"listBudgets","parameters":[{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BudgetV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List budgets","tags":["budgets"],"x-error-codes":["INVALID_CURSOR"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["budgets:read"]}},"/v1/budgets/{id}":{"get":{"operationId":"getBudget","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BudgetDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a budget with all of its versions","tags":["budgets"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["budgets:read"]}},"/v1/budgets/{id}/versions":{"post":{"operationId":"createBudgetVersion","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBudgetVersionV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BudgetVersionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a reforecast version, blank or cloned from an existing version","tags":["budgets"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["budgets:write"]}},"/v1/budgets/versions/{id}/submit":{"post":{"operationId":"submitBudgetVersion","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BudgetVersionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: INVALID_STATE_TRANSITION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Submit a draft budget version for approval","tags":["budgets"],"x-error-codes":["NOT_FOUND","INVALID_STATE_TRANSITION","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["budgets:write"]}},"/v1/budgets/versions/{id}/approve":{"post":{"operationId":"approveBudgetVersion","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BudgetVersionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: INVALID_STATE_TRANSITION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Approve a submitted budget version","tags":["budgets"],"x-error-codes":["NOT_FOUND","INVALID_STATE_TRANSITION","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["budgets:write"]}},"/v1/budgets/versions/{id}/archive":{"post":{"operationId":"archiveBudgetVersion","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BudgetVersionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: INVALID_STATE_TRANSITION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Archive a draft, submitted, or approved budget version","tags":["budgets"],"x-error-codes":["NOT_FOUND","INVALID_STATE_TRANSITION","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["budgets:write"]}},"/v1/budgets/versions/{id}/activate":{"post":{"operationId":"activateBudgetVersion","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BudgetVersionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: INVALID_STATE_TRANSITION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Activate an approved budget version, superseding whatever version currently holds any of its fiscal years","tags":["budgets"],"x-error-codes":["NOT_FOUND","INVALID_STATE_TRANSITION","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["budgets:write"]}},"/v1/budgets/versions/{id}/grid":{"get":{"operationId":"getBudgetGrid","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"fiscal_year","required":true,"in":"query","description":"Fiscal year to render, within the version budget span.","schema":{"example":2027,"type":"number"}},{"name":"property_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"all","required":false,"in":"query","description":"Roll up across every property + unassigned.","schema":{"type":"string","enum":["true","false"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BudgetGridV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a budget version's P&L grid for one fiscal year and scope","tags":["budgets"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED"],"x-required-scopes":["budgets:read"]}},"/v1/budgets/versions/{id}/lines-batch":{"patch":{"operationId":"patchBudgetLines","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchBudgetLinesV1Dto"}}}},"responses":{"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: BUDGET_VERSION_NOT_EDITABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Batch upsert/clear manual budget cells on a draft version","tags":["budgets"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","BUDGET_VERSION_NOT_EDITABLE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["budgets:write"]}},"/v1/budgets/versions/{id}/seed":{"post":{"operationId":"seedBudgetVersion","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeedBudgetVersionV1Dto"}}}},"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: BUDGET_VERSION_NOT_EDITABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Bulk-apply 'prior year + growth%' to every expense account: one derivation-method config per account (whole-version scope), then derive","tags":["budgets"],"x-error-codes":["NOT_FOUND","BUDGET_VERSION_NOT_EDITABLE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["budgets:write"]}},"/v1/budgets/versions/{id}/methods":{"put":{"operationId":"setBudgetDerivationMethod","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutDerivationMethodV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DerivationMethodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: BUDGET_VERSION_NOT_EDITABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: METHOD_ACCOUNT_NOT_INCOME, LEASE_INCOME_REQUIRES_PROPERTY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Assign (or replace) the derivation method governing one (account, property) cell on a draft version","tags":["budgets"],"x-error-codes":["VALIDATION_FAILED","METHOD_ACCOUNT_NOT_INCOME","LEASE_INCOME_REQUIRES_PROPERTY","NOT_FOUND","BUDGET_VERSION_NOT_EDITABLE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["budgets:write"]}},"/v1/budgets/versions/{id}/methods/{methodId}":{"delete":{"operationId":"removeBudgetDerivationMethod","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"methodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: BUDGET_VERSION_NOT_EDITABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Remove a derivation method from a draft version, restoring whatever line was underneath it","tags":["budgets"],"x-error-codes":["NOT_FOUND","BUDGET_VERSION_NOT_EDITABLE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["budgets:write"]}},"/v1/budgets/versions/{id}/derive":{"post":{"operationId":"deriveBudgetVersion","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeriveVersionV1Dto"}}}},"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: BUDGET_VERSION_NOT_EDITABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEASE_INCOME_REQUIRES_PROPERTY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Re-run the derivation-method configs already stored on a draft version, replacing each config's derived lines","tags":["budgets"],"x-error-codes":["NOT_FOUND","BUDGET_VERSION_NOT_EDITABLE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEASE_INCOME_REQUIRES_PROPERTY"],"x-required-scopes":["budgets:write"]}},"/v1/parties/{parentId}/files":{"get":{"operationId":"Parties.listFiles","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 200","schema":{"type":"number"}},{"name":"include","required":false,"in":"query","description":"Pass \"hierarchy\" to roll up the party's own files plus files of every contract where it is the counterparty.","schema":{"enum":["hierarchy"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EntityFileDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List files for a party","tags":["Parties"],"x-error-codes":["ATTACHMENT_NOT_FOUND","VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["parties:read"]},"post":{"operationId":"Parties.uploadFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"folderId","required":true,"in":"query","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF, image, Office, CSV or TXT file. Max 20 MiB. Sniffed server-side."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: ATTACHMENT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: ATTACHMENT_TYPE_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a file to a party","tags":["Parties"],"x-error-codes":["ATTACHMENT_NOT_FOUND","ATTACHMENT_TYPE_UNSUPPORTED","ATTACHMENT_TOO_LARGE","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["parties:write"]}},"/v1/parties/{parentId}/files/{fileId}/download":{"get":{"operationId":"Parties.getFileDownloadUrl","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDownloadUrlDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a signed download URL for a party file","tags":["Parties"],"x-error-codes":["ATTACHMENT_NOT_FOUND"],"x-required-scopes":["parties:read"]}},"/v1/parties/{parentId}/files/{fileId}":{"patch":{"operationId":"Parties.moveFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveEntityFileDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Move and/or rename a party file","tags":["Parties"],"x-error-codes":["ATTACHMENT_NOT_FOUND","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["parties:write"]},"delete":{"operationId":"Parties.deleteFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a party file","tags":["Parties"],"x-error-codes":["ATTACHMENT_NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["files:delete"]}},"/v1/legal-entities/{parentId}/files":{"get":{"operationId":"LegalEntities.listFiles","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 200","schema":{"type":"number"}},{"name":"include","required":false,"in":"query","description":"Pass \"hierarchy\" to roll up the legal entity's own files plus files of every property or space it owns (and their descendants) and its contracts.","schema":{"enum":["hierarchy"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EntityFileDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List files for a legal entity","tags":["Legal Entities"],"x-error-codes":["ATTACHMENT_NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_CURSOR"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["legal-entities:read"]},"post":{"operationId":"LegalEntities.uploadFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"folderId","required":true,"in":"query","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF, image, Office, CSV or TXT file. Max 20 MiB. Sniffed server-side."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: ATTACHMENT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: ATTACHMENT_TYPE_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a file to a legal entity","tags":["Legal Entities"],"x-error-codes":["ATTACHMENT_NOT_FOUND","ATTACHMENT_TYPE_UNSUPPORTED","ATTACHMENT_TOO_LARGE","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["legal-entities:write"]}},"/v1/legal-entities/{parentId}/files/{fileId}/download":{"get":{"operationId":"LegalEntities.getFileDownloadUrl","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDownloadUrlDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a signed download URL for a legal entity file","tags":["Legal Entities"],"x-error-codes":["ATTACHMENT_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["legal-entities:read"]}},"/v1/legal-entities/{parentId}/files/{fileId}":{"patch":{"operationId":"LegalEntities.moveFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveEntityFileDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Move and/or rename a legal-entity file","tags":["Legal Entities"],"x-error-codes":["ATTACHMENT_NOT_FOUND","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["legal-entities:write"]},"delete":{"operationId":"LegalEntities.deleteFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a legal entity file","tags":["Legal Entities"],"x-error-codes":["ATTACHMENT_NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["files:delete"]}},"/v1/properties/{parentId}/files":{"get":{"operationId":"Properties.listFiles","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 200","schema":{"type":"number"}},{"name":"include","required":false,"in":"query","description":"Pass \"descendants\" to include files from every space in this property, at any depth (roll-up). Pass \"hierarchy\" to include files of contracts linked to this property or to any space in it.","schema":{"enum":["descendants","hierarchy"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EntityFileDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List files for a property","tags":["Properties"],"x-error-codes":["ATTACHMENT_NOT_FOUND","VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["properties:read"]},"post":{"operationId":"Properties.uploadFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"folderId","required":true,"in":"query","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF, image, Office, CSV or TXT file. Max 20 MiB. Sniffed server-side."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: ATTACHMENT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: ATTACHMENT_TYPE_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a file to a property","tags":["Properties"],"x-error-codes":["ATTACHMENT_NOT_FOUND","ATTACHMENT_TYPE_UNSUPPORTED","ATTACHMENT_TOO_LARGE","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["properties:write"]}},"/v1/properties/{parentId}/files/{fileId}/download":{"get":{"operationId":"Properties.getFileDownloadUrl","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDownloadUrlDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a signed download URL for a property file","tags":["Properties"],"x-error-codes":["ATTACHMENT_NOT_FOUND"],"x-required-scopes":["properties:read"]}},"/v1/properties/{parentId}/files/{fileId}":{"patch":{"operationId":"Properties.moveFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveEntityFileDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Move and/or rename a property file","tags":["Properties"],"x-error-codes":["ATTACHMENT_NOT_FOUND","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["properties:write"]},"delete":{"operationId":"Properties.deleteFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a property file","tags":["Properties"],"x-error-codes":["ATTACHMENT_NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["files:delete"]}},"/v1/spaces/{parentId}/files":{"get":{"operationId":"Spaces.listFiles","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 200","schema":{"type":"number"}},{"name":"include","required":false,"in":"query","description":"Pass \"descendants\" to include files from spaces nested under this one, at any depth (roll-up). Pass \"hierarchy\" to include files of contracts linked to this space or to a space nested under it.","schema":{"enum":["descendants","hierarchy"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EntityFileDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List files for a space","tags":["Spaces"],"x-error-codes":["ATTACHMENT_NOT_FOUND","VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["properties:read"]},"post":{"operationId":"Spaces.uploadFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"folderId","required":true,"in":"query","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF, image, Office, CSV or TXT file. Max 20 MiB. Sniffed server-side."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: ATTACHMENT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: ATTACHMENT_TYPE_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a file to a space","tags":["Spaces"],"x-error-codes":["ATTACHMENT_NOT_FOUND","ATTACHMENT_TYPE_UNSUPPORTED","ATTACHMENT_TOO_LARGE","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["properties:write"]}},"/v1/spaces/{parentId}/files/{fileId}/download":{"get":{"operationId":"Spaces.getFileDownloadUrl","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDownloadUrlDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a signed download URL for a space file","tags":["Spaces"],"x-error-codes":["ATTACHMENT_NOT_FOUND"],"x-required-scopes":["properties:read"]}},"/v1/spaces/{parentId}/files/{fileId}":{"patch":{"operationId":"Spaces.moveFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveEntityFileDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Move and/or rename a space file","tags":["Spaces"],"x-error-codes":["ATTACHMENT_NOT_FOUND","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["properties:write"]},"delete":{"operationId":"Spaces.deleteFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a space file","tags":["Spaces"],"x-error-codes":["ATTACHMENT_NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["files:delete"]}},"/v1/contracts/{parentId}/files":{"get":{"operationId":"Contracts.listFiles","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 200","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EntityFileDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List files for a contract","tags":["Contracts"],"x-error-codes":["ATTACHMENT_NOT_FOUND","VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["contracts:read"]},"post":{"operationId":"Contracts.uploadFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"folderId","required":true,"in":"query","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF, image, Office, CSV or TXT file. Max 20 MiB. Sniffed server-side."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: ATTACHMENT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: ATTACHMENT_TYPE_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a file to a contract","tags":["Contracts"],"x-error-codes":["ATTACHMENT_NOT_FOUND","ATTACHMENT_TYPE_UNSUPPORTED","ATTACHMENT_TOO_LARGE","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["contracts:write"]}},"/v1/contracts/{parentId}/files/{fileId}/download":{"get":{"operationId":"Contracts.getFileDownloadUrl","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDownloadUrlDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a signed download URL for a contract file","tags":["Contracts"],"x-error-codes":["ATTACHMENT_NOT_FOUND"],"x-required-scopes":["contracts:read"]}},"/v1/contracts/{parentId}/files/{fileId}":{"patch":{"operationId":"Contracts.moveFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveEntityFileDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Move and/or rename a contract file","tags":["Contracts"],"x-error-codes":["ATTACHMENT_NOT_FOUND","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["contracts:write"]},"delete":{"operationId":"Contracts.deleteFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a contract file","tags":["Contracts"],"x-error-codes":["ATTACHMENT_NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["files:delete"]}},"/v1/consolidation-groups/{parentId}/files":{"get":{"operationId":"ConsolidationGroupFiles.list","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 200","schema":{"type":"number"}},{"name":"include","required":false,"in":"query","description":"Pass \"hierarchy\" to roll up the group's own files plus the full file hierarchy of every member legal entity (its own files, owned properties and spaces and their descendants, and its contracts), grouped by member.","schema":{"enum":["hierarchy"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EntityFileDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List files for a consolidation group","tags":["Consolidation Groups"],"x-error-codes":["ATTACHMENT_NOT_FOUND","VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["reports:read"]},"post":{"operationId":"ConsolidationGroupFiles.upload","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"folderId","required":true,"in":"query","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF, image, Office, CSV or TXT file. Max 20 MiB. Sniffed server-side."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: ATTACHMENT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: ATTACHMENT_TYPE_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a file to a consolidation group","tags":["Consolidation Groups"],"x-error-codes":["ATTACHMENT_NOT_FOUND","ATTACHMENT_TYPE_UNSUPPORTED","ATTACHMENT_TOO_LARGE","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["legal-entities:write"]}},"/v1/consolidation-groups/{parentId}/files/{fileId}/download":{"get":{"operationId":"ConsolidationGroupFiles.download","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDownloadUrlDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a signed download URL for a consolidation-group file","tags":["Consolidation Groups"],"x-error-codes":["ATTACHMENT_NOT_FOUND"],"x-required-scopes":["reports:read"]}},"/v1/consolidation-groups/{parentId}/files/{fileId}":{"patch":{"operationId":"ConsolidationGroupFiles.update","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveEntityFileDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Move and/or rename a consolidation-group file","tags":["Consolidation Groups"],"x-error-codes":["ATTACHMENT_NOT_FOUND","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["legal-entities:write"]},"delete":{"operationId":"ConsolidationGroupFiles.delete","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a consolidation-group file","tags":["Consolidation Groups"],"x-error-codes":["ATTACHMENT_NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["files:delete"]}},"/v1/org-folders":{"get":{"operationId":"OrgFolders.list","parameters":[{"name":"parentKind","required":true,"in":"query","schema":{"enum":["party","legal_entity","property","contract","consolidation_group"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OrgFolderDto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the folder taxonomy for one entity type","tags":["Org"],"x-error-codes":["VALIDATION_FAILED"],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"tens of folders per entity type per org"},"x-required-scopes":["org:read"]},"post":{"operationId":"OrgFolders.create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrgFolderDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OrgFolderDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a custom folder (optionally nested one level)","tags":["Org"],"x-error-codes":["VALIDATION_FAILED"],"x-required-scopes":["org:write"]}},"/v1/org-folders/{id}":{"patch":{"operationId":"OrgFolders.rename","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenameOrgFolderDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OrgFolderDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Rename a folder","tags":["Org"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND"],"x-required-scopes":["org:write"]},"delete":{"operationId":"OrgFolders.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DeleteOrgFolderResultDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a folder","tags":["Org"],"x-error-codes":["VALIDATION_FAILED"],"x-required-scopes":["org:write"]}},"/v1/banking/accounts":{"get":{"description":"Bank accounts, 100 per page; drain `meta.next_cursor` for the rest. Filter by `legal_entity_id`, `account_type`, `is_active`, `currency_code` (exact) and `cash_account_id` (exact match on the account's GL cash account) and `has_cash_account` (true: only accounts with a GL cash account, false: only those without); sort by name or created date (prefix `-` for descending), default name. `ids` returns those accounts regardless of `is_active` and the other filters. `search` is a case-insensitive substring match on: name, institution name, account holder name, last four digits.","operationId":"BankAccounts.list","parameters":[{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"account_type","required":false,"in":"query","schema":{"type":"string","enum":["checking","savings","credit_card","trust","other"]}},{"name":"is_active","required":false,"in":"query","schema":{"type":"boolean"}},{"name":"currency_code","required":false,"in":"query","description":"Exact match on the account currency, e.g. `USD`.","schema":{"type":"string"}},{"name":"cash_account_id","required":false,"in":"query","description":"Exact match on the bank account's GL cash account. With `limit=1` it answers whether a GL account is a bank's cash account.","schema":{"format":"uuid","type":"string"}},{"name":"has_cash_account","required":false,"in":"query","description":"Whether the account has a GL cash account: `true` keeps accounts with one, `false` only those without. Ignored when `ids` is given.","schema":{"type":"boolean"}},{"name":"external_ref","required":false,"in":"query","description":"Exact match on the record's `external_ref` (another system's key); returns 0 or 1 row. Combines with the other filters.","schema":{"minLength":1,"maxLength":200,"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: name","schema":{"enum":["name","-name","created_at","-created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: name, institution name, account holder name, last four digits.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BankAccountV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List bank accounts","tags":["Bank Accounts"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["banking:read"]},"post":{"operationId":"BankAccounts.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBankAccountV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankAccountV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, EXTERNAL_REF_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: BANK_ACCOUNT_CURRENCY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create bank account","tags":["Bank Accounts"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","BANK_ACCOUNT_CURRENCY_MISMATCH","EXTERNAL_REF_TAKEN"],"x-required-scopes":["banking:write"]}},"/v1/banking/accounts/summary":{"get":{"description":"Cash position over every active bank account, optionally for one `legal_entity_id`, within the caller's legal-entity scope: `account_count` over every currency, and `totals`, one per `currency_code` (most accounts first) with its `account_count`, `total_cash_balance` and its 5 `top_accounts` by balance (ties broken by id). Balances are never added across currencies. They are the GL cash balances the list reports as `cash_balance`, as decimal strings. An active account with no cash GL account (`cash_balance` null in the list) is counted in `account_count`, adds nothing to its total and is not ranked.","operationId":"BankAccounts.summary","parameters":[{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankCashSummaryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Summarize cash across active bank accounts","tags":["Bank Accounts"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"computed","reason":"One fixed cash-position object (count, a total and top 5 per currency) computed per request, not a stored list."},"x-required-scopes":["banking:read"]}},"/v1/banking/accounts/latest-balances":{"get":{"description":"The newest PREVIOUS-DAY balance row per account named in `ids` — never a live balance (spec §3.1). Feeds the accounts list Balance column so an operator sees the cash position across every account without opening each one. An account with no balance row — most accounts, since only CashPro-connected ones ever get one — is simply ABSENT from `data`: never a row of nulls, never a zero (spec §3.2, §3.3). `ids` is capped at 100, the list page size; naming more is `400 VALIDATION_FAILED`, not a silently truncated answer. An id belonging to another org is the same as an id with no balance — absent, never a `404` for the whole call — because tenancy is the repository predicate `(org_id, bank_account_id)`, never the id alone (Prohibition 16: `OrgContext.requireLegalEntity` is a no-op for user JWTs). One database statement regardless of how many ids are named.","operationId":"BankAccounts.latestBalances","parameters":[{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: bank_account_id","schema":{"enum":["bank_account_id","-bank_account_id"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: .","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BankAccountDailyBalanceV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Bulk-fetch the newest balance per bank account","tags":["Bank Accounts"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["banking:read"]}},"/v1/banking/accounts/{id}":{"get":{"operationId":"BankAccounts.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankAccountV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get bank account by id","tags":["Bank Accounts"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["banking:read"]},"put":{"operationId":"BankAccounts.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBankAccountV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankAccountV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: BANK_ACCOUNT_HAS_HISTORY, IDEMPOTENCY_CONFLICT, EXTERNAL_REF_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: BANK_ACCOUNT_CURRENCY_MISMATCH, ACCOUNT_LEGAL_ENTITY_MISMATCH, LEDGER_ENTRY_REFUSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update bank account","tags":["Bank Accounts"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","BANK_ACCOUNT_HAS_HISTORY","BANK_ACCOUNT_CURRENCY_MISMATCH","ACCOUNT_LEGAL_ENTITY_MISMATCH","LEDGER_ENTRY_REFUSED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","EXTERNAL_REF_TAKEN"],"x-required-scopes":["banking:write"]}},"/v1/banking/accounts/{id}/daily-balances":{"get":{"description":"The bank's PREVIOUS-DAY balance and activity figures for this account — never a live balance (spec §3.1) — one row per `as_of_date`, on the unified list contract (cursor paging, 100 per page; drain `meta.next_cursor` for the rest). Default sort is `-as_of_date` (newest reported day first); pass `?sort=as_of_date` for oldest-first, the order a trend chart wants. With no `from_date`/`to_date`, the WINDOW (independent of paging) defaults to the most recent 30 days that have data, resolved from this account's latest `as_of_date`, not the last 30 calendar days: an account whose feed stopped a month ago still shows its last 30 reported days rather than an empty chart. A window wider than `MAX_BALANCE_WINDOW_DAYS` (400) days is capped, not refused, and `meta.window_from`/`meta.window_to` report the window actually served — separately from `meta.next_cursor`/`meta.limit`, which say where the client is within that window. A row written by only one of the two capture sources keeps nulls for the figures the other source would have supplied (spec §3.6) rather than being suppressed or shown as zero. Most accounts have no balances at all — only CashPro-connected accounts do — so an empty array is the common `200`, never a `404`; `404` means the account itself does not exist in this org.","operationId":"BankAccounts.listDailyBalances","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"from_date","required":false,"in":"query","description":"Defaults to 29 days before the resolved `to_date`. Widened past `MAX_BALANCE_WINDOW_DAYS` from `to_date` is capped, not refused.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Defaults to this account's latest reported `as_of_date` — not today's calendar date — so an account whose feed stopped still shows its last reported days (spec §4.1). Falls back to today when the account has no rows at all.","schema":{"format":"date","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -as_of_date","schema":{"enum":["as_of_date","-as_of_date"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: .","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BankAccountDailyBalanceV1Dto"}},"meta":{"$ref":"#/components/schemas/BankAccountDailyBalancesMetaV1Dto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List an account's daily balances","tags":["Bank Accounts"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INVALID_CURSOR","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["banking:read"]}},"/v1/banking/accounts/{id}/plaid-connection":{"post":{"description":"Stamps a Plaid identity onto an existing manually-created bank account, keeping the same row — and therefore its GL cash account, reconciliations, statement imports, payment runs and posted history. Rejects an account that already has a connection, and rejects a Plaid account already held by another row (the response context names it, so the client can offer a merge). Enqueues an initial sync on commit.","operationId":"BankAccounts.connectPlaid","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectBankAccountPlaidV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankAccountV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: BANK_ACCOUNT_ALREADY_CONNECTED, BANK_ACCOUNT_INACTIVE, BANK_ACCOUNT_ALREADY_LINKED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Connect an existing bank account to a Plaid account","tags":["Bank Accounts"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","FORBIDDEN","BANK_ACCOUNT_ALREADY_CONNECTED","BANK_ACCOUNT_INACTIVE","BANK_ACCOUNT_ALREADY_LINKED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/accounts/{id}/cashpro-connection":{"post":{"description":"Stamps a CashPro identity onto an existing manually-created bank account, keeping the same row — and therefore its GL cash account, reconciliations, statement imports, payment runs and posted history. Verifies the account with the bank before accepting it: a mistyped account number does not error at CashPro, it returns nothing, so an unverifiable account is refused rather than silently accepted. Rejects an account already fed by anything, and rejects addressing already held by another row (the response context names it, so the client can offer a merge).","operationId":"BankAccounts.connectCashPro","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectBankAccountCashProV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankAccountV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, BANK_CONNECTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: BANK_ACCOUNT_ALREADY_CONNECTED, BANK_ACCOUNT_INACTIVE, BANK_ACCOUNT_ALREADY_LINKED, BANK_CONNECTION_DISABLED, CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: BANK_ACCOUNT_CURRENCY_MISMATCH, BANK_ACCOUNT_VERIFICATION_EMPTY, BANK_CONNECTION_CREDENTIALS_REJECTED, BANK_CONNECTION_PROVIDER_ACCESS_BLOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: BANK_PROVIDER_CONTRACT_VIOLATED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: BANK_CONNECTION_PROVIDER_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Connect an existing bank account to a CashPro account","tags":["Bank Accounts"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","BANK_ACCOUNT_ALREADY_CONNECTED","BANK_ACCOUNT_INACTIVE","BANK_ACCOUNT_ALREADY_LINKED","BANK_ACCOUNT_CURRENCY_MISMATCH","BANK_ACCOUNT_VERIFICATION_EMPTY","BANK_CONNECTION_NOT_FOUND","BANK_CONNECTION_DISABLED","CONFLICT","BANK_CONNECTION_CREDENTIALS_REJECTED","BANK_CONNECTION_PROVIDER_UNAVAILABLE","BANK_CONNECTION_PROVIDER_ACCESS_BLOCKED","BANK_PROVIDER_CONTRACT_VIOLATED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/accounts/{id}/merge":{"post":{"description":"Folds a duplicate Plaid-created bank account into the manual account named by the path id, which survives. Moves the source’s transactions, reconciliations, statement imports, payment runs and bank rules onto the survivor (and, when the survivor is an eligible paying account, any entity default paying account that pointed at the source), transfers the Plaid connection, then deactivates the source. Refused when the source has transactions already matched to documents — their journal entries posted to the source’s own GL cash account and the ledger is append-only.","operationId":"BankAccounts.merge","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeBankAccountV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MergeBankAccountResponseV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: BANK_ACCOUNT_INACTIVE, BANK_ACCOUNT_ALREADY_LINKED, BANK_ACCOUNT_MERGE_HAS_POSTED_ACTIVITY, BANK_ACCOUNT_MERGE_RECONCILIATION_IN_PROGRESS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: BANK_ACCOUNT_MERGE_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Merge a duplicate Plaid account into this manual account","tags":["Bank Accounts"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","BANK_ACCOUNT_INACTIVE","BANK_ACCOUNT_ALREADY_LINKED","BANK_ACCOUNT_MERGE_HAS_POSTED_ACTIVITY","BANK_ACCOUNT_MERGE_RECONCILIATION_IN_PROGRESS","BANK_ACCOUNT_MERGE_LEGAL_ENTITY_MISMATCH","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/connection-methods":{"get":{"description":"The generated connection chooser (spec §4.2): one entry per provider the registry knows about, in display order, with this org's provisioning state resolved server-side — `available` and `unavailable_reason` so the frontend renders a disabled card with a reason rather than knowing which providers exist or why one is off. Adding a provider is a registry entry, not a frontend change.","operationId":"BankConnections.listMethods","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BankConnectionMethodV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List the ways this org can connect a bank","tags":["Bank Connections"],"x-pagination":{"mode":"computed","reason":"Generated from the in-code provider registry, never queried; a handful of entries, one per installed provider."},"x-required-scopes":["banking:read"]}},"/v1/banking/connections":{"get":{"description":"The connection-list UI's backend (spec §4.2, §4.3) — one row per connection, with what a card needs to render itself and a drill-down id for `/test`, `/credentials` and `/accounts`. Never returns credential material — no secret, not even masked, and no boolean standing in for whether credentials exist. 100 per page; drain `meta.next_cursor` for the rest. Sort by created date or label (prefix `-` for descending), default newest first. `provider` (repeatable or comma-separated registry keys) keeps only those providers; `ids` returns those connections and ignores `search` and `provider`. `search` is a case-insensitive substring match on: label, institution name. Rows carry `legal_entity_name`.","operationId":"BankConnections.list","parameters":[{"name":"provider","required":false,"in":"query","description":"Only connections of these providers (registry keys). Repeat the parameter or send a comma-separated list, e.g. `provider=cashpro,plaid`. Ignored when `ids` is given, like every other filter. An unknown key is a 400.","schema":{"type":"array","items":{"type":"string","enum":["plaid","cashpro"]}}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at","label","-label"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: label, institution name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BankConnectionSummaryV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List this org's bank connections","tags":["Bank Connections"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["banking:read"]},"post":{"description":"Tests the submitted credentials against the provider BEFORE writing anything (spec §4.1, §4.5) — on failure nothing is persisted. Only for a `credential_owner: 'customer'` provider (CashPro today); a `'spark'`-owned provider (Plaid) is refused — those connections are created through their own flow (Plaid Link), not by submitting credentials here.","operationId":"BankConnections.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBankConnectionV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankConnectionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: BANK_PROVIDER_REQUIRES_SPARK_FLOW, BANK_CONNECTION_CREDENTIALS_REJECTED, BANK_CONNECTION_PROVIDER_ACCESS_BLOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: BANK_CONNECTION_PROVIDER_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a bank connection with credentials","tags":["Bank Connections"],"x-connector-forbidden":true,"x-error-codes":["VALIDATION_FAILED","BANK_PROVIDER_REQUIRES_SPARK_FLOW","BANK_CONNECTION_CREDENTIALS_REJECTED","BANK_CONNECTION_PROVIDER_UNAVAILABLE","BANK_CONNECTION_PROVIDER_ACCESS_BLOCKED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/connections/{id}":{"get":{"description":"The drill-down target from `BankConnections.list` — the recoverable id `/test`, `/credentials` and `/accounts` need. Resolved by `(id, org_id)`; never returns credential material.","operationId":"BankConnections.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankConnectionSummaryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: BANK_CONNECTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get one bank connection","tags":["Bank Connections"],"x-error-codes":["BANK_CONNECTION_NOT_FOUND"],"x-required-scopes":["banking:read"]}},"/v1/banking/connections/{id}/account-template":{"get":{"description":"The bulk-entry point for this connection's provider (plan 2026-09-19 Task 3, spec §2.2/§6): columns are the provider’s `addressing` keys in declared order, so the header can never drift from what the row validator actually accepts. Gains a leading `connection` column only when this org holds more than one connection for the same provider (decided from the org’s own data); that column resolves by the connection's `label` first, then its `institution_name` — a label is how two connections at the same bank (both \"Bank of America\") are told apart. The `legal_entity` column accepts either the entity's `code` or its exact `name` (both case-insensitive, code preferred when a value matches both) — never just a code, since not every entity has one yet. Includes exactly one example row, marked in the reserved leading `example` column so a parser can tell it apart from a real one; the example values themselves pass the same validator a real upload runs. A provider with no addressing fields (Plaid — it discovers accounts) has no template at all: `BANK_PROVIDER_HAS_NO_ADDRESSING`, not an empty file.","operationId":"BankConnections.getAccountTemplate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"The CSV template, UTF-8 BOM-prefixed and CRLF-terminated for Excel.","content":{"text/csv":{"schema":{"type":"string"}}}},"404":{"description":"Possible error codes: BANK_CONNECTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: BANK_PROVIDER_HAS_NO_ADDRESSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Download the bulk account-import CSV template","tags":["Bank Connections"],"x-error-codes":["BANK_CONNECTION_NOT_FOUND","BANK_PROVIDER_HAS_NO_ADDRESSING"],"x-required-scopes":["banking:read"]}},"/v1/banking/connections/{id}/test":{"post":{"description":"Calls the provider's testConnection with the credentials already on file — no body. For a customer-owned connection, updates `status`/`status_detail` from the outcome (spec §4.4: credentials_rejected, degraded, or healthy — never needs_reauth, which has no meaning for a connection with no user session to repair). A `'spark'`-owned connection's status is left to its own dedicated reconnect path.","operationId":"BankConnections.test","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankConnectionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: BANK_CONNECTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: BANK_CONNECTION_CREDENTIALS_REJECTED, BANK_CONNECTION_PROVIDER_ACCESS_BLOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: BANK_CONNECTION_PROVIDER_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Re-test a bank connection's stored credentials","tags":["Bank Connections"],"x-error-codes":["BANK_CONNECTION_NOT_FOUND","BANK_CONNECTION_CREDENTIALS_REJECTED","BANK_CONNECTION_PROVIDER_UNAVAILABLE","BANK_CONNECTION_PROVIDER_ACCESS_BLOCKED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/connections/{id}/credentials":{"post":{"description":"Tests the NEW secret before anything changes; only on success does the current credential version retire and the new one become live, in one transaction (spec §4.5, §9.5). A failed new secret leaves the old one working — nothing is retired until the new secret is proven. Never re-links accounts, GL assignments, or sync history: they reference the connection, which never changes.","operationId":"BankConnections.rotateCredentials","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RotateBankConnectionCredentialsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankConnectionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: BANK_CONNECTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: BANK_CONNECTION_ROTATION_CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: BANK_PROVIDER_REQUIRES_SPARK_FLOW, BANK_CONNECTION_CREDENTIALS_REJECTED, BANK_CONNECTION_PROVIDER_ACCESS_BLOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: BANK_CONNECTION_PROVIDER_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Rotate a bank connection's credentials","tags":["Bank Connections"],"x-connector-forbidden":true,"x-error-codes":["VALIDATION_FAILED","BANK_CONNECTION_NOT_FOUND","BANK_PROVIDER_REQUIRES_SPARK_FLOW","BANK_CONNECTION_CREDENTIALS_REJECTED","BANK_CONNECTION_PROVIDER_UNAVAILABLE","BANK_CONNECTION_PROVIDER_ACCESS_BLOCKED","BANK_CONNECTION_ROTATION_CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/connections/{id}/accounts":{"post":{"description":"CashPro has no account enumeration — accounts are addressed by account number + BIC, one at a time (spec §4.3). Verified by a one-day fetch BEFORE acceptance: a mistyped account number does not error, it returns nothing, so an empty fetch is refused (`BANK_ACCOUNT_VERIFICATION_EMPTY`) rather than silently accepted and only discovered at month-end.","operationId":"BankConnections.addAccount","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddCashProAccountV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankAccountV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: BANK_CONNECTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: BANK_PROVIDER_REQUIRES_SPARK_FLOW, BANK_ACCOUNT_VERIFICATION_EMPTY, ACCOUNT_LEGAL_ENTITY_MISMATCH, LEDGER_ENTRY_REFUSED, BANK_CONNECTION_CREDENTIALS_REJECTED, BANK_CONNECTION_PROVIDER_ACCESS_BLOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: BANK_CONNECTION_PROVIDER_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a CashPro account, verified before acceptance","tags":["Bank Connections"],"x-error-codes":["VALIDATION_FAILED","BANK_CONNECTION_NOT_FOUND","BANK_PROVIDER_REQUIRES_SPARK_FLOW","BANK_ACCOUNT_VERIFICATION_EMPTY","ACCOUNT_LEGAL_ENTITY_MISMATCH","LEDGER_ENTRY_REFUSED","BANK_CONNECTION_CREDENTIALS_REJECTED","BANK_CONNECTION_PROVIDER_UNAVAILABLE","BANK_CONNECTION_PROVIDER_ACCESS_BLOCKED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/connections/{id}/backfill":{"post":{"description":"Splits the span into bank-legal windows and enqueues one job per window. Returns the windows it enqueued; fetches nothing itself. `to_date` defaults to yesterday in the org’s time zone — today is refused, because the bank’s previous-day report has not settled it. A `from_date` older than the bank’s retention is REFUSED rather than clamped, and the refusal names the earliest day that would work: a person asked for this span, so a silently shortened answer would be a gap only they could have acted on. The windows are independent — no watermark is written and the transaction writer is idempotent — so they may run in any order. Backfill fills gaps; it does not repair rows a bank has since restated.","operationId":"BankConnections.backfill","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackfillConnectionV1Dto"}}}},"responses":{"202":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankConnectionBackfillV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: BANK_CONNECTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: BANK_BACKFILL_CONNECTION_NOT_SYNCABLE, BANK_BACKFILL_PROVIDER_NOT_WINDOWED, BANK_BACKFILL_WINDOW_INVALID, BANK_BACKFILL_ACCOUNTS_NOT_ON_CONNECTION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Pull a specific date range of history for a bank connection","tags":["Bank Connections"],"x-error-codes":["VALIDATION_FAILED","BANK_CONNECTION_NOT_FOUND","BANK_BACKFILL_CONNECTION_NOT_SYNCABLE","BANK_BACKFILL_PROVIDER_NOT_WINDOWED","BANK_BACKFILL_WINDOW_INVALID","BANK_BACKFILL_ACCOUNTS_NOT_ON_CONNECTION"],"x-required-scopes":["banking:write"]}},"/v1/banking/rules":{"get":{"description":"Bank rules of the org in the order the rule engine applies them, 100 per page; drain `meta.next_cursor` for the rest. Filter by `account_id` (the rule's scope bank account), `direction`, `mode` and `is_active`; sort by priority or name (prefix `-` for descending), default priority. `ids` returns those rules regardless of `is_active` and the other filters. `search` is a case-insensitive substring match on: name. Rows carry `scope_bank_account_name` and `to_bank_account_name` (a transfer action's destination).","operationId":"BankRules.list","parameters":[{"name":"account_id","required":false,"in":"query","description":"Only rules scoped to this bank account.","schema":{"format":"uuid","type":"string"}},{"name":"direction","required":false,"in":"query","schema":{"type":"string","enum":["in","out"]}},{"name":"mode","required":false,"in":"query","schema":{"type":"string","enum":["suggest","auto_post"]}},{"name":"is_active","required":false,"in":"query","schema":{"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: priority","schema":{"enum":["priority","-priority","name","-name"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BankRuleV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List bank rules","tags":["Banking Rules"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["banking:read"]},"post":{"operationId":"BankRules.create","parameters":[{"name":"apply_to_pending","required":false,"in":"query","description":"When true, immediately apply to existing pending tx.","schema":{"type":"boolean"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBankRuleV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankRuleV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: BANK_TX_PARTY_IS_LEGAL_ENTITY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create bank rule","tags":["Banking Rules"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","BANK_TX_PARTY_IS_LEGAL_ENTITY"],"x-required-scopes":["banking:write"]}},"/v1/banking/rules/reorder":{"put":{"description":"Deprecated: use POST /v1/banking/rules/{id}/move. Posts the full ordered id list, which a paged list cannot send.","operationId":"BankRules.reorder","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderBankRulesV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BankRuleV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Reorder rule priorities","tags":["Banking Rules"],"x-error-codes":["VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/rules/{id}/move":{"post":{"description":"Places the rule immediately before `before_rule_id` or after `after_rule_id` (exactly one) and renumbers the org's rules 1..n, active and inactive, so no two share a priority. Works on any page of the list. Returns the moved rule with its new `priority`.","operationId":"BankRules.move","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveBankRuleV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankRuleV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Move a rule before or after another","tags":["Banking Rules"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/rules/{id}":{"get":{"operationId":"BankRules.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankRuleV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get bank rule","tags":["Banking Rules"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["banking:read"]},"put":{"operationId":"BankRules.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBankRuleV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankRuleV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: BANK_TX_PARTY_IS_LEGAL_ENTITY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update bank rule","tags":["Banking Rules"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","BANK_TX_PARTY_IS_LEGAL_ENTITY"],"x-required-scopes":["banking:write"]},"delete":{"operationId":"BankRules.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Soft-delete bank rule","tags":["Banking Rules"],"x-error-codes":["NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/rules/{id}/test":{"post":{"operationId":"BankRules.test","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankRuleTestResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Dry-run rule against pending tx","tags":["Banking Rules"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["banking:read"]}},"/v1/banking/rules/{id}/apply":{"post":{"operationId":"BankRules.apply","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankRuleApplyResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Apply rule to pending tx now","tags":["Banking Rules"],"x-error-codes":["NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/counterparty-mappings":{"get":{"description":"The org-wide map from bank-line signals to parties, 100 per page; drain `meta.next_cursor` for the rest. Newest first by default; sort by created date (prefix `-` for descending). `ids` returns those mappings and ignores `search` and the other filters. `search` is a case-insensitive substring match on: signal value. It learns from the matches people make; each row says how many matches back it (`counted_matches` since its last reset). For a caller limited to some legal entities every mapping is still listed, but its counts include only matches whose entity (the generated document's, else the line's bank account's — the `legal_entity` Why? shows) is one of them.","operationId":"CounterpartyMappings.list","parameters":[{"name":"state","required":false,"in":"query","schema":{"type":"string","enum":["suggested","learned","confirmed","ambiguous","retired"]}},{"name":"party_id","required":false,"in":"query","description":"Filters the mapping's own party column. An ambiguous mapping has none, except one that fell from confirmed, which keeps its confirmed party (see `ambiguous_parties`).","schema":{"format":"uuid","type":"string"}},{"name":"signal_kind","required":false,"in":"query","schema":{"type":"string","enum":["ach_originator_id","plaid_counterparty","ach_originator_name","descriptor"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: signal value.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CounterpartyMappingV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List counterparty mappings","tags":["Banking Counterparty Map"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["banking:read"]},"post":{"description":"Maps a bank signal to an active party; the mapping is `confirmed`. The value is normalized the way bank lines are. A signal that already has a mapping is refused with 409 and the existing id — change that one with PATCH.","operationId":"CounterpartyMappings.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCounterpartyMappingV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CounterpartyMappingV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, COUNTERPARTY_MAPPING_VALUE_INVALID, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: COUNTERPARTY_MAPPING_ALREADY_EXISTS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: COUNTERPARTY_MAPPING_PARTY_NOT_USABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a counterparty mapping by hand","tags":["Banking Counterparty Map"],"x-error-codes":["VALIDATION_FAILED","COUNTERPARTY_MAPPING_ALREADY_EXISTS","COUNTERPARTY_MAPPING_PARTY_NOT_USABLE","COUNTERPARTY_MAPPING_VALUE_INVALID","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/counterparty-mappings/{id}":{"get":{"description":"The mapping plus its evidence (Why?): every match behind it, newest first, with the line, entity, party, generated document, source, actor and whether it still counts. `cursor`/`limit` page the evidence. For a caller limited to some legal entities, the evidence and the counts include only matches whose entity (the generated document's, else the line's bank account's — the `legal_entity` Why? shows) is one of them; the mapping itself is org-wide.","operationId":"CounterpartyMappings.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CounterpartyMappingDetailV1Dto"},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a counterparty mapping and why it says what it says","tags":["Banking Counterparty Map"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["banking:read"]},"patch":{"description":"Exactly one of: `{ \"party_id\" }` — change party (confirmed for that active party, count restarts; also settles an ambiguous mapping); `{ \"state\": \"retired\" }` — stop using it; `{ \"state\": \"active\" }` — turn it back on (count restarts). `{ \"state\": \"retired\" }` on a retired mapping and `{ \"state\": \"active\" }` on one that is not retired change nothing and answer 200; `{ \"party_id\" }` on a retired mapping confirms it, which also turns it back on. Any other body (none, both, an unknown field, or `null`) is a 400. There is no DELETE: a mapping is retired, so its history stays.","operationId":"CounterpartyMappings.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCounterpartyMappingV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CounterpartyMappingV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, COUNTERPARTY_MAPPING_UPDATE_INVALID, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: COUNTERPARTY_MAPPING_PARTY_NOT_USABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Change, stop or turn back on a counterparty mapping","tags":["Banking Counterparty Map"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","COUNTERPARTY_MAPPING_UPDATE_INVALID","COUNTERPARTY_MAPPING_PARTY_NOT_USABLE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/transactions":{"get":{"description":"Bank transactions, 100 per page; drain `meta.next_cursor` for the rest. Filter by `status`, `direction`, `category`, `account_id`, `from_date`, `to_date`, `pending` (hidden by default), `ic_tagged_only`, `party_tagged_only`, `amount` (absolute amount equals, e.g. `2500.00`, either sign) and `open_only` (not matched to a document and not removed by the provider); sort by transaction date, created date or amount (prefix `-` for descending), default newest transaction date first. `ids` returns those lines regardless of status, pending, amount and the other filters. Tab counts under the same filters: `GET /v1/banking/transactions/counts`.","operationId":"BankTransactions.list","parameters":[{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["imported","accounted","excluded","needs_review"]}},{"name":"direction","required":false,"in":"query","schema":{"type":"string","enum":["in","out"]}},{"name":"category","required":false,"in":"query","schema":{"type":"string","enum":["uncategorized","sales_receipt","expense","excluded","needs_review","transfer","ic_settlement","payment_in","payment_out","refund_payment","deposit"]}},{"name":"account_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"from_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"open_only","required":false,"in":"query","description":"Only lines that are open for matching: not matched to a document and not removed by the provider. Independent of `status`: combine with `status=imported` to list the lines a person can still pick.","schema":{"type":"boolean"}},{"name":"ic_tagged_only","required":false,"in":"query","schema":{"type":"boolean"}},{"name":"party_tagged_only","required":false,"in":"query","schema":{"type":"boolean"}},{"name":"pending","required":false,"in":"query","description":"Show pending transactions. Defaults to false — the canonical list hides pending rows. Set true to surface them, e.g. for a \"Show pending\" toggle.","schema":{"type":"boolean"}},{"name":"amount","required":false,"in":"query","description":"Absolute amount equals: lines whose amount is this value in magnitude, whether money in (positive) or out (negative). Send an unsigned decimal string with at most two places, e.g. `2500.00`; combine with `direction` to pick one side. Exact comparison, no tolerance. On the list, ignored when `ids` is given.","schema":{"example":"2500.00","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -transaction_date","schema":{"enum":["-transaction_date","transaction_date","created_at","-created_at","amount","-amount"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: description, external id, bank account name, counterparty entity name, party name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BankTransactionV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List bank transactions","tags":["Banking Transactions"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["banking:read"]},"post":{"operationId":"BankTransactions.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBankTransactionV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankTransactionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: BANK_TX_IC_TAG_IS_OWN_ENTITY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create bank transaction","tags":["Banking Transactions"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE","BANK_TX_IC_TAG_IS_OWN_ENTITY"],"x-required-scopes":["banking:write"]}},"/v1/banking/transactions/counts":{"get":{"description":"Exact counts of bank transactions per status tab (`imported`, `needs_review`, `accounted`, `excluded`) under the list filters of `GET /v1/banking/transactions` except `status`: `account_id`, `from_date`, `to_date`, `direction`, `category`, `pending` (hidden by default), `ic_tagged_only`, `party_tagged_only`, `amount` (absolute amount equals), `open_only` and `search` (matches description, external id, bank account name, counterparty entity name, party name). Each count equals the rows the list returns for that `status` under the same filters.","operationId":"BankTransactions.counts","parameters":[{"name":"direction","required":false,"in":"query","schema":{"type":"string","enum":["in","out"]}},{"name":"category","required":false,"in":"query","schema":{"type":"string","enum":["uncategorized","sales_receipt","expense","excluded","needs_review","transfer","ic_settlement","payment_in","payment_out","refund_payment","deposit"]}},{"name":"account_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"from_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"open_only","required":false,"in":"query","description":"Only lines that are open for matching: not matched to a document and not removed by the provider. Independent of `status`: combine with `status=imported` to list the lines a person can still pick.","schema":{"type":"boolean"}},{"name":"ic_tagged_only","required":false,"in":"query","schema":{"type":"boolean"}},{"name":"party_tagged_only","required":false,"in":"query","schema":{"type":"boolean"}},{"name":"pending","required":false,"in":"query","description":"Show pending transactions. Defaults to false — the canonical list hides pending rows. Set true to surface them, e.g. for a \"Show pending\" toggle.","schema":{"type":"boolean"}},{"name":"amount","required":false,"in":"query","description":"Absolute amount equals: lines whose amount is this value in magnitude, whether money in (positive) or out (negative). Send an unsigned decimal string with at most two places, e.g. `2500.00`; combine with `direction` to pick one side. Exact comparison, no tolerance. On the list, ignored when `ids` is given.","schema":{"example":"2500.00","type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: description, external id, bank account name, counterparty entity name, party name.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankTransactionCountsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Count bank transactions per tab","tags":["Banking Transactions"],"x-error-codes":["VALIDATION_FAILED"],"x-pagination":{"mode":"computed","reason":"Counts per status tab, grouped per request under the list filters; one fixed object, not a stored list."},"x-required-scopes":["banking:read"]}},"/v1/banking/transactions/stats":{"get":{"operationId":"BankTransactions.stats","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankTransactionStatsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Pending-tab stats","tags":["Banking Transactions"],"x-required-scopes":["banking:read"]}},"/v1/banking/transactions/meta/accounts":{"get":{"description":"Deprecated: use `GET /v1/banking/accounts` (it takes `search` and `ids`).","operationId":"BankTransactions.metaAccounts","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/MetaBankAccountV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List bank accounts (picker)","tags":["Banking Transactions"],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"tens of bank accounts per org"},"x-required-scopes":["banking:read"]}},"/v1/banking/transactions/meta/options":{"get":{"operationId":"BankTransactions.metaOptions","parameters":[{"name":"direction","required":true,"in":"query","schema":{"type":"string","enum":["in","out"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MetaProcessingOptionsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Processing options (picker payload)","tags":["Banking Transactions"],"x-error-codes":["VALIDATION_FAILED"],"x-required-scopes":["banking:read"]}},"/v1/banking/transactions/{id}":{"get":{"operationId":"BankTransactions.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankTransactionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get bank transaction by id","tags":["Banking Transactions"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["banking:read"]}},"/v1/banking/transactions/{id}/categorization-history":{"get":{"operationId":"BankTransactions.categorizationHistory","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Max items to return (default 5, 1..20).","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CategorizationHistoryResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List recent categorizations matching this tx description","tags":["Banking Transactions"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED"],"x-required-scopes":["banking:read"]}},"/v1/banking/transactions/{id}/candidates":{"get":{"description":"Read-only: returns the candidates the engine already stored for this line, best first, without computing anything. Each application shows its document's balance as it stands now, and `stale` is true when the documents changed since the candidates were computed (gone, no longer posted, or paid below the applied amount). `counterparty` describes the payer identification behind the top candidate; its `match_count` only counts matches in the caller's legal entities.","operationId":"BankTransactions.candidates","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankTransactionCandidatesV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the stored match candidates of a bank transaction","tags":["Banking Transactions"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["banking:read"]}},"/v1/banking/transactions/{id}/match-suggestions":{"get":{"operationId":"BankTransactions.matchSuggestions","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"limit","required":true,"in":"query","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MatchSuggestionsResponseV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List ranked match suggestions for a bank transaction","tags":["Banking Transactions"],"x-required-scopes":["banking:read"]}},"/v1/banking/transactions/{id}/classification":{"put":{"operationId":"BankTransactions.classify","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBankTransactionClassificationV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankTransactionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: BANK_TX_IC_TAG_IS_OWN_ENTITY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Set/clear IC counterparty or party classification","tags":["Banking Transactions"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","BANK_TX_IC_TAG_IS_OWN_ENTITY"],"x-required-scopes":["banking:write"]}},"/v1/banking/transactions/{id}/exclude":{"put":{"description":"Marks the bank transaction `excluded`, which hides it from the feed and from matching. Refused with `BANK_LINE_MATCHED` when the line is matched to a document — either side of a transfer included; revert the match first. Undo with `PUT :id/include`.","operationId":"BankTransactions.exclude","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankTransactionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, BANK_LINE_MATCHED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Exclude a bank transaction from the feed","tags":["Banking Transactions"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","BANK_LINE_MATCHED"],"x-required-scopes":["banking:write"]}},"/v1/banking/transactions/{id}/include":{"put":{"description":"Puts an `excluded` bank transaction back on the feed as `imported` and requests a fresh match suggestion for it. Only an excluded line can be included (400 otherwise).","operationId":"BankTransactions.include","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankTransactionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Include an excluded bank transaction again","tags":["Banking Transactions"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/transactions/{id}/mark-review":{"put":{"description":"Flags an unmatched bank transaction `needs_review`, which puts it in the feed's needs-review tab and raises the needs-review work item. Any unmatched line can be flagged, an excluded one included; flagging a flagged line changes nothing. Refused with `BANK_LINE_MATCHED` when the line is matched to a document: the match is the review. Matching a flagged line (`PUT :id/process`) clears the flag; `PUT :id/include` does not apply (it takes excluded lines only).","operationId":"BankTransactions.markReview","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankTransactionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, BANK_LINE_MATCHED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Mark a bank transaction for review","tags":["Banking Transactions"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","BANK_LINE_MATCHED"],"x-required-scopes":["banking:write"]}},"/v1/banking/transactions/{id}/process":{"put":{"operationId":"BankTransactions.process","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessBankTransactionV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ProcessBankTransactionResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, DOCUMENT_STATUS_FORBIDS_ACTION, BANK_LINE_ALREADY_MATCHED, BANK_LINE_EXCLUDED, BANK_LINE_REMOVED_BY_PROVIDER, MATCH_PAYMENT_ALREADY_RECONCILED, TRANSFER_PAIR_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH, LEDGER_ENTRY_REFUSED, DIMENSION_REQUIRED, MATCH_REFUND_AMOUNT_MISMATCH, BANK_TX_PARTY_IS_LEGAL_ENTITY, PAYMENT_NOT_BANK_RECONCILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Process bank transaction (match or categorize)","tags":["Banking Transactions"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","ACCOUNT_LEGAL_ENTITY_MISMATCH","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","DOCUMENT_NOT_FOUND","DOCUMENT_STATUS_FORBIDS_ACTION","LEGAL_ENTITY_NOT_IN_SCOPE","DIMENSION_REQUIRED","MATCH_REFUND_AMOUNT_MISMATCH","BANK_TX_PARTY_IS_LEGAL_ENTITY","BANK_LINE_ALREADY_MATCHED","BANK_LINE_EXCLUDED","BANK_LINE_REMOVED_BY_PROVIDER","MATCH_PAYMENT_ALREADY_RECONCILED","PAYMENT_NOT_BANK_RECONCILABLE","TRANSFER_PAIR_INVALID"],"x-required-scopes":["banking:write"]}},"/v1/banking/transactions/bulk-process":{"post":{"operationId":"BankTransactions.bulkProcess","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkProcessBankTransactionsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BulkProcessBankTransactionsResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Bulk-process bank transactions","tags":["Banking Transactions"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/transactions/{id}/revert":{"put":{"operationId":"BankTransactions.revert","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RevertBankTransactionResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, DOCUMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PERIOD_LOCKED, IDEMPOTENCY_CONFLICT, DOCUMENT_STATUS_FORBIDS_ACTION, DOCUMENT_RECONCILED_CANNOT_CHANGE, DOCUMENT_REFUNDS_EXCEED_REMAINING_PAYMENTS, DOCUMENT_COST_CAPITALIZED_CANNOT_VOID, BANK_LINE_ALREADY_MATCHED, LOAN_ESCROW_MOVEMENT_HELD","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Revert bank transaction (undo match or categorize)","tags":["Banking Transactions"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","PERIOD_LOCKED","PERIOD_MISSING","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","DOCUMENT_NOT_FOUND","DOCUMENT_STATUS_FORBIDS_ACTION","LEGAL_ENTITY_NOT_IN_SCOPE","DOCUMENT_RECONCILED_CANNOT_CHANGE","DOCUMENT_REFUNDS_EXCEED_REMAINING_PAYMENTS","DOCUMENT_COST_CAPITALIZED_CANNOT_VOID","BANK_LINE_ALREADY_MATCHED","LOAN_ESCROW_MOVEMENT_HELD"],"x-required-scopes":["banking:write"]}},"/v1/banking/transactions/{id}/categorize-as-ic-settlement":{"post":{"operationId":"BankTransactions.icSettlement","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategorizeAsIcSettlementV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/IcSettlementResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY, BANK_TX_PENDING_NOT_MATCHABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, PERIOD_LOCKED, PERIOD_CLOSED, IC_SETTLEMENT_BANK_TRANSACTION_ALREADY_PROCESSED, BANK_LINE_REMOVED_BY_PROVIDER","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED, IC_SETTLEMENT_BANK_TRANSACTION_INVALID, IC_SETTLEMENT_PAIRED_TRANSACTION_INVALID, IC_SETTLEMENT_DATED_BEFORE_SOURCE, IC_SETTLEMENT_NOTHING_TO_SETTLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Categorize bank transaction as IC settlement","tags":["Banking Transactions"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","PERIOD_LOCKED","PERIOD_CLOSED","PERIOD_MISSING","LEDGER_ENTRY_REFUSED","LEGAL_ENTITY_NOT_IN_SCOPE","BANK_TX_PENDING_NOT_MATCHABLE","IC_SETTLEMENT_BANK_TRANSACTION_ALREADY_PROCESSED","IC_SETTLEMENT_BANK_TRANSACTION_INVALID","IC_SETTLEMENT_PAIRED_TRANSACTION_INVALID","IC_SETTLEMENT_DATED_BEFORE_SOURCE","IC_SETTLEMENT_NOTHING_TO_SETTLE","BANK_LINE_REMOVED_BY_PROVIDER"],"x-required-scopes":["banking:write"]}},"/v1/banking/reconciliations":{"post":{"operationId":"BankReconciliations.start","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartReconciliationV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReconciliationSessionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RECONCILIATION_IN_PROGRESS, RECONCILIATION_DATE_NOT_AFTER_PREVIOUS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: BANK_ACCOUNT_NOT_RECONCILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Start a bank reconciliation","tags":["Banking Reconciliations"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","BANK_ACCOUNT_NOT_RECONCILABLE","RECONCILIATION_IN_PROGRESS","RECONCILIATION_DATE_NOT_AFTER_PREVIOUS","VALIDATION_FAILED"],"x-required-scopes":["banking:write"]},"get":{"description":"The org's reconciliations, 100 per page; drain `meta.next_cursor` for the rest. Filter by `bank_account_id` and `legal_entity_id`; sort by statement ending date (prefix `-` for descending), default newest first. `ids` returns those reconciliations and ignores `search` and the other filters; a restricted member still sees only the entities they are allowed. `search` is a case-insensitive substring match on: bank account name.","operationId":"BankReconciliations.list","parameters":[{"name":"legal_entity_id","required":false,"in":"query","description":"Only reconciliations whose own `legal_entity_id` is this legal entity (the reconciliation's entity, not the account's).","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -statement_ending_date","schema":{"enum":["-statement_ending_date","statement_ending_date"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: bank account name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}},{"name":"bank_account_id","required":false,"in":"query","description":"Optional. When omitted, returns all of the org's reconciliations.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ReconciliationSummaryV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List reconciliations (org-wide, optionally filtered by account)","tags":["Banking Reconciliations"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["banking:read"]}},"/v1/banking/reconciliations/accounts":{"get":{"description":"One row per active bank account with its latest non-discarded reconciliation, the date it is reconciled through and its state, 100 per page; drain `meta.next_cursor` for the rest. Filter by `state` and `legal_entity_id`, search by account name or last four digits, and sort by company, account or reconciled-through date (prefix `-` for descending); the default is company, then account name, then id.","operationId":"BankReconciliations.listAccounts","parameters":[{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"state","required":false,"in":"query","description":"Only accounts in this state. The state is the one each row reports: computed from the account's latest non-discarded reconciliation and the org's today.","schema":{"type":"string","enum":["needs_attention","in_progress","completed_auto","completed","waiting_for_statement","never_reconciled","not_reconcilable"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: company","schema":{"enum":["company","-company","account","-account","reconciled_through","-reconciled_through"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: account name, last four digits.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ReconciliationAccountV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List active bank accounts with their reconciliation state","tags":["Banking Reconciliations"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["banking:read"]}},"/v1/banking/reconciliations/{id}":{"get":{"operationId":"BankReconciliations.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReconciliationSessionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a bank reconciliation session","tags":["Banking Reconciliations"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["banking:read"]},"patch":{"operationId":"BankReconciliations.editInfo","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EditReconciliationInfoV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReconciliationSessionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RECONCILIATION_NOT_IN_PROGRESS, RECONCILIATION_DATE_NOT_AFTER_PREVIOUS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: RECONCILIATION_BEGINNING_BALANCE_LOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Edit reconciliation statement info","tags":["Banking Reconciliations"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","RECONCILIATION_NOT_IN_PROGRESS","RECONCILIATION_DATE_NOT_AFTER_PREVIOUS","RECONCILIATION_BEGINNING_BALANCE_LOCKED","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]},"delete":{"description":"A reconciliation that was never completed is deleted. One that was completed once (and undone) can be discarded only while it is the latest of its bank account; it is kept with status `discarded`.","operationId":"BankReconciliations.discard","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RECONCILIATION_NOT_IN_PROGRESS, RECONCILIATION_WAS_COMPLETED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Discard an in-progress bank reconciliation","tags":["Banking Reconciliations"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","RECONCILIATION_NOT_IN_PROGRESS","RECONCILIATION_WAS_COMPLETED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/reconciliations/{id}/items":{"patch":{"operationId":"BankReconciliations.toggleItems","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToggleItemsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReconciliationSessionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RECONCILIATION_NOT_IN_PROGRESS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: INVALID_RECONCILIATION_LINE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Toggle cleared state of reconciliation items","tags":["Banking Reconciliations"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","RECONCILIATION_NOT_IN_PROGRESS","INVALID_RECONCILIATION_LINE","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/reconciliations/{id}/complete":{"post":{"operationId":"BankReconciliations.complete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteReconciliationV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReconciliationSessionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RECONCILIATION_NOT_IN_PROGRESS, PERIOD_LOCKED, PERIOD_CLOSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: RECONCILIATION_NOT_BALANCED, RECONCILIATION_ADJUST_FAILED, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Complete a bank reconciliation","tags":["Banking Reconciliations"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","RECONCILIATION_NOT_IN_PROGRESS","RECONCILIATION_NOT_BALANCED","RECONCILIATION_ADJUST_FAILED","VALIDATION_FAILED","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_LOCKED","PERIOD_CLOSED","PERIOD_MISSING","DIMENSION_REQUIRED"],"x-required-scopes":["banking:write"]}},"/v1/banking/reconciliations/{id}/undo":{"post":{"operationId":"BankReconciliations.undo","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReconciliationSessionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RECONCILIATION_NOT_COMPLETED, RECONCILIATION_LATER_PERIOD_COMPLETED, RECONCILIATION_IN_PROGRESS, PERIOD_LOCKED, DOCUMENT_STATUS_FORBIDS_ACTION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: RECONCILIATION_ADJUST_REVERSAL_FAILED, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Undo a completed bank reconciliation","tags":["Banking Reconciliations"],"x-error-codes":["NOT_FOUND","RECONCILIATION_NOT_COMPLETED","RECONCILIATION_LATER_PERIOD_COMPLETED","RECONCILIATION_IN_PROGRESS","RECONCILIATION_ADJUST_REVERSAL_FAILED","PERIOD_LOCKED","PERIOD_MISSING","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","DOCUMENT_STATUS_FORBIDS_ACTION","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["banking:write"]}},"/v1/banking/reconciliations/{id}/statement":{"post":{"operationId":"BankReconciliations.uploadStatement","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF or CSV bank-statement file."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StatementImportV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: EMPTY_FILE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: FILE_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: UNSUPPORTED_FILE_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a bank statement file for a reconciliation","tags":["Banking Reconciliations"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","EMPTY_FILE","FILE_TOO_LARGE","UNSUPPORTED_FILE_TYPE"],"x-required-scopes":["banking:write"]}},"/v1/banking/plaid/link-token":{"post":{"description":"Issues a Plaid Link token for the FE Link iframe. mode=create returns a token to connect a new institution; mode=update returns a token to re-authenticate an existing plaid_item that the user needs to repair (ITEM_LOGIN_REQUIRED, PENDING_DISCONNECT).","operationId":"Plaid.linkToken.create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLinkTokenV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LinkTokenV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a Plaid Link token","tags":["Plaid"],"x-error-codes":["VALIDATION_FAILED","FORBIDDEN","NOT_FOUND"],"x-required-scopes":["banking:write"]}},"/v1/banking/plaid/items":{"post":{"description":"Exchanges a public_token from Link onSuccess for a long-lived access_token, persists the encrypted access_token under plaid_items, and returns the canonical accounts list from /accounts/get. Does NOT create bank_accounts rows — that happens in a follow-up call to POST /v1/banking/plaid/items/:id/accounts where the user assigns each Plaid account to a legal entity (or skips it).","operationId":"Plaid.items.exchange","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExchangePublicTokenV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ExchangePublicTokenResponseV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Exchange a Plaid public_token and persist the item","tags":["Plaid"],"x-error-codes":["VALIDATION_FAILED","FORBIDDEN","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]},"get":{"description":"The org's Plaid items, 100 per page; drain `meta.next_cursor` for the rest. Filter by `status`; sort by created date (prefix `-` for descending), default newest first. `ids` returns those items regardless of `status` and ignores `search`. `search` is a case-insensitive substring match on: institution name.","operationId":"Plaid.items.list","parameters":[{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["active","error","login_required","pending_disconnect","disconnected"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["created_at","-created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: institution name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PlaidItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List Plaid items","tags":["Plaid"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["banking:read"]}},"/v1/banking/plaid/items/{id}/accounts":{"post":{"description":"For each Plaid account on the item, either assign it to a legal entity (creating a bank_accounts row) or skip it. Idempotent on (org_id, plaid_account_id) — re-submitting the same body is a no-op. Toggling skip=true on a previously linked account is rejected with PLAID_ACCOUNT_ALREADY_LINKED. After commit, an initial-sync job is enqueued to backfill transactions.","operationId":"Plaid.items.assignAccounts","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignPlaidAccountsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AssignPlaidAccountsResponseV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH, BANK_ACCOUNT_CURRENCY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Assign Plaid accounts to legal entities","tags":["Plaid"],"x-error-codes":["VALIDATION_FAILED","FORBIDDEN","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","ACCOUNT_LEGAL_ENTITY_MISMATCH","BANK_ACCOUNT_CURRENCY_MISMATCH"],"x-required-scopes":["banking:write"]}},"/v1/banking/plaid/items/{id}":{"get":{"operationId":"Plaid.items.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PlaidItemDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a Plaid item with its linked bank accounts","tags":["Plaid"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["banking:read"]},"delete":{"description":"Calls Plaid /item/remove, marks the local plaid_items row as disconnected, clears the encrypted access_token, and deactivates the linked bank_accounts rows. Historical transactions stay; reconnection requires a fresh Link flow.","operationId":"Plaid.items.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Disconnect a Plaid item","tags":["Plaid"],"x-error-codes":["NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Disconnects a bank feed and deactivates its bank accounts.","x-required-scopes":["banking:write"]}},"/v1/banking/plaid/items/{id}/discoverable-accounts":{"get":{"description":"Returns Plaid accounts visible on the item that the user has neither imported (no bank_accounts row) nor deliberately skipped (no plaid_ignored_accounts row). Used by the FE to surface NEW_ACCOUNTS_AVAILABLE additions and the connect-time picker. Pass include_ignored=true to get the skipped ones back too, each flagged `ignored: true`, so a user can import an account they previously declined.","operationId":"Plaid.items.discoverableAccounts","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"include_ignored","required":false,"in":"query","description":"Include accounts the user previously chose to skip, each flagged `ignored: true`. Use this to offer \"you skipped N accounts — import one\" without a second endpoint. Defaults to false, so the response carries only accounts with no recorded decision.","schema":{"default":false,"type":"boolean"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DiscoverableAccountsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List Plaid accounts on this item with no recorded decision","tags":["Plaid"],"x-error-codes":["FORBIDDEN","NOT_FOUND"],"x-required-scopes":["banking:read"]}},"/v1/banking/plaid/items/{id}/sync":{"post":{"description":"Enqueues a sync-item job for the given Plaid item. Restricted to first-party principals (Spark staff or sparkiq_internal keys). The job id is `sync-item:${id}` so duplicate triggers collapse onto a single in-flight job.","operationId":"Plaid.items.sync","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"202":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TriggerPlaidSyncResponseV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Trigger a manual sync for a Plaid item (internal/support)","tags":["Plaid"],"x-error-codes":["FORBIDDEN","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-internal":true,"x-required-scopes":["banking:write"]}},"/v1/banking/plaid/items/{id}/reconnect-check":{"post":{"description":"Calls Plaid's /item/get for this item and records the status it reports. Called by the connect wizard after a Link update-mode session: repairing an item through update mode changes state at Plaid and returns no public_token, so without this the application never learns the connection was fixed. ITEM/LOGIN_REPAIRED remains the backstop, not the only mechanism.","operationId":"Plaid.items.reconnectCheck","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PlaidItemReconnectCheckResponseV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Re-read a Plaid item's status from Plaid","tags":["Plaid"],"x-error-codes":["FORBIDDEN","NOT_FOUND"],"x-required-scopes":["banking:write"]}},"/v1/banking/plaid/webhook":{"post":{"description":"Plaid pushes lifecycle and transactions events here. The PlaidWebhookSignatureGuard verifies the ES256 JWT in `Plaid-Verification` against the cached JWK before this handler runs. The dispatcher persists the event under plaid_webhook_events (deduped by payload_hash), then enqueues sync-item / reconnect-check jobs or updates the plaid_items status per spec §10.3.","operationId":"Plaid.webhook.receive","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaidWebhookV1Dto"}}}},"responses":{"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"401":{"description":"Possible error codes: UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"summary":"Inbound Plaid webhook (signature-verified)","tags":["Plaid"],"x-error-codes":["UNAUTHORIZED","VALIDATION_FAILED"],"x-public":true}},"/v1/banking/accounts/{accountId}/statement-imports":{"post":{"description":"Reads the statement's lines as a transaction feed, and its period end and ending balance. A bank account fed by a live connection already gets its lines from the provider, so its statement is used for its balance only: it is read but cannot be committed.","operationId":"BankStatementImports.upload","parameters":[{"name":"accountId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF or CSV bank-statement file."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StatementImportV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: EMPTY_FILE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: STATEMENT_FILE_ALREADY_IMPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: FILE_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: UNSUPPORTED_FILE_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a bank statement file","tags":["Banking Statement Imports"],"x-error-codes":["EMPTY_FILE","FILE_TOO_LARGE","UNSUPPORTED_FILE_TYPE","NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","STATEMENT_FILE_ALREADY_IMPORTED"],"x-required-scopes":["banking:write"]}},"/v1/banking/statement-imports":{"get":{"description":"The org's statement imports, 100 per page; drain `meta.next_cursor` for the rest. Filter by `bank_account_id`, `purpose` and `status` (one or several, comma-separated); sort by created date (prefix `-` for descending), default newest first. `ids` returns those imports and ignores `search` and the other filters; a restricted member still sees only the entities they are allowed. `search` is a case-insensitive substring match on: file name. Rows carry `bank_account_name` and `legal_entity_name`.","operationId":"BankStatementImports.list","parameters":[{"name":"bank_account_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","description":"One or more of `parsing`, `parsed`, `failed`, `committed`, `discarded`, comma-separated or repeated. A single value keeps working.","schema":{"type":"string","enum":["parsing","parsed","failed","committed","discarded"]}},{"name":"purpose","required":false,"in":"query","schema":{"type":"string","enum":["feed","reconciliation"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: file name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StatementImportListRowV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List statement imports (org-wide, optionally filtered)","tags":["Banking Statement Imports"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["banking:read"]}},"/v1/banking/statement-imports/{id}":{"get":{"operationId":"BankStatementImports.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StatementImportDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a statement import with its parsed lines","tags":["Banking Statement Imports"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["banking:read"]},"delete":{"description":"A committed import cannot be discarded. A reconciliation the statement opened by itself, that nobody has changed and that was never completed, is discarded with it; any other in-progress reconciliation it is tied to is left for a person to finish (it no longer completes by itself).","operationId":"BankStatementImports.discard","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, STATEMENT_IMPORT_COMMITTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Discard a statement import","tags":["Banking Statement Imports"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","STATEMENT_IMPORT_COMMITTED"],"x-required-scopes":["banking:write"]}},"/v1/banking/statement-imports/{id}/lines":{"patch":{"operationId":"BankStatementImports.patchLines","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchStatementLineV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StatementImportDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IMPORT_NOT_PARSED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Patch a parsed statement line before commit","tags":["Banking Statement Imports"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","IMPORT_NOT_PARSED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/statement-imports/{id}/commit":{"post":{"operationId":"BankStatementImports.commit","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CommitStatementImportResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: NOT_A_FEED_IMPORT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ALREADY_COMMITTED, IMPORT_NOT_PARSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Commit a feed import into bank transactions","tags":["Banking Statement Imports"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","NOT_A_FEED_IMPORT","ALREADY_COMMITTED","IMPORT_NOT_PARSED"],"x-required-scopes":["banking:write"]}},"/v1/banking/statement-imports/{id}/confirm-period-end":{"post":{"description":"A CSV statement can be an export of any date range, so its period end (the latest line date, or what a model read) is only a proposal. Confirming the real period end lets a reconciliation start on its own from the statement balance. A PDF statement needs no confirmation.","operationId":"BankStatementImports.confirmPeriodEnd","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmStatementPeriodEndV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StatementImportV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IMPORT_NOT_PARSED, STATEMENT_PERIOD_END_NOT_CONFIRMABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: NO_ENDING_BALANCE, STATEMENT_PERIOD_END_BEFORE_LAST_LINE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Confirm a statement's period end","tags":["Banking Statement Imports"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","IMPORT_NOT_PARSED","NO_ENDING_BALANCE","STATEMENT_PERIOD_END_NOT_CONFIRMABLE","STATEMENT_PERIOD_END_BEFORE_LAST_LINE"],"x-required-scopes":["banking:write"]}},"/v1/banking/connections/{id}/account-imports":{"post":{"description":"Parses, structurally validates, and resolves every row (plan 2026-09-19 Task 4): a row failing its own field rules or naming an unresolvable legal entity / cash account / connection is staged `rejected` with a complete-sentence reason; a row whose account already exists on this connection is staged `accepted` immediately (spec §2.6 — a corrected re-upload adds only what's missing); every other structurally-valid row is staged `pending` and verified against the bank in the background (`GET .../account-imports/{id}` to poll). Re-uploading the identical file (same sha256) returns the existing import rather than creating a second one.","operationId":"BankAccountImports.upload","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"The CSV file generated from the account-template endpoint."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AccountImportV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, EMPTY_FILE, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: BANK_CONNECTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: ACCOUNT_IMPORT_FILE_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: ACCOUNT_IMPORT_UNSUPPORTED_FILE_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_IMPORT_TOO_MANY_ROWS, BANK_PROVIDER_REQUIRES_SPARK_FLOW","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a bulk account-import CSV for a bank connection","tags":["Banking Account Imports"],"x-error-codes":["VALIDATION_FAILED","EMPTY_FILE","ACCOUNT_IMPORT_FILE_TOO_LARGE","ACCOUNT_IMPORT_UNSUPPORTED_FILE_TYPE","ACCOUNT_IMPORT_TOO_MANY_ROWS","BANK_CONNECTION_NOT_FOUND","BANK_PROVIDER_REQUIRES_SPARK_FLOW","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/account-imports/{id}":{"get":{"description":"Status and counts always come back; `data` is this import's rejected rows in file order, cursor-paged (a 300-row file can carry 300 rejections). The import's own summary rides in `meta.import` so one poll answers both \"how is the whole file doing\" and \"what got rejected, and why\". 100 per page; drain `meta.next_cursor` for the rest. Sort by row number (prefix `-` for descending), default file order. `ids` returns those rows of this import (rejected ones only) and ignores `search`. `search` is a case-insensitive substring match on: name, rejection reason.","operationId":"BankAccountImports.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: row_number","schema":{"enum":["row_number","-row_number"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: name, rejection reason.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AccountImportRejectedRowV1Dto"}},"meta":{"$ref":"#/components/schemas/AccountImportListMetaV1Dto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: BANK_ACCOUNT_IMPORT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Poll an account import: status, counts and rejected rows","tags":["Banking Account Imports"],"x-error-codes":["BANK_ACCOUNT_IMPORT_NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["banking:read"]}},"/v1/banking/account-imports/{id}/commit":{"post":{"description":"Creates one `bank_accounts` row per `accepted` row on a `completed` import, through the same writer the single-account add-account path uses. Idempotent by row: a row that already carries a `bank_account_id` (from an earlier commit call, or because its account already existed on this connection) is linked or skipped, never duplicated — a second commit of an already-committed import creates nothing and reports the rows as already committed, which is a correct answer, not an error. Refuses an import that is not yet `completed`, and never commits a `rejected` or still-`pending` row.","operationId":"BankAccountImports.commit","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommitAccountImportV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AccountImportCommitResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: BANK_ACCOUNT_IMPORT_NOT_FOUND, BANK_CONNECTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_IMPORT_NOT_COMPLETED, BANK_PROVIDER_REQUIRES_SPARK_FLOW","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Commit an account import's accepted rows into bank accounts","tags":["Banking Account Imports"],"x-error-codes":["BANK_ACCOUNT_IMPORT_NOT_FOUND","ACCOUNT_IMPORT_NOT_COMPLETED","BANK_CONNECTION_NOT_FOUND","BANK_PROVIDER_REQUIRES_SPARK_FLOW","LEGAL_ENTITY_NOT_IN_SCOPE","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["banking:write"]}},"/v1/banking/account-imports/{id}/discard":{"post":{"description":"Marks the import `discarded`: background verification stops acting on it, it can no longer be committed, and — the reason this exists — the same file can be uploaded again. Without it an import left dead by a provider outage would block every re-upload of those exact bytes forever, since the upload endpoint returns the existing import for a file it has already seen. Rows already committed keep the bank accounts they created. Discarding an already-discarded import is a no-op, not an error.","operationId":"BankAccountImports.discard","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AccountImportV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: BANK_ACCOUNT_IMPORT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Abandon an account import and free its file for re-upload","tags":["Banking Account Imports"],"x-error-codes":["BANK_ACCOUNT_IMPORT_NOT_FOUND"],"x-required-scopes":["banking:write"]}},"/v1/properties":{"get":{"description":"Properties owned by the org. Replaces `GET /v1/trackables?trackable_type_code=property`. There is no `trackable_type_id` / `trackable_type_code` filter: the endpoint IS the type. For the spaces inside a property, call `GET /v1/spaces?property_id=`.","operationId":"Properties.list","parameters":[{"name":"search","required":false,"in":"query","description":"Case-insensitive search on name and code.","schema":{"type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Narrow to one owning legal entity. A restricted principal asking for an entity outside its allowed set gets 403 rather than a silently empty page.","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","description":"Lifecycle status, not occupancy.","schema":{"type":"string","enum":["active","inactive","archived"]}},{"name":"property_type","required":false,"in":"query","description":"Asset class. Filters the column, never the attributes blob.","schema":{"type":"string","enum":["office","retail","industrial","multifamily","land","mixed_use","other"]}},{"name":"ownership_kind","required":false,"in":"query","description":"Which properties to list by their legal entity's ownership. Defaults to 'owned' (which includes properties with no legal entity) — managed properties are opt-in, same contract as GET /v1/legal-entities.","schema":{"type":"string","enum":["owned","managed","all"]}},{"name":"managing_legal_entity_id","required":false,"in":"query","description":"Only properties whose INTERNAL manager is this legal entity.","schema":{"format":"uuid","type":"string"}},{"name":"managed_by","required":false,"in":"query","description":"Who manages the property: 'self' (no manager), 'internal' (an owned legal entity), 'external' (a party).","schema":{"type":"string","enum":["self","internal","external"]}},{"name":"is_leasable","required":false,"in":"query","description":"Narrow to properties that are, or are not, themselves the rentable location. `true` means the property is rented whole; `false` means something leasable sits beneath it.","schema":{"type":"boolean"}},{"name":"attribute_filters","required":false,"in":"query","description":"Equality filter on `attributes`, as a URL-encoded JSON object. Keys are validated against the built-in property attribute schema; an undeclared key is rejected rather than silently matching nothing.","schema":{"example":"{\"country\":\"US\"}","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: code","schema":{"enum":["code","-code","name","-name","created_at","-created_at","purchase_date","-purchase_date"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PropertyV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List properties","tags":["Properties"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["properties:read"]},"post":{"description":"Takes no type id — the endpoint implies it. A `code` collision surfaces as 409 CONFLICT (codes are unique per org, spec D4).","operationId":"Properties.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePropertyV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PropertyV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create property","tags":["Properties"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-plannable":true,"x-required-scopes":["properties:write"]}},"/v1/properties/{id}":{"get":{"operationId":"Properties.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PropertyV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get property by id","tags":["Properties"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["properties:read"]},"put":{"operationId":"Properties.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePropertyV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PropertyV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PROPERTY_OWNER_LOCKED_BY_LOAN_COLLATERAL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEASABLE_PATH_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update property","tags":["Properties"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","LEASABLE_PATH_CONFLICT","PROPERTY_OWNER_LOCKED_BY_LOAN_COLLATERAL"],"x-plannable":true,"x-required-scopes":["properties:write"]},"delete":{"description":"Refused with TRACKABLE_HAS_JOURNAL_REFERENCES when journal dimensions still tag this property — the accounting spine must not be left pointing at a deleted row. Refused with PROPERTY_HAS_LEASES when any contract (a terminated lease included) names this property or one of its spaces as premises; archive the property instead. Deleting also removes the property's spaces (the mirror clears the subtree deepest-first).","operationId":"Properties.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, TRACKABLE_HAS_JOURNAL_REFERENCES, PROPERTY_HAS_LEASES","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete property","tags":["Properties"],"x-error-codes":["NOT_FOUND","CONFLICT","TRACKABLE_HAS_JOURNAL_REFERENCES","PROPERTY_HAS_LEASES","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["properties:write"]}},"/v1/properties/managed":{"post":{"description":"Creates the property together with its MANAGED legal entity in one transaction (spec 2026-08-27 §5.2). Pass `managing_legal_entity_id` (+ optional `legal_entity_name`, default: the property name) to mint a new managed entity, OR `legal_entity_id` of an existing managed entity — exactly one of the two. An owned `legal_entity_id` is rejected. A `code` collision surfaces as 409 CONFLICT.","operationId":"Properties.createManaged","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateManagedPropertyV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PropertyV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create managed property","tags":["Properties"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["properties:write"]}},"/v1/spaces":{"get":{"description":"Spaces across the org. Replaces `GET /v1/trackables?trackable_type_code=space|unit`. Pass `property_id` for one property's spaces at any depth, or `parent_space_id=null` for top-level spaces only — the latter is what the old model expressed as the `space` vs `unit` type. Every filter here is a dedicated param: `space_type`, `status` and `rentable_sqft` are COLUMNS, and `occupancy` is DERIVED from live leases rather than stored, so there is nothing left for an `attribute_filters` key to address.","operationId":"Spaces.list","parameters":[{"name":"search","required":false,"in":"query","description":"Case-insensitive search on designation, name and external_code.","schema":{"type":"string"}},{"name":"property_id","required":false,"in":"query","description":"Narrow to one property. Matches at ANY nesting depth, because `spaces.property_id` is the root property at every level — this is the property scope, and it is one indexed equality rather than a recursive walk.","schema":{"format":"uuid","type":"string"}},{"name":"parent_space_id","required":false,"in":"query","description":"Narrow by container. Pass a uuid for the spaces directly inside that space, or the literal string `null` for TOP-LEVEL spaces only — the latter is what the old model called trackable type `space` (as opposed to `unit`). Omit for any depth.","schema":{"type":"string"}},{"name":"is_leasable","required":false,"in":"query","description":"Narrow to leasable (or non-leasable) spaces.","schema":{"type":"boolean"}},{"name":"occupancy","required":false,"in":"query","description":"Occupancy as of TODAY, resolved from live leases — never from a stored tag. A space is occupied when a `contract_properties` row links it to a contract that started on or before today and has not ended, where the end is the earlier of `end_date` and `termination_date`. There is deliberately no `inactive` value: inactive is LIFECYCLE and `?status=inactive` answers it. Conflating the two is what migration `0198` got wrong. Replaces `?attribute_filters={\"space_status\":...}`, which read a tag nobody maintained.","schema":{"type":"string","enum":["vacant","occupied"]}},{"name":"space_type","required":false,"in":"query","description":"Narrow by space type. A COLUMN filter — fix 7 moved this key out of the `attributes` blob, which is why it is a dedicated param.","schema":{"example":"office","type":"string"}},{"name":"ownership_kind","required":false,"in":"query","description":"Narrow by ownership kind. A COLUMN filter.","schema":{"type":"string","enum":["owned","common_area","rea"]}},{"name":"status","required":false,"in":"query","description":"Lifecycle status, not occupancy.","schema":{"type":"string","enum":["active","inactive","archived"]}},{"name":"legal_entity_id","required":false,"in":"query","description":"Narrow to spaces whose PROPERTY is owned by this legal entity — a space has no legal entity of its own.","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: designation","schema":{"enum":["designation","-designation","name","-name","created_at","-created_at","rentable_sqft","-rentable_sqft"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SpaceV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List spaces","tags":["Spaces"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["properties:read"]},"post":{"description":"Requires `property_id`. Pass `parent_space_id` for a nested space; it must belong to the same property. `designation` is unique PER PARENT (spec D4) — per property for a top-level space, per parent space for a nested one — so a collision surfaces as 409 SPACE_DESIGNATION_CONFLICT. Two different properties may each have a \"Suite 100\"; before `0278` they could not, because the create path copied `designation` into `external_code`, which is org-unique. `external_code` is now the caller's to set — an OUTSIDE system's code for this space, org-unique so an importer can use it as a lookup key, and null when omitted.","operationId":"Spaces.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSpaceV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SpaceV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, CONFLICT, SPACE_DESIGNATION_CONFLICT, SPACE_EXTERNAL_CODE_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LOCATION_LEASED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create space","tags":["Spaces"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","CONFLICT","SPACE_DESIGNATION_CONFLICT","SPACE_EXTERNAL_CODE_TAKEN","NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","LOCATION_LEASED"],"x-plannable":true,"x-required-scopes":["properties:write"]}},"/v1/spaces/{id}":{"get":{"operationId":"Spaces.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SpaceV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get space by id","tags":["Spaces"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["properties:read"]},"put":{"operationId":"Spaces.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSpaceV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SpaceV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SPACE_EXTERNAL_CODE_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEASABLE_PATH_CONFLICT, LOCATION_LEASED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update space","tags":["Spaces"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","SPACE_EXTERNAL_CODE_TAKEN","LEGAL_ENTITY_NOT_IN_SCOPE","LEASABLE_PATH_CONFLICT","LOCATION_LEASED"],"x-plannable":true,"x-required-scopes":["properties:write"]},"delete":{"description":"Refused with TRACKABLE_HAS_JOURNAL_REFERENCES when journal dimensions still tag this space — the accounting spine must not point at a deleted row. Refused with SPACE_HAS_LEASES when any contract (a terminated lease included) names this space, or a space directly under it, as premises; archive the space instead. Deleting the LAST leasable space under a parent restores that parent (the containing space, or the property) to leasable, which is the inverse of the clear that subdividing performs.","operationId":"Spaces.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, TRACKABLE_HAS_JOURNAL_REFERENCES, SPACE_HAS_LEASES","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete space","tags":["Spaces"],"x-error-codes":["NOT_FOUND","CONFLICT","TRACKABLE_HAS_JOURNAL_REFERENCES","SPACE_HAS_LEASES","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["properties:write"]}},"/v1/deals":{"get":{"description":"Sorted newest first (`-created_at`, the only sort). `search` matches the name, the code and the address line and city in `attributes`; `ids` returns those deals whatever the other filters say. Each row embeds its completeness summary (§7). Pass `property_id` to find the deal a given property was promoted from (spec §8.3 back-link).","operationId":"Deals.list","parameters":[{"name":"status","required":false,"in":"query","description":"Defaults to `all` when omitted.","schema":{"type":"string","enum":["in_progress","promoted","dropped","all"]}},{"name":"kind","required":false,"in":"query","schema":{"type":"string","enum":["acquisition","disposition","internal_transfer"]}},{"name":"property_id","required":false,"in":"query","description":"Filter to the deal promoted into this property. Backs the property → originating-deal link (spec §8.3). Renamed from `trackable_id` in fix 7 unit 7.","schema":{"format":"uuid","type":"string"}},{"name":"stage_id","required":false,"in":"query","description":"Only deals currently in this stage.","schema":{"format":"uuid","type":"string"}},{"name":"lost_reason_id","required":false,"in":"query","description":"Only deals dropped with this lost reason.","schema":{"format":"uuid","type":"string"}},{"name":"contracting_legal_entity_id","required":false,"in":"query","description":"Only deals whose contracting legal entity is this one.","schema":{"format":"uuid","type":"string"}},{"name":"seller_party_id","required":false,"in":"query","description":"Only deals with this party in the Seller role (deal_role `seller`), the party the list's Seller column shows. A party on the deal in another role does not match.","schema":{"format":"uuid","type":"string"}},{"name":"from_date","required":false,"in":"query","description":"Only deals created on or after this day, in the org's time zone. Either bound may be sent alone.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Only deals created on or before this day, in the org's time zone. A `from_date` after `to_date` is 400 VALIDATION_FAILED.","schema":{"format":"date","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: name, code, address_line1, city.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DealV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List deals","tags":["Deals"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["deals:read"]},"post":{"operationId":"Deals.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDealV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DEAL_SIDE_NOT_ALLOWED_FOR_KIND, DEAL_STAGE_CATALOG_INCOMPLETE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Start a deal (in_progress)","tags":["Deals"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","CONFLICT","DEAL_SIDE_NOT_ALLOWED_FOR_KIND","DEAL_STAGE_CATALOG_INCOMPLETE"],"x-required-scopes":["deals:write"]}},"/v1/deals/board":{"get":{"description":"One column per active non-terminal stage of the kind, in stage order, empty ones included. Cards are ordered by time in stage, longest first, at most 100 per column; `count` is the column's true total (a full column links to the list filtered by `stage_id`). Closed and Dead deals stay in the list.","operationId":"Deals.board","parameters":[{"name":"kind","required":false,"in":"query","description":"Defaults to `acquisition`.","schema":{"type":"string","enum":["acquisition","disposition","internal_transfer"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealBoardV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"The deal board: in-progress deals of one kind by stage","tags":["Deals"],"x-error-codes":["VALIDATION_FAILED"],"x-pagination":{"mode":"computed","reason":"The board is computed per request from the stage catalog and the open deals; each column is bounded by a fixed card cap, so there is no cursor."},"x-required-scopes":["deals:read"]}},"/v1/deals/{id}":{"get":{"operationId":"Deals.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a deal by id (parties, tenants, completeness)","tags":["Deals"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["deals:read"]},"patch":{"operationId":"Deals.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDealV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_NOT_EDITABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DEAL_KIND_IMMUTABLE, DEAL_SIDE_NOT_ALLOWED_FOR_KIND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a deal (any subset of fields — per-section save)","tags":["Deals"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","DEAL_NOT_EDITABLE","DEAL_KIND_IMMUTABLE","DEAL_SIDE_NOT_ALLOWED_FOR_KIND"],"x-required-scopes":["deals:write"]},"delete":{"operationId":"Deals.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_DELETE_PROMOTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a mistaken deal (blocked once promoted — use drop instead)","tags":["Deals"],"x-error-codes":["NOT_FOUND","DEAL_DELETE_PROMOTED"],"x-required-scopes":["deals:write"]}},"/v1/deals/{id}/promote":{"post":{"description":"Requires both deals:close and properties:write, because promoting creates a property.","operationId":"Deals.promote","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_INVALID_TRANSITION, DEAL_KIND_NOT_PROMOTABLE, CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DEAL_CHECKLIST_INCOMPLETE, DEAL_STAGE_CATALOG_INCOMPLETE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Promote a deal to a property — creates the property (requires every gating checklist requirement satisfied)","tags":["Deals"],"x-error-codes":["NOT_FOUND","DEAL_INVALID_TRANSITION","DEAL_CHECKLIST_INCOMPLETE","DEAL_KIND_NOT_PROMOTABLE","DEAL_STAGE_CATALOG_INCOMPLETE","CONFLICT","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["deals:close","properties:write"]}},"/v1/deals/{id}/drop":{"post":{"operationId":"Deals.drop","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DropDealV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_INVALID_TRANSITION, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DEAL_STAGE_CATALOG_INCOMPLETE, DEAL_LOST_REASON_UNKNOWN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Drop a deal (in_progress → dropped), with an optional reason","tags":["Deals"],"x-error-codes":["NOT_FOUND","DEAL_INVALID_TRANSITION","DEAL_STAGE_CATALOG_INCOMPLETE","DEAL_LOST_REASON_UNKNOWN","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["deals:write"]}},"/v1/deals/{id}/reopen":{"post":{"operationId":"Deals.reopen","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_INVALID_TRANSITION, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DEAL_STAGE_CATALOG_INCOMPLETE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Reopen a dropped deal (dropped → in_progress)","tags":["Deals"],"x-error-codes":["NOT_FOUND","DEAL_INVALID_TRANSITION","DEAL_STAGE_CATALOG_INCOMPLETE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["deals:write"]}},"/v1/deals/{id}/stage":{"post":{"description":"Forward moves require the requirement sets of every non-terminal stage up to the target (context.requirements lists every check on a refusal); backward moves are not gated. Closed and Dead are reached by promote and drop, never here. Refusals, in order: DEAL_INVALID_TRANSITION, DEAL_STAGE_CONFLICT, DEAL_STAGE_INVALID_TARGET, DEAL_STAGE_TERMINAL, DEAL_STAGE_REQUIREMENTS_UNMET.","operationId":"Deals.moveStage","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveDealStageV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_INVALID_TRANSITION, DEAL_STAGE_CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DEAL_STAGE_INVALID_TARGET, DEAL_STAGE_TERMINAL, DEAL_STAGE_REQUIREMENTS_UNMET","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Move an in-progress deal to another non-terminal stage","tags":["Deals"],"x-error-codes":["NOT_FOUND","DEAL_INVALID_TRANSITION","DEAL_STAGE_CONFLICT","DEAL_STAGE_INVALID_TARGET","DEAL_STAGE_TERMINAL","DEAL_STAGE_REQUIREMENTS_UNMET","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["deals:write"]}},"/v1/deals/{id}/stages":{"get":{"description":"Every active stage of the deal's kind in sort order. `requirements` is the stage's own set; `can_enter` applies the cumulative rule. Seeds the deal's critical dates on first read, like the critical-dates list.","operationId":"Deals.listStages","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DealStagePathV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"The deal's stage path with each stage's requirements and whether it can be entered now","tags":["Deals"],"x-error-codes":["NOT_FOUND"],"x-pagination":{"mode":"computed","reason":"The deal stage path is computed per request from the stage catalog and the deal; it is small and unpaged."},"x-required-scopes":["deals:read"]}},"/v1/deals/{id}/parties":{"get":{"operationId":"Deals.listParties","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DealPartyV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a deal's parties","tags":["Deals"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["deals:read"]},"post":{"operationId":"Deals.addParty","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddDealPartyV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealPartyV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, DEAL_NOT_EDITABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DEAL_ROLE_UNKNOWN, DEAL_ROLE_NOT_ALLOWED_FOR_KIND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a party to a deal (deal_role: a code from the org's role catalog)","tags":["Deals"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT","DEAL_NOT_EDITABLE","DEAL_ROLE_UNKNOWN","DEAL_ROLE_NOT_ALLOWED_FOR_KIND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["deals:write"]}},"/v1/deals/{id}/parties/{dealPartyId}":{"delete":{"operationId":"Deals.removeParty","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"dealPartyId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_NOT_EDITABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Remove a party from a deal","tags":["Deals"],"x-error-codes":["NOT_FOUND","DEAL_NOT_EDITABLE"],"x-required-scopes":["deals:write"]}},"/v1/deals/{id}/tenants":{"get":{"operationId":"Deals.listTenants","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DealTenantV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a deal's tenants","tags":["Deals"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["deals:read"]},"post":{"operationId":"Deals.addTenant","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddDealTenantV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealTenantV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, DEAL_NOT_EDITABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a tenant to a deal","tags":["Deals"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT","DEAL_NOT_EDITABLE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["deals:write"]}},"/v1/deals/{id}/tenants/{tenantId}":{"delete":{"operationId":"Deals.removeTenant","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"tenantId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_NOT_EDITABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Remove a tenant from a deal","tags":["Deals"],"x-error-codes":["NOT_FOUND","DEAL_NOT_EDITABLE"],"x-required-scopes":["deals:write"]}},"/v1/deals/{id}/critical-dates":{"get":{"operationId":"Deals.listCriticalDates","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DealCriticalDateV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a deal's critical dates (seeds standards on first read)","tags":["Deals"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["deals:read"]},"post":{"operationId":"Deals.addCriticalDate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddDealCriticalDateV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealCriticalDateV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_NOT_EDITABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DEAL_CRITICAL_DATES_MAX_CUSTOM, CRITICAL_DATE_KIND_NOT_STANDARD, CRITICAL_DATE_RULE_SET, CRITICAL_DATE_ANCHOR_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a custom critical date (max 5 custom), or restore a removed standard one via `kind`","tags":["Deals"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","DEAL_NOT_EDITABLE","DEAL_CRITICAL_DATES_MAX_CUSTOM","CRITICAL_DATE_KIND_NOT_STANDARD","CRITICAL_DATE_RULE_SET","CRITICAL_DATE_ANCHOR_INVALID","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["deals:write"]}},"/v1/deals/{id}/critical-dates/{cdId}":{"patch":{"operationId":"Deals.updateCriticalDate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cdId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDealCriticalDateV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealCriticalDateV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_NOT_EDITABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DEAL_CRITICAL_DATE_LABEL_IMMUTABLE, CRITICAL_DATE_RULE_SET, CRITICAL_DATE_RULE_CYCLE, CRITICAL_DATE_ANCHOR_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a critical date (date, status; label for custom only)","tags":["Deals"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","DEAL_NOT_EDITABLE","DEAL_CRITICAL_DATE_LABEL_IMMUTABLE","CRITICAL_DATE_RULE_SET","CRITICAL_DATE_RULE_CYCLE","CRITICAL_DATE_ANCHOR_INVALID","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["deals:write"]},"delete":{"operationId":"Deals.removeCriticalDate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cdId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_NOT_EDITABLE, CRITICAL_DATE_IS_ANCHOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Remove a critical date (exclude a standard or delete a custom)","tags":["Deals"],"x-error-codes":["NOT_FOUND","DEAL_NOT_EDITABLE","CRITICAL_DATE_IS_ANCHOR"],"x-required-scopes":["deals:write"]}},"/v1/deals/{id}/critical-dates/recompute":{"post":{"description":"Recomputes each ruled, unlocked date from its anchor in dependency order, for example after a holiday was added to the org calendar. A date that moves writes a change row with cause `recompute`. Returns all the deal's critical dates, unpaged, in display order.","operationId":"Deals.recomputeCriticalDates","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DealCriticalDateV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_NOT_EDITABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Recompute every ruled, unlocked critical date of the deal","tags":["Deals"],"x-error-codes":["NOT_FOUND","DEAL_NOT_EDITABLE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["deals:write"]}},"/v1/deals/{id}/critical-dates/{cdId}/changes":{"get":{"description":"Every change to the date's value: old and new date, the cause, the date that triggered it (for a cascade or recompute) and the actor. 100 per page; drain `meta.next_cursor` for the rest.","operationId":"Deals.listCriticalDateChanges","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cdId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: cause.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DealCriticalDateChangeV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a critical date's change log, newest first","tags":["Deals"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["deals:read"]}},"/v1/deals/{parentId}/files":{"get":{"operationId":"Deals.listFiles","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 200","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EntityFileDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List files for a deal","tags":["Deals"],"x-error-codes":["ATTACHMENT_NOT_FOUND","VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["deals:read"]},"post":{"operationId":"Deals.uploadFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"folderId","required":true,"in":"query","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF, image, Office, CSV or TXT file. Max 20 MiB. Sniffed server-side."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_NOT_EDITABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: ATTACHMENT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: ATTACHMENT_TYPE_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a file to a deal","tags":["Deals"],"x-error-codes":["ATTACHMENT_NOT_FOUND","ATTACHMENT_TYPE_UNSUPPORTED","ATTACHMENT_TOO_LARGE","VALIDATION_FAILED","DEAL_NOT_EDITABLE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["deals:write"]}},"/v1/deals/{parentId}/files/{fileId}/download":{"get":{"operationId":"Deals.getFileDownloadUrl","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDownloadUrlDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a signed download URL for a deal file","tags":["Deals"],"x-error-codes":["ATTACHMENT_NOT_FOUND"],"x-required-scopes":["deals:read"]}},"/v1/deals/{parentId}/files/{fileId}":{"patch":{"operationId":"Deals.moveFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveEntityFileDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EntityFileDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_NOT_EDITABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Move and/or rename a deal file","tags":["Deals"],"x-error-codes":["ATTACHMENT_NOT_FOUND","VALIDATION_FAILED","DEAL_NOT_EDITABLE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["deals:write"]},"delete":{"operationId":"Deals.deleteFile","parameters":[{"name":"parentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"fileId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DEAL_NOT_EDITABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a deal file","tags":["Deals"],"x-error-codes":["ATTACHMENT_NOT_FOUND","DEAL_NOT_EDITABLE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["files:delete"]}},"/v1/distribution-declarations":{"get":{"operationId":"DistributionDeclarations.list","parameters":[{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"from_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","schema":{"format":"date","type":"string"}},{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["active","undone"]}},{"name":"external_ref","required":false,"in":"query","description":"Exact match on the record's `external_ref` (another system's key); returns 0 or 1 row. Combines with the other filters.","schema":{"minLength":1,"maxLength":200,"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -declaration_date","schema":{"enum":["-declaration_date","declaration_date","-created_at","created_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DistributionDeclarationListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List distribution declarations","tags":["DistributionDeclarations"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["distributions:read"]},"post":{"operationId":"DistributionDeclarations.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDistributionDeclarationV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionDeclarationCreatedDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, ENTITY_OWNERSHIPS_NOT_FOUND, DISTRIBUTION_WATERFALL_REACHED_TWICE, CASH_SHORTFALL, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EQUITY_WATERFALL_DECLARATION_BEFORE_FROZEN, OWNERSHIP_CYCLE_DETECTED, PERIOD_CLOSED, PERIOD_LOCKED, IDEMPOTENCY_CONFLICT, EXTERNAL_REF_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: OWNERSHIP_MAX_DEPTH, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DISTRIBUTION_DIRECTED_INVALID, DISTRIBUTION_HOLDER_REFS_INVALID, DISTRIBUTION_WATERFALL_ENTITY, MISSING_SYSTEM_ROLE_ACCOUNT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING, EQUITY_CAPITAL_EVENT_UNFOLDABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Declare a distribution: creates one declaration row + N per-owner owner_distribution documents","tags":["DistributionDeclarations"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","ENTITY_OWNERSHIPS_NOT_FOUND","OWNERSHIP_MAX_DEPTH","DISTRIBUTION_WATERFALL_REACHED_TWICE","EQUITY_WATERFALL_DECLARATION_BEFORE_FROZEN","OWNERSHIP_CYCLE_DETECTED","PERIOD_CLOSED","PERIOD_LOCKED","CASH_SHORTFALL","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_MISSING","EQUITY_CAPITAL_EVENT_UNFOLDABLE","EXTERNAL_REF_TAKEN","DISTRIBUTION_DIRECTED_INVALID","DISTRIBUTION_HOLDER_REFS_INVALID","DISTRIBUTION_WATERFALL_ENTITY","MISSING_SYSTEM_ROLE_ACCOUNT"],"x-plannable":true,"x-required-scopes":["distributions:write"]}},"/v1/distribution-declarations/cascade-preview":{"get":{"operationId":"DistributionDeclarations.cascadePreview","parameters":[{"name":"legal_entity_id","required":true,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"cascade","required":true,"in":"query","schema":{"type":"string","enum":["direct","ultimate"]}},{"name":"total_amount","required":true,"in":"query","description":"Positive decimal amount as a string, e.g. \"24525.00\".","schema":{"type":"string"}},{"name":"declaration_date","required":true,"in":"query","description":"YYYY-MM-DD","schema":{"format":"date","type":"string"}},{"name":"distribution_type","required":false,"in":"query","description":"The distribution's type: an entity with a waterfall for it (or an `any` one) splits through the waterfall. Defaults to `operating_income`.","schema":{"type":"string","enum":["operating_income","capital_event","distribution_in_kind","tax_distribution"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CascadePreviewV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, ENTITY_OWNERSHIPS_NOT_FOUND, DISTRIBUTION_WATERFALL_REACHED_TWICE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: OWNERSHIP_MAX_DEPTH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview the per-tier allocation that a distribution will produce. Returns one row per leaf owner across all tiers (cascade=ultimate) or one row per direct owner (cascade=direct).","tags":["DistributionDeclarations"],"x-error-codes":["VALIDATION_FAILED","ENTITY_OWNERSHIPS_NOT_FOUND","OWNERSHIP_MAX_DEPTH","DISTRIBUTION_WATERFALL_REACHED_TWICE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["distributions:read"]}},"/v1/distribution-declarations/distributable-preview":{"get":{"operationId":"DistributionDeclarations.distributablePreview","parameters":[{"name":"legal_entity_id","required":true,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"from_date","required":true,"in":"query","description":"YYYY-MM-DD","schema":{"format":"date","type":"string"}},{"name":"to_date","required":true,"in":"query","description":"YYYY-MM-DD","schema":{"format":"date","type":"string"}},{"name":"basis","required":false,"in":"query","description":"Reporting basis the net income is read on. Omitted: the P&L's default basis (accrual).","schema":{"type":"string","enum":["accrual","cash"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributablePreviewV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Compute the distributable amount for an LE over a date range. Used by the FE to auto-fill or guide the create form.","tags":["DistributionDeclarations"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["reports:read","distributions:read"]}},"/v1/distribution-declarations/{id}":{"get":{"operationId":"DistributionDeclarations.getById","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionDeclarationV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a distribution declaration by id","tags":["DistributionDeclarations"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["distributions:read"]}},"/v1/distribution-declarations/{id}/undo":{"post":{"operationId":"DistributionDeclarations.undo","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UndoDistributionDeclarationV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionDeclarationUndoneDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DISTRIBUTION_DECLARATION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DISTRIBUTION_ALREADY_UNDONE, DISTRIBUTION_UNDO_HAS_REFUNDS, DISTRIBUTION_UNDO_NOT_LATEST_WATERFALL, DISTRIBUTION_HAS_ACTIVE_APPLICATIONS, DISTRIBUTION_DOWNSTREAM_CONSUMED, IDEMPOTENCY_CONFLICT, PERIOD_LOCKED, DOCUMENT_STATUS_FORBIDS_ACTION, DOCUMENT_RECONCILED_CANNOT_VOID, DOCUMENT_MATCHED_CANNOT_VOID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Cascade-undo a distribution declaration: voids each linked per-owner document","tags":["DistributionDeclarations"],"x-error-codes":["VALIDATION_FAILED","DISTRIBUTION_DECLARATION_NOT_FOUND","DISTRIBUTION_ALREADY_UNDONE","DISTRIBUTION_UNDO_HAS_REFUNDS","DISTRIBUTION_UNDO_NOT_LATEST_WATERFALL","DISTRIBUTION_HAS_ACTIVE_APPLICATIONS","DISTRIBUTION_DOWNSTREAM_CONSUMED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","PERIOD_LOCKED","PERIOD_MISSING","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","DOCUMENT_STATUS_FORBIDS_ACTION","LEGAL_ENTITY_NOT_IN_SCOPE","DOCUMENT_RECONCILED_CANNOT_VOID","DOCUMENT_MATCHED_CANNOT_VOID"],"x-required-scopes":["distributions:write"]}},"/v1/distribution-policies":{"get":{"description":"Lists distribution policies across the org, optionally filtered by legal_entity_id and/or status, each with its `template` and its resolved `effective` policy. A caller restricted to a subset of legal entities (an LE-scoped API key, or a role confined to a subset) sees only policies on entities it may act on.","operationId":"DistributionPolicies.list","parameters":[{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["active","paused","archived"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DistributionPolicyV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List distribution policies","tags":["DistributionPolicies"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["distributions:read"]},"post":{"description":"Creates the (at most one) live distribution policy for a legal entity. A custom policy sends its formula (cadence, due_day and base required; the rest default). With `template_id` the policy is based on that template: it sends no formula field (each one sent is refused with 422, or 400 when it is a null the request validation rejects), only its baseline, opening undistributed, overrides of the template amounts and its own lines, and every role line of the template must resolve for the entity. A caller restricted to a subset of legal entities gets 403 for another entity's legal_entity_id.","operationId":"DistributionPolicies.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDistributionPolicyV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionPolicyV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, DISTRIBUTION_MANAGED_ENTITY_EXCLUDED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, DISTRIBUTION_POLICY_TEMPLATE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: POLICY_ALREADY_EXISTS_FOR_LE, DISTRIBUTION_POLICY_TEMPLATE_ARCHIVED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH, LEDGER_ENTRY_REFUSED, MISSING_SYSTEM_ROLE_ACCOUNT, DISTRIBUTION_POLICY_FIELD_FROM_TEMPLATE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a distribution policy for a legal entity","tags":["DistributionPolicies"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","POLICY_ALREADY_EXISTS_FOR_LE","DISTRIBUTION_MANAGED_ENTITY_EXCLUDED","ACCOUNT_LEGAL_ENTITY_MISMATCH","LEDGER_ENTRY_REFUSED","MISSING_SYSTEM_ROLE_ACCOUNT","LEGAL_ENTITY_NOT_IN_SCOPE","DISTRIBUTION_POLICY_FIELD_FROM_TEMPLATE","DISTRIBUTION_POLICY_TEMPLATE_NOT_FOUND","DISTRIBUTION_POLICY_TEMPLATE_ARCHIVED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["distributions:write"]}},"/v1/distribution-policies/{id}":{"get":{"description":"Returns one distribution policy with its own adjustment lines, its `template` (id and name; null on a custom policy) and `effective`: the values it computes with, each field marked `inherited` (from the template) or `own`, its template lines minus its exclusions followed by its own lines, and the template lines it excluded. A caller restricted to a subset of legal entities gets 403 outside its scope.","operationId":"DistributionPolicies.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionPolicyV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DISTRIBUTION_POLICY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a distribution policy by id","tags":["DistributionPolicies"],"x-error-codes":["VALIDATION_FAILED","DISTRIBUTION_POLICY_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["distributions:read"]},"patch":{"description":"Partial update of a policy's schedule, base, guards and/or own adjustment lines (a given `adjustments` array replaces every own line). A template-based policy accepts its status, baseline, opening undistributed, overrides of the template amounts (null re-inherits), own lines and `excluded_template_line_ids` (replaced whole); a formula field is refused with 422 (an explicit null on any of them but `basis` is a 400). The entity cannot be moved — there is no legal_entity_id field. Refused with 409 once the policy is archived; a caller restricted to a subset of legal entities gets 403 outside its scope.","operationId":"DistributionPolicies.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDistributionPolicyV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionPolicyV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DISTRIBUTION_POLICY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DISTRIBUTION_POLICY_ARCHIVED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH, LEDGER_ENTRY_REFUSED, MISSING_SYSTEM_ROLE_ACCOUNT, DISTRIBUTION_POLICY_FIELD_FROM_TEMPLATE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a distribution policy","tags":["DistributionPolicies"],"x-error-codes":["VALIDATION_FAILED","ACCOUNT_LEGAL_ENTITY_MISMATCH","LEDGER_ENTRY_REFUSED","MISSING_SYSTEM_ROLE_ACCOUNT","LEGAL_ENTITY_NOT_IN_SCOPE","DISTRIBUTION_POLICY_NOT_FOUND","DISTRIBUTION_POLICY_ARCHIVED","DISTRIBUTION_POLICY_FIELD_FROM_TEMPLATE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["distributions:write"]}},"/v1/distribution-policies/{id}/position":{"get":{"description":"Computes the policy's running position as of `as_of` (defaults to the org's today). The earned, receipts and paid windows all run [baseline_date, as_of] INCLUSIVE of as_of — a distribution paid today already counts as paid. On a template-based policy the statement names the template, marks each adjustment's origin and lists the excluded template lines apart, with no amount. A caller restricted to a subset of legal entities gets 403 outside its scope.","operationId":"DistributionPolicies.position","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"as_of","required":false,"in":"query","description":"Defaults to the org today. YYYY-MM-DD only — a partial date (e.g. \"2026-09\") or a full datetime is rejected.","schema":{"format":"date","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionPositionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DISTRIBUTION_POLICY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: MISSING_SYSTEM_ROLE_ACCOUNT, ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Compute a policy's running distribution position as of a date (defaults to the org today)","tags":["DistributionPolicies"],"x-error-codes":["VALIDATION_FAILED","DISTRIBUTION_POLICY_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","MISSING_SYSTEM_ROLE_ACCOUNT","ACCOUNT_LEGAL_ENTITY_MISMATCH"],"x-required-scopes":["reports:read","distributions:read"]}},"/v1/distribution-policies/{id}/copy-adjustments":{"post":{"description":"Copies `source_policy_id`'s effective adjustment lines — on a template-based source, its template's lines it does not exclude, then its own — onto this policy, replacing this policy's OWN lines. A template-based target keeps its template's lines and its exclusions. When both policies are on the same template, only the source's own lines are copied (the template's lines already reach this policy), so a self-copy leaves its own lines unchanged. No link to the source is kept. Every copied line is re-validated against THIS policy's legal entity — a source line that fails (e.g. an explicit account scoped to the source's own, different entity) leaves this policy untouched. More than 100 copied lines is refused with 422 DISTRIBUTION_POLICY_TOO_MANY_ADJUSTMENTS. A caller restricted to a subset of legal entities gets 403 unless BOTH policies are within its scope.","operationId":"DistributionPolicies.copyAdjustments","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopyDistributionPolicyAdjustmentsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionPolicyV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DISTRIBUTION_POLICY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DISTRIBUTION_POLICY_ARCHIVED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH, LEDGER_ENTRY_REFUSED, MISSING_SYSTEM_ROLE_ACCOUNT, DISTRIBUTION_POLICY_TOO_MANY_ADJUSTMENTS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace a policy's own adjustment lines with another policy's, re-validated against this policy's legal entity","tags":["DistributionPolicies"],"x-error-codes":["VALIDATION_FAILED","DISTRIBUTION_POLICY_NOT_FOUND","DISTRIBUTION_POLICY_ARCHIVED","ACCOUNT_LEGAL_ENTITY_MISMATCH","LEDGER_ENTRY_REFUSED","MISSING_SYSTEM_ROLE_ACCOUNT","DISTRIBUTION_POLICY_TOO_MANY_ADJUSTMENTS","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["distributions:write"]}},"/v1/distribution-policies/{id}/detach":{"post":{"description":"Makes a template-based policy custom with a copy of its template's current formula and resolved amounts, and as its own lines the template's lines it had not excluded followed by its own (spec D30). No link to the template is kept. A custom policy is returned unchanged. Refused with 409 once the policy is archived, and with 422 DISTRIBUTION_POLICY_TOO_MANY_ADJUSTMENTS when the copied lines would exceed 100; a caller restricted to a subset of legal entities gets 403 outside its scope.","operationId":"DistributionPolicies.detach","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionPolicyV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DISTRIBUTION_POLICY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DISTRIBUTION_POLICY_ARCHIVED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DISTRIBUTION_POLICY_TOO_MANY_ADJUSTMENTS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Detach a template-based policy into a custom one","tags":["DistributionPolicies"],"x-error-codes":["VALIDATION_FAILED","DISTRIBUTION_POLICY_NOT_FOUND","DISTRIBUTION_POLICY_ARCHIVED","DISTRIBUTION_POLICY_TOO_MANY_ADJUSTMENTS","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["distributions:write"]}},"/v1/distribution-policy-templates":{"get":{"description":"Lists the org's distribution policy templates, optionally filtered by status, each with its lines and `assigned_count` (live policies based on it). `meta.starters_created` says whether the four starter templates were ever created; while it is false, `POST /distribution-policy-templates/starters` creates the missing ones.","operationId":"DistributionPolicyTemplates.list","parameters":[{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["active","archived"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DistributionPolicyTemplateV1Dto"}},"meta":{"$ref":"#/components/schemas/DistributionPolicyTemplatesListMetaV1Dto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List distribution policy templates","tags":["DistributionPolicyTemplates"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["distributions:read"]},"post":{"description":"Creates a template: a formula (cadence, base, guards, …), default holdback / cash floor / minimum, and adjustment lines naming a system role or an org-wide account. A new template has no entities, so its roles are not checked until it is assigned.","operationId":"DistributionPolicyTemplates.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDistributionPolicyTemplateV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionPolicyTemplateV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DISTRIBUTION_POLICY_TEMPLATE_NAME_TAKEN, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH, LEDGER_ENTRY_REFUSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a distribution policy template","tags":["DistributionPolicyTemplates"],"x-error-codes":["VALIDATION_FAILED","DISTRIBUTION_POLICY_TEMPLATE_NAME_TAKEN","ACCOUNT_LEGAL_ENTITY_MISMATCH","LEDGER_ENTRY_REFUSED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["distributions:write"]}},"/v1/distribution-policy-templates/starters":{"post":{"description":"Creates whichever of the four starter templates (Propco quarterly, Holdco quarterly, Propco monthly, Holdco monthly) this org never had, and returns only the ones this call created — an empty list once all four exist. An archived starter is never re-created, and a starter whose name a live template already holds is skipped. None is assigned to any entity.","operationId":"DistributionPolicyTemplates.createStarters","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DistributionPolicyTemplateV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create the starter templates this org never had","tags":["DistributionPolicyTemplates"],"x-error-codes":["IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["distributions:write"]}},"/v1/distribution-policy-templates/{id}":{"get":{"description":"Returns one template with its formula, default amounts, lines (each with the id a policy excludes it by) and `assigned_count`.","operationId":"DistributionPolicyTemplates.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionPolicyTemplateV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DISTRIBUTION_POLICY_TEMPLATE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a distribution policy template by id","tags":["DistributionPolicyTemplates"],"x-error-codes":["VALIDATION_FAILED","DISTRIBUTION_POLICY_TEMPLATE_NOT_FOUND"],"x-required-scopes":["distributions:read"]},"patch":{"description":"Partial update of a template; the change reaches every assigned entity's position at once. A given `lines` array replaces the lines whole (an unchanged line keeps its id and the exclusions of it). `status: archived` archives it, refused with 409 while live policies are assigned. A new role line every assigned entity cannot resolve is refused with 422 naming them. A caller restricted to a subset of legal entities gets 403 unless every assigned entity is in its scope.","operationId":"DistributionPolicyTemplates.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDistributionPolicyTemplateV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionPolicyTemplateV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DISTRIBUTION_POLICY_TEMPLATE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DISTRIBUTION_POLICY_TEMPLATE_IN_USE, DISTRIBUTION_POLICY_TEMPLATE_ARCHIVED, DISTRIBUTION_POLICY_TEMPLATE_NAME_TAKEN, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH, LEDGER_ENTRY_REFUSED, MISSING_SYSTEM_ROLE_ACCOUNT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update or archive a distribution policy template","tags":["DistributionPolicyTemplates"],"x-error-codes":["VALIDATION_FAILED","DISTRIBUTION_POLICY_TEMPLATE_NOT_FOUND","DISTRIBUTION_POLICY_TEMPLATE_IN_USE","DISTRIBUTION_POLICY_TEMPLATE_ARCHIVED","DISTRIBUTION_POLICY_TEMPLATE_NAME_TAKEN","ACCOUNT_LEGAL_ENTITY_MISMATCH","LEDGER_ENTRY_REFUSED","MISSING_SYSTEM_ROLE_ACCOUNT","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["distributions:write"]}},"/v1/distribution-policy-templates/{id}/assign":{"post":{"description":"For each distinct legal entity: creates a template-based policy when it has none (`created`), moves it from another template keeping its overrides and own lines and dropping its exclusions (`moved`), turns its custom policy into a template-based one (`converted`), or leaves it (`unchanged`). An entity that cannot be assigned fails on its own row with an error code and the call still answers 200 — results are in input order. Only a missing (404) or archived (409) template fails the whole call.","operationId":"DistributionPolicyTemplates.assign","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignDistributionPolicyTemplateV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DistributionTemplateAssignmentResultV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DISTRIBUTION_POLICY_TEMPLATE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DISTRIBUTION_POLICY_TEMPLATE_ARCHIVED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Assign a template to many legal entities at once","tags":["DistributionPolicyTemplates"],"x-error-codes":["VALIDATION_FAILED","DISTRIBUTION_POLICY_TEMPLATE_NOT_FOUND","DISTRIBUTION_POLICY_TEMPLATE_ARCHIVED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["distributions:write"]}},"/v1/distribution-policy-templates/{id}/move-entities":{"post":{"description":"Moves every live policy on this template to `to_template_id`, with the per-entity results of assign (overrides and own lines kept, exclusions dropped) — the way to empty a template before archiving it. This template may already be archived; the target must be active and a different template (400 otherwise).","operationId":"DistributionPolicyTemplates.moveEntities","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveDistributionPolicyTemplateEntitiesV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DistributionTemplateAssignmentResultV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DISTRIBUTION_POLICY_TEMPLATE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DISTRIBUTION_POLICY_TEMPLATE_ARCHIVED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Move every entity on this template to another template","tags":["DistributionPolicyTemplates"],"x-error-codes":["VALIDATION_FAILED","DISTRIBUTION_POLICY_TEMPLATE_NOT_FOUND","DISTRIBUTION_POLICY_TEMPLATE_ARCHIVED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["distributions:write"]}},"/v1/scheduled-distributions":{"get":{"description":"Lists the scheduled distribution items of the org — one per policy and due date — filtered by `legal_entity_id`, `status` (comma separated), a due-date window (`from_date`, `to_date`, inclusive) and `flag`, and `in_batch` (`false`: items in no batch, `true`: items in one). `group_by` orders the list: `due_date` (default), `entity`, or `tree` (holdcos above the entities they own). The owner split is not on the list; `GET /{id}` returns it. A caller restricted to a subset of legal entities sees only items on entities it may act on, and gets 403 for a `legal_entity_id` outside its scope.","operationId":"ScheduledDistributions.list","parameters":[{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","description":"Comma-separated statuses, e.g. `staged,needs_review`.","schema":{"type":"array","items":{"type":"string","enum":["scheduled","staged","nothing_to_distribute","approved","rejected","skipped","needs_review","queued","executed","failed","cancelled"]}}},{"name":"from_date","required":false,"in":"query","description":"Inclusive lower bound on the due date. YYYY-MM-DD.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Inclusive upper bound on the due date. YYYY-MM-DD.","schema":{"format":"date","type":"string"}},{"name":"flag","required":false,"in":"query","description":"Only items carrying this flag.","schema":{"type":"string","enum":["prior_period_open","cash_shortfall","period_open","no_cash_accounts","downstream_no_policy","upstream_pending","no_cap_table","period_already_declared"]}},{"name":"in_batch","required":false,"in":"query","description":"`false` keeps only the items in no batch, `true` only the items in one; omitted keeps both. Applied in the query, so every page holds only matching items.","schema":{"type":"boolean"}},{"name":"group_by","required":false,"in":"query","description":"Orders the list (it does not nest it). `due_date`: due date, entity name, id. `entity`: entity name, entity id, due date, id. `tree`: due date, depth descending (undetermined last — holdcos above the entities they own), entity name, id. A cursor is valid only for the `group_by` it was issued for.","schema":{"default":"due_date","type":"string","enum":["due_date","entity","tree"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..200, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ScheduledDistributionV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List scheduled distributions","tags":["ScheduledDistributions"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["distributions:read"]}},"/v1/scheduled-distributions/{id}":{"get":{"description":"Returns one item with `computation` (the statement frozen when it was last computed; null while `scheduled`), its `history` (oldest first) and `owner_split`: how the adjusted amount splits across the entity's direct owners on the due date (null while the item has no amount — not computed yet, or 0.00 — or the entity has no cap table on that date), `split`: the waterfall split of the adjusted amount on the due date, computed live (null when no waterfall applies), and `owned_same_day`: the same-day items of the entities it owns directly, read live (one in review shows there although the statement did not count it). A caller restricted to a subset of legal entities gets 403 outside its scope, and sees only its own entities in `owned_same_day`.","operationId":"ScheduledDistributions.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ScheduledDistributionDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: SCHEDULED_DISTRIBUTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a scheduled distribution by id","tags":["ScheduledDistributions"],"x-error-codes":["VALIDATION_FAILED","SCHEDULED_DISTRIBUTION_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["distributions:read"]},"patch":{"description":"Approves, modifies (with `adjusted_amount`), rejects, skips or resets a `staged`, `needs_review`, `approved` or `nothing_to_distribute` item. A `modify` to an amount other than the computed one needs a `reason` (free text); approving an item that exceeds available cash needs `acknowledge_cash_shortfall`. A final item (rejected, skipped, executed, cancelled) is refused with 409 `SCHEDULED_DISTRIBUTION_TERMINAL`; a `scheduled`, `queued` or `failed` one, or an `approve` on `nothing_to_distribute` (modify it first), with 409 `SCHEDULED_DISTRIBUTION_NOT_DECIDABLE`. A caller restricted to a subset of legal entities gets 403 outside its scope.","operationId":"ScheduledDistributions.decide","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecideScheduledDistributionV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ScheduledDistributionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: SCHEDULED_DISTRIBUTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SCHEDULED_DISTRIBUTION_TERMINAL, SCHEDULED_DISTRIBUTION_NOT_DECIDABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SCHEDULED_DISTRIBUTION_FLAG_UNACKNOWLEDGED, SCHEDULED_DISTRIBUTION_ADJUSTMENT_REASON_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Decide a scheduled distribution","tags":["ScheduledDistributions"],"x-error-codes":["VALIDATION_FAILED","SCHEDULED_DISTRIBUTION_NOT_FOUND","SCHEDULED_DISTRIBUTION_TERMINAL","SCHEDULED_DISTRIBUTION_NOT_DECIDABLE","SCHEDULED_DISTRIBUTION_FLAG_UNACKNOWLEDGED","SCHEDULED_DISTRIBUTION_ADJUSTMENT_REASON_REQUIRED","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Approves a distribution of money to owners.","x-required-scopes":["distributions:write"]}},"/v1/scheduled-distributions/bulk-decisions":{"post":{"description":"Applies one decision (`approve`, `reject`, `skip` or `reset`) to up to 500 items, each on its own. An item that is missing, outside the caller's scope, final or not decidable (an `approve` on `nothing_to_distribute` included) fails on its own row with an error code, even when it carries a flag. Otherwise an item carrying a flag other than `period_open` and `no_cash_accounts` is left alone (`skipped_flagged`; an `approve` checks `prior_period_open` as of the call, not as stored). The call answers 200 and results are in input order. `modify` is not available in bulk.","operationId":"ScheduledDistributions.bulkDecide","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkDecideScheduledDistributionsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BulkDecisionResultV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Approve, reject, skip or reset many scheduled distributions","tags":["ScheduledDistributions"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Approves distributions of money to owners.","x-required-scopes":["distributions:write"]}},"/v1/scheduled-distributions/{id}/stage":{"post":{"description":"Computes one `scheduled` item immediately, whatever its due date, and returns it `staged` (or `nothing_to_distribute`). Only a `scheduled` item can be staged. A caller restricted to a subset of legal entities gets 403 outside its scope.","operationId":"ScheduledDistributions.stage","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ScheduledDistributionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: SCHEDULED_DISTRIBUTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SCHEDULED_DISTRIBUTION_NOT_SCHEDULED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: MISSING_SYSTEM_ROLE_ACCOUNT, ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Stage a scheduled distribution now","tags":["ScheduledDistributions"],"x-error-codes":["VALIDATION_FAILED","SCHEDULED_DISTRIBUTION_NOT_FOUND","SCHEDULED_DISTRIBUTION_NOT_SCHEDULED","MISSING_SYSTEM_ROLE_ACCOUNT","ACCOUNT_LEGAL_ENTITY_MISMATCH","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["distributions:write"]}},"/v1/scheduled-distributions/{id}/recompute":{"post":{"description":"Recomputes an item against the books as they are now: the computed amount, statement, flags and cash fields are replaced. An operator amount stays, with its reason, unless the new computed amount equals it. A new computed amount below the minimum makes the item `nothing_to_distribute` (not approvable until modified), unless the operator amount stays or an operator already made the item approvable that way and the computed amount has not moved. Otherwise an approved item whose computed amount changed, or that now carries a `cash_shortfall` nobody acknowledged, returns to `needs_review`. A caller restricted to a subset of legal entities gets 403 outside its scope.","operationId":"ScheduledDistributions.recompute","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ScheduledDistributionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: SCHEDULED_DISTRIBUTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SCHEDULED_DISTRIBUTION_TERMINAL, SCHEDULED_DISTRIBUTION_NOT_DECIDABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: MISSING_SYSTEM_ROLE_ACCOUNT, ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Recompute a decidable scheduled distribution","tags":["ScheduledDistributions"],"x-error-codes":["VALIDATION_FAILED","SCHEDULED_DISTRIBUTION_NOT_FOUND","SCHEDULED_DISTRIBUTION_TERMINAL","SCHEDULED_DISTRIBUTION_NOT_DECIDABLE","MISSING_SYSTEM_ROLE_ACCOUNT","ACCOUNT_LEGAL_ENTITY_MISMATCH","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["distributions:write"]}},"/v1/scheduled-distributions/{id}/retry":{"post":{"description":"Puts a `failed` item of a batch that is `executing` or `completed_with_failures` back to `queued`, with its error cleared, and enqueues its job; a `completed_with_failures` batch returns to `executing`. It executes the amount that was approved: nothing is recomputed. Any other item is refused with 409 `SCHEDULED_DISTRIBUTION_NOT_RETRYABLE`. A caller restricted to a subset of legal entities gets 403 outside its scope.","operationId":"ScheduledDistributions.retry","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ScheduledDistributionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: SCHEDULED_DISTRIBUTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SCHEDULED_DISTRIBUTION_NOT_RETRYABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Retry a failed batch item","tags":["ScheduledDistributions"],"x-error-codes":["VALIDATION_FAILED","SCHEDULED_DISTRIBUTION_NOT_FOUND","SCHEDULED_DISTRIBUTION_NOT_RETRYABLE","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["distributions:write"]}},"/v1/distribution-batches":{"post":{"description":"Groups 1 to 500 distinct `approved` scheduled distributions, of any entities and due dates, into one batch and sends it to approval as one decision. The whole call is refused on the first refused item: one that is not approved, already in a batch, or not executable (an undetermined depth or no cap table). With no approval rule matching the batch, execution starts at once; otherwise the batch is `pending_approval` until its request is decided. Only a user can submit: an API key gets 403. A caller restricted to a subset of legal entities gets 403 when any item is outside its scope.","operationId":"DistributionBatches.submit","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitDistributionBatchV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionBatchV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: DISTRIBUTION_BATCH_SUBMITTER_NOT_A_USER, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: SCHEDULED_DISTRIBUTION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DISTRIBUTION_BATCH_ITEM_NOT_APPROVED, DISTRIBUTION_BATCH_ITEM_ALREADY_BATCHED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DISTRIBUTION_BATCH_ITEM_NOT_EXECUTABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Submit approved scheduled distributions as a batch","tags":["DistributionBatches"],"x-error-codes":["VALIDATION_FAILED","SCHEDULED_DISTRIBUTION_NOT_FOUND","DISTRIBUTION_BATCH_ITEM_NOT_APPROVED","DISTRIBUTION_BATCH_ITEM_ALREADY_BATCHED","DISTRIBUTION_BATCH_ITEM_NOT_EXECUTABLE","DISTRIBUTION_BATCH_SUBMITTER_NOT_A_USER","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["distributions:write"]},"get":{"description":"Lists the batches of the org, newest submission first, filtered by `status` (comma separated). Each row carries `submitted_by_name`, the submitter's display name, else their email (null when neither is on file). A caller restricted to a subset of legal entities sees only batches whose every item is on an entity it may act on. Each row carries `approval_request` as the card does: the open request if there is one, else the latest, else null; `actionable` is for the caller.","operationId":"DistributionBatches.list","parameters":[{"name":"status","required":false,"in":"query","description":"Comma-separated statuses, e.g. `pending_approval,executing`.","schema":{"type":"array","items":{"type":"string","enum":["pending_approval","approved","rejected","executing","completed","completed_with_failures","cancelled"]}}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..200, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DistributionBatchListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List distribution batches","tags":["DistributionBatches"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["distributions:read"]}},"/v1/distribution-batches/{id}":{"get":{"description":"Returns the batch with what an approver needs to decide it: `counts` (items, flagged, modified, cash shortfalls), the `due_dates` range, the `entities` involved, every item (entity, due date, depth, status, adjusted amount, flags, error, and the declaration it executed), `submitted_by_name`, and the batch approval request: the open one if there is one, else the latest, else null, with `actionable` saying whether the caller can decide it now. A caller restricted to a subset of legal entities gets 403 when any item is outside its scope.","operationId":"DistributionBatches.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionBatchCardV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DISTRIBUTION_BATCH_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a distribution batch (the approval card)","tags":["DistributionBatches"],"x-error-codes":["VALIDATION_FAILED","DISTRIBUTION_BATCH_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["distributions:read"]}},"/v1/distribution-batches/{id}/cancel":{"post":{"description":"Cancels a batch that has not started executing (`pending_approval` or `approved`): its open approval request is withdrawn and every item returns to `approved`, out of the batch. A batch that is executing or later cannot be cancelled (409 `DISTRIBUTION_BATCH_INVALID_STATUS`), nor can one whose request was already decided. A caller restricted to a subset of legal entities gets 403 when any item is outside its scope.","operationId":"DistributionBatches.cancel","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelDistributionBatchV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionBatchV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DISTRIBUTION_BATCH_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DISTRIBUTION_BATCH_INVALID_STATUS, CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Cancel a distribution batch","tags":["DistributionBatches"],"x-error-codes":["VALIDATION_FAILED","DISTRIBUTION_BATCH_NOT_FOUND","DISTRIBUTION_BATCH_INVALID_STATUS","LEGAL_ENTITY_NOT_IN_SCOPE","CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["distributions:write"]}},"/v1/legal-entities/distribution-summary":{"get":{"description":"One row per legal entity that is not managed, by name: its active or paused policy, the next due date of a scheduled item, how many items wait for a decision, the position at its latest computation (less that item’s amount once committed; not today’s position) and the active declarations of the current fiscal year. A caller restricted to a subset of legal entities sees only those.","operationId":"LegalEntityDistributionSummary.list","parameters":[{"name":"policy_status","required":false,"in":"query","description":"Comma-separated. `none`: the entity has no active or paused policy (an archived one counts as none).","schema":{"type":"array","items":{"type":"string","enum":["active","paused","none"]}}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring of the entity's name.","schema":{"maxLength":200,"type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Only this legal entity (at most one row).","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..200, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DistributionEntitySummaryV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List legal entities with their distribution summary","tags":["ScheduledDistributions"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["distributions:read"]}},"/v1/legal-entities/{id}/distribution-timeline":{"get":{"description":"One list, sorted by date, of the entity's distribution declarations (manual and scheduled; an undone one stays, as `undone`) and its scheduled items in any status but executed and cancelled (a rejected, skipped or failed item stays). An executed item appears as its declaration; a cancelled item is omitted. The window defaults to the org's today minus 12 months through today plus 36 months and may not exceed 10 years. A caller restricted to a subset of legal entities gets 403 outside its scope.","operationId":"LegalEntityDistributionTimeline.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"from_date","required":false,"in":"query","description":"Inclusive start of the window. Defaults to the org's today minus 12 months. YYYY-MM-DD.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Inclusive end of the window. Defaults to the org's today plus 36 months. The window may not exceed 10 years. YYYY-MM-DD.","schema":{"format":"date","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionTimelineV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a legal entity's distribution timeline","tags":["ScheduledDistributions"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"none","reason":"one entity over a bounded date window, not a collection that grows without bound","bound":"at most one item per policy and due date inside a window of at most 10 years"},"x-required-scopes":["distributions:read"]}},"/v1/legal-entities/{legalEntityId}/waterfall-preview":{"post":{"description":"Splits `amount` on `as_of` through the legal entity's waterfall for `distribution_type` (else its `any` waterfall): the cap table, positions and frozen history are read as of the date, and the income priority tiers need is measured on the ledger. With `version_id`, the waterfall's open draft is previewed appended to its active history. Nothing is stored.","operationId":"Waterfalls.preview","parameters":[{"name":"legalEntityId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaterfallPreviewRequestV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WaterfallPreviewV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: EQUITY_LEGAL_ENTITY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: EQUITY_WATERFALL_NOT_APPLICABLE, EQUITY_WATERFALL_VERSION_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview a waterfall split","tags":["Distributions"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","EQUITY_LEGAL_ENTITY_NOT_FOUND","EQUITY_WATERFALL_NOT_APPLICABLE","EQUITY_WATERFALL_VERSION_INVALID"],"x-required-scopes":["equity:read"]}},"/v1/distributions/overview":{"get":{"description":"Four figures, each a count and a total: scheduled items to decide (staged, needing review, below the minimum or approved, in no batch); batches awaiting approval; batches in progress (executing or completed with failures); and what was distributed in the current fiscal year (active declarations). A caller restricted to a subset of legal entities sees only items and declarations of those entities, and only the batches whose items all belong to them.","operationId":"DistributionsOverview.get","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionsOverviewV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Get the distributions center figures","tags":["Distributions"],"x-pagination":{"mode":"none","reason":"four fixed figures, not a collection","bound":"exactly four figures"},"x-required-scopes":["distributions:read"]}},"/v1/distribution-refunds":{"post":{"description":"Records a holder paying back distributions it received. The entity posts a `distribution_refund` (DR distributions receivable / CR owner distributions) with the amount OPEN until the money arrives: collect it with a bank match, a payment application or `POST /v1/documents/{id}/mark-paid`. When the holder is one of the org's own legal entities its side is recorded too, as a `distribution_refund_payable` on its own books, dated `holder_date` (default `refund_date`) and keyed by `holder_external_ref`; paying it records the entity's receipt in the same transaction. `holder_side: false` records only the entity's side. A `capital` refund books the holder's side against its investment.\n\nThe refund reduces the `bucket`'s distributed column of the holder's capital account (it may go negative) and never changes ownership. No capital event is written for a holder without a position or a date before the entity's ledger start. Refused on an entity whose waterfall applies on the date.","operationId":"DistributionRefunds.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDistributionRefundV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionRefundV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: EXTERNAL_REF_TAKEN, PERIOD_CLOSED, PERIOD_LOCKED, POSTING_BEFORE_LEGAL_ENTITY_START, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DISTRIBUTION_REFUND_POSITION_AMBIGUOUS, DISTRIBUTION_REFUND_POSITION_NOT_HELD, DISTRIBUTION_REFUND_DECLARATION_MISMATCH, DISTRIBUTION_WATERFALL_ENTITY, MISSING_SYSTEM_ROLE_ACCOUNT, LEDGER_ENTRY_REFUSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record a refund of distributions","tags":["Distributions"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","EXTERNAL_REF_TAKEN","DISTRIBUTION_REFUND_POSITION_AMBIGUOUS","DISTRIBUTION_REFUND_POSITION_NOT_HELD","DISTRIBUTION_REFUND_DECLARATION_MISMATCH","DISTRIBUTION_WATERFALL_ENTITY","MISSING_SYSTEM_ROLE_ACCOUNT","PERIOD_CLOSED","PERIOD_LOCKED","PERIOD_MISSING","POSTING_BEFORE_LEGAL_ENTITY_START","LEDGER_ENTRY_REFUSED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["distributions:write"]},"get":{"description":"Refunds of distributions, newest `refund_date` first, voided ones included (`voided_at` set). Filter by `legal_entity_id`, `party_id` or the exact `external_ref`. 100 per page; drain `meta.next_cursor`.","operationId":"DistributionRefunds.list","parameters":[{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"party_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"external_ref","required":false,"in":"query","description":"Exact match on the record's `external_ref` (another system's key); returns 0 or 1 row. Combines with the other filters.","schema":{"minLength":1,"maxLength":200,"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -refund_date","schema":{"enum":["refund_date","-refund_date"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: memo, external_ref.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DistributionRefundV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List refunds of distributions","tags":["Distributions"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["distributions:read"]}},"/v1/distribution-refunds/{id}":{"get":{"operationId":"DistributionRefunds.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionRefundV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DISTRIBUTION_REFUND_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a refund of distributions","tags":["Distributions"],"x-error-codes":["VALIDATION_FAILED","DISTRIBUTION_REFUND_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["distributions:read"]}},"/v1/distribution-refunds/{id}/void":{"post":{"description":"Voids the refund as a whole: both documents (each reverses its own entry) and its capital event. Refused while a payment is applied to either document — void the payment first.","operationId":"DistributionRefunds.void","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DistributionRefundV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: DISTRIBUTION_REFUND_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: DISTRIBUTION_REFUND_ALREADY_VOIDED, TARGET_HAS_ACTIVE_APPLICATIONS, DOCUMENT_HELD_BY_DISTRIBUTION_REFUND, DOCUMENT_CHANGED_WHILE_EDITING, DOCUMENT_STATUS_FORBIDS_ACTION, DOCUMENT_RECONCILED_CANNOT_VOID, DOCUMENT_MATCHED_CANNOT_VOID, PERIOD_LOCKED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Void a refund of distributions","tags":["Distributions"],"x-error-codes":["VALIDATION_FAILED","DISTRIBUTION_REFUND_NOT_FOUND","DISTRIBUTION_REFUND_ALREADY_VOIDED","TARGET_HAS_ACTIVE_APPLICATIONS","DOCUMENT_HELD_BY_DISTRIBUTION_REFUND","DOCUMENT_CHANGED_WHILE_EDITING","DOCUMENT_STATUS_FORBIDS_ACTION","DOCUMENT_RECONCILED_CANNOT_VOID","DOCUMENT_MATCHED_CANNOT_VOID","PERIOD_LOCKED","PERIOD_MISSING","LEDGER_ENTRY_REFUSED","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Voids a posted distribution refund and reverses its entries.","x-required-scopes":["distributions:write"]}},"/v1/search":{"get":{"description":"Ranked cross-entity search. Matches names, memos, document numbers and amounts; results are recency-weighted and filtered to the records the caller may read.","operationId":"Search.query","parameters":[{"name":"q","required":true,"in":"query","description":"Search term. Matched against names, memos, document numbers and amounts.","schema":{"example":"1042","type":"string"}},{"name":"kind","required":false,"in":"query","description":"Restrict to result kinds, e.g. `invoice`, `party`, `contract`. Repeat or comma-separate.","schema":{"type":"array","items":{"type":"string"}}},{"name":"legal_entity_id","required":false,"in":"query","description":"Restrict to one legal entity.","schema":{"type":"string"}},{"name":"from_date","required":false,"in":"query","description":"Earliest business date (inclusive).","schema":{"type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Latest business date (inclusive).","schema":{"type":"string"}},{"name":"date_from","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `from_date` (earliest business date, inclusive).","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `to_date` (latest business date, inclusive).","schema":{"type":"string"}},{"name":"amount_min","required":false,"in":"query","description":"Minimum amount (inclusive).","schema":{"type":"number"}},{"name":"amount_max","required":false,"in":"query","description":"Maximum amount (inclusive).","schema":{"type":"number"}},{"name":"limit","required":false,"in":"query","description":"Page size. Default 20.","schema":{"minimum":1,"maximum":100,"type":"number"}},{"name":"offset","required":false,"in":"query","description":"Rows to skip. Search is ranked by a computed relevance score, so it pages by offset rather than by cursor — there is no stable sort key to encode.","schema":{"minimum":0,"type":"number"}},{"name":"per_kind","required":false,"in":"query","description":"Maximum hits per kind. Stops one record type filling every slot when thousands of rows tie on the same match tier. Defaults to 5 — omitting it gives the capped behaviour, because an uncapped default reproduces exactly the flooding the cap exists to prevent. Pass `0` to opt out explicitly and get a purely score-ordered list (what the full results page does, so it hides nothing).","schema":{"minimum":0,"maximum":50,"default":5,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SearchHitV1Dto"}},"meta":{"$ref":"#/components/schemas/SearchMetaV1Dto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Search across every record type","tags":["Search"],"x-error-codes":["VALIDATION_FAILED"],"x-pagination":{"mode":"offset"},"x-required-scopes":["search:read"]}},"/v1/search/resolve":{"get":{"description":"Turns `kind:id` pairs into titles for the palette's recent-records list. Refs the caller may no longer read, or that no longer exist, are omitted — which is why clients store identifiers rather than caching titles.","operationId":"Search.resolve","parameters":[{"name":"refs","required":true,"in":"query","description":"Comma-separated `kind:id` pairs, e.g. `invoice:9f4c…,party:2b1a…`. Unknown, deleted, or forbidden refs are omitted from the response rather than erroring.","schema":{"example":"invoice:11111111-1111-1111-1111-111111111111","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SearchHitV1Dto"}},"meta":{"$ref":"#/components/schemas/ResolveMetaV1Dto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Resolve record references to display rows","tags":["Search"],"x-error-codes":["VALIDATION_FAILED"],"x-pagination":{"mode":"none","reason":"resolves a caller-supplied fixed set of refs, not an open-ended list","bound":"the number of refs the caller passed in one request"},"x-required-scopes":["search:read"]}},"/v1/internal/search/reindex":{"post":{"description":"Queues a full or per-table rebuild of `search_documents`. Returns immediately with the job id — the rebuild itself is minutes of work on a large org, which is why it is a queued job rather than an inline call. Safe to re-run: an identical request while one is already running is deduped onto it and enqueues nothing. Rows written while it runs are indexed by the triggers, so a rebuild never races live writes.","operationId":"SearchInternal.reindex","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReindexV1Dto"}}}},"responses":{"202":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReindexResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Rebuild the search index for this org","tags":["Internal — Search"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-internal":true,"x-required-scopes":["admin:*"]}},"/v1/parcels":{"get":{"operationId":"Parcels.list","parameters":[{"name":"include_inactive","required":false,"in":"query","description":"Include inactive (soft-deleted) parcels in the list.","schema":{"default":false,"type":"boolean"}},{"name":"property_id","required":false,"in":"query","description":"Filter parcels by property UUID.","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at","name","-name"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ParcelV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List parcels","tags":["Parcels"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["property-taxes:read"]},"post":{"operationId":"Parcels.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateParcelV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ParcelV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a parcel","tags":["Parcels"],"x-error-codes":["VALIDATION_FAILED","CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]}},"/v1/parcels/{id}":{"get":{"operationId":"Parcels.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ParcelV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a parcel","tags":["Parcels"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["property-taxes:read"]},"patch":{"operationId":"Parcels.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateParcelV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ParcelV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a parcel","tags":["Parcels"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]},"delete":{"operationId":"Parcels.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Soft-delete a parcel","tags":["Parcels"],"x-error-codes":["NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes":{"get":{"description":"One row per tax with its next payment (date, amount, billed or estimate, payee), what is past due, the current period window and attention flags. Sorted by next payment date (soonest first) by default; a tax with no next payment sorts last in either direction. `view` narrows to due_30, past_due or needs_attention — the same predicates as the summary tiles.","operationId":"PropertyTaxes.list","parameters":[{"name":"view","required":false,"in":"query","description":"due_30: next payment due within 30 days (late included); past_due: anything past due; needs_attention: past due or any attention flag except config_problem.","schema":{"type":"string","enum":["due_30","past_due","needs_attention"]}},{"name":"parcel_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"property_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"tax_type","required":false,"in":"query","schema":{"type":"string","enum":["city","township","county","school","real_estate","franchise","special_assessment","other"]}},{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["active","inactive"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: next_payment_date","schema":{"enum":["next_payment_date","-next_payment_date","next_payment_amount","-next_payment_amount","term_end","-term_end","property_name","-property_name","-created_at","created_at","tax_type","-tax_type"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: property_name, parcel_apn, parcel_name, tax_type, payee_name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ReTaxListRowV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List property taxes","tags":["Real Estate Taxes"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["property-taxes:read"]},"post":{"operationId":"PropertyTaxes.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateReTaxV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a property tax","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","ACCOUNT_LEGAL_ENTITY_MISMATCH","CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes/participations":{"get":{"operationId":"PropertyTaxes.listParticipations","parameters":[{"name":"contract_id","required":true,"in":"query","description":"Filter to a single lease's tax participations.","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ReTaxParticipationV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Reverse view — a lease's tax participations","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["property-taxes:read"]}},"/v1/property-taxes/summary":{"get":{"description":"Four org-wide numbers: open balance owed to authorities, open balance pending tenant reimbursement, pending landlord-direct share amounts, and pending tenant-direct share amounts. Read the field descriptions before using these as accounting figures — `pending_tenant_reimbursement` counts only shares with their own invoice, of either reimbursement method.","operationId":"PropertyTaxes.summary","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxSummaryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"The registry's overview cards, aggregated in one query","tags":["Real Estate Taxes"],"x-required-scopes":["property-taxes:read"]}},"/v1/property-taxes/bills/{billId}/shares/{shareId}/mark-paid":{"post":{"operationId":"PropertyTaxes.markSharePaid","parameters":[{"name":"billId","required":true,"in":"path","schema":{"type":"string"}},{"name":"shareId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkReTaxSharePaidV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxBillShareV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Mark a direct-pay share's manual paid state","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]},"delete":{"operationId":"PropertyTaxes.unmarkSharePaid","parameters":[{"name":"billId","required":true,"in":"path","schema":{"type":"string"}},{"name":"shareId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Clear a direct-pay share's manual paid state","tags":["Real Estate Taxes"],"x-error-codes":["NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Clears a recorded payment on a tax share.","x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes/bills/{billId}/attachments":{"get":{"operationId":"PropertyTaxes.listBillAttachments","parameters":[{"name":"billId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 200","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ReTaxBillAttachmentV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List attachments for a bill","tags":["Real Estate Taxes"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["property-taxes:read"]},"post":{"operationId":"PropertyTaxes.uploadBillAttachment","parameters":[{"name":"billId","required":true,"in":"path","schema":{"type":"string"}},{"name":"kind","required":false,"in":"query","description":"Attachment kind. Defaults to `tax_bill` when omitted.","schema":{"type":"string","enum":["tax_bill","proof_of_payment"]}},{"name":"share_id","required":false,"in":"query","description":"Scope the attachment to a specific tax share.","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF, PNG, JPEG, or WebP file. Max 25 MiB. Magic-byte sniffed server-side."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxBillAttachmentV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: ATTACHMENT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: ATTACHMENT_TYPE_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a tax bill or proof-of-payment attachment","tags":["Real Estate Taxes"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","ATTACHMENT_TYPE_UNSUPPORTED","ATTACHMENT_TOO_LARGE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes/bills/{billId}/attachments/{aid}/download-url":{"get":{"operationId":"PropertyTaxes.getBillAttachmentDownloadUrl","parameters":[{"name":"billId","required":true,"in":"path","schema":{"type":"string"}},{"name":"aid","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxBillAttachmentDownloadUrlV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND, NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a short-lived signed download URL for a bill attachment","tags":["Real Estate Taxes"],"x-error-codes":["ATTACHMENT_NOT_FOUND","NOT_FOUND"],"x-required-scopes":["property-taxes:read"]}},"/v1/property-taxes/bills/{billId}/attachments/{aid}":{"delete":{"operationId":"PropertyTaxes.deleteBillAttachment","parameters":[{"name":"billId","required":true,"in":"path","schema":{"type":"string"}},{"name":"aid","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: ATTACHMENT_NOT_FOUND, NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a bill attachment","tags":["Real Estate Taxes"],"x-error-codes":["ATTACHMENT_NOT_FOUND","NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes/{id}":{"get":{"operationId":"PropertyTaxes.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a property tax","tags":["Real Estate Taxes"],"x-error-codes":["NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["property-taxes:read"]},"patch":{"operationId":"PropertyTaxes.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateReTaxV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a property tax","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]},"delete":{"operationId":"PropertyTaxes.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a property tax","tags":["Real Estate Taxes"],"x-error-codes":["NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes/{id}/periods":{"post":{"operationId":"PropertyTaxes.createPeriod","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateReTaxPeriodV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxPeriodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, RE_TAX_FIXED_AREA_REQUIRED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a tax period (with inherit/seed from the prior year)","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","RE_TAX_FIXED_AREA_REQUIRED","ACCOUNT_LEGAL_ENTITY_MISMATCH","NOT_FOUND","CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes/{id}/periods/{periodId}":{"get":{"operationId":"PropertyTaxes.getPeriod","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxPeriodDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get the period workspace — config, participants, slots, bills","tags":["Real Estate Taxes"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["property-taxes:read"]},"patch":{"operationId":"PropertyTaxes.updatePeriod","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateReTaxPeriodV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxPeriodV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, RE_TAX_FIXED_AREA_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a period config snapshot or status","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","CONFLICT","RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","RE_TAX_FIXED_AREA_REQUIRED","ACCOUNT_LEGAL_ENTITY_MISMATCH","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes/{id}/periods/{periodId}/allocation":{"get":{"description":"The same computation bill input freezes, so what is previewed is what will be billed. An sqft participant carries no stored percentage — it depends on who else participates — so this is the only way to see one before a bill exists.","operationId":"PropertyTaxes.previewAllocation","parameters":[{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxAllocationV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview a period's allocation","tags":["Real Estate Taxes"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED"],"x-required-scopes":["property-taxes:read"]}},"/v1/property-taxes/{id}/periods/{periodId}/participants":{"post":{"operationId":"PropertyTaxes.addParticipant","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddReTaxParticipantV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxParticipantV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, RE_TAX_PARTICIPANT_SHARE_CUT, RE_TAX_PARTICIPANT_METHOD_MISMATCH, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY, CONFLICT, RE_TAX_PARTICIPANT_OVERLAP, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a participant (lease) to a tax period","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","NOT_FOUND","CONFLICT","RE_TAX_PARTICIPANT_SHARE_CUT","RE_TAX_PARTICIPANT_OVERLAP","RE_TAX_PARTICIPANT_METHOD_MISMATCH","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes/{id}/periods/{periodId}/participants/batch":{"post":{"description":"Either every participant lands or none does. Use this to seed a period from the property's leases: the share sum is checked ONCE over the resulting set, so a rejection leaves the period exactly as it was rather than half-populated. Note this reaches no set that repeated single adds could not — the sum only grows as participants are added, so every prefix of a valid set is valid. What it adds is the rollback, one round trip, and one idempotency key for the whole set. A contract_id repeated within the payload is rejected, as is one already on the period on the same days (409 RE_TAX_PARTICIPANT_OVERLAP).","operationId":"PropertyTaxes.addParticipantsBatch","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddReTaxParticipantsBatchV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ReTaxParticipantV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, RE_TAX_PARTICIPANT_SHARE_CUT, RE_TAX_PARTICIPANT_METHOD_MISMATCH, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY, CONFLICT, RE_TAX_PARTICIPANT_OVERLAP, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add several participants to a tax period in one transaction","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","NOT_FOUND","CONFLICT","RE_TAX_PARTICIPANT_SHARE_CUT","RE_TAX_PARTICIPANT_OVERLAP","RE_TAX_PARTICIPANT_METHOD_MISMATCH","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes/{id}/periods/{periodId}/participants/changes":{"post":{"description":"Applies a list of operations atomically — add a lease, change a participant's share from a date, end a participant — and checks the shares ONCE over the state before and after the whole list. A 'change' ends the row the day before `from` and starts a new row on it, so bills already issued keep the share they used; it is how a billed participant's share changes. A 'change' ON the row's first day has no days to keep, so it corrects the row in place instead (409 RE_TAX_PARTICIPANT_BILLED_SHARE_IMMUTABLE when an issued bill used it). Under participant area a change may cut only the participants it names — the subject of an operation or a participant id in accept_cuts — and is refused otherwise (400 RE_TAX_PARTICIPANT_SHARE_CUT, context { on, participant_ids }). POST …/changes/preview takes the same body and saves nothing. Returns the period’s participants after the change.","operationId":"PropertyTaxes.applyParticipantChanges","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReTaxParticipantChangesV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxParticipantChangesResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, RE_TAX_PARTICIPANT_SHARE_CUT, RE_TAX_PARTICIPANT_METHOD_MISMATCH, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY, RE_TAX_PARTICIPANT_OVERLAP, RE_TAX_PARTICIPANT_BILLED_SHARE_IMMUTABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Change several participants at once (dated changes, rebalance)","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","NOT_FOUND","RE_TAX_PARTICIPANT_SHARE_CUT","RE_TAX_PARTICIPANT_OVERLAP","RE_TAX_PARTICIPANT_METHOD_MISMATCH","RE_TAX_PARTICIPANT_BILLED_SHARE_IMMUTABLE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes/{id}/periods/{periodId}/participants/changes/preview":{"post":{"description":"Takes the body of POST …/participants/changes and runs the same checks, saving nothing. Returns the period split into date ranges over which the participants do not change, each with every participant's resolved share and the owner's remainder, before and after the operations, plus the participants the change would cut (share on the first cut day, before and after). A cut is listed, not refused, and so is a side that does not resolve (`problem`; `refusal` says when the save would refuse the result). Invalid operations and over-allocation are refused as the save would. With no operations, before and after are both the period's current timeline.","operationId":"PropertyTaxes.previewParticipantChanges","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReTaxParticipantChangesV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxParticipantChangesPreviewV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, RE_TAX_PARTICIPANT_METHOD_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY, RE_TAX_PARTICIPANT_OVERLAP, RE_TAX_PARTICIPANT_BILLED_SHARE_IMMUTABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview a participant change without saving it","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","NOT_FOUND","RE_TAX_PARTICIPANT_OVERLAP","RE_TAX_PARTICIPANT_METHOD_MISMATCH","RE_TAX_PARTICIPANT_BILLED_SHARE_IMMUTABLE"],"x-required-scopes":["property-taxes:read"]}},"/v1/property-taxes/{id}/periods/{periodId}/participants/{pid}":{"patch":{"description":"Edits the row in place. A billed participant's share_basis and share_pct cannot be edited in place (409 RE_TAX_PARTICIPANT_BILLED_SHARE_IMMUTABLE): use a dated change (POST …/participants/changes). ended_on stays editable — that is End and Undo end. Under participant area an edit may not cut other area tenants' shares (400 RE_TAX_PARTICIPANT_SHARE_CUT); accept the cut through the changes route.","operationId":"PropertyTaxes.updateParticipant","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"pid","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateReTaxParticipantV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxParticipantV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, RE_TAX_PARTICIPANT_SHARE_CUT, RE_TAX_PARTICIPANT_METHOD_MISMATCH, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY, RE_TAX_PARTICIPANT_BILLED_SHARE_IMMUTABLE, RE_TAX_PARTICIPANT_OVERLAP, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a participant's share or method","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","NOT_FOUND","RE_TAX_PARTICIPANT_SHARE_CUT","RE_TAX_PARTICIPANT_BILLED_SHARE_IMMUTABLE","RE_TAX_PARTICIPANT_OVERLAP","RE_TAX_PARTICIPANT_METHOD_MISMATCH","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]},"delete":{"operationId":"PropertyTaxes.removeParticipant","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"pid","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RE_TAX_PARTICIPANT_BILLED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Remove a participant from a tax period","tags":["Real Estate Taxes"],"x-error-codes":["NOT_FOUND","RE_TAX_PARTICIPANT_BILLED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes/{id}/periods/{periodId}/participants/{pid}/replace":{"post":{"description":"Ends the participant the day before effective_from and adds the successor lease from effective_from, in one transaction. Use it when a tenant is replaced mid-period: past bills stay as billed, and bills recorded afterwards split the tax by the days each lease participated. effective_from must be after the replaced participant's first day (its started_on, else the period start) and inside the period; a participant that already ended earlier is refused rather than re-opened. The successor passes the same rules as an add (409 RE_TAX_PARTICIPANT_OVERLAP if the lease already participates on those days; via_cam needs the period's recovery group), and negotiated shares may total at most 100% on any one day. A lease-ended work item is raised for the replaced lease, as when a participation is ended.","operationId":"PropertyTaxes.replaceParticipant","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"pid","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplaceReTaxParticipantV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReplaceReTaxParticipantResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, RE_TAX_PARTICIPANT_SHARE_CUT, RE_TAX_PARTICIPANT_METHOD_MISMATCH, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY, CONFLICT, RE_TAX_PARTICIPANT_OVERLAP, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace a participant with a successor lease","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","NOT_FOUND","CONFLICT","RE_TAX_PARTICIPANT_SHARE_CUT","RE_TAX_PARTICIPANT_OVERLAP","RE_TAX_PARTICIPANT_METHOD_MISMATCH","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes/{id}/periods/{periodId}/slots":{"post":{"operationId":"PropertyTaxes.addExpectedBill","parameters":[{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddReTaxExpectedBillV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxExpectedBillV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add an expected-bill slot to a tax period","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes/{id}/periods/{periodId}/slots/{sid}":{"patch":{"operationId":"PropertyTaxes.updateExpectedBill","parameters":[{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"sid","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateReTaxExpectedBillV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxExpectedBillV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update an expected-bill slot","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]},"delete":{"operationId":"PropertyTaxes.removeExpectedBill","parameters":[{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"sid","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Remove an expected-bill slot","tags":["Real Estate Taxes"],"x-error-codes":["NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes/{id}/periods/{periodId}/bills":{"post":{"operationId":"PropertyTaxes.inputBill","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InputReTaxBillV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxBillInputResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, PERIOD_LOCKED, PERIOD_CLOSED, RE_TAX_SUPPLEMENTAL_BILL_DUPLICATE, RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Input a bill — snapshots shares, posts the AP bill and any AR invoices, records the recovery charge links","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_LOCKED","PERIOD_CLOSED","PERIOD_MISSING","DIMENSION_REQUIRED","RE_TAX_SUPPLEMENTAL_BILL_DUPLICATE","RE_TAX_PARTICIPANT_DIRECT_BILL_IN_RECOVERY"],"x-required-scopes":["property-taxes:write"]}},"/v1/property-taxes/{id}/periods/{periodId}/bills/{billId}":{"patch":{"operationId":"PropertyTaxes.updateBill","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"billId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateReTaxBillV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxBillV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a bill — critical dates + notes only (amount is immutable)","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["property-taxes:write"]},"delete":{"operationId":"PropertyTaxes.voidBill","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"periodId","required":true,"in":"path","schema":{"type":"string"}},{"name":"billId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoidReTaxBillV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReTaxBillV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PERIOD_LOCKED, SOURCE_BILL_CHARGES_ALREADY_COLLECTED, TARGET_HAS_ACTIVE_APPLICATIONS, IDEMPOTENCY_CONFLICT, DOCUMENT_STATUS_FORBIDS_ACTION, DOCUMENT_RECONCILED_CANNOT_VOID, DOCUMENT_MATCHED_CANNOT_VOID, DOCUMENT_COST_CAPITALIZED_CANNOT_VOID, DOCUMENT_HELD_BY_PAYMENT_RUN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Void a bill — voids the AP bill and every share invoice, frees the slot","tags":["Real Estate Taxes"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","PERIOD_LOCKED","PERIOD_MISSING","SOURCE_BILL_CHARGES_ALREADY_COLLECTED","TARGET_HAS_ACTIVE_APPLICATIONS","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","DOCUMENT_STATUS_FORBIDS_ACTION","LEGAL_ENTITY_NOT_IN_SCOPE","DOCUMENT_RECONCILED_CANNOT_VOID","DOCUMENT_MATCHED_CANNOT_VOID","DOCUMENT_COST_CAPITALIZED_CANNOT_VOID","DOCUMENT_HELD_BY_PAYMENT_RUN"],"x-high-risk":true,"x-high-risk-reason":"Voids a tax bill, its AP bill and every share invoice.","x-required-scopes":["property-taxes:write"]}},"/v1/expense-recovery/registry":{"get":{"description":"One row per recovery group with its cycle's cost, unrecovered gap and billing state, in a single query. This is what the landing page lists; `ExpenseRecovery.listGroups` returns the group configuration behind it and stays the read the workspace uses. Cost comes from account totals, not run lines — read the field descriptions before using these as accounting figures.","operationId":"ExpenseRecovery.listGroupRegistry","parameters":[{"name":"cycle_year","required":true,"in":"query","schema":{"type":"string"}},{"name":"property_id","required":true,"in":"query","schema":{"type":"string"}},{"name":"include_inactive","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryGroupListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"The recovery-group registry — one row per group, cycle rolled up","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED"],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"tens of recovery groups per org"},"x-required-scopes":["expense-recovery:read"]}},"/v1/expense-recovery/summary":{"get":{"description":"Four org-wide numbers over the same cycles the registry lists: the recoverable cost in the cycles, what tenants owe of it, what has been billed, and what is still staged. `recoverable` excludes the admin fee and `billed` includes it, so billed exceeding recoverable is expected on a group that charges one.","operationId":"ExpenseRecovery.summary","parameters":[{"name":"cycle_year","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ExpenseRecoverySummaryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"The landing page's overview cards, aggregated in one query","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED"],"x-required-scopes":["expense-recovery:read"]}},"/v1/expense-recovery/groups":{"get":{"operationId":"ExpenseRecovery.listGroups","parameters":[{"name":"property_id","required":true,"in":"query","schema":{"type":"string"}},{"name":"code","required":true,"in":"query","schema":{"type":"string"}},{"name":"include_inactive","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryGroupV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List recovery groups","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED"],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"tens of recovery groups per org"},"x-required-scopes":["expense-recovery:read"]},"post":{"operationId":"ExpenseRecovery.createGroup","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRecoveryGroupV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecoveryGroupV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a recovery group","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","ACCOUNT_LEGAL_ENTITY_MISMATCH"],"x-plannable":true,"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/groups/{id}":{"get":{"operationId":"ExpenseRecovery.getGroup","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecoveryGroupV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a recovery group","tags":["Expense Recovery"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["expense-recovery:read"]},"patch":{"operationId":"ExpenseRecovery.updateGroup","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRecoveryGroupV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecoveryGroupV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a recovery group","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","CONFLICT","ACCOUNT_LEGAL_ENTITY_MISMATCH","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["expense-recovery:write"]},"delete":{"operationId":"ExpenseRecovery.deleteGroup","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete (deactivate) a recovery group","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/groups/{id}/accounts":{"get":{"description":"Every account the group recovers, with the per-account allocation rules: classification, cap eligibility, denominator basis and gross-up. An account is recovered by at most one group per property.","operationId":"ExpenseRecovery.listGroupAccounts","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryGroupAccountV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the accounts a recovery group recovers","tags":["Expense Recovery"],"x-error-codes":["NOT_FOUND"],"x-pagination":{"mode":"none","reason":"org configuration","bound":"tens of accounts per group"},"x-required-scopes":["expense-recovery:read"]},"put":{"description":"REPLACES the whole set in one transaction. An account dropped from the payload is removed, which is refused while any lease still has a term row on it. An empty array clears the set. Re-runs the account-rule sweep once after all additions, so a newly-added account backfills already-posted journal lines that predate the change.","operationId":"ExpenseRecovery.replaceGroupAccounts","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutGroupAccountsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryGroupAccountV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace the accounts a recovery group recovers","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","ACCOUNT_LEGAL_ENTITY_MISMATCH","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/groups/{id}/terms":{"get":{"description":"Every (lease, account) term row in the group, or one lease's rows when contract_id is given. A row records whether the lease participates in that account and the overrides that apply to it.","operationId":"ExpenseRecovery.listRecoveryTerms","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"contract_id","required":false,"in":"query","description":"Narrow to one lease’s terms in this group.","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryTermV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a recovery group's lease terms","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND"],"x-pagination":{"mode":"none","reason":"org configuration","bound":"accounts × leases per group, low hundreds"},"x-required-scopes":["expense-recovery:read"]}},"/v1/expense-recovery/groups/{id}/terms/{contractId}":{"put":{"description":"REPLACES every term the lease has in this group. Each account named must be one the group recovers, and the lease must already have a recovery profile in the group. Every row written is detached from its template, so a later template push skips it — saving the grid is a hand edit.","operationId":"ExpenseRecovery.replaceContractTerms","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"contractId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutContractTermsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryTermV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace one lease's terms in a recovery group","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/groups/{id}/templates":{"get":{"description":"Every template defined on the group, each with its row set. A template is a reusable set of term rows a lease can be stamped from.","operationId":"ExpenseRecovery.listRecoveryTemplates","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryTemplateV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a recovery group's term templates","tags":["Expense Recovery"],"x-error-codes":["NOT_FOUND"],"x-pagination":{"mode":"none","reason":"org configuration","bound":"a handful of templates per group"},"x-required-scopes":["expense-recovery:read"]},"post":{"description":"Creates the template and its rows. Every account named must be one the group recovers. Creating a template stamps nothing — POST .../apply is what puts it on a lease.","operationId":"ExpenseRecovery.createRecoveryTemplate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRecoveryTemplateV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecoveryTemplateV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a term template on a recovery group","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/groups/{id}/templates/{tid}":{"patch":{"description":"Supplying rows REPLACES the row set AND pushes it to every lease still tracking the template; pushed_contracts reports how many were restamped. A header-only patch pushes nothing and reports 0.","operationId":"ExpenseRecovery.updateRecoveryTemplate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"tid","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRecoveryTemplateV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecoveryTemplateWithPushV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a term template","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["expense-recovery:write"]},"delete":{"description":"Deletes the template and its rows. The term rows it stamped stay on their leases; they simply stop tracking a template.","operationId":"ExpenseRecovery.deleteRecoveryTemplate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"tid","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a term template","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/groups/{id}/templates/{tid}/apply":{"post":{"description":"Writes the template's rows as term rows on every named lease. A row a hand edit had detached is left alone and counted in skipped_manual, unless reset is true. Each lease must be at the group's property and already have a recovery profile in the group.","operationId":"ExpenseRecovery.applyRecoveryTemplate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"tid","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyRecoveryTemplateV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApplyRecoveryTemplateResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Stamp a term template onto leases","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/groups/{id}/contributions":{"get":{"operationId":"ExpenseRecovery.listGroupContributions","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryGroupContributionV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a recovery group's journal-line contribution links","tags":["Expense Recovery"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["expense-recovery:read"]}},"/v1/expense-recovery/groups/{id}/contributions/{lineId}":{"patch":{"operationId":"ExpenseRecovery.setGroupContributionFraction","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"lineId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetGroupContributionFractionV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecoveryGroupContributionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a group contribution link's fraction","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["expense-recovery:write"]},"delete":{"operationId":"ExpenseRecovery.removeGroupContribution","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"lineId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Remove a contribution link from a recovery group","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/profiles":{"get":{"operationId":"ExpenseRecovery.listProfiles","parameters":[{"name":"contract_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"recovery_group_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryProfileV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List tenants' recovery profiles","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["expense-recovery:read"]},"put":{"description":"The lease-level half of the deal — share, base year, cap, admin fee — entered once per (contract, recovery group) and shared by every account that group recovers. The profile must exist before any recovery term for the same (contract, recovery group) can be written (spec 2026-09-19 D3); which accounts sit under the cap is a per-term flag (in_cap), so a cap no longer needs a second call.","operationId":"ExpenseRecovery.upsertProfile","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertRecoveryProfileV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecoveryProfileV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Insert or replace a tenant's recovery profile for one recovery group","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/module-accounts":{"get":{"description":"The lock is per-property even though accounts are org-wide, matching UNIQUE (org_id, property_id, account_id). Without this read, GET /groups/:id/accounts returns rows only for accounts a recovery group names, so a module-locked account (in no group) produces no row at all — the FE cannot render the parent spec's disabled band without fetching the lock separately. Ordered by account_id.","operationId":"ExpenseRecovery.listModuleAccounts","parameters":[{"name":"property_id","required":true,"in":"query","description":"The property to scope the read to.","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryModuleAccountV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List module locks on a property","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED"],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"tens of module-locked accounts per property"},"x-required-scopes":["expense-recovery:read"]},"post":{"description":"Registers that a module (e.g. RE Taxes) recovers this account on this property outside any recovery group. Rejects with VALIDATION_FAILED when the account is already named by a group there — remove it from that group first, or split the account.","operationId":"ExpenseRecovery.createModuleAccount","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRecoveryModuleAccountV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecoveryModuleAccountV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Lock an account to a module on a property","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","CONFLICT","ACCOUNT_LEGAL_ENTITY_MISMATCH"],"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/module-accounts/{id}":{"delete":{"operationId":"ExpenseRecovery.deleteModuleAccount","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Release a module lock","tags":["Expense Recovery"],"x-error-codes":["NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/runs":{"post":{"operationId":"ExpenseRecovery.createRun","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRecoveryRunV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecoveryRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, RECOVERY_PRIOR_RUN_UNDER_REVISION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create and compute a reconciliation run for a recovery group and year — the period is derived from the group's cycle anchor","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","CONFLICT","RECOVERY_PRIOR_RUN_UNDER_REVISION"],"x-required-scopes":["expense-recovery:write"]},"get":{"operationId":"ExpenseRecovery.listRuns","parameters":[{"name":"property_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"recovery_group_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryRunV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List reconciliation runs","tags":["Expense Recovery"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["expense-recovery:read"]}},"/v1/expense-recovery/runs/{id}":{"get":{"operationId":"ExpenseRecovery.getRun","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecoveryRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a reconciliation run with lines and adjustments","tags":["Expense Recovery"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["expense-recovery:read"]},"delete":{"description":"Deletes a draft or computed run and everything staged under it — its lines, line details, account totals, adjustments, and its own staged charges — freeing the cycle year so the group can be run again. An approved run is refused: void the resulting documents instead.","operationId":"ExpenseRecovery.deleteRun","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Discard a reconciliation run","tags":["Expense Recovery"],"x-error-codes":["NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/runs/{id}/line-details":{"get":{"description":"The itemized statement grain behind the run's rolled-up lines[] (one per contract) and account_totals[] (account only) — the per-account statement row the FE's itemized worksheet needs. A sibling route rather than a field on GET /runs/:id: detail rows are the largest collection on a run by an order of magnitude, and run detail is refetched on every recompute. Empty is normal, not an error — a draft run or one that predates Phase C has no detail rows. Ordered contract_id, account_id.","operationId":"ExpenseRecovery.getRunLineDetails","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryRunLineDetailV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get the (contract, account) itemized worksheet rows for a run","tags":["Expense Recovery"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["expense-recovery:read"]}},"/v1/expense-recovery/runs/{id}/recompute":{"post":{"operationId":"ExpenseRecovery.recomputeRun","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecoveryRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RECOVERY_PRIOR_RUN_UNDER_REVISION, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Re-gather actuals and recompute all lines for a run","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","RECOVERY_PRIOR_RUN_UNDER_REVISION","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/runs/{id}/adjustments":{"post":{"operationId":"ExpenseRecovery.addRunAdjustment","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRecoveryRunAdjustmentV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecoveryRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add an adjustment to a run and recompute","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND"],"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/runs/{id}/adjustments/{adjustmentId}":{"delete":{"description":"Deletes one adjustment — manually created or carried forward from a prior run's period-open seeding — and recomputes. A carried-forward row is a real, independently deletable row on this run; deleting it never affects the run it was seeded from.","operationId":"ExpenseRecovery.deleteRunAdjustment","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"adjustmentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a run adjustment and recompute","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/runs/{id}/approve":{"post":{"description":"Stages one charge per contract with a non-zero true-up onto the org's recovery charge shelf. The run's lifecycle ends here — collecting the charges into a document is a separate billing step, and voiding happens at the document level.","operationId":"ExpenseRecovery.approveRun","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecoveryRunV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RECOVERY_PRIOR_RUN_UNDER_REVISION, CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Approve a computed reconciliation run","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","RECOVERY_PRIOR_RUN_UNDER_REVISION","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Approves a recovery run that bills tenants.","x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/runs/{id}/revise":{"post":{"description":"Moves an approved run back to computed at the next revision and recomputes it. Approving the revision stages only the difference per tenant.","operationId":"ExpenseRecovery.reviseRun","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecoveryRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: RECOVERY_RUN_NOT_REVISABLE, RECOVERY_PRIOR_RUN_UNDER_REVISION, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Revise an approved reconciliation run","tags":["Expense Recovery"],"x-error-codes":["RECOVERY_RUN_NOT_REVISABLE","RECOVERY_PRIOR_RUN_UNDER_REVISION","VALIDATION_FAILED","NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/billing/preview":{"get":{"description":"Nets every ready charge on the shelf (run true-ups from any recovery group, module tax shares, direct fees) per tenant. A tenant whose charges net to exactly zero shows kind \"none\" — billing would settle it without a document.","operationId":"ExpenseRecovery.previewBilling","parameters":[{"name":"property_id","required":true,"in":"query","description":"The property to scope the read to.","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BillingPreviewV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview what billing would produce for a property, without writing anything","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["expense-recovery:read"]}},"/v1/expense-recovery/billing":{"post":{"description":"Nets ALL of a tenant's ready charges — across every recovery group, module, and fee — into a single invoice or credit memo. Mixed signs net inside one document rather than crossing in the mail. A tenant whose charges net to exactly zero is settled with no document produced. Refuses (VALIDATION_FAILED) if a tenant has charges but no counterparty party configured on its contract.","operationId":"ExpenseRecovery.collectBilling","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectBillingV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecoveryBillingResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Collect every ready charge for a property into one document per tenant","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","DIMENSION_REQUIRED"],"x-required-scopes":["expense-recovery:write"]}},"/v1/expense-recovery/billings":{"get":{"operationId":"ExpenseRecovery.listBillings","parameters":[{"name":"property_id","required":true,"in":"query","description":"The property to scope the read to.","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryBillingV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List billing acts for a property","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["expense-recovery:read"]}},"/v1/expense-recovery/charges":{"get":{"description":"Plain audit listing over the charge shelf — distinct from the internal billing-shelf query, which additionally gates on settled_at and run approval. billed=true shows collected charges; billed=false shows everything not yet collected (including a charge staged by a run still pending approval); omit billed to see everything. run_id narrows to a single run’s charges; module charges (source=re_tax) carry no run and drop out when it is set.","operationId":"ExpenseRecovery.listCharges","parameters":[{"name":"property_id","required":true,"in":"query","description":"The property to scope the read to.","schema":{"format":"uuid","type":"string"}},{"name":"contract_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"run_id","required":false,"in":"query","description":"Narrow to one run’s charges. Module charges (source=re_tax) have no run and are excluded whenever this is set.","schema":{"format":"uuid","type":"string"}},{"name":"billed","required":false,"in":"query","description":"true = collected charges only; false = everything not yet collected; omit = everything.","schema":{"type":"string","enum":["true","false"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryChargeV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List recovery charges for a property","tags":["Expense Recovery"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["expense-recovery:read"]}},"/v1/charges/explanations":{"get":{"description":"Every charge billed onto the document, oldest first, with the invoice line that carries it (`document_line_id`, null for a statement-billed charge or one billed before lines were recorded) and whether `GET /v1/charges/{id}/explanation` can explain it. Only percentage rent charges are explainable today. `search` matches the source. An unknown document lists nothing.","operationId":"Charges.listExplanations","parameters":[{"name":"document_id","required":true,"in":"query","description":"The document whose charges to list (its billed charges).","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: created_at","schema":{"enum":["created_at","-created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: source.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ChargeExplanationRefV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a document's charges and which can be explained","tags":["Charges"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["expense-recovery:read"]}},"/v1/charges/{id}/explanation":{"get":{"description":"The charge's derivation, read from what its producer stored when it computed it (never recomputed). For a percentage rent charge: the period, qualifying sales by category, breakpoints and their derivation, tiers, the shared-breakpoint allocation, gross, previously billed, delta, adjustments and whether sales were estimated. 404 `CHARGE_EXPLANATION_NOT_FOUND` when the charge is not in this org, or its run line was revised away; 422 `CHARGE_EXPLANATION_UNSUPPORTED` for any other source.","operationId":"Charges.getExplanation","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ChargeExplanationV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: CHARGE_EXPLANATION_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: CHARGE_EXPLANATION_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Explain how a charge was computed","tags":["Charges"],"x-error-codes":["VALIDATION_FAILED","CHARGE_EXPLANATION_NOT_FOUND","CHARGE_EXPLANATION_UNSUPPORTED"],"x-required-scopes":["expense-recovery:read"]}},"/v1/insurance":{"get":{"operationId":"Insurance.list","parameters":[{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["active","inactive"]}},{"name":"property_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InsuranceListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List insurance records","tags":["Insurance"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["insurance:read"]},"post":{"operationId":"Insurance.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInsuranceV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create an insurance record for a property","tags":["Insurance"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/participations":{"get":{"operationId":"Insurance.listParticipations","parameters":[{"name":"contract_id","required":true,"in":"query","description":"Filter to a single lease's insurance participations.","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InsuranceParticipationV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Reverse view — a lease's insurance participations","tags":["Insurance"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["insurance:read"]}},"/v1/insurance/summary":{"get":{"description":"Four org-wide numbers: open balance owed to issuers, open balance owed by tenants, terms expiring inside the look-ahead window, and coverages with no term in force. Read the field descriptions before using these as accounting figures — `owed_by_tenants` counts only reimbursement shares with their own AR invoice, and excludes direct-pay shares.","operationId":"Insurance.summary","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceSummaryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"The registry's overview cards, aggregated in one query","tags":["Insurance"],"x-required-scopes":["insurance:read"]}},"/v1/insurance/coverages":{"get":{"description":"One row per coverage with its newest policy term rolled up, in a single query. This is what the registry screen lists; `Insurance.list` returns the property-level records behind it and is not used by the UI. Each row carries its next payment (date, amount, billed or estimate, payee), what is past due, the current term and attention flags. Sorted by next payment date (soonest first) by default; a coverage with no next payment sorts last in either direction. `view` narrows to due_30, past_due, expiring_60 or needs_attention — the same predicates as the summary tiles.","operationId":"Insurance.listCoverageRegistry","parameters":[{"name":"view","required":false,"in":"query","description":"due_30: next payment due within 30 days (late included); past_due: anything past due; expiring_60: newest term ends within 60 days with no renewal; needs_attention: past due or any attention flag except config_problem.","schema":{"type":"string","enum":["due_30","past_due","expiring_60","needs_attention"]}},{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["active","inactive"]}},{"name":"property_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"coverage_type","required":false,"in":"query","schema":{"type":"string","enum":["property","general_liability","umbrella","flood","earthquake","boiler_machinery","business_interruption","environmental","terrorism","other"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: next_payment_date","schema":{"enum":["next_payment_date","-next_payment_date","next_payment_amount","-next_payment_amount","term_end","-term_end","property_name","-property_name"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: property_name, coverage_type, carrier_name, broker_name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InsuranceCoverageListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"The per-coverage registry — one row per property × coverage type","tags":["Insurance"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["insurance:read"]},"post":{"description":"The registry lists coverages, so adding a row means adding a coverage. The insurance record is an internal grouping created on demand; the legal entity comes from the property, never from the caller.","operationId":"Insurance.addCoverageToProperty","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddCoverageToPropertyV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceCoverageV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a coverage to a property, creating its insurance record if needed","tags":["Insurance"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/coverages/{coverageId}":{"get":{"description":"The workspace header read. Same projection as the registry, so the header cannot disagree with the row the user clicked.","operationId":"Insurance.getCoverage","parameters":[{"name":"coverageId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceCoverageListItemV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"One coverage with its newest term rolled up","tags":["Insurance"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["insurance:read"]},"patch":{"operationId":"Insurance.updateCoverage","parameters":[{"name":"coverageId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateInsuranceCoverageV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceCoverageV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a coverage","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]},"delete":{"operationId":"Insurance.deleteCoverage","parameters":[{"name":"coverageId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceDeletedV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a coverage that has no policy history","tags":["Insurance"],"x-error-codes":["NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/{id}":{"get":{"operationId":"Insurance.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get an insurance record","tags":["Insurance"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["insurance:read"]},"patch":{"operationId":"Insurance.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateInsuranceV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update an insurance record","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/{id}/coverages":{"get":{"operationId":"Insurance.listCoverages","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InsuranceCoverageV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List an insurance record’s coverages","tags":["Insurance"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["insurance:read"]},"post":{"operationId":"Insurance.addCoverage","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInsuranceCoverageV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceCoverageV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a coverage","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/coverages/{coverageId}/terms":{"get":{"operationId":"Insurance.listTerms","parameters":[{"name":"coverageId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InsuranceTermV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a coverage’s policy terms","tags":["Insurance"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["insurance:read"]},"post":{"description":"Generates the expected-invoice schedule from the term’s payment cadence. Set inherit_from_latest to carry the prior term’s configuration forward.","operationId":"Insurance.createTerm","parameters":[{"name":"coverageId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInsuranceTermV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceTermCreatedV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INSURANCE_FIXED_AREA_REQUIRED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create or renew a policy term","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSURANCE_FIXED_AREA_REQUIRED","CONFLICT","ACCOUNT_LEGAL_ENTITY_MISMATCH","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/terms/{termId}":{"get":{"operationId":"Insurance.getTerm","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceTermV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a policy term","tags":["Insurance"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["insurance:read"]},"patch":{"operationId":"Insurance.updateTerm","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateInsuranceTermV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceTermV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INSURANCE_FIXED_AREA_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY, CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a policy term","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","INSURANCE_FIXED_AREA_REQUIRED","CONFLICT","ACCOUNT_LEGAL_ENTITY_MISMATCH","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/terms/{termId}/participants":{"get":{"operationId":"Insurance.listParticipants","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InsuranceTermParticipantV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a term’s participants","tags":["Insurance"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["insurance:read"]},"post":{"description":"A lease may hold several rows in a term when their dates do not overlap (409 INSURANCE_PARTICIPANT_OVERLAP otherwise); all its rows share one method (400 INSURANCE_PARTICIPANT_METHOD_MISMATCH). Under participant area an add may not cut other area tenants' shares (400 INSURANCE_PARTICIPANT_SHARE_CUT, context { on, participant_ids }); accept the cut through POST …/participants/changes.","operationId":"Insurance.addParticipant","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInsuranceParticipantV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceParticipantV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INSURANCE_PARTICIPANT_SHARE_CUT, INSURANCE_PARTICIPANT_METHOD_MISMATCH, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY, INSURANCE_PARTICIPANT_OVERLAP, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add a participant to a term","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","INSURANCE_PARTICIPANT_SHARE_CUT","INSURANCE_PARTICIPANT_OVERLAP","INSURANCE_PARTICIPANT_METHOD_MISMATCH","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/terms/{termId}/participants/batch":{"post":{"description":"Either every participant lands or none does. Use this to seed a term from the property’s leases: the allocation is checked ONCE over the resulting set, so a rejection leaves the term exactly as it was rather than half-populated. What it adds is the rollback, one round trip, and one idempotency key for the whole set. A contract_id repeated within the payload is rejected (400), and one whose dates overlap a row the lease already has on the term is refused (409 INSURANCE_PARTICIPANT_OVERLAP). Under participant area the batch may not cut area tenants already on the term (400 INSURANCE_PARTICIPANT_SHARE_CUT).","operationId":"Insurance.addParticipantsBatch","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddInsuranceParticipantsBatchV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InsuranceParticipantV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INSURANCE_PARTICIPANT_SHARE_CUT, INSURANCE_PARTICIPANT_METHOD_MISMATCH, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY, INSURANCE_PARTICIPANT_OVERLAP, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add several participants to a term in one transaction","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","INSURANCE_PARTICIPANT_SHARE_CUT","INSURANCE_PARTICIPANT_OVERLAP","INSURANCE_PARTICIPANT_METHOD_MISMATCH","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/terms/{termId}/participants/changes":{"post":{"description":"Applies a list of operations atomically — add a lease, change a participant's share from a date, end a participant — and checks the shares ONCE over the state before and after the whole list. A 'change' ends the row the day before `from` and starts a new row on it, so invoices already input keep the share they used; it is how a billed participant's share changes. A 'change' ON the row's first day has no days to keep, so it corrects the row in place instead (409 INSURANCE_PARTICIPANT_BILLED_SHARE_IMMUTABLE when an issued invoice used it). Under participant area a change may cut only the participants it names — the subject of an operation or a participant id in accept_cuts — and is refused otherwise (400 INSURANCE_PARTICIPANT_SHARE_CUT, context { on, participant_ids }). POST …/changes/preview takes the same body and saves nothing. Returns the term’s participants after the change.","operationId":"Insurance.applyParticipantChanges","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsuranceParticipantChangesV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceParticipantChangesResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INSURANCE_PARTICIPANT_SHARE_CUT, INSURANCE_PARTICIPANT_METHOD_MISMATCH, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY, INSURANCE_PARTICIPANT_OVERLAP, INSURANCE_PARTICIPANT_BILLED_SHARE_IMMUTABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Change several participants at once (dated changes, rebalance)","tags":["Insurance"],"x-error-codes":["VALIDATION_FAILED","INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","NOT_FOUND","INSURANCE_PARTICIPANT_SHARE_CUT","INSURANCE_PARTICIPANT_OVERLAP","INSURANCE_PARTICIPANT_METHOD_MISMATCH","INSURANCE_PARTICIPANT_BILLED_SHARE_IMMUTABLE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/terms/{termId}/participants/changes/preview":{"post":{"description":"Takes the body of POST …/participants/changes and runs the same checks, saving nothing. Returns the term split into date ranges over which the participants do not change, each with every participant's resolved share and the owner's remainder, before and after the operations, plus the participants the change would cut (share on the first cut day, before and after). A cut is listed, not refused, and so is a side that does not resolve (`problem`; `refusal` says when the save would refuse the result). Invalid operations and over-allocation are refused as the save would. With no operations, before and after are both the term's current timeline.","operationId":"Insurance.previewParticipantChanges","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsuranceParticipantChangesV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceParticipantChangesPreviewV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INSURANCE_PARTICIPANT_METHOD_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY, INSURANCE_PARTICIPANT_OVERLAP, INSURANCE_PARTICIPANT_BILLED_SHARE_IMMUTABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview a participant change without saving it","tags":["Insurance"],"x-error-codes":["VALIDATION_FAILED","INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","NOT_FOUND","INSURANCE_PARTICIPANT_OVERLAP","INSURANCE_PARTICIPANT_METHOD_MISMATCH","INSURANCE_PARTICIPANT_BILLED_SHARE_IMMUTABLE"],"x-required-scopes":["insurance:read"]}},"/v1/insurance/terms/{termId}/allocation":{"get":{"description":"The same computation invoice input freezes, so what is previewed is what will be billed.","operationId":"Insurance.previewAllocation","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceAllocationV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview a term’s allocation","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED"],"x-required-scopes":["insurance:read"]}},"/v1/insurance/participants/{participantId}":{"patch":{"description":"Edits the row in place. A billed participant's share_basis and share_pct cannot be edited in place (409 INSURANCE_PARTICIPANT_BILLED_SHARE_IMMUTABLE): use a dated change (POST …/participants/changes). ended_on stays editable — that is End and Undo end. Under participant area an edit may not cut other area tenants' shares (400 INSURANCE_PARTICIPANT_SHARE_CUT); accept the cut through the changes route.","operationId":"Insurance.updateParticipant","parameters":[{"name":"participantId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateInsuranceParticipantV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceParticipantV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INSURANCE_PARTICIPANT_SHARE_CUT, INSURANCE_PARTICIPANT_METHOD_MISMATCH, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY, INSURANCE_PARTICIPANT_BILLED_SHARE_IMMUTABLE, INSURANCE_PARTICIPANT_OVERLAP, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a participant","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","INSURANCE_PARTICIPANT_SHARE_CUT","INSURANCE_PARTICIPANT_BILLED_SHARE_IMMUTABLE","INSURANCE_PARTICIPANT_OVERLAP","INSURANCE_PARTICIPANT_METHOD_MISMATCH","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]},"delete":{"operationId":"Insurance.removeParticipant","parameters":[{"name":"participantId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceDeletedV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: INSURANCE_PARTICIPANT_BILLED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Remove a participant","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSURANCE_PARTICIPANT_BILLED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/participants/{participantId}/replace":{"post":{"description":"Ends the participant the day before effective_from and adds the successor lease from effective_from, in one transaction. Use it when a tenant is replaced mid-term: past invoices stay as billed, and invoices recorded afterwards split the premium by the days each lease participated. effective_from must be after the replaced participant’s first day (its started_on, else the term start) and inside the term; a participant that already ended earlier is refused rather than re-opened. The successor passes the same rules as an add (409 INSURANCE_PARTICIPANT_OVERLAP if the lease already participates on those days), and negotiated shares may total at most 100% on any one day. Under participant area it may not cut other area tenants’ shares (400 INSURANCE_PARTICIPANT_SHARE_CUT). A lease-ended work item is raised for the replaced lease, as when a participation is ended.","operationId":"Insurance.replaceParticipant","parameters":[{"name":"participantId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplaceInsuranceParticipantV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReplaceInsuranceParticipantResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INSURANCE_PARTICIPANT_SHARE_CUT, INSURANCE_PARTICIPANT_METHOD_MISMATCH, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY, INSURANCE_PARTICIPANT_OVERLAP, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace a participant with a successor lease","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","INSURANCE_PARTICIPANT_SHARE_CUT","INSURANCE_PARTICIPANT_OVERLAP","INSURANCE_PARTICIPANT_METHOD_MISMATCH","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/terms/{termId}/expected-invoices":{"get":{"operationId":"Insurance.listExpectedInvoices","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InsuranceExpectedInvoiceV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a term’s expected invoices","tags":["Insurance"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["insurance:read"]},"post":{"description":"For an endorsement or premium audit outside the cadence.","operationId":"Insurance.addExpectedInvoice","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInsuranceExpectedInvoiceV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceExpectedInvoiceV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add an expected invoice by hand","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/expected-invoices/{slotId}":{"patch":{"operationId":"Insurance.updateExpectedInvoice","parameters":[{"name":"slotId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateInsuranceExpectedInvoiceV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceExpectedInvoiceV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update an expected invoice","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]},"delete":{"operationId":"Insurance.removeExpectedInvoice","parameters":[{"name":"slotId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceDeletedV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Remove an expected invoice","tags":["Insurance"],"x-error-codes":["NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/terms/{termId}/invoices":{"get":{"operationId":"Insurance.listInvoices","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InsurancePremiumInvoiceV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a term’s premium invoices","tags":["Insurance"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["insurance:read"]},"post":{"description":"One transaction: fills the expected invoice, freezes each tenant’s share, creates the payable (a bill, or an intercompany transaction when the issuer is one of your own entities) and an AR invoice per reimbursement share; a through-CAM share’s invoice is linked to the recovery group as an estimate for the true-up.","operationId":"Insurance.inputInvoice","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InputPremiumInvoiceV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsurancePremiumInvoiceDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT, PERIOD_LOCKED, PERIOD_CLOSED, INSURANCE_TERM_CLOSED, INSURANCE_UNPLANNED_INVOICE_DUPLICATE, INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Enter a premium invoice","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_LOCKED","PERIOD_CLOSED","PERIOD_MISSING","DIMENSION_REQUIRED","INSURANCE_TERM_CLOSED","INSURANCE_UNPLANNED_INVOICE_DUPLICATE","INSURANCE_PARTICIPANT_DIRECT_BILL_IN_RECOVERY"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/invoices/{invoiceId}":{"get":{"operationId":"Insurance.getInvoice","parameters":[{"name":"invoiceId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsurancePremiumInvoiceDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a premium invoice with its frozen shares","tags":["Insurance"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["insurance:read"]},"delete":{"description":"Reverses every document it created, drops any CAM charges it staged (invoices entered before 2026-11-01) and frees its expected invoice for re-entry.","operationId":"Insurance.voidInvoice","parameters":[{"name":"invoiceId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoidPremiumInvoiceV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsurancePremiumInvoiceV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, PERIOD_LOCKED, SOURCE_BILL_CHARGES_ALREADY_COLLECTED, TARGET_HAS_ACTIVE_APPLICATIONS, IDEMPOTENCY_CONFLICT, DOCUMENT_ALREADY_VOIDED, DOCUMENT_STATUS_FORBIDS_ACTION, DOCUMENT_RECONCILED_CANNOT_VOID, DOCUMENT_MATCHED_CANNOT_VOID, DOCUMENT_COST_CAPITALIZED_CANNOT_VOID, DOCUMENT_HELD_BY_PAYMENT_RUN, DOCUMENT_HELD_BY_IC_SETTLEMENT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Void a premium invoice","tags":["Insurance"],"x-error-codes":["NOT_FOUND","CONFLICT","PERIOD_LOCKED","PERIOD_MISSING","SOURCE_BILL_CHARGES_ALREADY_COLLECTED","TARGET_HAS_ACTIVE_APPLICATIONS","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","DOCUMENT_ALREADY_VOIDED","DOCUMENT_STATUS_FORBIDS_ACTION","LEGAL_ENTITY_NOT_IN_SCOPE","DOCUMENT_RECONCILED_CANNOT_VOID","DOCUMENT_MATCHED_CANNOT_VOID","DOCUMENT_COST_CAPITALIZED_CANNOT_VOID","DOCUMENT_HELD_BY_PAYMENT_RUN","DOCUMENT_HELD_BY_IC_SETTLEMENT"],"x-high-risk":true,"x-high-risk-reason":"Voids a premium invoice and its bills.","x-required-scopes":["insurance:write"]}},"/v1/insurance/shares/{shareId}/mark-paid":{"post":{"description":"Only for tenant_direct_pay: every other method derives its paid state from its document balance.","operationId":"Insurance.markSharePaid","parameters":[{"name":"shareId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkSharePaidV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceInvoiceShareV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Mark a direct-pay share paid","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED"],"x-required-scopes":["insurance:write"]},"delete":{"operationId":"Insurance.unmarkSharePaid","parameters":[{"name":"shareId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceInvoiceShareV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Clear a direct-pay share’s paid mark","tags":["Insurance"],"x-error-codes":["NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Clears a recorded payment on an insurance share.","x-required-scopes":["insurance:write"]}},"/v1/insurance/terms/{termId}/attachments":{"get":{"operationId":"Insurance.listTermAttachments","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 200","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InsuranceAttachmentV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a term’s policy documents","tags":["Insurance"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["insurance:read"]},"post":{"description":"The declarations page, the binder — whatever proves what this policy says.","operationId":"Insurance.uploadTermAttachment","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}},{"name":"share_id","required":false,"in":"query","description":"Invoice uploads only: attach the file to one share instead of the invoice. Forces kind=proof_of_payment.","schema":{"format":"uuid","type":"string"}},{"name":"kind","required":false,"in":"query","description":"Defaults to policy_document on a term and premium_invoice on an invoice. Ignored when share_id is given.","schema":{"type":"string","enum":["policy_document","premium_invoice","proof_of_payment"]}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF, PNG, JPEG or WebP file, at most 25 MiB. Magic-byte sniffed server-side, so a mislabeled file is rejected."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceAttachmentV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: ATTACHMENT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: ATTACHMENT_TYPE_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a policy document to a term","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","ATTACHMENT_TYPE_UNSUPPORTED","ATTACHMENT_TOO_LARGE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/terms/{termId}/attachments/{attachmentId}/download-url":{"get":{"operationId":"Insurance.getTermAttachmentDownloadUrl","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}},{"name":"attachmentId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceAttachmentDownloadUrlV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND, ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a short-lived signed download URL for a policy document","tags":["Insurance"],"x-error-codes":["NOT_FOUND","ATTACHMENT_NOT_FOUND"],"x-required-scopes":["insurance:read"]}},"/v1/insurance/terms/{termId}/attachments/{attachmentId}":{"delete":{"operationId":"Insurance.deleteTermAttachment","parameters":[{"name":"termId","required":true,"in":"path","schema":{"type":"string"}},{"name":"attachmentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a policy document","tags":["Insurance"],"x-error-codes":["NOT_FOUND","ATTACHMENT_NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/invoices/{invoiceId}/attachments":{"get":{"operationId":"Insurance.listInvoiceAttachments","parameters":[{"name":"invoiceId","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500, default 200","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InsuranceAttachmentV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List an invoice’s attachments, including its shares’ proofs","tags":["Insurance"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["insurance:read"]},"post":{"description":"Pass share_id to file the upload against one share instead of the invoice; that always records it as proof_of_payment.","operationId":"Insurance.uploadInvoiceAttachment","parameters":[{"name":"invoiceId","required":true,"in":"path","schema":{"type":"string"}},{"name":"share_id","required":false,"in":"query","description":"Invoice uploads only: attach the file to one share instead of the invoice. Forces kind=proof_of_payment.","schema":{"format":"uuid","type":"string"}},{"name":"kind","required":false,"in":"query","description":"Defaults to policy_document on a term and premium_invoice on an invoice. Ignored when share_id is given.","schema":{"type":"string","enum":["policy_document","premium_invoice","proof_of_payment"]}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF, PNG, JPEG or WebP file, at most 25 MiB. Magic-byte sniffed server-side, so a mislabeled file is rejected."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceAttachmentV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: ATTACHMENT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: ATTACHMENT_TYPE_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a premium invoice scan or a share’s proof of payment","tags":["Insurance"],"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","ATTACHMENT_TYPE_UNSUPPORTED","ATTACHMENT_TOO_LARGE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/insurance/invoices/{invoiceId}/attachments/{attachmentId}/download-url":{"get":{"operationId":"Insurance.getInvoiceAttachmentDownloadUrl","parameters":[{"name":"invoiceId","required":true,"in":"path","schema":{"type":"string"}},{"name":"attachmentId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsuranceAttachmentDownloadUrlV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND, ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a short-lived signed download URL for an invoice attachment","tags":["Insurance"],"x-error-codes":["NOT_FOUND","ATTACHMENT_NOT_FOUND"],"x-required-scopes":["insurance:read"]}},"/v1/insurance/invoices/{invoiceId}/attachments/{attachmentId}":{"delete":{"operationId":"Insurance.deleteInvoiceAttachment","parameters":[{"name":"invoiceId","required":true,"in":"path","schema":{"type":"string"}},{"name":"attachmentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete an invoice attachment","tags":["Insurance"],"x-error-codes":["NOT_FOUND","ATTACHMENT_NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["insurance:write"]}},"/v1/payment-runs/eligible-bills":{"get":{"description":"The picker query. Returns posted bills with an open balance and a vendor party, not reserved by another active run (draft/pending_approval/rejected/approved). Scope with EITHER `legal_entity_id` (a list — bills of any of those entities, no currency filter; the run currency is enforced at create/add-bills) OR `bank_account_id` (the account’s legal entity AND currency). At least one is required; when both are sent, `bank_account_id` wins. Every entity must be in the caller’s scope. Bills without a party are excluded: payments are generated per vendor. Each row says how its vendor is paid (`payment_method`, masked `payment_method_detail`), and `payment_method` filters on it (`none` = no method). `min_amount`/`max_amount` filter on the OPEN BALANCE (inclusive bounds), not the bill total. `date_field` selects which date `from`/`to` bound (default `due`). Bills without a due date sort last in both directions of `due_date`. `ids` returns those bills regardless of the date window, `search`, amount, `payment_method` and `document_type` filters, but never a bill that is not eligible or outside the scope above. Because it overrides `document_type`, `ids` widens to every payable type (`bill`, `owner_distribution`, `intercompany_transaction`), so it can return rows of any of them. `search` is a case-insensitive substring match on: bill number, vendor name.","operationId":"PaymentRuns.listEligibleBills","parameters":[{"name":"bank_account_id","required":false,"in":"query","description":"Scopes the picker to one bank account — only bills matching that account's legal entity and currency are eligible. Provide this OR `legal_entity_id` (at least one is required). When both are sent, `bank_account_id` wins (its currency filter is the stricter path).","schema":{"format":"uuid","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Scopes the picker to these legal entities (repeat or comma-separate), WITHOUT a currency filter — a bill of any of them is listed, so the builder loads bills before any bank account is chosen. The run currency is enforced at create/add-bills. Each id must be in the caller’s scope (403 LEGAL_ENTITY_NOT_IN_SCOPE otherwise). Provide this OR `bank_account_id` (at least one is required).","schema":{"type":"array","items":{"type":"string","format":"uuid"}}},{"name":"document_type","required":false,"in":"query","description":"Which payable document types to list (repeat or comma-separate): `bill`, `owner_distribution` (a distribution leg). Default `bill`.","schema":{"default":["bill"],"type":"array","items":{"type":"string","enum":["bill","owner_distribution","intercompany_transaction"]}}},{"name":"payment_method","required":false,"in":"query","description":"The vendor’s payment method (repeat or comma-separate). `none` matches a vendor with no payment method at all.","schema":{"type":"array","items":{"type":"string","enum":["ach","wire","check","none"]}}},{"name":"party_ids","required":false,"in":"query","description":"Comma-separated vendor (party) ids. Narrows to these vendors only.","schema":{"type":"array","items":{"type":"string"}}},{"name":"date_field","required":false,"in":"query","description":"Which date field `from`/`to` bound. Default `due`.","schema":{"type":"string","enum":["due","document"]}},{"name":"from_date","required":false,"in":"query","description":"Inclusive lower bound for `date_field`.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Inclusive upper bound for `date_field`.","schema":{"format":"date","type":"string"}},{"name":"from","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `from_date` (inclusive lower bound for `date_field`).","schema":{"format":"date","type":"string"}},{"name":"to","required":false,"in":"query","deprecated":true,"description":"Deprecated alias for `to_date` (inclusive upper bound for `date_field`).","schema":{"format":"date","type":"string"}},{"name":"min_amount","required":false,"in":"query","description":"Inclusive lower bound on the OPEN BALANCE (not the bill total).","schema":{"type":"number"}},{"name":"max_amount","required":false,"in":"query","description":"Inclusive upper bound on the OPEN BALANCE (not the bill total).","schema":{"type":"number"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -due_date","schema":{"enum":["-due_date","due_date","-document_date","document_date","-created_at","created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: bill number, vendor name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EligibleBillV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_BANK_ACCOUNT_MISSING_CASH_ACCOUNT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List bills eligible for a payment run across legal entities or one bank account","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_BANK_ACCOUNT_MISSING_CASH_ACCOUNT"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["payment-runs:read"]}},"/v1/payment-runs":{"post":{"description":"Reserves the given bills (at least one; each must pass eligibility) and derives the run’s legal entities from them — one entity row per entity with a bill in the run. The run currency is the first bill’s entity’s; a bill in another currency is refused (PAYMENT_RUN_CURRENCY_MISMATCH). Each entity pays from the account `bank_accounts` gives it, else from its default paying account while still eligible (`bank_account_is_default`), else from its only eligible account, else from none yet — choose one with PATCH :id/entities/:legalEntityId before submitting. Every entity must be in the caller’s scope.","operationId":"PaymentRuns.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentRunV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_BILL_RESERVED, PAYMENT_RUN_BILL_AVAILABLE_EXCEEDED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_BANK_ACCOUNT_MISSING_CASH_ACCOUNT, PAYMENT_RUN_ENTITY_ACCOUNT_INVALID, PAYMENT_RUN_BILL_NOT_ELIGIBLE, PAYMENT_RUN_CURRENCY_MISMATCH, PAYMENT_RUN_TOO_MANY_BILLS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a draft payment run","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_BANK_ACCOUNT_MISSING_CASH_ACCOUNT","PAYMENT_RUN_ENTITY_ACCOUNT_INVALID","PAYMENT_RUN_BILL_NOT_ELIGIBLE","PAYMENT_RUN_BILL_RESERVED","PAYMENT_RUN_BILL_AVAILABLE_EXCEEDED","PAYMENT_RUN_CURRENCY_MISMATCH","PAYMENT_RUN_TOO_MANY_BILLS","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Starts a payment run that pays vendors.","x-required-scopes":["payment-runs:write"]},"get":{"description":"A run may span several legal entities, each paying from its own bank account; every row names them in `entities`. `legal_entity_id`, `bank_account_id` and `payment_method` take lists (repeat or comma-separate) and match a run when ANY of its entities / bills matches. A caller restricted to some legal entities sees only runs whose EVERY entity is allowed. Sorts: `created_at` (default `-created_at`), `run_number`, `payment_date` (runs without a payment date sort last in both directions), `total_amount` and `bill_count`; ties break on id. Totals and counts leave out bills the run released unpaid. `schedule_id` lists only the runs that schedule generated. `ids` returns those runs regardless of `status` and the other filters, never one a restricted caller could not otherwise see. `search` is a case-insensitive substring match on: run number, memo, vendor name, bill number.","operationId":"PaymentRuns.list","parameters":[{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["draft","pending_approval","approved","partially_completed","completed","rejected","cancelled"]}},{"name":"bank_account_id","required":false,"in":"query","description":"Paying bank accounts. Repeat or comma-separate. A run is listed when ANY of its entities pays from one of them.","schema":{"type":"array","items":{"type":"string","format":"uuid"}}},{"name":"legal_entity_id","required":false,"in":"query","description":"Legal entities. Repeat or comma-separate. A run is listed when ANY of its entities is one of them. Each id must be in the caller’s scope (403 LEGAL_ENTITY_NOT_IN_SCOPE otherwise); a run is only ever listed to a caller allowed for EVERY entity in it.","schema":{"type":"array","items":{"type":"string","format":"uuid"}}},{"name":"payment_method","required":false,"in":"query","description":"Payment methods. Repeat or comma-separate. A run is listed when any of its bills is paid that way — the method frozen at submit, or the vendor’s live method while the run is a draft. `none` matches a bill whose vendor has no payment method.","schema":{"type":"array","items":{"type":"string","enum":["ach","wire","check","none"]}}},{"name":"schedule_id","required":false,"in":"query","description":"Only the runs this payment run schedule generated.","schema":{"format":"uuid","type":"string"}},{"name":"distribution_declaration_id","required":false,"in":"query","description":"Only the runs generated for this distribution declaration.","schema":{"format":"uuid","type":"string"}},{"name":"date_field","required":false,"in":"query","description":"Which date `from_date`/`to_date` bound: `payment` (the run’s payment_date, the default) or `created` (the org-local day the run was created).","schema":{"type":"string","enum":["payment","created"]}},{"name":"from_date","required":false,"in":"query","description":"Inclusive lower bound for `date_field`.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Inclusive upper bound for `date_field`.","schema":{"format":"date","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at","-run_number","run_number","-payment_date","payment_date","-total_amount","total_amount","-bill_count","bill_count"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: run number, memo, vendor name, bill number.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRunV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List payment runs","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["payment-runs:read"]}},"/v1/payment-runs/{id}":{"get":{"operationId":"PaymentRuns.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a payment run with its bills","tags":["Payment runs"],"x-error-codes":["PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["payment-runs:read"]},"patch":{"description":"Draft only. An entity’s paying account is set with PATCH :id/entities/:legalEntityId.","operationId":"PaymentRuns.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePaymentRunV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_INVALID_STATUS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Edit a draft run (payment_date, memo)","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_INVALID_STATUS","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/bills":{"post":{"description":"Draft only. Reuses the same eligibility gate as create — each bill must be a posted bill with an open balance, a vendor party, in the run currency and an entity the caller may act in, and must not be reserved by another active run. A bill of an entity new to the run adds that entity (its account chosen as on create; `bank_accounts` may set it). The resulting total (bills already in the run plus this batch) must stay at or under 200.","operationId":"PaymentRuns.addBills","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddPaymentRunBillsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_INVALID_STATUS, PAYMENT_RUN_BILL_RESERVED, PAYMENT_RUN_BILL_AVAILABLE_EXCEEDED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_BILL_NOT_ELIGIBLE, PAYMENT_RUN_BANK_ACCOUNT_MISSING_CASH_ACCOUNT, PAYMENT_RUN_ENTITY_ACCOUNT_INVALID, PAYMENT_RUN_CURRENCY_MISMATCH, PAYMENT_RUN_TOO_MANY_BILLS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add bills to a draft run","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","PAYMENT_RUN_NOT_FOUND","PAYMENT_RUN_INVALID_STATUS","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_BILL_NOT_ELIGIBLE","PAYMENT_RUN_BILL_RESERVED","PAYMENT_RUN_BILL_AVAILABLE_EXCEEDED","PAYMENT_RUN_BANK_ACCOUNT_MISSING_CASH_ACCOUNT","PAYMENT_RUN_ENTITY_ACCOUNT_INVALID","PAYMENT_RUN_CURRENCY_MISMATCH","PAYMENT_RUN_TOO_MANY_BILLS","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/entities/{legalEntityId}":{"patch":{"description":"Draft only. The account must be the entity’s own, active, with a linked GL cash account, in the run currency — another entity’s or another currency’s is refused with 422 PAYMENT_RUN_ENTITY_ACCOUNT_INVALID. The entity must have a bill in the run (400 otherwise). Submit refuses a run while any entity has no account (PAYMENT_RUN_ENTITY_ACCOUNT_REQUIRED).","operationId":"PaymentRuns.setEntityAccount","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"legalEntityId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetPaymentRunEntityAccountV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_INVALID_STATUS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_ENTITY_ACCOUNT_INVALID, PAYMENT_RUN_BANK_ACCOUNT_MISSING_CASH_ACCOUNT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Choose the bank account one entity of a draft run pays from","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_INVALID_STATUS","PAYMENT_RUN_ENTITY_ACCOUNT_INVALID","PAYMENT_RUN_BANK_ACCOUNT_MISSING_CASH_ACCOUNT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/bills/{billId}":{"delete":{"description":"Draft only. Deletes the run's payment_run_bills row outright (not a soft release), freeing the bill for pickup by another run immediately. The bill’s entity leaves the run with its last bill, unless it is the run’s only entity.","operationId":"PaymentRuns.removeBill","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"billId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_INVALID_STATUS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Remove a bill from a draft run","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_INVALID_STATUS","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["payment-runs:write"]},"patch":{"description":"Draft only (v2, spec §1.1.1). `amount_to_pay: null` resets the line to pay the bill’s full live balance (needs the bill unreserved by other active runs, else PAYMENT_RUN_BILL_RESERVED); a positive number requests an exact partial, re-validated against the bill’s AVAILABLE amount (balance minus other active runs’ reservations, else PAYMENT_RUN_BILL_AVAILABLE_EXCEEDED).","operationId":"PaymentRuns.updateBillAmount","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"billId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePaymentRunBillV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_INVALID_STATUS, PAYMENT_RUN_BILL_RESERVED, PAYMENT_RUN_BILL_AVAILABLE_EXCEEDED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Edit a draft run bill's requested amount to pay","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_INVALID_STATUS","PAYMENT_RUN_BILL_RESERVED","PAYMENT_RUN_BILL_AVAILABLE_EXCEEDED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/submit":{"post":{"description":"Draft only. Restricted to the run's creator, except for a run generated by a schedule, which any user with `payment-runs:write` may submit (and revert). Anyone else gets 403 PAYMENT_RUN_SUBMIT_FORBIDDEN. A run generated by a schedule carries its schedule_id; submitting it resolves its “needs attention” work item. Refused while any entity has no paying account (PAYMENT_RUN_ENTITY_ACCOUNT_REQUIRED) or one that can no longer pay it — deactivated, unlinked from its cash account, another entity’s or another currency’s (PAYMENT_RUN_ENTITY_ACCOUNT_INVALID) — or any vendor has no payment method (PAYMENT_RUN_VENDORS_WITHOUT_METHOD), or any owner paid by ACH has no tax ID type (PAYMENT_RUN_OWNERS_WITHOUT_TAX_ID), naming them. Freezes each bill’s payment method from its vendor’s current one — revert to draft or a rejection clears it. Evaluates payment_run approval rules per entity on its share, per payment group on its total and org-wide on the run total (each bill’s amount_to_pay, or its open balance when unset). A matching rule holds the run in pending_approval and materializes one request per triggering evaluation (visible in the Approval Inbox); no matching rule takes the run straight to approved. Either way, approval only LOCKS INTENT — the bills stay reserved and NO payments are posted here. payment_out generation + GL posting happen later, when an owner/admin marks each entity paid (POST /:id/entities/{legalEntityId}/mark-paid).","operationId":"PaymentRuns.submit","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunActionResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE, PAYMENT_RUN_SUBMIT_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_INVALID_STATUS, PAYMENT_RUN_GENERATION_STALE_BILLS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_ENTITY_ACCOUNT_REQUIRED, PAYMENT_RUN_ENTITY_ACCOUNT_INVALID, PAYMENT_RUN_VENDORS_WITHOUT_METHOD, PAYMENT_RUN_OWNERS_WITHOUT_TAX_ID, PAYMENT_RUN_TOO_MANY_BILLS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Submit a draft run through the approval engine","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_INVALID_STATUS","PAYMENT_RUN_SUBMIT_FORBIDDEN","PAYMENT_RUN_ENTITY_ACCOUNT_REQUIRED","PAYMENT_RUN_ENTITY_ACCOUNT_INVALID","PAYMENT_RUN_VENDORS_WITHOUT_METHOD","PAYMENT_RUN_OWNERS_WITHOUT_TAX_ID","PAYMENT_RUN_GENERATION_STALE_BILLS","PAYMENT_RUN_TOO_MANY_BILLS","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Submits a payment run; with no approval rule it is approved at once.","x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/approval-requests/{requestId}/approve-with-changes":{"post":{"description":"Edit and approve (spec 2026-10-23 D19). The caller must be able to decide this OPEN request of a pending_approval run — the same checks as POST /v1/approvals/{id}/decision, the authority limit included, against the run as it stands (403 FORBIDDEN `APPROVAL_NOT_AUTHORIZED` / `APPROVAL_AUTHORITY_INSUFFICIENT`, 409 CONFLICT `APPROVAL_NOT_OPEN` / `APPROVAL_ALREADY_DECIDED`). The changes only make the run smaller or route it differently: `remove_bill_ids`, lower `amount_changes`, and `account_changes` to another eligible account of the same entity. At least one change (400 VALIDATION_FAILED otherwise); there is no field for a payment date or a vendor’s method. An entity request may change only its own entity, a payment-group request only the members it was submitted with, an org-wide request any entity (403 PAYMENT_RUN_APPROVER_CHANGE_OUT_OF_SCOPE). Adding a bill or raising an amount is refused with 422 PAYMENT_RUN_APPROVER_CHANGE_INCREASE, removing every bill with 422 PAYMENT_RUN_APPROVER_CHANGE_EMPTIES_RUN. In one transaction the changes are applied (removed bills and lowered amounts release their reservation; an entity left with no bill leaves the run; one audit row per change under the manual edit’s action), then the request is approved as a normal decision whose note reads “Approved with changes:” followed by one line per change and the optional `note`. The submitter is notified (payment_run.approved_with_changes). When it was the run’s last open request the run becomes approved; other open requests stay open over the reduced amounts. Answers with the run detail.","operationId":"PaymentRuns.approveWithChanges","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"requestId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovePaymentRunWithChangesV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN, LEGAL_ENTITY_NOT_IN_SCOPE, PAYMENT_RUN_APPROVER_CHANGE_OUT_OF_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND, PAYMENT_RUN_APPROVAL_REQUEST_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, PAYMENT_RUN_INVALID_STATUS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_APPROVER_CHANGE_INCREASE, PAYMENT_RUN_APPROVER_CHANGE_EMPTIES_RUN, PAYMENT_RUN_APPROVER_ACCOUNT_NOT_ELIGIBLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Trim a pending run and approve one of its approval requests","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","FORBIDDEN","CONFLICT","PAYMENT_RUN_NOT_FOUND","PAYMENT_RUN_APPROVAL_REQUEST_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_INVALID_STATUS","PAYMENT_RUN_APPROVER_CHANGE_OUT_OF_SCOPE","PAYMENT_RUN_APPROVER_CHANGE_INCREASE","PAYMENT_RUN_APPROVER_CHANGE_EMPTIES_RUN","PAYMENT_RUN_APPROVER_ACCOUNT_NOT_ELIGIBLE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Approves a payment run, releasing money to vendors.","x-required-scopes":["documents:approve"]}},"/v1/payment-runs/{id}/withdraw":{"post":{"description":"The creator’s fast path off an approval gate. pending_approval only — withdraws the open approval request and returns the run to draft. Submitter-enforced by the approval engine: any other org member gets 403. Bill reservations are kept — only the approval request is cancelled, not the run’s bill selection.","operationId":"PaymentRuns.withdraw","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunActionResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE, FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_INVALID_STATUS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Withdraw a run’s open approval request back to draft","tags":["Payment runs"],"x-error-codes":["PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_INVALID_STATUS","FORBIDDEN","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/revert-to-draft":{"post":{"description":"rejected only. Restricted to the run's creator, except for a run generated by a schedule, which any user with `payment-runs:write` may revert (and submit). Anyone else gets 403 PAYMENT_RUN_REVERT_FORBIDDEN. Bill reservations are kept.","operationId":"PaymentRuns.revertToDraft","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunActionResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE, PAYMENT_RUN_REVERT_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_INVALID_STATUS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Return a rejected run to draft for editing and resubmission","tags":["Payment runs"],"x-error-codes":["PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_INVALID_STATUS","PAYMENT_RUN_REVERT_FORBIDDEN","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/cancel":{"post":{"description":"From draft, pending_approval, or rejected. Withdraws any open approval request — any payment-runs:write holder may cancel, not just the submitter — and releases every bill reservation so they’re immediately reservable by another run. Cancelling a run a schedule generated resolves its “needs attention” work item.","operationId":"PaymentRuns.cancel","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunActionResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_INVALID_STATUS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Cancel a run (terminal)","tags":["Payment runs"],"x-error-codes":["PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_INVALID_STATUS","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/entities/mark-paid":{"post":{"description":"Bulk form of POST …/entities/{legalEntityId}/mark-paid: every listed entity goes through exactly that path — same permission (OWNER/ADMIN, and the caller must be allowed every entity of the run), same refusals with the same codes — in ONE transaction. The first entity the single endpoint would refuse refuses the whole request and nothing is posted for any of them. `paid_on` (required, not after the org’s today, else 400 VALIDATION_FAILED) dates every payment. The run status is derived once, after the last entity: partially_completed while another entity is pending, completed once every entity is paid or released. Answers with the updated run.\n\n`ach_submitted: true` declares the NACHA file sent through the bank for the listed entities on the NACHA/manual rail: each with ACH vendors and an unconfirmed file is first confirmed through the same path as …/ach-file/confirm-submitted (same audit, same Spark Pay closing), in the same transaction. Entities Spark Pay has claimed are not confirmed and settle by their own rail, so one call can mix both rails; sends still in flight are refused as without the flag. Without it, an unconfirmed ACH is still refused with 409 PAYMENT_RUN_ACH_NOT_SUBMITTED.","operationId":"PaymentRuns.markEntitiesPaid","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkPaymentRunEntitiesPaidV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE, PAYMENT_RUN_COMPLETE_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_INVALID_STATUS, PAYMENT_RUN_ENTITY_NOT_PENDING, PAYMENT_RUN_ENTITY_NOTHING_TO_PAY, PAYMENT_RUN_VENDOR_METHOD_CHANGED, PAYMENT_RUN_SENDS_IN_FLIGHT, PAYMENT_RUN_ACH_NOT_SUBMITTED, PAYMENT_RUN_GENERATION_STALE_BILLS, IDEMPOTENCY_CONFLICT, PERIOD_LOCKED, PERIOD_CLOSED, DOCUMENT_STATUS_FORBIDS_ACTION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_ACH_VENDORS_NOT_PAYABLE, PAYMENT_RUN_AMOUNT_EXCEEDS_BALANCE, PAYMENT_RUN_BANK_ACCOUNT_MISSING_CASH_ACCOUNT, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Mark several entities of a run paid at once","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_INVALID_STATUS","PAYMENT_RUN_COMPLETE_FORBIDDEN","PAYMENT_RUN_ENTITY_NOT_PENDING","PAYMENT_RUN_ENTITY_NOTHING_TO_PAY","PAYMENT_RUN_VENDOR_METHOD_CHANGED","PAYMENT_RUN_SENDS_IN_FLIGHT","PAYMENT_RUN_ACH_NOT_SUBMITTED","PAYMENT_RUN_ACH_VENDORS_NOT_PAYABLE","PAYMENT_RUN_GENERATION_STALE_BILLS","PAYMENT_RUN_AMOUNT_EXCEEDS_BALANCE","PAYMENT_RUN_BANK_ACCOUNT_MISSING_CASH_ACCOUNT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_LOCKED","PERIOD_CLOSED","PERIOD_MISSING","DOCUMENT_STATUS_FORBIDS_ACTION","DIMENSION_REQUIRED"],"x-high-risk":true,"x-high-risk-reason":"Marks vendors paid and posts the payments to the ledger.","x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/entities/{legalEntityId}/mark-paid":{"post":{"description":"The run must be approved or partially_completed and the entity pending (409 PAYMENT_RUN_ENTITY_NOT_PENDING otherwise); OWNER/ADMIN only (403 otherwise), and the caller must be allowed every entity of the run. Refused with 409 PAYMENT_RUN_VENDOR_METHOD_CHANGED while a vendor’s live payment method differs from the one frozen at submit. `paid_on` (default: the run’s payment date, capped at the org’s today; a later day is refused with 400 VALIDATION_FAILED) dates every payment the entity posts. An entity whose every bill was released unpaid, with no Spark Pay transfer, is refused with 409 PAYMENT_RUN_ENTITY_NOTHING_TO_PAY — release it instead. A Spark Pay entity whose every transfer already settled is not: it is marked paid with nothing left to post.\n\nWhat is posted depends on the rail the ENTITY used. NACHA file / manual: refused with 409 PAYMENT_RUN_ACH_NOT_SUBMITTED while the entity has ACH vendors and its file was never confirmed submitted — unless the request says `ach_submitted: true`, which first confirms it through the same path as …/ach-file/confirm-submitted (same audit, same Spark Pay closing), in the same transaction; downloading the file is not required, and a Spark Pay entity is not confirmed but settled by its own rail as below — and with 422 PAYMENT_RUN_ACH_VENDORS_NOT_PAYABLE (naming them) while an ACH vendor lacks bank details a NACHA file can pay; then one posted payment_out per vendor (ACH, wire and check, by the frozen method) on the entity’s bank cash account, applied to its bills, which are released. Spark Pay: the entity’s ACH vendors are not posted here — each sent vendor’s draft posts when its transfer settles, and a vendor whose send failed has its draft deleted and its bills released; refused with 409 PAYMENT_RUN_SENDS_IN_FLIGHT while any of the entity’s sends is undecided or still queued. Its wire and check vendors are posted as above.\n\nThe entity becomes paid and the run follows its entities: partially_completed while another entity is pending, completed once every entity is paid or released. Atomic: any failure rolls back and the entity stays pending to retry.","operationId":"PaymentRuns.markEntityPaid","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"legalEntityId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkPaymentRunEntityPaidV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunActionResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE, PAYMENT_RUN_COMPLETE_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_INVALID_STATUS, PAYMENT_RUN_ENTITY_NOT_PENDING, PAYMENT_RUN_ENTITY_NOTHING_TO_PAY, PAYMENT_RUN_VENDOR_METHOD_CHANGED, PAYMENT_RUN_SENDS_IN_FLIGHT, PAYMENT_RUN_ACH_NOT_SUBMITTED, PAYMENT_RUN_GENERATION_STALE_BILLS, IDEMPOTENCY_CONFLICT, PERIOD_LOCKED, PERIOD_CLOSED, DOCUMENT_STATUS_FORBIDS_ACTION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_ACH_VENDORS_NOT_PAYABLE, PAYMENT_RUN_AMOUNT_EXCEEDS_BALANCE, PAYMENT_RUN_BANK_ACCOUNT_MISSING_CASH_ACCOUNT, LEDGER_ENTRY_REFUSED, ACCOUNT_LEGAL_ENTITY_MISMATCH, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PERIOD_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Mark one entity of a run paid — post its payments","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_INVALID_STATUS","PAYMENT_RUN_COMPLETE_FORBIDDEN","PAYMENT_RUN_ENTITY_NOT_PENDING","PAYMENT_RUN_ENTITY_NOTHING_TO_PAY","PAYMENT_RUN_VENDOR_METHOD_CHANGED","PAYMENT_RUN_SENDS_IN_FLIGHT","PAYMENT_RUN_ACH_NOT_SUBMITTED","PAYMENT_RUN_ACH_VENDORS_NOT_PAYABLE","PAYMENT_RUN_GENERATION_STALE_BILLS","PAYMENT_RUN_AMOUNT_EXCEEDS_BALANCE","PAYMENT_RUN_BANK_ACCOUNT_MISSING_CASH_ACCOUNT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEDGER_ENTRY_REFUSED","ACCOUNT_LEGAL_ENTITY_MISMATCH","PERIOD_LOCKED","PERIOD_CLOSED","PERIOD_MISSING","DOCUMENT_STATUS_FORBIDS_ACTION","DIMENSION_REQUIRED"],"x-high-risk":true,"x-high-risk-reason":"Marks vendors paid and posts the payments to the ledger.","x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/entities/{legalEntityId}/release":{"post":{"description":"The run must be approved or partially_completed and the entity pending; OWNER/ADMIN only (403 otherwise), and the caller must be allowed every entity of the run. Releases the entity’s bills back to the pool without touching the other entities. The run follows its entities: completed once every entity is paid or released with at least one paid, cancelled when every entity was released. Refused with 409 PAYMENT_RUN_SEND_METHOD_CONFLICT while either rail holds the entity (a Spark Pay send or transfer, or a confirmed NACHA file — release that claim first) and 409 PAYMENT_RUN_SENDS_IN_FLIGHT while one of its send jobs is still queued.","operationId":"PaymentRuns.releaseEntity","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"legalEntityId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunActionResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE, PAYMENT_RUN_COMPLETE_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_INVALID_STATUS, PAYMENT_RUN_ENTITY_NOT_PENDING, PAYMENT_RUN_SEND_METHOD_CONFLICT, PAYMENT_RUN_SENDS_IN_FLIGHT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Release one unpaid entity from a run","tags":["Payment runs"],"x-error-codes":["PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_INVALID_STATUS","PAYMENT_RUN_COMPLETE_FORBIDDEN","PAYMENT_RUN_ENTITY_NOT_PENDING","PAYMENT_RUN_SEND_METHOD_CONFLICT","PAYMENT_RUN_SENDS_IN_FLIGHT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Pulls an approved entity out of a payment run.","x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/entities/{legalEntityId}/send-payments":{"post":{"description":"Enqueues one background send per ACH vendor of the entity (by the method frozen at submit) and returns 202 immediately (a Moov call can take 25s; fifty cannot sit in one request). Wire and check vendors are not sent: they are posted when the entity is marked paid. The run must be approved or partially_completed and the entity pending; OWNER/ADMIN only (403 otherwise), and the caller must be allowed every entity of the run. Each vendor gets one draft payment_out and exactly one transfer from the entity’s bank account; each payment posts when its transfer settles, days later. Mutually exclusive with the entity’s NACHA file: refused once its file was confirmed submitted (PAYMENT_RUN_ALREADY_EXPORTED); another entity’s rail does not matter. Refused with PAYMENT_RUN_VENDORS_NOT_PAYABLE when one of the entity’s ACH vendors has no Moov destination, and with PAYMENT_RUN_VENDOR_METHOD_CHANGED when a vendor’s method changed since submit. Re-pressing is the recovery path — vendors already sent are skipped, so nothing is ever paid twice. Per-vendor state is read back from GET /v1/payment-runs/{id}.","operationId":"PaymentRuns.sendEntityPayments","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"legalEntityId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"202":{"description":"Accepted — one send job enqueued per ACH vendor.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunSendResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE, PAYMENT_RUN_COMPLETE_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_INVALID_STATUS, PAYMENT_RUN_ENTITY_NOT_PENDING, PAYMENT_RUN_VENDOR_METHOD_CHANGED, PAYMENT_RUN_ALREADY_EXPORTED, PAYMENT_RUN_SPARK_PAY_DISTRIBUTION_LEGS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_BANK_NOT_MOOV_LINKED, PAYMENT_RUN_VENDORS_NOT_PAYABLE, PAYMENT_RUN_INTERCOMPANY_NOT_SPARK_PAY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Send one entity of a run via Spark Pay — one ACH transfer per ACH vendor","tags":["Payment runs"],"x-error-codes":["PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_INVALID_STATUS","PAYMENT_RUN_COMPLETE_FORBIDDEN","PAYMENT_RUN_ENTITY_NOT_PENDING","PAYMENT_RUN_VENDOR_METHOD_CHANGED","PAYMENT_RUN_ALREADY_EXPORTED","PAYMENT_RUN_SPARK_PAY_DISTRIBUTION_LEGS","PAYMENT_RUN_BANK_NOT_MOOV_LINKED","PAYMENT_RUN_VENDORS_NOT_PAYABLE","PAYMENT_RUN_INTERCOMPANY_NOT_SPARK_PAY","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Sends ACH payments out of a bank account.","x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/entities/{legalEntityId}/release-send-claim":{"post":{"description":"Clears the entity’s ach_exported_at and spark_pay_enqueued_at, reopening it to either rail. The run must be approved or partially_completed and the entity pending; OWNER/ADMIN only (403 otherwise), and the caller must be allowed every entity of the run.\n\nIt exists because a claim is written before anything moves. Pressing Send stamps spark_pay_enqueued_at before the first job runs, so an entity whose every vendor send then failed for a reason outside the operator’s control — bank not linked, Moov unavailable — is claimed by a rail that paid nobody, while the NACHA fallback stays 409’d. Same shape for a NACHA file confirmed as submitted and then rejected by the bank.\n\nRefused with 409 PAYMENT_RUN_SEND_METHOD_CONFLICT once ANY Spark Pay transfer exists for the entity: money has moved, and reopening the other rail would pay those vendors twice. Refused with 409 PAYMENT_RUN_SENDS_IN_FLIGHT while any of the entity’s send jobs is still queued or running — a queued job cannot be cancelled. A blocked vendor’s job terminates normally on its final attempt, so this is a wait bounded by the queue’s backoff, not a permanent refusal.","operationId":"PaymentRuns.releaseEntitySendClaim","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"legalEntityId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunEntityClaimV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE, PAYMENT_RUN_COMPLETE_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_INVALID_STATUS, PAYMENT_RUN_ENTITY_NOT_PENDING, PAYMENT_RUN_SEND_METHOD_CONFLICT, PAYMENT_RUN_SENDS_IN_FLIGHT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Release both disbursement-rail claims on one entity of a run","tags":["Payment runs"],"x-error-codes":["PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_INVALID_STATUS","PAYMENT_RUN_COMPLETE_FORBIDDEN","PAYMENT_RUN_ENTITY_NOT_PENDING","PAYMENT_RUN_SEND_METHOD_CONFLICT","PAYMENT_RUN_SENDS_IN_FLIGHT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Clears a send claim, so a payment can be sent again.","x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/entities/{legalEntityId}/ach-file/confirm-submitted":{"post":{"description":"Claims the entity for the NACHA rail, which closes it to Spark Pay. The run must be approved or partially_completed (422 PAYMENT_RUN_NOT_APPROVED otherwise) and the entity pending; OWNER/ADMIN only (403 otherwise), and the caller must be allowed every entity of the run.\n\nWhy it is a separate action rather than a side effect of downloading the file: nothing the server can observe distinguishes a real submission from a link prefetch or a curious clerk, and a claim written by either would permanently veto the Spark Pay rail. So the download stays free and repeatable and the operator declares the submission here.\n\nIdempotent — confirming an already-confirmed entity succeeds and returns the existing stamp. Refused with 409 PAYMENT_RUN_SEND_METHOD_CONFLICT when Spark Pay has already claimed the entity (Send pressed, or transfers exist) — another entity’s rail does not matter. Use …/release-send-claim to undo a claim made in error.","operationId":"PaymentRuns.confirmEntityAchSubmitted","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"legalEntityId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunEntityClaimV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE, PAYMENT_RUN_COMPLETE_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_ENTITY_NOT_PENDING, PAYMENT_RUN_VENDOR_METHOD_CHANGED, PAYMENT_RUN_SEND_METHOD_CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_NOT_APPROVED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Declare one entity’s NACHA file submitted to the bank","tags":["Payment runs"],"x-error-codes":["PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_NOT_APPROVED","PAYMENT_RUN_COMPLETE_FORBIDDEN","PAYMENT_RUN_ENTITY_NOT_PENDING","PAYMENT_RUN_VENDOR_METHOD_CHANGED","PAYMENT_RUN_SEND_METHOD_CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Records a NACHA file as sent to the bank.","x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/entities/{legalEntityId}/ach-file":{"get":{"description":"One file per entity, from its bank account. The run must be approved or partially_completed and the entity pending, and the caller must be allowed every entity of the run. Holds only the entity’s ACH vendors (by the method frozen at submit) over its bills still reserved on the run; decrypts their bank details in-memory, builds an unbalanced (credits-only, Service Class 220) NACHA file, and streams it as text/plain — never written to disk/bucket. Refused with 422 PAYMENT_RUN_ACH_VENDORS_NOT_PAYABLE, naming them, when any of those vendors has missing bank numbers or a routing number failing the ABA check-digit validation — a file that silently left them out would have them posted as paid at Mark paid. Named `ach-{run_number}-{entity}-{yyyymmdd}.txt`. Refused with 409 PAYMENT_RUN_VENDOR_METHOD_CHANGED when a vendor’s method changed since submit, and with 409 PAYMENT_RUN_SEND_METHOD_CONFLICT once Spark Pay has claimed the entity — from the moment its send-payments is pressed. Safe and repeatable: this GET stamps nothing; the entity is closed to Spark Pay by POST …/ach-file/confirm-submitted. The disclosure is audited explicitly in the service (payment-runs.export_ach, with legal_entity_id and included/excluded/total_cents counts) — the AuditInterceptor does not fire on GET routes.","operationId":"PaymentRuns.exportEntityAch","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"legalEntityId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"NACHA ACH file","content":{"text/plain":{"schema":{"type":"string"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_ENTITY_NOT_PENDING, PAYMENT_RUN_VENDOR_METHOD_CHANGED, PAYMENT_RUN_SEND_METHOD_CONFLICT","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_NOT_APPROVED, BANK_ACCOUNT_ACH_NOT_CONFIGURED, PAYMENT_RUN_ACH_VENDORS_NOT_PAYABLE, PAYMENT_RUN_NO_ACH_ENTRIES","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Export one entity of a run as a NACHA ACH credit file","tags":["Payment runs"],"x-error-codes":["PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_NOT_APPROVED","PAYMENT_RUN_ENTITY_NOT_PENDING","PAYMENT_RUN_VENDOR_METHOD_CHANGED","PAYMENT_RUN_SEND_METHOD_CONFLICT","BANK_ACCOUNT_ACH_NOT_CONFIGURED","PAYMENT_RUN_ACH_VENDORS_NOT_PAYABLE","PAYMENT_RUN_NO_ACH_ENTRIES"],"x-high-risk":true,"x-high-risk-reason":"Exposes vendor bank account and routing numbers.","x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/ach-files":{"get":{"description":"A NACHA file goes to one bank, so the run’s entities are grouped by the originating routing number of their bank account; each group is one file with a batch per entity (GET …/ach-file?origin_routing=). Every entity of the run appears once: in `legal_entity_ids` when its own download (GET …/entities/{legalEntityId}/ach-file) would succeed, otherwise in `excluded` with the code that download answers with — never silently dropped. An entity whose account has no originating routing number is listed under the group with `origin_routing` null. Same run-level rules as the downloads: the run must be approved or partially_completed (422 PAYMENT_RUN_NOT_APPROVED) and the caller allowed every entity of it. Discloses no bank number and writes nothing.","operationId":"PaymentRuns.listAchFiles","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunAchFilesV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_NOT_APPROVED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List the run’s NACHA files — one per originating bank","tags":["Payment runs"],"x-error-codes":["PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_NOT_APPROVED"],"x-high-risk":true,"x-high-risk-reason":"Lists the NACHA bank files that carry vendor bank details.","x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/ach-file":{"get":{"description":"One file for every entity of the run whose bank account originates through `origin_routing`, one batch each (its own company ID, name, SEC code and entry description), ordered by entity name; batch numbers are sequential and the file control totals every batch. The file header’s Immediate Origin is the shared company ID when every batch has the same one, otherwise the first batch’s — to be confirmed with the bank.\n\nEach entity is checked and audited exactly as its own download (GET …/entities/{legalEntityId}/ach-file): one payment-runs.export_ach audit row per entity, marked `combined`, and nothing stamped — each entity is closed to Spark Pay by its own POST …/ach-file/confirm-submitted. An entity its own download would refuse is left out of the file; GET …/ach-files lists which and why. 404 PAYMENT_RUN_ACH_FILE_NOT_FOUND when no entity of the run originates through that routing number, 422 PAYMENT_RUN_ACH_FILE_EMPTY (naming each entity and reason) when all of them are left out. Streamed as text/plain, never stored; named `ach-{run_number}-{bank}-{routing}-{yyyymmdd}.txt`.","operationId":"PaymentRuns.exportAchFile","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"origin_routing","required":true,"in":"query","description":"The bank’s originating routing number, 9 digits.","schema":{"pattern":"^\\d{9}$","example":"021000021","type":"string"}}],"responses":{"200":{"description":"NACHA ACH file (one batch per included entity)","content":{"text/plain":{"schema":{"type":"string"}}},"headers":{"X-Ach-Included-Legal-Entity-Ids":{"description":"The legal entities this file holds, comma-separated, in batch order — exactly the ones to confirm submitted. Read it rather than an earlier GET …/ach-files: eligibility can change between the two.","schema":{"type":"string","example":"uuid-1,uuid-2"}},"X-Ach-Excluded-Legal-Entities":{"description":"The entities of this bank left out of the file, as `legal_entity_id=REASON_CODE` pairs, comma-separated; empty when none. The reason is the code GET …/ach-files reports.","schema":{"type":"string","example":"uuid-3=PAYMENT_RUN_ACH_ALREADY_SUBMITTED"}},"Content-Disposition":{"description":"attachment; filename=\"ach-{run_number}-{bank}-{routing}-{yyyymmdd}.txt\"","schema":{"type":"string"}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND, PAYMENT_RUN_ACH_FILE_NOT_FOUND","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_NOT_APPROVED, PAYMENT_RUN_ACH_FILE_EMPTY","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Export one bank’s NACHA file — a batch per entity","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_NOT_APPROVED","PAYMENT_RUN_ACH_FILE_NOT_FOUND","PAYMENT_RUN_ACH_FILE_EMPTY"],"x-high-risk":true,"x-high-risk-reason":"Exposes vendor bank account and routing numbers.","x-required-scopes":["payment-runs:write"]}},"/v1/payment-runs/{id}/manual-payments-file":{"get":{"description":"One row per (entity, vendor) paid by wire or check — by the method frozen at submit — over the bills still reserved on the run, with what whoever pays by hand needs: for a wire the beneficiary, bank, SWIFT/BIC, ABA routing and the full account number or IBAN; for a check the payee and mailing address. The run must be approved or partially_completed and the caller allowed every entity of the run. Covers every pending entity, or only `legal_entity_id` when given. Streamed as text/csv, never stored. Refused with 409 PAYMENT_RUN_VENDOR_METHOD_CHANGED when a vendor’s method changed since submit. Named `manual-payments-{run_number}[-{entity}]-{yyyymmdd}.csv`. The disclosure is audited explicitly in the service (payment-runs.export_manual_payments, counts only) — the AuditInterceptor does not fire on GET routes.","operationId":"PaymentRuns.exportManualPayments","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Narrows the file to one legal entity of the run. Omitted, the file lists the wire and check payments of every entity that is still pending. The entity must belong to the run (404 PAYMENT_RUN_NOT_FOUND otherwise) and be pending (409 PAYMENT_RUN_ENTITY_NOT_PENDING).","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"Manual-payments CSV","content":{"text/csv":{"schema":{"type":"string"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"text/csv":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_NOT_FOUND","content":{"text/csv":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENT_RUN_ENTITY_NOT_PENDING, PAYMENT_RUN_VENDOR_METHOD_CHANGED","content":{"text/csv":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_NOT_APPROVED","content":{"text/csv":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Export the run’s wire and check payments as a CSV","tags":["Payment runs"],"x-error-codes":["PAYMENT_RUN_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_NOT_APPROVED","PAYMENT_RUN_ENTITY_NOT_PENDING","PAYMENT_RUN_VENDOR_METHOD_CHANGED"],"x-required-scopes":["payment-runs:write"]}},"/v1/payment-run-default-accounts":{"get":{"description":"One row per active legal entity the caller may act on (with `ids`, per listed entity, inactive included), sorted by name (`sort`: `name`, `-name`) then id: the accounts it may pay a run from (its own, active, in its currency, with a linked GL cash account) and its default among them. A new payment run, manual or scheduled, pays each entity from its default, else from its only eligible account, else from none until one is chosen. A default that stopped being eligible reads as null. `search` is a case-insensitive substring match on: entity name. `legal_entity_id` (repeat or comma-separate, at most 100) lists only those entities, each of which must be in the caller’s scope. `ids` (legal entity ids, at most 100) returns those entities, inactive included, ignoring `search` and `legal_entity_id`, never one outside the caller’s scope. Pages of 100 by default (max 100).","operationId":"PaymentRunDefaultAccounts.list","parameters":[{"name":"legal_entity_id","required":false,"in":"query","description":"Legal entities. Repeat or comma-separate, at most 100. Only these entities are listed (active ones, as without it). Each must be in the caller’s scope. Ignored when `ids` is given.","schema":{"type":"array","items":{"type":"string","format":"uuid"}}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: name","schema":{"enum":["name","-name"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: entity name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRunDefaultAccountV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List each legal entity's default paying account","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["payment-runs:read"]}},"/v1/payment-run-default-accounts/{legalEntityId}":{"patch":{"description":"`bank_account_id` must be one of the entity's eligible accounts (its own, active, in its currency, with a linked GL cash account) — any other is refused with 422 PAYMENT_RUN_DEFAULT_ACCOUNT_NOT_ELIGIBLE. `null` clears the default and changes no run. A new default also fills, in the same transaction, the account of this entity on every draft run (any origin) that has none, one audit row per run; a draft with an account chosen, and any run past draft, keep theirs. `drafts_updated` says how many drafts took it; `drafts_skipped` how many were left alone (a run covering an entity the caller may not act on, or one the account cannot pay). New runs pay the entity from the default. Returns the entity’s row.","operationId":"PaymentRunDefaultAccounts.set","parameters":[{"name":"legalEntityId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetPaymentRunDefaultAccountV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SetPaymentRunDefaultAccountResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENT_RUN_DEFAULT_ACCOUNT_NOT_ELIGIBLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Set or clear a legal entity's default paying account","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_DEFAULT_ACCOUNT_NOT_ELIGIBLE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["payment-runs:write"]}},"/v1/payment-run-schedules":{"get":{"description":"Sorted by `name` by default (`sort`: `name`, `-name`, `created_at`, `-created_at`), then id. `search` is a case-insensitive substring match on: name. `ids` returns those schedules regardless of `status` and the other filters, never one the caller may not see. `legal_entity_id` and `entity_group_id` take lists (repeat or comma-separate); a schedule matches when its scope includes any of them — an entity listed directly or as a current member of one of its groups, or one of its groups. A caller restricted to some legal entities sees a schedule only when every entity in its scope and every current member of its groups is allowed, and may filter only by allowed entities. Each active schedule carries `overlaps_with`: the other active schedules it competes with for bills (spec D16) — null id and name for one the caller may not see — computed for the whole page in one read.","operationId":"PaymentRunSchedules.list","parameters":[{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["active","paused"]}},{"name":"legal_entity_id","required":false,"in":"query","description":"Legal entities. Repeat or comma-separate. A schedule is listed when one of them is in its scope, listed or as a current member of one of its groups. Each must be in the caller’s scope.","schema":{"type":"array","items":{"type":"string","format":"uuid"}}},{"name":"entity_group_id","required":false,"in":"query","description":"Payment groups. Repeat or comma-separate. A schedule is listed when one of them is in its scope.","schema":{"type":"array","items":{"type":"string","format":"uuid"}}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: name","schema":{"enum":["name","-name","created_at","-created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRunScheduleV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List payment run schedules","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["payment-runs:read"]},"post":{"description":"The owner is `owner_user_id`, or the caller when omitted: runs are created in the owner's name. An API key has no user, so it must send `owner_user_id` (PAYMENT_RUN_SCHEDULE_USER_REQUIRED otherwise). The scope needs at least one legal entity or payment group (a consolidation group is refused with ENTITY_GROUP_WRONG_TYPE); the caller and the owner must be allowed every entity in it and every current member of its groups. `weekday` (0 = Sunday) serves weekly and biweekly, `days_of_month` (`'1'`–`'28'`, `'last'`) monthly (one day) and twice_monthly (two); sending the other one is refused, naming it. Defaults: `vendor_mode` all, `extra_days` 0, `payment_offset_days` 1, `status` active. An active schedule gets `next_run_date`: the first run date on or after the org’s today and `start_date`. `non_usd_legal_entity_ids` warns about entities its USD runs will leave out.","operationId":"PaymentRunSchedules.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentRunScheduleV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunScheduleV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY, IDEMPOTENCY_KEY_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE, PAYMENT_RUN_SCHEDULE_USER_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ENTITY_GROUP_WRONG_TYPE, PAYMENT_RUN_SCHEDULE_OWNER_INVALID, PAYMENT_RUN_SCHEDULE_OWNER_OUT_OF_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a payment run schedule","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","ENTITY_GROUP_WRONG_TYPE","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_SCHEDULE_OWNER_INVALID","PAYMENT_RUN_SCHEDULE_OWNER_OUT_OF_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","IDEMPOTENCY_KEY_REQUIRED","PAYMENT_RUN_SCHEDULE_USER_REQUIRED"],"x-required-scopes":["payment-runs:write"]}},"/v1/payment-run-schedules/summary":{"get":{"description":"Counts only the schedules the caller can see (the list’s all-entities rule).","operationId":"PaymentRunSchedules.summary","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunScheduleSummaryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Count active and paused payment run schedules","tags":["Payment runs"],"x-error-codes":[],"x-required-scopes":["payment-runs:read"]}},"/v1/payment-run-schedules/preview":{"post":{"description":"Takes a schedule as the editor holds it (saved or not): its scope, vendor and frequency fields plus `extra_days` and `payment_offset_days`, with the same validation and defaults as create. Answers with the run Generate now would build today: generated today, paying `payment_offset_days` business days later, taking the bills due before `window_end` (the run date after the next one, plus `extra_days`; a bill with no due date counts as due on its document date). The next one is, when `schedule_id` names a saved schedule, the `next_run_date` the body’s rule would get on save (the first run date on or after today while paused, or for a new schedule). Bills are taken oldest due first, at most 200, with `left_out_count` for the rest. A bill another run holds in part counts at what is still available; one held in full is not taken. Totals come per entity, with the account each would pay from (`bank_account_is_default`), the entities left out (non-USD, or not accessible to the caller) and what would keep the run in draft (`missing`). `overlaps` lists the active schedules it would compete with for bills: the body counts as active, and `schedule_id` is never compared with itself. Nothing is written.","operationId":"PaymentRunSchedules.preview","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewPaymentRunScheduleV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunSchedulePreviewV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_SCHEDULE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ENTITY_GROUP_WRONG_TYPE, PAYMENT_RUN_SCHEDULE_GROUP_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview the run a payment run schedule would build today","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","ENTITY_GROUP_WRONG_TYPE","PAYMENT_RUN_SCHEDULE_GROUP_UNAVAILABLE","PAYMENT_RUN_SCHEDULE_NOT_FOUND"],"x-required-scopes":["payment-runs:read"]}},"/v1/payment-run-schedules/{id}":{"get":{"description":"With its entities, groups (current member counts), vendors, owner name and last execution, and `overlaps`: the other active schedules it competes with for bills (none while paused). A caller restricted to some legal entities gets 404 unless every entity in scope and every current member of its groups is allowed.","operationId":"PaymentRunSchedules.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunScheduleV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_SCHEDULE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a payment run schedule","tags":["Payment runs"],"x-error-codes":["PAYMENT_RUN_SCHEDULE_NOT_FOUND"],"x-required-scopes":["payment-runs:read"]},"patch":{"description":"Every field is optional. Changing `frequency` drops the stored `weekday` / `days_of_month` the new frequency does not use, unless sent; `vendor_mode: all` drops the stored vendors likewise. `owner_user_id` reassigns the schedule (spec D14). The owner is checked when it changes and when the schedule is resumed (PAYMENT_RUN_SCHEDULE_OWNER_INVALID / _OUT_OF_SCOPE). A scope edit checks a still-valid owner against what it adds only (new entities and the current members of new groups); removing never is. Pausing or editing is never blocked by an owner who has since lost access — entities they lost stay in scope and executions leave them out. Every save recomputes `next_run_date` from the org’s today without backfilling, never on a day the schedule already ran, clears it while paused, and resolves the schedule’s open \"failed\" alert.","operationId":"PaymentRunSchedules.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePaymentRunScheduleV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunScheduleV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_SCHEDULE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ENTITY_GROUP_WRONG_TYPE, PAYMENT_RUN_SCHEDULE_OWNER_INVALID, PAYMENT_RUN_SCHEDULE_OWNER_OUT_OF_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Edit, pause, resume or reassign a payment run schedule","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","ENTITY_GROUP_WRONG_TYPE","LEGAL_ENTITY_NOT_IN_SCOPE","PAYMENT_RUN_SCHEDULE_OWNER_INVALID","PAYMENT_RUN_SCHEDULE_OWNER_OUT_OF_SCOPE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","PAYMENT_RUN_SCHEDULE_NOT_FOUND"],"x-required-scopes":["payment-runs:write"]}},"/v1/payment-run-schedules/{id}/executions":{"get":{"description":"The history: every time the schedule ran, on its date (`scheduled`) or by Generate now (`manual`), newest first. Each carries its result, the run it made or added to (`run_number` while the run exists), its counts and total, and what was left out or missing. Same visibility as the schedule: 404 unless the caller may see it. `sort` is `-created_at` (default) or `created_at`, then id. `ids` returns those executions of this schedule only. `search` is accepted and ignored: an execution has no text field to search.","operationId":"PaymentRunSchedules.listExecutions","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: .","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRunScheduleExecutionV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_SCHEDULE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a payment run schedule's executions","tags":["Payment runs"],"x-error-codes":["VALIDATION_FAILED","INVALID_CURSOR","PAYMENT_RUN_SCHEDULE_NOT_FOUND"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["payment-runs:read"]}},"/v1/payment-run-schedules/{id}/generate":{"post":{"description":"Runs the schedule today, active or paused, exactly as its date would — but in the CURRENT owner's name, whoever presses it (the run's `created_by` is the owner). Takes the bills due before the run date after the schedule’s next one (plus `extra_days`); bills an earlier run holds are not taken again. If the schedule’s last run is still a draft, the new bills are added to it and its payment date and memo refreshed instead of a second run (`absorbed`). The run is always left in draft, with an alert, for a person to review and submit: `draft_ready`, or `draft_missing_info` when something is missing. Answers with the execution it recorded — `no_bills` when nothing qualified, `failed` when the owner can no longer act (`error_code`). Never moves `next_run_date`; not limited per day.","operationId":"PaymentRunSchedules.generate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PaymentRunScheduleExecutionV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENT_RUN_SCHEDULE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Generate a payment run from a schedule now","tags":["Payment runs"],"x-error-codes":["PAYMENT_RUN_SCHEDULE_NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Creates a payment run that pays vendors.","x-required-scopes":["payment-runs:write"]}},"/v1/legal-entities/{id}/payments/connect":{"post":{"description":"Creates the legal entity's Moov business account (or reuses the one already carrying its foreignID) and requests the Spark Payments capabilities. Prefills only business facts we already hold — legal name, EIN and business address. Representatives, beneficial owners and identity documents are never sent from here: the browser collects those directly through the embedded Moov onboarding Drop, using a token from POST /v1/legal-entities/{id}/payments/onboarding-token. Safe to retry; an already-connected legal entity returns its current status unchanged.","operationId":"LegalEntityPayments.connect","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectLegalEntityPaymentsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LegalEntityPaymentsStatusV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENTS_LEGAL_ENTITY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENTS_BUSINESS_TYPE_REQUIRED, PAYMENTS_BUSINESS_TYPE_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"502":{"description":"Possible error codes: PAYMENTS_PROVIDER_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PAYMENTS_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Enable Spark Payments for a legal entity","tags":["Legal Entity Payments"],"x-error-codes":["VALIDATION_FAILED","PAYMENTS_LEGAL_ENTITY_NOT_FOUND","PAYMENTS_BUSINESS_TYPE_REQUIRED","PAYMENTS_BUSINESS_TYPE_INVALID","PAYMENTS_PROVIDER_ERROR","PAYMENTS_NOT_CONFIGURED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["payments:write"]}},"/v1/legal-entities/{id}/payments":{"get":{"description":"Current Spark Payments state, served from our database — this endpoint does not call Moov, so a Moov outage cannot take the legal-entity page down. Freshness is owned by the scheduled reconciliation job; `stale: true` means the stored status is older than its refresh cadence and should be treated with suspicion. `not_connected` means the legal entity has no Moov account at all. To force a read-through (right after the onboarding Drop closes, say) call POST /v1/legal-entities/{id}/payments/refresh.","operationId":"LegalEntityPayments.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LegalEntityPaymentsStatusV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get Spark Payments status for a legal entity","tags":["Legal Entity Payments"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["payments:read"]}},"/v1/legal-entities/{id}/payments/refresh":{"post":{"description":"Re-reads this legal entity's account from Moov and returns the updated status. Use it when a stale answer is unacceptable — immediately after the onboarding Drop closes, for example. Ordinary page loads should use GET /v1/legal-entities/{id}/payments, which is served from our database and does not depend on Moov being reachable. Returns 409 PAYMENTS_ACCOUNT_NOT_CONNECTED when the legal entity has no Moov account yet.","operationId":"LegalEntityPayments.refresh","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LegalEntityPaymentsStatusV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENTS_ACCOUNT_NOT_CONNECTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"502":{"description":"Possible error codes: PAYMENTS_PROVIDER_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PAYMENTS_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Refresh a legal entity's Spark Payments status from Moov","tags":["Legal Entity Payments"],"x-error-codes":["VALIDATION_FAILED","PAYMENTS_ACCOUNT_NOT_CONNECTED","PAYMENTS_PROVIDER_ERROR","PAYMENTS_NOT_CONFIGURED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["payments:read"]}},"/v1/legal-entities/{id}/payments/onboarding-token":{"post":{"description":"Issues a short-lived Moov access token for the browser-side `<moov-onboarding>` Drop, scoped exclusively to this legal entity's Moov account. Call it once to open the Drop (`scope_set: initial`) and again when the Drop begins writing representatives and ownership (`scope_set: full`). Returns 409 PAYMENTS_ACCOUNT_NOT_CONNECTED when the legal entity has no Moov account yet — connect it first; an account-less token would carry our platform key's authority and is never minted. Hand the token straight to the Drop: do not store it, log it, or send it anywhere other than Moov.","operationId":"LegalEntityPayments.mintOnboardingToken","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MintOnboardingTokenV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MoovOnboardingTokenV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENTS_LEGAL_ENTITY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENTS_ACCOUNT_NOT_CONNECTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"502":{"description":"Possible error codes: PAYMENTS_PROVIDER_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PAYMENTS_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Mint a Moov onboarding token for the embedded Drop","tags":["Legal Entity Payments"],"x-connector-forbidden":true,"x-error-codes":["VALIDATION_FAILED","PAYMENTS_LEGAL_ENTITY_NOT_FOUND","PAYMENTS_ACCOUNT_NOT_CONNECTED","PAYMENTS_PROVIDER_ERROR","PAYMENTS_NOT_CONFIGURED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["payments:write"]}},"/v1/legal-entities/{id}/payments/bank-accounts/{bankAccountId}/link":{"post":{"description":"Exchanges the existing Plaid connection for a Moov processor token and registers the bank as a funding source. Requires a live Plaid connection because funds are pulled from this side, and Moov only permits debits from a verified account. An account that is already linked is re-checked against Moov's live payment-method list: if Moov will not debit it (typically after an ACH return) this refuses with PAYMENTS_FUNDING_ACCOUNT_DISABLED instead of reporting already_linked. Read context.required_action on that error — add_different_bank_account for an errored account, where re-linking cannot work, or reverify for a verificationFailed one, which Moov documents as recoverable and which must NOT be replaced.","operationId":"linkLegalEntityPaymentsBankAccount","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"bankAccountId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/LinkedSourceBankV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENTS_BANK_ACCOUNT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENTS_ACCOUNT_NOT_CONNECTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENTS_BANK_ACCOUNT_NOT_LINKABLE, PAYMENTS_FUNDING_ACCOUNT_DISABLED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"502":{"description":"Possible error codes: PAYMENTS_PROVIDER_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PAYMENTS_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Link a bank account to Spark Payments as a funding source","tags":["Legal Entity Payments"],"x-error-codes":["VALIDATION_FAILED","PAYMENTS_ACCOUNT_NOT_CONNECTED","PAYMENTS_BANK_ACCOUNT_NOT_FOUND","PAYMENTS_BANK_ACCOUNT_NOT_LINKABLE","PAYMENTS_FUNDING_ACCOUNT_DISABLED","PAYMENTS_PROVIDER_ERROR","PAYMENTS_NOT_CONFIGURED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-high-risk":true,"x-high-risk-reason":"Links the bank account that pays vendors.","x-required-scopes":["payments:write"]}},"/v1/legal-entities/{id}/payments/bank-accounts":{"get":{"description":"Every active bank account on the legal entity, with whether a Moov payment method is stored (`linked_for_payments`), whether one could be created (`linkable`), and whether Moov will actually debit it right now (`funding_account_status`). The last is read from Moov's live payment-method list on each call, so an account Moov disabled after an ACH return reports `unusable` rather than linked-and-ready, with the remedy Moov documents for that state in `status_detail`; if Moov cannot be reached it reports `unknown` instead of failing the request. Pages of 100 by default (max 100), sorted by `name` (`sort`: `name`, `-name`) then id; each page makes its own live Moov call. `search` is a case-insensitive substring match on: bank account name, institution name. `ids` (bank account ids, at most 100) returns those accounts of this legal entity, inactive included, ignoring `search` and `linked_for_payments`. `linked_for_payments` (boolean) keeps only accounts with a stored Moov payment method (`true`) or only those without one (`false`); omitted lists all. `id` equals `bank_account_id`.","operationId":"listLegalEntityPaymentsBankAccounts","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"linked_for_payments","required":false,"in":"query","description":"`true` lists only accounts with a stored Moov payment method, `false` only those without one; omit for all. Ignored when `ids` is given.","schema":{"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: name","schema":{"enum":["name","-name"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: bank account name, institution name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FundingAccountV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List bank accounts and their Spark Payments linkage","tags":["Legal Entity Payments"],"x-error-codes":["LEGAL_ENTITY_NOT_IN_SCOPE","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["payments:read"]}},"/v1/legal-entities/{id}/payments/transfers":{"post":{"deprecated":true,"description":"**Deprecated.** Sunset on 2027-03-01T00:00:00Z. Replacement: `POST /v1/payment-runs/:id/send-payments`. Moves money bank-to-bank in a single Moov transfer but writes no document — the payment never reaches the ledger or the bill it paid. Pay a single bill as a run of one via the replacement route instead.","operationId":"sendLegalEntityPayment","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendPaymentV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TransferV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENTS_TRANSFER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PAYMENTS_ACCOUNT_NOT_CONNECTED, PAYMENTS_SOURCE_BANK_NOT_LINKED, PAYMENTS_TRANSFER_PROCESSING, PAYMENTS_TRANSFER_IN_FLIGHT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENTS_SOURCE_BANK_AMBIGUOUS, PAYMENTS_SOURCE_BANK_NOT_ELIGIBLE, PAYMENTS_VENDOR_BANK_MISSING, PAYMENTS_IDEMPOTENCY_KEY_REUSED, DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"502":{"description":"Possible error codes: PAYMENTS_PROVIDER_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PAYMENTS_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Pay a vendor from this legal entity’s linked bank account","tags":["Legal Entity Payments"],"x-error-codes":["VALIDATION_FAILED","PAYMENTS_ACCOUNT_NOT_CONNECTED","PAYMENTS_SOURCE_BANK_NOT_LINKED","PAYMENTS_SOURCE_BANK_AMBIGUOUS","PAYMENTS_SOURCE_BANK_NOT_ELIGIBLE","PAYMENTS_VENDOR_BANK_MISSING","PAYMENTS_IDEMPOTENCY_KEY_REUSED","PAYMENTS_TRANSFER_PROCESSING","PAYMENTS_TRANSFER_IN_FLIGHT","PAYMENTS_TRANSFER_NOT_FOUND","PAYMENTS_PROVIDER_ERROR","PAYMENTS_NOT_CONFIGURED","LEGAL_ENTITY_NOT_IN_SCOPE","DIMENSION_REQUIRED"],"x-high-risk":true,"x-high-risk-reason":"Sends money out of a bank account to a vendor.","x-required-scopes":["payments:write"]}},"/v1/legal-entities/{id}/payments/transfers/{transferId}":{"get":{"operationId":"getLegalEntityPaymentTransfer","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"transferId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TransferV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PAYMENTS_TRANSFER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: DIMENSION_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"502":{"description":"Possible error codes: PAYMENTS_PROVIDER_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Read a payment’s current status","tags":["Legal Entity Payments"],"x-error-codes":["PAYMENTS_TRANSFER_NOT_FOUND","PAYMENTS_PROVIDER_ERROR","LEGAL_ENTITY_NOT_IN_SCOPE","DIMENSION_REQUIRED"],"x-required-scopes":["payments:read"]}},"/v1/parties/{id}/payments":{"get":{"operationId":"getPartyPaymentsStatus","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/VendorPaymentStatusV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Whether this vendor can receive payments, and what is missing","tags":["Party Payments"],"x-error-codes":["VALIDATION_FAILED"],"x-required-scopes":["payments:read"]}},"/v1/parties/{id}/payments/enable":{"post":{"description":"Creates the vendor’s Moov account from the bank details already on file and attaches their bank. The vendor is never contacted and verifies nothing: Moov auto-grants the capability needed to receive, and an unverified bank can still be credited.","operationId":"enablePartyPayments","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/VendorPaymentStatusV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PAYMENTS_VENDOR_BANK_MISSING","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"502":{"description":"Possible error codes: PAYMENTS_PROVIDER_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"503":{"description":"Possible error codes: PAYMENTS_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Enable a vendor to receive payments","tags":["Party Payments"],"x-error-codes":["VALIDATION_FAILED","PAYMENTS_VENDOR_BANK_MISSING","PAYMENTS_PROVIDER_ERROR","PAYMENTS_NOT_CONFIGURED"],"x-required-scopes":["payments:write"]}},"/v1/webhooks/payments/moov":{"post":{"description":"Moov pushes transfer/account/wallet events here. MoovWebhookSignatureGuard verifies the X-Timestamp/X-Nonce/X-Webhook-ID/X-Signature headers against MOOV_WEBHOOK_SECRET. The body is unsigned and never trusted: the handler records identifiers, enqueues a moov_webhook_event job that re-reads the object from the Moov API, and returns 200 for every verified delivery (a 404 would disable the webhook at Moov).","operationId":"Payments.moovWebhook.receive","parameters":[],"responses":{"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"summary":"Inbound Moov webhook (header-HMAC verified)","tags":["Payments Webhooks"],"x-error-codes":["VALIDATION_FAILED"],"x-public":true}},"/v1/sales/categories":{"get":{"description":"The org's sales categories, active and inactive unless `is_active` filters them. `search` matches code or name.","operationId":"SalesCategories.list","parameters":[{"name":"is_active","required":false,"in":"query","description":"Filter by active state. Omit to return both.","schema":{"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: name","schema":{"enum":["name","code"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: name, code.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesCategoryV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List sales categories","tags":["Tenant Sales"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["sales:read"]},"post":{"description":"Adds a category. `code` is upper snake case and unique per org, inactive categories included.","operationId":"SalesCategories.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSalesCategoryV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SalesCategoryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SALES_CATEGORY_CODE_TAKEN, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a sales category","tags":["Tenant Sales"],"x-error-codes":["VALIDATION_FAILED","SALES_CATEGORY_CODE_TAKEN","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["sales:write"]}},"/v1/sales/categories/{id}":{"patch":{"description":"Renames, deactivates or reactivates a category. The code is fixed. Deactivating keeps every config and report that uses it intact; a config cannot newly require an inactive category.","operationId":"SalesCategories.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSalesCategoryV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SalesCategoryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: SALES_CATEGORY_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a sales category","tags":["Tenant Sales"],"x-error-codes":["VALIDATION_FAILED","SALES_CATEGORY_NOT_FOUND"],"x-required-scopes":["sales:write"]}},"/v1/contracts/{id}/sales-config":{"get":{"description":"The reporting obligation: cadence, due days, annual statement terms, measurement basis and the required categories with their allowed deductions. `effective_reporting_start_date` is the stored start, else the lease anchor (rent commencement, else start date). 404 `SALES_CONFIG_NOT_FOUND` when the lease does not report sales.","operationId":"ContractSales.getConfig","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractSalesConfigV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND, SALES_CONFIG_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a lease's sales config","tags":["Tenant Sales"],"x-error-codes":["NOT_FOUND","SALES_CONFIG_NOT_FOUND"],"x-required-scopes":["sales:read"]},"put":{"description":"Full replacement, so PUT: an omitted optional field takes its default (monthly, due 20 days after period end, annual statement required and due 60 days after the measurement year, not certified, calendar year, reminder emails inherit the org switch), and `allowed_deductions` defaults to sales tax and returns. The category list replaces the old one. Every category must be an active category of the org. 422 `SALES_CONFIG_INVALID` when a calendar change (cadence, basis, fiscal month, reporting start, annual statement) would take a submitted report off the reporting calendar; `errors[]` names each period. 422 `SALES_CONFIG_NOT_A_LEASE` when the contract is not a lease: only a lease reports sales.","operationId":"ContractSales.putConfig","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutContractSalesConfigV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractSalesConfigV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SALES_CONFIG_INVALID, SALES_CONFIG_NOT_A_LEASE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create or replace a lease's sales config","tags":["Tenant Sales"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","SALES_CONFIG_INVALID","SALES_CONFIG_NOT_A_LEASE"],"x-required-scopes":["sales:write"]}},"/v1/contracts/{id}/sales-category-mappings":{"get":{"description":"The tenant's own sales labels mapped to the org's categories, each over a half-open `[effective_from, effective_to)` range. Used by CSV import.","operationId":"ContractSales.listCategoryMappings","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesCategoryMappingV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a lease's sales category mappings","tags":["Tenant Sales"],"x-error-codes":["NOT_FOUND"],"x-pagination":{"mode":"none","reason":"One lease's tenant POS labels, written by hand or by a CSV import review.","bound":"tens of rows per contract"},"x-required-scopes":["sales:read"]},"put":{"description":"Full replacement; `[]` clears them. `effective_to` is exclusive and null for open-ended. One source label may not map twice on the same day.","operationId":"ContractSales.putCategoryMappings","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutSalesCategoryMappingsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesCategoryMappingV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SALES_CONFIG_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace a lease's sales category mappings","tags":["Tenant Sales"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","SALES_CONFIG_INVALID"],"x-required-scopes":["sales:write"]}},"/v1/contracts/{id}/sales/summary":{"get":{"description":"Reported sales by period and category (current submitted versions, last 24 months, newest first) with year-over-year change, plus the trailing 12 whole months: total sales, sales per square foot, the pre-tax subtotal of posted contract invoices minus contract credit memos (rent and the charges on the rent invoice; year-end recovery reconciliations excluded), and occupancy cost % (billed ÷ sales). Ratios are exact, 2 decimals, rounded half-up. 404 `SALES_CONFIG_NOT_FOUND` when the lease does not report sales.","operationId":"ContractSales.getSummary","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SalesSummaryV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, SALES_CONFIG_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a lease's tenant sales summary","tags":["Tenant Sales"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","SALES_CONFIG_NOT_FOUND"],"x-required-scopes":["sales:read"]}},"/v1/sales/reports":{"get":{"description":"Every version of every report, newest period first by default. `from_date`/`to_date` filter on `period_end`. Lines are not included; read one report for its lines and qualifying sales.","operationId":"SalesReports.list","parameters":[{"name":"contract_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["draft","submitted","superseded","verified"]}},{"name":"from_date","required":false,"in":"query","description":"Only reports whose period ends on or after this date.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Only reports whose period ends on or before this date.","schema":{"format":"date","type":"string"}},{"name":"is_annual_statement","required":false,"in":"query","description":"Annual statements only (true) or periods only (false).","schema":{"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -period_start","schema":{"enum":["-period_start","period_start"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: notes.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesReportListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List sales reports","tags":["Tenant Sales"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["sales:read"]},"post":{"description":"A manual version-1 draft for one period on the lease's reporting calendar (or one measurement year with `is_annual_statement`). Lines may be partial. Refused for an off-calendar period, a period that already has a real submitted version (restate it instead) or a draft. A period holding only an estimate is not refused: the draft is version 2 and submitting it replaces the estimate.","operationId":"SalesReports.create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSalesReportV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SalesReportV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, SALES_CONFIG_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SALES_REPORT_PERIOD_ALREADY_REPORTED, SALES_REPORT_DRAFT_EXISTS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SALES_REPORT_OFF_CALENDAR, SALES_REPORT_LINES_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a draft sales report","tags":["Tenant Sales"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","SALES_CONFIG_NOT_FOUND","SALES_REPORT_OFF_CALENDAR","SALES_REPORT_LINES_INVALID","SALES_REPORT_PERIOD_ALREADY_REPORTED","SALES_REPORT_DRAFT_EXISTS"],"x-required-scopes":["sales:write"]}},"/v1/sales/reports/bulk":{"post":{"description":"One submitted report per contract (1-500, each contract once) for one regular period — the bulk entry grid. All or nothing: every row is validated first, and any failure answers 422 `SALES_REPORT_BULK_INVALID` naming each failing row in `context.errors` and writes nothing. Each period must have no real submitted version and no draft. A period holding an estimate is replaced: the estimate is superseded by the submitted report.","operationId":"SalesReports.bulkSubmit","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkSalesReportsV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesReportV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SALES_REPORT_BULK_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create and submit sales reports in bulk","tags":["Tenant Sales"],"x-error-codes":["VALIDATION_FAILED","SALES_REPORT_BULK_INVALID"],"x-required-scopes":["sales:write"]}},"/v1/sales/reports/{id}":{"get":{"description":"One report version with its lines. `qualifying_amount` per line and `qualifying_total` use the lease's current allowed deductions.","operationId":"SalesReports.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SalesReportV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: SALES_REPORT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a sales report","tags":["Tenant Sales"],"x-error-codes":["VALIDATION_FAILED","SALES_REPORT_NOT_FOUND"],"x-required-scopes":["sales:read"]},"patch":{"description":"Draft only. `lines`, when sent, replaces every line. A submitted report answers 409 `SALES_REPORT_NOT_DRAFT`: restate it instead.","operationId":"SalesReports.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSalesReportV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SalesReportV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: SALES_REPORT_NOT_FOUND, SALES_CONFIG_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SALES_REPORT_NOT_DRAFT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SALES_REPORT_LINES_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a draft sales report","tags":["Tenant Sales"],"x-error-codes":["VALIDATION_FAILED","SALES_REPORT_NOT_FOUND","SALES_CONFIG_NOT_FOUND","SALES_REPORT_NOT_DRAFT","SALES_REPORT_LINES_INVALID"],"x-required-scopes":["sales:write"]}},"/v1/sales/reports/{id}/submit":{"post":{"description":"Draft only; every category the config requires must have a line. The period's submitted version, if any, becomes `superseded` with `superseded_by_id` set to this report, in the same transaction.","operationId":"SalesReports.submit","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SalesReportV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: SALES_REPORT_NOT_FOUND, SALES_CONFIG_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SALES_REPORT_NOT_DRAFT, SALES_REPORT_PERIOD_ALREADY_REPORTED, SALES_REPORT_DRAFT_EXISTS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SALES_REPORT_LINES_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Submit a draft sales report","tags":["Tenant Sales"],"x-error-codes":["VALIDATION_FAILED","SALES_REPORT_NOT_FOUND","SALES_CONFIG_NOT_FOUND","SALES_REPORT_NOT_DRAFT","SALES_REPORT_LINES_INVALID","SALES_REPORT_PERIOD_ALREADY_REPORTED","SALES_REPORT_DRAFT_EXISTS"],"x-required-scopes":["sales:write"]}},"/v1/sales/reports/{id}/restate":{"post":{"description":"`:id` must be the period's current submitted version. Creates a draft `version + 1` with its lines copied; submitting that draft supersedes `:id`. Refused while the period already has a draft.","operationId":"SalesReports.restate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SalesReportV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: SALES_REPORT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SALES_REPORT_NOT_CURRENT, SALES_REPORT_DRAFT_EXISTS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Restate a submitted sales report","tags":["Tenant Sales"],"x-error-codes":["VALIDATION_FAILED","SALES_REPORT_NOT_FOUND","SALES_REPORT_NOT_CURRENT","SALES_REPORT_DRAFT_EXISTS"],"x-required-scopes":["sales:write"]}},"/v1/sales/imports":{"post":{"description":"Parses the CSV and stages its rows for review; nothing is reported until commit. Columns: `contract_ref` (contract id or external ref), `period_start`, `period_end` (YYYY-MM-DD or M/D/YYYY), `category` (a category code or name, or a label mapped on the lease's `/sales-category-mappings`), `gross`, and optional deduction columns named by deduction type. Header names are case-insensitive; other columns are ignored. At most 2 MiB and 5,000 rows. The same file cannot be uploaded twice while its import is open or committed.","operationId":"SalesImports.upload","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"The CSV."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SalesImportDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, EMPTY_FILE, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SALES_IMPORT_DUPLICATE_FILE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: SALES_IMPORT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: SALES_IMPORT_NOT_CSV","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SALES_IMPORT_FILE_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a tenant sales CSV","tags":["Tenant Sales"],"x-error-codes":["VALIDATION_FAILED","EMPTY_FILE","SALES_IMPORT_NOT_CSV","SALES_IMPORT_TOO_LARGE","SALES_IMPORT_FILE_INVALID","SALES_IMPORT_DUPLICATE_FILE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["sales:write"]},"get":{"description":"Newest first by default, each with its outcome counts as of now. `search` matches the file name.","operationId":"SalesImports.list","parameters":[{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["open","committed","discarded"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: file_name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesImportListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List tenant sales CSV imports","tags":["Tenant Sales"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["sales:read"]}},"/v1/sales/imports/{id}":{"get":{"description":"The import, its rows, and one group per (contract, period) saying what committing would do: `ready` (a new report), `restatement` (a new version of a submitted report), `blocked` (with the reason), or `committed`. Evaluated live: a mapping added since upload applies.","operationId":"SalesImports.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SalesImportDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: SALES_IMPORT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Review a tenant sales CSV import","tags":["Tenant Sales"],"x-error-codes":["SALES_IMPORT_NOT_FOUND"],"x-required-scopes":["sales:read"]}},"/v1/sales/imports/{id}/commit":{"post":{"description":"Re-evaluates the import and submits one `csv` report per group that is ready (a restatement supersedes the period's submitted version). Blocked groups stay pending: fix them (map a label, fix the lease) and commit again. The import becomes `committed` once nothing is pending. Nothing ready is not an error: the review comes back as is.","operationId":"SalesImports.commit","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SalesImportDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: SALES_IMPORT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SALES_IMPORT_NOT_OPEN, SALES_IMPORT_CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Commit a tenant sales CSV import","tags":["Tenant Sales"],"x-error-codes":["SALES_IMPORT_NOT_FOUND","SALES_IMPORT_NOT_OPEN","SALES_IMPORT_CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["sales:write"]}},"/v1/sales/imports/{id}/discard":{"post":{"description":"Skips every pending row and closes the import. Reports already committed from it stay. Refused unless the import is open.","operationId":"SalesImports.discard","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SalesImportDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: SALES_IMPORT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: SALES_IMPORT_NOT_OPEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Discard a tenant sales CSV import","tags":["Tenant Sales"],"x-error-codes":["SALES_IMPORT_NOT_FOUND","SALES_IMPORT_NOT_OPEN"],"x-required-scopes":["sales:write"]}},"/v1/sales/tracker":{"get":{"description":"A tenant × period grid: one row per lease with a sales config, one cell per expected report (period or annual statement) overlapping `[from_date, to_date]`, with its due date, derived status, days late and the current version's qualifying total. Statuses are judged on the org's local today. Rows are sorted by property name, then tenant name. Not paged: one envelope for the whole grid; the window is at most 36 months (400 `VALIDATION_FAILED` beyond that, or when `from_date` is after `to_date`).","operationId":"SalesTracker.get","parameters":[{"name":"property_id","required":false,"in":"query","description":"Only leases with a location on this property.","schema":{"format":"uuid","type":"string"}},{"name":"from_date","required":false,"in":"query","description":"Window start. Defaults to the first day of the month 11 months before `to_date`, so the default window is 12 calendar months.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Window end. Defaults to the org's today (its time zone). The window is at most 36 months.","schema":{"format":"date","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SalesTrackerV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get the sales reporting tracker","tags":["Tenant Sales"],"x-error-codes":["VALIDATION_FAILED"],"x-required-scopes":["sales:read"]}},"/v1/contracts/{id}/sales/reminders":{"get":{"description":"Every reminder email sent (or attempted) for the lease, newest first: its report period, kind, sequence, status, the addresses it went to, attempts and the last error. `search` matches the last error.","operationId":"ContractSales.listReminders","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: error.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesReminderSendV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a lease's sales report reminders","tags":["Tenant Sales"],"x-error-codes":["NOT_FOUND","INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["sales:read"]}},"/v1/sales/reminders/send":{"post":{"description":"Emails the tenant's contacts that receive notices a reminder for one expected report on the lease's calendar, whether or not automatic reminders are on (kind `manual`, the next free sequence). Returns the send row, `failed` when the email provider refused it. 422 `SALES_REMINDER_NOT_OWED` for a period off the calendar, not yet ended, or already received (a period covered only by an estimate is still owed); 422 `SALES_REMINDER_NO_RECIPIENT` when the tenant has no active contact that receives notices.","operationId":"SalesReminders.send","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendSalesReminderV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SalesReminderSendV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, SALES_CONFIG_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SALES_REMINDER_NOT_OWED, SALES_REMINDER_NO_RECIPIENT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Send a sales report reminder now","tags":["Tenant Sales"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","SALES_CONFIG_NOT_FOUND","SALES_REMINDER_NOT_OWED","SALES_REMINDER_NO_RECIPIENT"],"x-required-scopes":["sales:write"]}},"/v1/contracts/{id}/percentage-rent":{"get":{"description":"`live` is the version in force on the org's today, null when none is (no config yet, or the first version starts later). `versions` is every version, newest start first; a same-day re-save appears before the version it replaced, which carries `superseded_at`.","operationId":"ContractPercentageRent.getConfig","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractPercentageRentV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a lease's percentage rent config","tags":["Contracts"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["percentage-rent:read"]},"put":{"description":"Every save is a new version; rules are replaced as a whole and an omitted optional field takes its default. `effective_from` equal to the live version's start replaces that version (it is stamped `superseded_at`); a later date ends it the day before; an earlier date is 422 `PERCENTAGE_RENT_CONFIG_BACKDATED`. The lease needs a sales config (422 `PERCENTAGE_RENT_SALES_CONFIG_REQUIRED`), every rule category must be one of the sales config's, and cross-field rules are 422 `PERCENTAGE_RENT_CONFIG_INVALID` with `context.violations[]`. `item_id` must be an active income item.","operationId":"ContractPercentageRent.putConfig","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutPercentageRentConfigV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PercentageRentConfigV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PERCENTAGE_RENT_CONFIG_INVALID, PERCENTAGE_RENT_SALES_CONFIG_REQUIRED, PERCENTAGE_RENT_CONFIG_BACKDATED, PERCENTAGE_RENT_ITEM_INVALID, PERCENTAGE_RENT_TAX_RATE_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Save a new version of a lease's percentage rent config","tags":["Contracts"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","PERCENTAGE_RENT_CONFIG_INVALID","PERCENTAGE_RENT_SALES_CONFIG_REQUIRED","PERCENTAGE_RENT_CONFIG_BACKDATED","PERCENTAGE_RENT_ITEM_INVALID","PERCENTAGE_RENT_TAX_RATE_INVALID"],"x-plannable":true,"x-required-scopes":["percentage-rent:write"]}},"/v1/contracts/{id}/percentage-rent/automation":{"get":{"description":"`override` is the lease's own setting per field (null = inherits the org's), or null when it inherits everything; `effective` is the policy its charges follow. Not versioned: it applies to the lease's lines of any period.","operationId":"ContractPercentageRentAutomation.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractPercentageRentAutomationV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a lease's percentage rent automation override","tags":["Contracts"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["percentage-rent:read"]},"put":{"description":"The whole override: an omitted or null field inherits the org setting, and an all-null body removes the override. Lines already held stay held until a person approves them.","operationId":"ContractPercentageRentAutomation.put","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutContractPercentageRentAutomationV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractPercentageRentAutomationV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace a lease's percentage rent automation override","tags":["Contracts"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND"],"x-required-scopes":["percentage-rent:write"]}},"/v1/percentage-rent/preview":{"get":{"description":"Runs the percentage rent engine on the lease as of `as_of` (default: the org's today), using the config version live that day and the measurement year containing it. `result` compares the qualifying sales reported so far with the FULL year's breakpoints, so it is what the year would bill if it ended on `as_of`; nothing is billed. `projected_year_end_sales` adds the mean of the last three received months for each month not yet received, and `projected_overage` is the rent that projection would bill. 404 `PERCENTAGE_RENT_CONFIG_NOT_FOUND` when no config is live on `as_of`; 404 `NOT_FOUND` when the contract is not found or `as_of` falls outside its measurement years; 422 `PERCENTAGE_RENT_SALES_CONFIG_REQUIRED` when the lease has no sales config.","operationId":"PercentageRent.preview","parameters":[{"name":"contract_id","required":true,"in":"query","description":"The lease to preview.","schema":{"format":"uuid","type":"string"}},{"name":"as_of","required":false,"in":"query","description":"The day to preview as of; defaults to the org's today. Picks the live config version and the measurement year containing it.","schema":{"format":"date","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PercentageRentPreviewV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, PERCENTAGE_RENT_CONFIG_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PERCENTAGE_RENT_SALES_CONFIG_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview a lease's percentage rent for the year to date","tags":["Percentage Rent"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","PERCENTAGE_RENT_CONFIG_NOT_FOUND","PERCENTAGE_RENT_SALES_CONFIG_REQUIRED"],"x-required-scopes":["percentage-rent:read"]}},"/v1/percentage-rent/runs":{"get":{"description":"Newest window first by default. Lines are not included; read one run for its lines, adjustments and charges.","operationId":"PercentageRentRuns.list","parameters":[{"name":"property_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["draft","computed","approved"]}},{"name":"kind","required":false,"in":"query","schema":{"type":"string","enum":["annual","interim","audit","termination"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -window_end","schema":{"enum":["-window_end","window_end"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: notes.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PercentageRentRunV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List percentage rent runs","tags":["Percentage Rent"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["percentage-rent:read"]},"post":{"description":"Selects every lease on the property whose measurement year (`annual`) or interim reporting period (`interim`, leases billed `cumulative` or `periodic`) closed inside the window and before the org's today, with a live percentage rent config, not terminated, and with no line for that period in any run; computes one line each. A line is `pending` (clean), `held` (`hold_reasons`: a person approves it) or `blocked` (`block_reasons`: it cannot be approved). Nothing is staged until approval. The run bills under the property's legal entity (400 `VALIDATION_FAILED` when it has none). An `audit` run selects instead every year ending in the window whose annual (or termination) line is approved, one audit line per year (a year already audited is skipped; 409 `PERCENTAGE_RENT_AUDIT_EXISTS` when every qualifying year already has one), and needs `notes`, the finding (422 `PERCENTAGE_RENT_AUDIT_INVALID`, also when no year qualifies).","operationId":"PercentageRentRuns.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePercentageRentRunV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PercentageRentRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, PERCENTAGE_RENT_AUDIT_EXISTS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PERCENTAGE_RENT_AUDIT_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create and compute a percentage rent run","tags":["Percentage Rent"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","CONFLICT","PERCENTAGE_RENT_AUDIT_INVALID","PERCENTAGE_RENT_AUDIT_EXISTS"],"x-required-scopes":["percentage-rent:write"]}},"/v1/percentage-rent/runs/{id}":{"get":{"description":"The run with every line: its computation, hold and block reasons, adjustments, `charge_amount` (delta + adjustments) and the charge on the shelf (staged, or billed once `billed_document_id` is set).","operationId":"PercentageRentRuns.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PercentageRentRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PERCENTAGE_RENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a percentage rent run","tags":["Percentage Rent"],"x-error-codes":["VALIDATION_FAILED","PERCENTAGE_RENT_RUN_NOT_FOUND"],"x-required-scopes":["percentage-rent:read"]},"delete":{"description":"Deletes a run with no approved line and no charge on the shelf (revise one first). 409 `PERCENTAGE_RENT_RUN_NOT_DELETABLE` otherwise.","operationId":"PercentageRentRuns.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PERCENTAGE_RENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PERCENTAGE_RENT_RUN_NOT_DELETABLE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a percentage rent run","tags":["Percentage Rent"],"x-error-codes":["VALIDATION_FAILED","PERCENTAGE_RENT_RUN_NOT_FOUND","PERCENTAGE_RENT_RUN_NOT_DELETABLE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["percentage-rent:write"]}},"/v1/percentage-rent/runs/{id}/recompute":{"post":{"description":"Re-runs every line on current sales, config and charges, keeping line ids. An approved line whose charge is staged but not billed is re-staged at the new amount when it still reviews clean, else it drops back for approval. A line whose charge is billed is never rewritten: when its inputs changed it is marked with the named `stale_reason` (e.g. `sales_restated`), else when its numbers moved `recomputed_after_billing`. Nor is an approved line under a later approved line of the same year in another run: it keeps its charge and is marked the same way, `later_line_approved` when no input changed. `stale_at` moves only when the reason changes.","operationId":"PercentageRentRuns.recompute","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PercentageRentRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PERCENTAGE_RENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Recompute a percentage rent run","tags":["Percentage Rent"],"x-error-codes":["VALIDATION_FAILED","PERCENTAGE_RENT_RUN_NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["percentage-rent:write"]}},"/v1/percentage-rent/runs/{id}/staleness-check":{"post":{"description":"Checks every approved line of the run (billed or not) against its current inputs, as the daily job does, and returns the run. A line whose inputs changed is marked with the named `stale_reason` (`terminated`, `config_changed`, `actuals_replaced_estimate`, `sales_restated`, `base_rent_changed`, `inputs_changed`); one marked earlier is cleared once its inputs match again. Nothing is recomputed or re-staged. A billed annual or termination line whose year has an approved audit line is not checked and its stale mark, whatever the reason, is cleared: the audit is its correction. Audit lines are never checked. Each line is checked on its own; one that cannot be checked is skipped and logged.","operationId":"PercentageRentRuns.checkStaleness","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PercentageRentRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PERCENTAGE_RENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Check a percentage rent run for stale lines","tags":["Percentage Rent"],"x-error-codes":["VALIDATION_FAILED","PERCENTAGE_RENT_RUN_NOT_FOUND"],"x-required-scopes":["percentage-rent:write"]}},"/v1/percentage-rent/runs/{id}/lines/{lineId}/adjustments":{"post":{"description":"Adds a signed amount to the line and recomputes it. A `manual` amount (the default) adds into the line's rent charge; on an audit line, `interest` and `audit_costs` stage as their own charges (422 `PERCENTAGE_RENT_ADJUSTMENT_KIND_INVALID` on any other line or for an amount that is not positive, 409 `PERCENTAGE_RENT_ADJUSTMENT_EXISTS` for a second one; 422 `PERCENTAGE_RENT_AUDIT_COSTS_NOT_RECOVERABLE` when the lease does not recover audit costs or the understatement is under its threshold). The line is held (`manual_adjustment`) until a person approves it; an approved line's staged charges are taken off the shelf. 409 `PERCENTAGE_RENT_RUN_BILLED` once a charge is billed or settled; 409 `PERCENTAGE_RENT_LATER_LINE_APPROVED` while a later line of the same lease year, in another run, is approved.","operationId":"PercentageRentRuns.addAdjustment","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"lineId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePercentageRentAdjustmentV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PercentageRentRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, PERCENTAGE_RENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PERCENTAGE_RENT_RUN_BILLED, PERCENTAGE_RENT_LATER_LINE_APPROVED, PERCENTAGE_RENT_ADJUSTMENT_EXISTS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PERCENTAGE_RENT_ADJUSTMENT_KIND_INVALID, PERCENTAGE_RENT_AUDIT_COSTS_NOT_RECOVERABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Add an adjustment to a percentage rent line","tags":["Percentage Rent"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","PERCENTAGE_RENT_RUN_NOT_FOUND","PERCENTAGE_RENT_RUN_BILLED","PERCENTAGE_RENT_LATER_LINE_APPROVED","PERCENTAGE_RENT_ADJUSTMENT_KIND_INVALID","PERCENTAGE_RENT_ADJUSTMENT_EXISTS","PERCENTAGE_RENT_AUDIT_COSTS_NOT_RECOVERABLE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["percentage-rent:write"]}},"/v1/percentage-rent/runs/{id}/adjustments/{adjustmentId}":{"delete":{"description":"Removes the adjustment and recomputes its line, under the same rules as adding one.","operationId":"PercentageRentRuns.deleteAdjustment","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"adjustmentId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, PERCENTAGE_RENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PERCENTAGE_RENT_RUN_BILLED, PERCENTAGE_RENT_LATER_LINE_APPROVED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a percentage rent line adjustment","tags":["Percentage Rent"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","PERCENTAGE_RENT_RUN_NOT_FOUND","PERCENTAGE_RENT_RUN_BILLED","PERCENTAGE_RENT_LATER_LINE_APPROVED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["percentage-rent:write"]}},"/v1/percentage-rent/runs/{id}/approve":{"post":{"description":"Recomputes the run, then approves every `pending` and `held` line (or only `line_ids`), staging each line's `charge_amount` on the shelf (a zero charge stages nothing and still approves). A lease billing `separate` (its % rent config `invoice_mode`, `inherit` taking the org default; termination and audit lines always) gets ONE posted document for every line of it this call approved, dated org-today or the first open date (`documents_created`); every other charge waits for the lease's next rent invoice. 409 `PERCENTAGE_RENT_NO_OPEN_PERIOD` (nothing approved) when the legal entity has no open period. Already-approved lines are skipped, so a repeat is a no-op. A `blocked` line never approves: naming one is 422 `PERCENTAGE_RENT_LINE_NOT_APPROVABLE` (409 `PERCENTAGE_RENT_LATER_LINE_APPROVED` when it is blocked `later_line_approved`: a later line of the same year in another run is approved); the run-level call skips it.","operationId":"PercentageRentRuns.approve","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovePercentageRentRunV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PercentageRentRunApprovalV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND, PERCENTAGE_RENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PERCENTAGE_RENT_LATER_LINE_APPROVED, PERCENTAGE_RENT_RUN_BILLED, PERCENTAGE_RENT_NO_OPEN_PERIOD, CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PERCENTAGE_RENT_LINE_NOT_APPROVABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Approve percentage rent lines","tags":["Percentage Rent"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","PERCENTAGE_RENT_RUN_NOT_FOUND","PERCENTAGE_RENT_LINE_NOT_APPROVABLE","PERCENTAGE_RENT_LATER_LINE_APPROVED","PERCENTAGE_RENT_RUN_BILLED","PERCENTAGE_RENT_NO_OPEN_PERIOD","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-high-risk":true,"x-high-risk-reason":"Approves percentage rent that bills tenants.","x-required-scopes":["percentage-rent:write"]}},"/v1/percentage-rent/runs/{id}/invoice":{"post":{"description":"Bills every approved line of the run whose charges are still on the shelf (unbilled and unsettled), whatever the lease invoice mode, on one posted document per lease: an invoice, or a credit memo when the charges net negative (net zero settles them with no document). Use it to re-bill after a separate % rent invoice is voided, or to bill a `next_rent_invoice` lease early; a charge the next rent invoice already took is not billed twice. 409 `PERCENTAGE_RENT_NOTHING_TO_INVOICE` when no approved line has an unbilled charge, 409 `PERCENTAGE_RENT_NO_OPEN_PERIOD` when the legal entity has no open period.","operationId":"PercentageRentRuns.invoice","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PercentageRentRunInvoiceV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PERCENTAGE_RENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PERCENTAGE_RENT_NOTHING_TO_INVOICE, PERCENTAGE_RENT_NO_OPEN_PERIOD, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Invoice the approved percentage rent lines now","tags":["Percentage Rent"],"x-error-codes":["VALIDATION_FAILED","PERCENTAGE_RENT_RUN_NOT_FOUND","PERCENTAGE_RENT_NOTHING_TO_INVOICE","PERCENTAGE_RENT_NO_OPEN_PERIOD","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["percentage-rent:write"]}},"/v1/percentage-rent/runs/{id}/revise":{"post":{"description":"Takes every staged charge of the run off the shelf, adds 1 to `revision` and recomputes with every approval dropped. Refused with 409 `PERCENTAGE_RENT_RUN_BILLED` once any charge is billed or settled: correct a billed year with a later run instead. 409 `PERCENTAGE_RENT_LATER_LINE_APPROVED` while a later line of the same lease year, in another run, is approved: revise that run first.","operationId":"PercentageRentRuns.revise","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PercentageRentRunDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PERCENTAGE_RENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PERCENTAGE_RENT_RUN_BILLED, PERCENTAGE_RENT_LATER_LINE_APPROVED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Revise a percentage rent run","tags":["Percentage Rent"],"x-error-codes":["VALIDATION_FAILED","PERCENTAGE_RENT_RUN_NOT_FOUND","PERCENTAGE_RENT_RUN_BILLED","PERCENTAGE_RENT_LATER_LINE_APPROVED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["percentage-rent:write"]}},"/v1/percentage-rent/runs/{id}/estimates":{"post":{"description":"For every reporting period (the lease expected report: a month, quarter or year by cadence) covering a month a `missing_sales` line expects and has no report for, writes a submitted `estimate` sales report at that period: the config's `late_estimate_basis_pct` of the same month last year per month, else the trailing average of the months on file, summed over the period. A period with no history is returned in `impossible` and stays missing; one with an open draft is in `skipped_draft`; one already reported is never overwritten. The real report later becomes the next version of that period (restate the estimate, then submit). Then recomputes the run: the line is held (`estimated_sales`) for a person to approve. 422 `PERCENTAGE_RENT_ESTIMATE_NOT_ALLOWED` for an API key, or when a line's config has `late_estimate_enabled` off.","operationId":"PercentageRentRuns.estimates","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PercentageRentRunEstimatesV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PERCENTAGE_RENT_RUN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PERCENTAGE_RENT_ESTIMATE_NOT_ALLOWED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Write late-report sales estimates for a run","tags":["Percentage Rent"],"x-error-codes":["VALIDATION_FAILED","PERCENTAGE_RENT_RUN_NOT_FOUND","PERCENTAGE_RENT_ESTIMATE_NOT_ALLOWED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["percentage-rent:write"]}},"/v1/percentage-rent/settings":{"get":{"description":"The policy the daily % rent job follows: when a computed charge goes out on its own, and which review holds apply. An org that never saved one reads the defaults (`always`, every hold on, swing 50%). A lease may override any field (`/v1/contracts/{id}/percentage-rent/automation`).","operationId":"PercentageRentSettings.get","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PercentageRentSettingsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Get the org's percentage rent automation settings","tags":["Percentage Rent"],"x-required-scopes":["percentage-rent:read"]},"put":{"description":"The whole policy. Applies to lines reviewed from now on; a line already held stays held until a person approves it, and a pending line picks a stricter setting up on the job's next pass. Manual adjustments and audit findings always hold. 400 `VALIDATION_FAILED` for `up_to_limit` without `auto_send_limit`, a negative limit, or `swing_pct` outside 1-1000.","operationId":"PercentageRentSettings.put","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutPercentageRentSettingsV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PercentageRentSettingsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace the org's percentage rent automation settings","tags":["Percentage Rent"],"x-error-codes":["VALIDATION_FAILED"],"x-high-risk":true,"x-high-risk-reason":"Changes the org's percentage rent automation.","x-required-scopes":["percentage-rent:write"]}},"/v1/percentage-rent/lines":{"get":{"description":"Lines of open (`computed`) runs that are `held` (waiting for approval: approve them with `POST /v1/percentage-rent/runs/{run_id}/approve` and `line_ids`) or `blocked` (waiting on missing sales, an unmapped category, an earlier window...). A line blocked only by a reason that never lifts (`annual_line_exists`, `after_termination`) is left out. Oldest period first. `search` matches the tenant name.","operationId":"PercentageRent.listQueue","parameters":[{"name":"status","required":false,"in":"query","description":"Comma-separated: `held` (waits for approval), `blocked` (waits on something else, e.g. missing sales). Default: both.","schema":{"example":"held,blocked","type":"string"}},{"name":"property_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: period_end","schema":{"enum":["period_end"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: tenant_name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PercentageRentQueueLineV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List percentage rent lines that need a person","tags":["Percentage Rent"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["percentage-rent:read"]}},"/v1/percentage-rent/tenants":{"get":{"description":"One row per lease with a sales config (leases with no % rent config read `sales_only`), ordered by property then tenant: the last actual report, the report owed next, progress toward the breakpoint this measurement year, the charge that bills next and when. `search` matches the tenant name.","operationId":"PercentageRent.listTenants","parameters":[{"name":"property_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: property","schema":{"enum":["property"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: tenant_name.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PercentageRentTenantV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List reporting tenants with their next percentage rent bill","tags":["Percentage Rent"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["percentage-rent:read","sales:read"]}},"/v1/percentage-rent/overview":{"get":{"description":"What needs a person (held lines and their charges), how many sales reports are late, what is approved and waiting to bill, and what was billed this fiscal year, plus the org's send mode. `property_id` narrows every figure to one property.","operationId":"PercentageRent.overview","parameters":[{"name":"property_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PercentageRentOverviewV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get the percentage rent header tiles","tags":["Percentage Rent"],"x-error-codes":["VALIDATION_FAILED"],"x-required-scopes":["percentage-rent:read","sales:read"]}},"/v1/tickets":{"get":{"operationId":"Tickets.list","parameters":[{"name":"status_code","required":false,"in":"query","schema":{"maxLength":64,"type":"string"}},{"name":"priority_code","required":false,"in":"query","schema":{"maxLength":64,"type":"string"}},{"name":"ticket_type_code","required":false,"in":"query","schema":{"maxLength":64,"type":"string"}},{"name":"property_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"tenant_party_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"search","required":false,"in":"query","description":"Free-text search over ticket_number and subject.","schema":{"type":"string"}},{"name":"follow_up_before","required":false,"in":"query","description":"Only tickets whose follow_up_date is on or before this date.","schema":{"type":"string"}},{"name":"unassigned","required":false,"in":"query","description":"Only tickets with no owner_coordinator assignment.","schema":{"type":"boolean"}},{"name":"due_before","required":false,"in":"query","description":"Only tickets whose anticipated_completion_date is on or before this date.","schema":{"type":"string"}},{"name":"due_after","required":false,"in":"query","description":"Only tickets whose anticipated_completion_date is on or after this date.","schema":{"type":"string"}},{"name":"active","required":false,"in":"query","description":"Only tickets in an active status (open, in_progress, on_hold) — the same set counted by the metrics endpoint.","schema":{"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -date_received","schema":{"enum":["-date_received","date_received","-created_at","created_at","ticket_number","-ticket_number"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TicketListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List tickets","tags":["Tickets"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["tickets:read"]},"post":{"operationId":"Tickets.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTicketV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TicketV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: INVALID_ASSIGNEE, TICKET_OWNER_PARTICIPATION_INVALID, TICKET_REFERENCE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create ticket","tags":["Tickets"],"x-error-codes":["VALIDATION_FAILED","INVALID_ASSIGNEE","TICKET_OWNER_PARTICIPATION_INVALID","TICKET_REFERENCE_NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["tickets:write"]}},"/v1/tickets/metrics":{"get":{"operationId":"Tickets.metrics","parameters":[{"name":"legal_entity_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TicketMetricsV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Ticket summary metrics","tags":["Tickets"],"x-error-codes":["LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["tickets:read"]}},"/v1/tickets/{id}":{"get":{"operationId":"Tickets.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TicketV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: TICKET_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get ticket by id","tags":["Tickets"],"x-error-codes":["TICKET_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["tickets:read"]},"patch":{"operationId":"Tickets.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTicketV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TicketV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: TICKET_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: TICKET_OWNER_PARTICIPATION_INVALID, TICKET_REFERENCE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update ticket","tags":["Tickets"],"x-error-codes":["TICKET_NOT_FOUND","VALIDATION_FAILED","TICKET_OWNER_PARTICIPATION_INVALID","TICKET_REFERENCE_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["tickets:write"]},"delete":{"operationId":"Tickets.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: TICKET_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete ticket","tags":["Tickets"],"x-error-codes":["TICKET_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["tickets:write"]}},"/v1/tickets/{id}/close":{"post":{"operationId":"Tickets.close","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TicketV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: TICKET_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Close a ticket","tags":["Tickets"],"x-error-codes":["TICKET_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["tickets:write"]}},"/v1/tickets/{id}/reopen":{"post":{"operationId":"Tickets.reopen","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TicketV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: TICKET_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Reopen a ticket","tags":["Tickets"],"x-error-codes":["TICKET_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["tickets:write"]}},"/v1/tracks":{"get":{"operationId":"Tracks.list","parameters":[{"name":"ticket_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"status_code","required":false,"in":"query","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["-created_at","created_at","track_number","-track_number"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TrackListItemV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List tracks","tags":["Tracks"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["tickets:read"]},"post":{"operationId":"Tracks.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTrackV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TrackV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: TICKET_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create track","tags":["Tracks"],"x-error-codes":["TICKET_NOT_FOUND","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["tickets:write"]}},"/v1/tracks/{id}":{"get":{"operationId":"Tracks.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TrackV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: TRACK_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get track by id","tags":["Tracks"],"x-error-codes":["TRACK_NOT_FOUND","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["tickets:read"]},"patch":{"operationId":"Tracks.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTrackV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TrackV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: TRACK_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update track","tags":["Tracks"],"x-error-codes":["TRACK_NOT_FOUND","VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["tickets:write"]}},"/v1/ticket-assignments":{"get":{"operationId":"TicketAssignments.list","parameters":[{"name":"scope","required":true,"in":"query","schema":{"type":"string","enum":["ticket","track"]}},{"name":"scope_id","required":true,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"role","required":false,"in":"query","schema":{"type":"string","enum":["owner_coordinator","performer"]}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TicketAssignmentV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SCOPE_TARGET_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List assignments for a ticket or track","tags":["Ticket Assignments"],"x-error-codes":["SCOPE_TARGET_MISMATCH","VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["tickets:read"]},"post":{"operationId":"TicketAssignments.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTicketAssignmentV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TicketAssignmentV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SCOPE_TARGET_MISMATCH, INVALID_ASSIGNEE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create an assignment (coordinator or performer)","tags":["Ticket Assignments"],"x-error-codes":["SCOPE_TARGET_MISMATCH","INVALID_ASSIGNEE","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["tickets:write"]}},"/v1/ticket-assignments/{id}":{"delete":{"operationId":"TicketAssignments.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"404":{"description":"Possible error codes: TICKET_ASSIGNMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete an assignment","tags":["Ticket Assignments"],"x-error-codes":["TICKET_ASSIGNMENT_NOT_FOUND"],"x-required-scopes":["tickets:write"]}},"/v1/ticket-notes":{"get":{"operationId":"TicketNotes.list","parameters":[{"name":"scope","required":true,"in":"query","schema":{"type":"string","enum":["ticket","track"]}},{"name":"scope_id","required":true,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -posted_at","schema":{"enum":["-posted_at","posted_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TicketNoteV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SCOPE_TARGET_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List notes for a ticket or track","tags":["Ticket Notes"],"x-error-codes":["INVALID_CURSOR","SCOPE_TARGET_MISMATCH","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["tickets:read"]},"post":{"operationId":"TicketNotes.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["scope","scope_id","body"],"properties":{"scope":{"type":"string","enum":["ticket","track"]},"scope_id":{"type":"string","format":"uuid"},"subject":{"type":"string","maxLength":500,"nullable":true},"body":{"type":"string","maxLength":20000},"status_note":{"type":"string","maxLength":200,"nullable":true},"visibility":{"type":"string","enum":["private","public"]},"files":{"type":"array","description":"multipart/form-data only: PDF/PNG/JPEG/WebP files (max 10) attached to the created note.","items":{"type":"string","format":"binary"}}}}},"multipart/form-data":{"schema":{"type":"object","required":["scope","scope_id","body"],"properties":{"scope":{"type":"string","enum":["ticket","track"]},"scope_id":{"type":"string","format":"uuid"},"subject":{"type":"string","maxLength":500,"nullable":true},"body":{"type":"string","maxLength":20000},"status_note":{"type":"string","maxLength":200,"nullable":true},"visibility":{"type":"string","enum":["private","public"]},"files":{"type":"array","description":"multipart/form-data only: PDF/PNG/JPEG/WebP files (max 10) attached to the created note.","items":{"type":"string","format":"binary"}}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TicketNoteV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: ATTACHMENT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: ATTACHMENT_TYPE_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SCOPE_TARGET_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Post a note to a ticket or track","tags":["Ticket Notes"],"x-error-codes":["SCOPE_TARGET_MISMATCH","ATTACHMENT_TYPE_UNSUPPORTED","ATTACHMENT_TOO_LARGE","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["tickets:write"]}},"/v1/ticket-attachments":{"get":{"operationId":"TicketAttachments.list","parameters":[{"name":"scope","required":true,"in":"query","schema":{"type":"string","enum":["ticket","track"]}},{"name":"scope_id","required":true,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"note_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..500. Omit to receive the full collection in one page.","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TicketAttachmentV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_CURSOR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SCOPE_TARGET_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List attachments for a ticket or track","tags":["Ticket Attachments"],"x-error-codes":["SCOPE_TARGET_MISMATCH","VALIDATION_FAILED","INVALID_CURSOR"],"x-pagination":{"mode":"cursor-optional"},"x-required-scopes":["tickets:read"]},"post":{"operationId":"TicketAttachments.upload","parameters":[{"name":"scope","required":true,"in":"query","schema":{"enum":["ticket","track"],"type":"string"}},{"name":"scope_id","required":true,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"note_id","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF, PNG, JPEG, or WebP file. Max 25 MiB. Magic-byte sniffed server-side."}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TicketAttachmentV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: ATTACHMENT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"415":{"description":"Possible error codes: ATTACHMENT_TYPE_UNSUPPORTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: SCOPE_TARGET_MISMATCH","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload a PDF or image attachment to a ticket or track","tags":["Ticket Attachments"],"x-error-codes":["SCOPE_TARGET_MISMATCH","ATTACHMENT_TYPE_UNSUPPORTED","ATTACHMENT_TOO_LARGE","VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["tickets:write"]}},"/v1/ticket-attachments/{id}/download":{"get":{"operationId":"TicketAttachments.getDownloadUrl","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TicketAttachmentDownloadUrlV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: TICKET_ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a short-lived signed download URL for an attachment","tags":["Ticket Attachments"],"x-error-codes":["TICKET_ATTACHMENT_NOT_FOUND"],"x-required-scopes":["tickets:read"]}},"/v1/ticket-attachments/{id}":{"delete":{"operationId":"TicketAttachments.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: TICKET_ATTACHMENT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete an attachment","tags":["Ticket Attachments"],"x-error-codes":["TICKET_ATTACHMENT_NOT_FOUND","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY"],"x-required-scopes":["tickets:write"]}},"/v1/ticket-assignees":{"get":{"operationId":"TicketAssignees.list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TicketAssigneeV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List members assignable to a ticket","tags":["Ticket Lookups"],"x-error-codes":[],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"org headcount"},"x-required-scopes":["tickets:read"]}},"/v1/ticket-statuses":{"get":{"operationId":"TicketStatuses.list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TicketLookupV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List ticket statuses","tags":["Ticket Lookups"],"x-error-codes":[],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"a handful of ticket statuses per org"},"x-required-scopes":["tickets:read"]}},"/v1/track-statuses":{"get":{"operationId":"TrackStatuses.list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TicketLookupV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List track statuses","tags":["Ticket Lookups"],"x-error-codes":[],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"a handful of track statuses per org"},"x-required-scopes":["tickets:read"]}},"/v1/track-types":{"get":{"operationId":"TrackTypes.list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TicketLookupV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List track types","tags":["Ticket Lookups"],"x-error-codes":[],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"a handful of track types per org"},"x-required-scopes":["tickets:read"]}},"/v1/ticket-priorities":{"get":{"operationId":"TicketPriorities.list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TicketLookupV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List ticket priorities","tags":["Ticket Lookups"],"x-error-codes":[],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"a handful of ticket priorities per org"},"x-required-scopes":["tickets:read"]}},"/v1/communication-channels":{"get":{"operationId":"CommunicationChannels.list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TicketLookupV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List communication channels","tags":["Ticket Lookups"],"x-error-codes":[],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"a handful of communication channels per org"},"x-required-scopes":["tickets:read"]}},"/v1/ticket-types":{"get":{"operationId":"TicketTypes.list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TicketLookupV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List ticket types","tags":["Ticket Lookups"],"x-error-codes":[],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"a handful of ticket types per org"},"x-required-scopes":["tickets:read"]}},"/v1/ticket-categories":{"get":{"operationId":"TicketCategories.list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TicketLookupV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List ticket categories","tags":["Ticket Lookups"],"x-error-codes":[],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"a handful of ticket categories per org"},"x-required-scopes":["tickets:read"]}},"/v1/webhooks/ticketing/resend-inbound":{"post":{"description":"Resend pushes inbound-email events here when a reporter replies to a ticket notification. ResendInboundSignatureGuard verifies the svix-id/svix-timestamp/svix-signature headers against RESEND_WEBHOOK_SECRET before this handler runs. Delegates to TicketInboundEmailService.handle() for ingestion.","operationId":"Ticketing.resendInboundWebhook.receive","parameters":[],"responses":{"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"summary":"Inbound Resend webhook (Svix signature-verified)","tags":["Ticketing Webhooks"],"x-error-codes":["VALIDATION_FAILED"],"x-public":true}},"/v1/ping":{"get":{"operationId":"Ping.ok","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PingResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"summary":"Liveness check","tags":["Ping"],"x-public":true}},"/v1/ping/fail":{"get":{"operationId":"Ping.fail","parameters":[],"responses":{"409":{"description":"Possible error codes: DOCUMENT_ALREADY_POSTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"summary":"Force an error for contract testing","tags":["Ping"],"x-error-codes":["DOCUMENT_ALREADY_POSTED"],"x-public":true}},"/v1/ping/authed":{"get":{"operationId":"Ping.authed","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AuthedPingResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Auth-required echo of the resolved principal","tags":["Ping"],"x-required-scopes":["documents:read"]}},"/v1/ping/scoped":{"get":{"operationId":"Ping.scoped","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PingResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Scope-gated ping (requires documents:read)","tags":["Ping"],"x-required-scopes":["documents:read"]}},"/v1/ping/le-scoped":{"get":{"operationId":"Ping.leScoped","parameters":[{"name":"le","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PingResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"LE-scoped ping — demos OrgContext.requireLegalEntity()","tags":["Ping"],"x-required-scopes":["documents:read"]}},"/v1/ping/internal":{"post":{"operationId":"Ping.internal","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PingResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Internal-only ping (first-party principals only)","tags":["Ping"],"x-internal":true,"x-required-scopes":["admin:*"]}},"/v1/api-keys":{"post":{"operationId":"ApiKeys.create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKeyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CreateApiKeyResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, API_KEY_EXPIRES_AT_IN_PAST","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a new API key","tags":["API Keys"],"x-connector-forbidden":true,"x-error-codes":["VALIDATION_FAILED","FORBIDDEN","LEGAL_ENTITY_NOT_IN_SCOPE","API_KEY_EXPIRES_AT_IN_PAST"],"x-required-scopes":["admin:keys"]},"get":{"operationId":"ApiKeys.list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApiKeyResponseDto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List API keys for the current org","tags":["API Keys"],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"tens of API keys per org"},"x-required-scopes":["admin:keys"]}},"/v1/api-keys/{id}/usage":{"get":{"operationId":"ApiKeys.usage","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApiKeyUsageResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Get usage counts for an API key","tags":["API Keys"],"x-required-scopes":["admin:keys"]}},"/v1/api-keys/{id}":{"get":{"operationId":"ApiKeys.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApiKeyResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Get a single API key","tags":["API Keys"],"x-required-scopes":["admin:keys"]},"patch":{"operationId":"ApiKeys.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateApiKeyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApiKeyResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, API_KEY_EXPIRES_AT_IN_PAST","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: FORBIDDEN, API_KEY_TIER_OVERRIDE_FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update an API key","tags":["API Keys"],"x-connector-forbidden":true,"x-error-codes":["NOT_FOUND","VALIDATION_FAILED","FORBIDDEN","API_KEY_TIER_OVERRIDE_FORBIDDEN","API_KEY_EXPIRES_AT_IN_PAST"],"x-required-scopes":["admin:keys"]}},"/v1/api-keys/{id}/revoke":{"post":{"operationId":"ApiKeys.revoke","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ApiKeyResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Revoke an API key (idempotent)","tags":["API Keys"],"x-required-scopes":["admin:keys"]}},"/v1/api-keys/{id}/rotate":{"post":{"operationId":"ApiKeys.rotate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CreateApiKeyResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Rotate an API key (revoke old + create new with same scopes)","tags":["API Keys"],"x-connector-forbidden":true,"x-required-scopes":["admin:keys"]}},"/v1/internal/impersonations":{"post":{"operationId":"Impersonations.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateImpersonationDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CreateImpersonationResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Mint an impersonation token","tags":["Admin / Impersonation"],"x-internal":true,"x-required-scopes":["admin:impersonate"]},"get":{"operationId":"Impersonations.list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ImpersonationResponseDto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"List active impersonations across all orgs","tags":["Admin / Impersonation"],"x-internal":true,"x-pagination":{"mode":"none","reason":"internal admin action, not org data — bounded by staff headcount","bound":"active impersonation grants across all orgs, a handful at a time"},"x-required-scopes":["admin:impersonate"]}},"/v1/internal/impersonations/{id}/revoke":{"post":{"operationId":"Impersonations.revoke","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ImpersonationResponseDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Revoke an impersonation token","tags":["Admin / Impersonation"],"x-internal":true,"x-required-scopes":["admin:impersonate"]}},"/v1/escalations/{id}/accept":{"post":{"description":"Stamps the proposed factor onto the event as the accepted one and stages the retro delta for every period already invoiced since the reset: what each posted invoice should have billed for the term minus what it did. Rejected when a reading the proposal cited has been revised since, or when the nightly review refreshed the proposal after it was read. The optional body states the factor the reviewer was shown (`expected_factor_num`/`expected_factor_den`); if the proposal no longer carries it, the request is refused with ESCALATION_INPUTS_STALE so a refreshed number is never accepted unseen.","operationId":"Escalations.accept","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptEscalationV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EscalationEventV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ESCALATION_EVENT_NOT_DECIDABLE, ESCALATION_EARLIER_RESET_UNDECIDED, ESCALATION_INPUTS_STALE, ESCALATION_PRIOR_RENT_UNRESOLVED, ESCALATION_BILLED_AMOUNT_UNKNOWN, ESCALATION_UNPOSTED_INVOICE_IN_WINDOW, ESCALATION_INVOICE_OFF_SCHEDULE, ESCALATION_BILLED_AMOUNT_CHANGED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ESCALATION_APPLIES_TO_PSF_UNSUPPORTED, ESCALATION_MIXED_COMPARISONS, ESCALATION_TERM_NOT_BILLABLE, ESCALATION_CONTRACT_HAS_NO_PROPERTY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Accept a proposed index-linked rent escalation","tags":["Escalations"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","ESCALATION_EVENT_NOT_DECIDABLE","ESCALATION_EARLIER_RESET_UNDECIDED","ESCALATION_INPUTS_STALE","ESCALATION_APPLIES_TO_PSF_UNSUPPORTED","ESCALATION_MIXED_COMPARISONS","ESCALATION_PRIOR_RENT_UNRESOLVED","ESCALATION_TERM_NOT_BILLABLE","ESCALATION_CONTRACT_HAS_NO_PROPERTY","ESCALATION_BILLED_AMOUNT_UNKNOWN","ESCALATION_UNPOSTED_INVOICE_IN_WINDOW","ESCALATION_INVOICE_OFF_SCHEDULE","ESCALATION_BILLED_AMOUNT_CHANGED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["contracts:write"]}},"/v1/escalations/{id}/override":{"post":{"description":"Replaces the computed factor with the figure the parties agreed, stated in basis points, and stages the retro delta the same way accepting does. A revised index reading does NOT block an override: the human is replacing the computed factor, so it no longer depends on the readings.","operationId":"Escalations.override","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OverrideEscalationV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EscalationEventV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ESCALATION_EVENT_NOT_DECIDABLE, ESCALATION_EARLIER_RESET_UNDECIDED, ESCALATION_PRIOR_RENT_UNRESOLVED, ESCALATION_BILLED_AMOUNT_UNKNOWN, ESCALATION_UNPOSTED_INVOICE_IN_WINDOW, ESCALATION_INVOICE_OFF_SCHEDULE, ESCALATION_BILLED_AMOUNT_CHANGED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ESCALATION_APPLIES_TO_PSF_UNSUPPORTED, ESCALATION_MIXED_COMPARISONS, ESCALATION_TERM_NOT_BILLABLE, ESCALATION_CONTRACT_HAS_NO_PROPERTY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Override a proposed escalation with a negotiated percentage","tags":["Escalations"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","ESCALATION_EVENT_NOT_DECIDABLE","ESCALATION_EARLIER_RESET_UNDECIDED","ESCALATION_APPLIES_TO_PSF_UNSUPPORTED","ESCALATION_MIXED_COMPARISONS","ESCALATION_PRIOR_RENT_UNRESOLVED","ESCALATION_TERM_NOT_BILLABLE","ESCALATION_CONTRACT_HAS_NO_PROPERTY","ESCALATION_BILLED_AMOUNT_UNKNOWN","ESCALATION_UNPOSTED_INVOICE_IN_WINDOW","ESCALATION_INVOICE_OFF_SCHEDULE","ESCALATION_BILLED_AMOUNT_CHANGED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["contracts:write"]}},"/v1/escalations/{id}/reverse":{"post":{"description":"Accepts a `proposed`, `accepted` or `overridden` event. Supersedes it, clears its unbilled staged charge, and re-queues the same reset as `awaiting_index` so the nightly sweep proposes it again against current readings. Refused with 409 ESCALATION_LATER_RESET_EXISTS while a later reset on the same term is `proposed`, `accepted` or `overridden` — reversals go newest-first, so reverse that one first. Refused with 409 ESCALATION_DECISION_ALREADY_BILLED once the true-up has already been billed onto a document the tenant can see. On a recovery statement, void the statement, then reverse. On a rent invoice, correct it with a credit memo: voiding the rent invoice reissues it with the charge. Refused with 409 ESCALATION_REVERSE_BEFORE_INDEX_SWAP when the reset was decided under a version an index swap superseded and falls before the swap took effect: correct it with a credit memo (or a manual adjustment).","operationId":"Escalations.reverse","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReverseEscalationV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EscalationEventV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ESCALATION_EVENT_NOT_DECIDABLE, ESCALATION_DECISION_ALREADY_BILLED, ESCALATION_LATER_RESET_EXISTS, ESCALATION_REVERSE_BEFORE_INDEX_SWAP, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Undo a decided escalation and release its staged true-up","tags":["Escalations"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","ESCALATION_EVENT_NOT_DECIDABLE","ESCALATION_DECISION_ALREADY_BILLED","ESCALATION_LATER_RESET_EXISTS","ESCALATION_REVERSE_BEFORE_INDEX_SWAP","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["contracts:write"]}},"/v1/escalations/{id}":{"get":{"description":"The work center links here. `preview` is present for a proposed event; when the preview would refuse, `preview_refusal` carries the code and the sentence instead, and the request still succeeds. `billing` says where the staged true-up billed, or which rent invoice is expected to carry it.","operationId":"Escalations.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EscalationDetailV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"One escalation: the event, how it was computed, its preview and its billing","tags":["Escalations"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["contracts:read"]}},"/v1/escalations/{id}/true-up-preview":{"get":{"description":"Runs the same window and the same arithmetic the accept path runs, and writes nothing. The per-period rows show where the total comes from.","operationId":"Escalations.trueUpPreview","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TrueUpPreviewV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ESCALATION_EVENT_NOT_DECIDABLE, ESCALATION_INPUTS_STALE, ESCALATION_PRIOR_RENT_UNRESOLVED, ESCALATION_BILLED_AMOUNT_UNKNOWN, ESCALATION_UNPOSTED_INVOICE_IN_WINDOW, ESCALATION_INVOICE_OFF_SCHEDULE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ESCALATION_APPLIES_TO_PSF_UNSUPPORTED, ESCALATION_MIXED_COMPARISONS, ESCALATION_TERM_NOT_BILLABLE, ESCALATION_CONTRACT_HAS_NO_PROPERTY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview the retro true-up accepting this escalation would stage","tags":["Escalations"],"x-error-codes":["NOT_FOUND","ESCALATION_EVENT_NOT_DECIDABLE","ESCALATION_INPUTS_STALE","ESCALATION_APPLIES_TO_PSF_UNSUPPORTED","ESCALATION_MIXED_COMPARISONS","ESCALATION_PRIOR_RENT_UNRESOLVED","ESCALATION_TERM_NOT_BILLABLE","ESCALATION_CONTRACT_HAS_NO_PROPERTY","ESCALATION_BILLED_AMOUNT_UNKNOWN","ESCALATION_UNPOSTED_INVOICE_IN_WINDOW","ESCALATION_INVOICE_OFF_SCHEDULE"],"x-required-scopes":["contracts:read"]}},"/v1/contracts/{id}/terms/{termId}/escalation-config":{"get":{"description":"Returns the live version of the clause governing this term today, or 404 when the term has no index-linked escalation.","operationId":"Contracts.getEscalationConfig","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"termId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EscalationConfigV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ESCALATION_TERM_UNKNOWN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a term's index-linked escalation clause","tags":["Contracts"],"x-error-codes":["NOT_FOUND","ESCALATION_TERM_UNKNOWN"],"x-required-scopes":["contracts:read"]},"put":{"description":"Full replacement, so PUT rather than PATCH. A live clause is superseded and the replacement becomes the live version; the old one is kept as the version that governed its own dates.","operationId":"Contracts.putEscalationConfig","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"termId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutEscalationConfigV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EscalationConfigV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, ESCALATION_CONFIG_INVALID, ESCALATION_RESET_SUB_ANNUAL, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ESCALATION_CONFIG_OVERLAP, ESCALATION_EARLIER_RESET_UNDECIDED, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ESCALATION_TERM_UNKNOWN, ESCALATION_SERIES_UNKNOWN, ESCALATION_TERM_OFF_CADENCE, ESCALATION_CONTRACT_HAS_NO_PROPERTY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Replace a term's index-linked escalation clause","tags":["Contracts"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","ESCALATION_CONFIG_INVALID","ESCALATION_TERM_UNKNOWN","ESCALATION_SERIES_UNKNOWN","ESCALATION_CONFIG_OVERLAP","ESCALATION_RESET_SUB_ANNUAL","ESCALATION_TERM_OFF_CADENCE","ESCALATION_EARLIER_RESET_UNDECIDED","ESCALATION_CONTRACT_HAS_NO_PROPERTY","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-plannable":true,"x-required-scopes":["contracts:write"]},"delete":{"description":"Removes EVERY version of the clause — the live one and any superseded predecessors — together with the undecided reset events derived from them, in one transaction. All versions go because the foreign key from a clause to its term is ON DELETE RESTRICT and does not consult superseded_at, so a leftover superseded row would still prevent the term from ever being deleted. Answers 204 when the term has no clause, so the call is safely repeatable. Refused with ESCALATION_CONFIG_HAS_DECIDED_EVENTS when a reset derived from the clause was already accepted or overridden: reverse it first.","operationId":"Contracts.deleteEscalationConfig","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"termId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"204":{"description":"The clause and its undecided events are gone."},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ESCALATION_CONFIG_HAS_DECIDED_EVENTS, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: ESCALATION_TERM_UNKNOWN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a term's index-linked escalation clause","tags":["Contracts"],"x-error-codes":["NOT_FOUND","ESCALATION_TERM_UNKNOWN","ESCALATION_CONFIG_HAS_DECIDED_EVENTS","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["contracts:write"]}},"/v1/contracts/{id}/escalations":{"get":{"description":"Every escalation event on this contract, newest reset first, in EVERY status — the decided ones are the audit trail of who accepted what, when, and why. A decided row carries the retro catch-up charge it staged in `staged_charge`, whose `billed_document_id` says whether the decision can still be reversed. A pending row carries null there; its live retro figure comes from `GET /v1/escalations/{id}/true-up-preview`.","operationId":"Contracts.listEscalations","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..200, default 50","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ContractEscalationEventV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List a lease's index-linked rent escalations","tags":["Contracts"],"x-error-codes":["NOT_FOUND"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["contracts:read"]}},"/v1/consolidation-groups":{"get":{"description":"Lists entity groups of one type: `group_type=consolidation` (the default, so existing callers are unchanged), `payment`, or `all`. Payment groups need `reports:read` or `payment-runs:read`; `consolidation` and `all` need `reports:read`.","operationId":"ConsolidationGroups.list","parameters":[{"name":"group_type","required":false,"in":"query","description":"Which group type to list. Defaults to 'consolidation' so existing callers keep seeing consolidation groups only.","schema":{"default":"consolidation","type":"string","enum":["consolidation","payment","all"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ConsolidationGroupV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List entity groups","tags":["Consolidation Groups"],"x-error-codes":["VALIDATION_FAILED","INSUFFICIENT_SCOPE"],"x-pagination":{"mode":"none","reason":"org configuration, created by an administrator","bound":"tens of entity groups per org"},"x-required-scopes-any":["reports:read","payment-runs:read"]},"post":{"operationId":"ConsolidationGroups.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateConsolidationGroupV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ConsolidationGroupV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create an entity group","tags":["Consolidation Groups"],"x-error-codes":["VALIDATION_FAILED","CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["legal-entities:write"]}},"/v1/consolidation-groups/{id}":{"get":{"operationId":"ConsolidationGroups.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ConsolidationGroupV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get an entity group","tags":["Consolidation Groups"],"x-error-codes":["NOT_FOUND","INSUFFICIENT_SCOPE"],"x-required-scopes-any":["reports:read","payment-runs:read"]},"patch":{"operationId":"ConsolidationGroups.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateConsolidationGroupV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ConsolidationGroupV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, ENTITY_GROUP_IN_USE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update an entity group","tags":["Consolidation Groups"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","CONFLICT","ENTITY_GROUP_IN_USE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["legal-entities:write"]},"delete":{"operationId":"ConsolidationGroups.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: ENTITY_GROUP_IN_USE, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete an entity group","tags":["Consolidation Groups"],"x-error-codes":["NOT_FOUND","ENTITY_GROUP_IN_USE","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["legal-entities:write"]}},"/v1/consolidation-groups/{id}/control":{"get":{"description":"Who controls each member as of a date, from the org's entity ownerships: the parent, members it controls by majority (with the members it already controls, more than 50%; exactly 50% is not control) or by agreement, and members it does not control. Each controlled member carries the parent's economic share and the non-controlling interest.","operationId":"ConsolidationGroups.control","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"as_of_date","required":false,"in":"query","description":"The date the ownership is read at. Defaults to the org's today.","schema":{"format":"date","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/GroupControlV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Read a consolidation group's control and non-controlling interest","tags":["Consolidation Groups"],"x-error-codes":["NOT_FOUND","INSUFFICIENT_SCOPE","VALIDATION_FAILED"],"x-required-scopes":["reports:read"]}},"/v1/dashboard/kpis":{"get":{"operationId":"Dashboard.kpis","parameters":[{"name":"legal_entity_id","required":false,"in":"query","description":"Scope the KPIs to one legal entity. Default: org-wide.","schema":{"format":"uuid","type":"string"}},{"name":"period","required":true,"in":"query","description":"Comparison window for each KPI and its prior-period delta.","schema":{"type":"string","enum":["this_month","last_month","qtd","ytd","ttm"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DashboardKpiV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Hero KPI cards for the Home dashboard","tags":["Dashboard"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-pagination":{"mode":"none","reason":"a fixed set of hero cards defined by the product, not user data","bound":"the KPI catalog, currently a handful of cards"},"x-required-scopes":["reports:read"]}},"/v1/dashboard/measures":{"get":{"operationId":"Dashboard.measures","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/MeasureV1Dto"}},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Composable measure catalog for the widget builder","tags":["Dashboard"],"x-error-codes":["VALIDATION_FAILED"],"x-pagination":{"mode":"none","reason":"the built-in measures plus the org’s active KPI definitions — a small per-org set bounded by the KPI table, not free-growing user event data","bound":"the built-in measures + the org’s active KPI definitions"},"x-required-scopes":["reports:read"]}},"/v1/dashboard/query":{"post":{"operationId":"Dashboard.query","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeasureQueryV1BodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MeasureQueryResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: INSUFFICIENT_SCOPE, LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Run a composed measure query for a custom widget","tags":["Dashboard"],"x-error-codes":["VALIDATION_FAILED","INSUFFICIENT_SCOPE","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["reports:read"]}},"/v1/kpis":{"get":{"operationId":"Kpis.list","parameters":[{"name":"include_inactive","required":false,"in":"query","description":"Include deactivated KPIs in the list.","schema":{"default":false,"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: name","schema":{"enum":["name","-name"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/KpiV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List KPIs","tags":["KPIs"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["reports:read"]},"post":{"operationId":"Kpis.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateKpiV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/KpiV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a KPI","tags":["KPIs"],"x-error-codes":["VALIDATION_FAILED","CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["accounting:write"]}},"/v1/kpis/{id}":{"get":{"operationId":"Kpis.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/KpiV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a KPI","tags":["KPIs"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["reports:read"]},"patch":{"operationId":"Kpis.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateKpiV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/KpiV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a KPI","tags":["KPIs"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["accounting:write"]},"delete":{"operationId":"Kpis.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a KPI","tags":["KPIs"],"x-error-codes":["NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["accounting:write"]}},"/v1/kpis/preview":{"post":{"operationId":"Kpis.preview","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewKpiV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/KpiPreviewResultV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: LEGAL_ENTITY_NOT_IN_SCOPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Evaluate a KPI formula (draft or saved) against real GL data","tags":["KPIs"],"x-error-codes":["VALIDATION_FAILED","LEGAL_ENTITY_NOT_IN_SCOPE"],"x-required-scopes":["reports:read"]}},"/v1/statistical-measure-types":{"get":{"description":"Returns the built-in derived measure types first (source=derived, each with a resolver_key), followed by the org’s manual types (source=manual). The cursor meta paginates the manual rows only.","operationId":"StatisticalMeasureTypes.list","parameters":[{"name":"include_inactive","required":false,"in":"query","description":"Include deactivated (soft-deleted) manual measure types.","schema":{"default":false,"type":"boolean"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: name","schema":{"enum":["name","-name"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StatMeasureTypeV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List statistical measure types","tags":["Statistical Measure Types"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["statistics:read"]},"post":{"operationId":"StatisticalMeasureTypes.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateStatMeasureTypeV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StatMeasureTypeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Create a statistical measure type","tags":["Statistical Measure Types"],"x-error-codes":["VALIDATION_FAILED","CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["statistics:write"]}},"/v1/statistical-measure-types/{id}":{"get":{"operationId":"StatisticalMeasureTypes.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StatMeasureTypeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a statistical measure type","tags":["Statistical Measure Types"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["statistics:read"]},"patch":{"operationId":"StatisticalMeasureTypes.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateStatMeasureTypeV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StatMeasureTypeV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a statistical measure type","tags":["Statistical Measure Types"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["statistics:write"]},"delete":{"operationId":"StatisticalMeasureTypes.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Soft-delete a statistical measure type","tags":["Statistical Measure Types"],"x-error-codes":["NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["statistics:write"]}},"/v1/statistical-measures":{"get":{"description":"Recorded quantities for manual measure types, cursor-paginated. Filter by measure_type_id, a dimension id (property/space/legal_entity), and a from_date/to_date range over the entry effective date (period_month or as_of_date).","operationId":"StatisticalMeasures.list","parameters":[{"name":"measure_type_id","required":false,"in":"query","description":"Only entries recorded for this measure type.","schema":{"format":"uuid","type":"string"}},{"name":"property_id","required":false,"in":"query","description":"Only entries recorded against this property.","schema":{"format":"uuid","type":"string"}},{"name":"space_id","required":false,"in":"query","description":"Only entries recorded against this space.","schema":{"format":"uuid","type":"string"}},{"name":"legal_entity_id","required":false,"in":"query","description":"Only entries recorded against this legal entity.","schema":{"format":"uuid","type":"string"}},{"name":"from_date","required":false,"in":"query","description":"Only entries whose effective date (period_month or as_of_date) is on or after this date.","schema":{"format":"date","type":"string"}},{"name":"to_date","required":false,"in":"query","description":"Only entries whose effective date (period_month or as_of_date) is on or before this date.","schema":{"format":"date","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"1..100, default 50","schema":{"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["created_at","-created_at"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StatMeasureV1Dto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List statistical measure entries","tags":["Statistical Measures"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor"},"x-required-scopes":["statistics:read"]},"post":{"description":"Validates dimension/basis coherence against the referenced manual measure type: exactly the dimension column matching the type dimension is set (org types set none), and exactly the temporal column matching the type basis is set (flow → period_month, balance → as_of_date). A duplicate (type, dimension, period/as-of) slot conflicts.","operationId":"StatisticalMeasures.create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateStatMeasureV1Dto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StatMeasureV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Record a statistical measure entry","tags":["Statistical Measures"],"x-error-codes":["VALIDATION_FAILED","CONFLICT","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["statistics:write"]}},"/v1/statistical-measures/{id}":{"get":{"operationId":"StatisticalMeasures.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StatMeasureV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a statistical measure entry","tags":["Statistical Measures"],"x-error-codes":["NOT_FOUND"],"x-required-scopes":["statistics:read"]},"patch":{"operationId":"StatisticalMeasures.update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateStatMeasureV1Dto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StatMeasureV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: CONFLICT, IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Update a statistical measure entry","tags":["Statistical Measures"],"x-error-codes":["VALIDATION_FAILED","NOT_FOUND","CONFLICT","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["statistics:write"]},"delete":{"operationId":"StatisticalMeasures.delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Delete a statistical measure entry","tags":["Statistical Measures"],"x-error-codes":["NOT_FOUND","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT"],"x-required-scopes":["statistics:write"]}},"/v1/plans":{"get":{"description":"The organization's plan runs, newest first: previews (kept 7 days) and commits, each without its\nplan and report. Filter by `status`, `mode` or `session_id`; `search` matches the description.\nRead one run, with its plan and report, at `GET /v1/plans/{id}`. A legal-entity-scoped principal\nsees only the runs it made itself.","operationId":"Plans.list","parameters":[{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["previewed","committed","held","released","undone","failed"]}},{"name":"mode","required":false,"in":"query","schema":{"type":"string","enum":["preview","commit"]}},{"name":"session_id","required":false,"in":"query","description":"Only runs committed with this `session_id`.","schema":{"format":"uuid","type":"string"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"number","minimum":1,"maximum":100},"description":"1..100, default 100"},{"name":"sort","required":false,"in":"query","description":"Default: -created_at","schema":{"enum":["created_at","-created_at"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on: description.","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Up to 100 ids; returns those rows regardless of other filters and ignores search.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PlanRunListItemDto"}},"meta":{"$ref":"#/components/schemas/CursorEnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_CURSOR, VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"List plan runs","tags":["Plans"],"x-error-codes":["INVALID_CURSOR","VALIDATION_FAILED"],"x-pagination":{"mode":"cursor","contract":"unified","defaultLimit":100,"maxLimit":100},"x-required-scopes":["plans:preview"]},"post":{"description":"Runs a plan inside one database transaction and keeps it when every step succeeds. The body is\nEITHER a full plan (`steps`, as for a preview) OR the `plan_id` of a preview, never both.\n\nA `plan_id` is re-executed, not replayed, and only by the principal that previewed it (or a\ncaller holding `plans:release`; a plan-only key or a legal-entity-scoped or\nsecurity-group-restricted principal never counts as holding it); any other plan_id answers\n`PLAN_NOT_FOUND`. The run must do what its preview\nshowed: the same rows written per step, and the same step responses once ids and timestamps are\nset aside. Otherwise nothing is kept and the answer is 409 `PLAN_DRIFT`, unless the body says\n`allow_drift: true` (only with `plan_id`; with `steps` it is refused as `VALIDATION_FAILED`,\n`context.pointer` `/allow_drift`). Sequence-allocated numbers (a document number, for example)\nand date fields defaulted to today can differ between preview and commit, and show as drift.\n\nWhen any step fails or is skipped, nothing is kept and the answer is still 200, with\n`committed: false` and the report saying why (`summary.first_error`); the run is stored with\nstatus `failed`. A plan that runs out of its time budget answers 504 `PLAN_TIMEOUT` with the\nreport in `context.report`, and keeps nothing either.\n\nThe `Idempotency-Key` is required and seeds each non-GET step's own key (sha256 of this key, a\nnewline, then the step's ref), so a retry does not run the plan twice. Retrying with the same\nIdempotency-Key replays the stored answer, even after the run was undone. Each step writes its\nown audit row; the commit adds one `plans.commit`.","operationId":"Plans.commit","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Required — a request without one is rejected with `IDEMPOTENCY_KEY_REQUIRED`. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanCommitDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PlanCommitReportDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PLAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, PLAN_DRIFT, PLAN_ORG_BUSY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: PLAN_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PLAN_ROUTE_NOT_PLANNABLE, PLAN_DUPLICATE_REF, PLAN_REF_FORWARD","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PLAN_RAW_DB_ACCESS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"504":{"description":"Possible error codes: PLAN_TIMEOUT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Commit a plan","tags":["Plans"],"x-error-codes":["VALIDATION_FAILED","IDEMPOTENCY_KEY_REQUIRED","INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","PLAN_NOT_FOUND","PLAN_DRIFT","PLAN_ROUTE_NOT_PLANNABLE","PLAN_DUPLICATE_REF","PLAN_REF_FORWARD","PLAN_TOO_LARGE","PLAN_TIMEOUT","PLAN_ORG_BUSY","PLAN_RAW_DB_ACCESS"],"x-required-scopes":["plans:commit"]}},"/v1/plans/capabilities":{"get":{"description":"Everything an agent needs to write a plan, in one call: the routes a non-GET step may call\n(`plannable_routes`, the operations marked `x-plannable` in this contract; every GET under\n`/v1/` is plannable without a mark), the limits (`max_steps`, the time budget, plans per\ninstance), the `$<ref>` reference grammar with examples, the headers a step may send, and\nevery plan error code with its `retryable` flag and `next_action`. Read it before the first\npreview, instead of probing routes one by one. It is the same for every caller and changes\nonly with a deploy.","operationId":"Plans.capabilities","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PlanCapabilitiesDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}}},"security":[{"access-token":[]}],"summary":"Get plan mode capabilities","tags":["Plans"],"x-error-codes":[],"x-required-scopes":["plans:preview"]}},"/v1/plans/{id}":{"get":{"description":"One plan run in your organization, with the plan as submitted and the stored report. A run that\ndoes not exist, belongs to another organization, or (for a legal-entity-scoped principal) was\nmade by another principal, answers `PLAN_NOT_FOUND`.","operationId":"Plans.get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PlanRunDetailDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PLAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a plan run","tags":["Plans"],"x-error-codes":["PLAN_NOT_FOUND","VALIDATION_FAILED"],"x-required-scopes":["plans:preview"]}},"/v1/plans/{id}/report":{"get":{"description":"The run's stored report, in the shape the preview or commit answered. The stored report is capped\n(`truncated: true` says a cap cut something). With `full=true`, a committed run answers with\n`writes` rebuilt without the cap from the rows it persisted; a preview keeps nothing, so it\nanswers the stored report unchanged, and so does a run that failed.","operationId":"Plans.report","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"full","required":false,"in":"query","description":"For a committed run, rebuild `writes` without the caps from the rows the run persisted (every id listed). A preview, and a run that failed, answer the stored report unchanged.","schema":{"type":"boolean"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PlanRunReportDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PLAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a plan run's report","tags":["Plans"],"x-error-codes":["PLAN_NOT_FOUND","VALIDATION_FAILED"],"x-required-scopes":["plans:preview"]}},"/v1/plans/{id}/undo":{"post":{"description":"Undoes a committed run in one transaction, all-or-nothing. Allowed while the run is `held`, and\nfor now also `released` (until hold ships). Only the principal that committed the run, or a\ncaller holding `plans:release` (never a plan-only key or a legal-entity-scoped or\nsecurity-group-restricted principal), can undo it; any other run id answers `PLAN_NOT_FOUND`.\n\nThe run's captured rows are walked newest first. The answer's `undo_mode` says which of two ways\nit went:\n\n- `clean`: the run posted nothing to the ledger. A row it created is deleted, an existing row it\n  changed is put back as it was before the run, and a row it deleted is re-inserted (listed under\n  `restored`).\n- `compensating`: the run posted to the ledger, applied a credit, or created a loan hedge (a\n  hedge create always undoes this way, even a swap with no premium, so its settlement check\n  runs). Each posting is reversed through its module's own reversal, newest first: a capital\n  contribution is reversed, a distribution declaration undone, a credit memo or vendor credit\n  un-applied (all listed under `compensated`, with the documents they void), and any other\n  posted document voided through the\n  normal void path (listed under `voided`). Each reversal lands in the ledger and both entries\n  stay. When the original's period is closed or locked, the reversal is dated into the current\n  open period (`voided[].moved_to_current_period`); with no open period the undo is refused (see\n  below, cause `NO_OPEN_PERIOD_FOR_CORRECTION`). A row the ledger still references is retired\n  instead of deleted and listed under `archived`: a loan becomes\n  `cancelled`, a legal entity `inactive`, a party or contact `is_active = false`, any other table\n  `status = 'archived'` where it allows it. A row that cannot be retired is left as it is and\n  listed under `kept`. Changed rows are put back and deleted rows re-inserted as above.\n\nA background job the run queued is deleted while it is still pending. Once it has finished it\nstays, listed under `kept`, and the rows it wrote are undone with the run (a job queued by a run\nruns as part of that run, so its writes are the run's).\n\nRefusals, each leaving everything as it was: 409 `PLAN_UNDO_CONFLICT` when something outside the\nrun changed (or removed) a row since, or took the key of a row undo would re-insert, naming the\nrow; 409 `PLAN_UNDO_BLOCKED` when a row the run created is referred to by something outside the\nrun (a loan included, before it is cancelled), when a job the run queued is running right now,\nor when a journal entry the run posted is still unreversed after the voids, with each blocking\ntable, ids and the plan run that created them in `context.blockers`; 409 `PLAN_UNDO_BLOCKED`\nalso when a module's reversal refuses (a payment applied since, a reconciled document, a\nsubmitted payment run), with the module's own code in `context.cause`, or when the run only\nposted a document or activated a loan that existed before it (create and post, or create and\nactivate, in the same plan); 409 `PLAN_UNDO_BLOCKED` also when the run inserted\n`capital_events` that no module reversal of the run accounts for, with\n`context: { table: 'capital_events', id, blockers: [], reason: 'no_compensator' }`, and when a loan hedge the\nrun created has settlement rows written since outside the run (an edit of its terms), named in\n`context.blockers`; and 409 `PLAN_NOT_HELD`\nwhen the run is not `held` or `released` (undoing it again, for one). Audit rows stay. The run\nends `undone`.","operationId":"Plans.undo","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PlanUndoResultDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PLAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, PLAN_NOT_HELD, PLAN_UNDO_CONFLICT, PLAN_UNDO_BLOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Undo a committed plan run","tags":["Plans"],"x-error-codes":["INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","PLAN_NOT_FOUND","PLAN_NOT_HELD","PLAN_UNDO_CONFLICT","PLAN_UNDO_BLOCKED"],"x-required-scopes":["plans:commit"]}},"/v1/plans/sessions/{session_id}/undo":{"post":{"description":"Undoes every committed run of a session (the `session_id` given at commit) that you can undo,\nnewest first, in one transaction: a conflict or blocker on any run refuses them all. Runs\nalready undone, and failed runs, are skipped, so repeating the call answers 200 with no runs.\nA session with no runs you can see answers `PLAN_NOT_FOUND`. Each run is undone as\n`POST /v1/plans/{id}/undo` describes.","operationId":"Plans.undoSession","parameters":[{"name":"session_id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PlanSessionUndoDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PLAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, PLAN_UNDO_CONFLICT, PLAN_UNDO_BLOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Undo a session's plan runs","tags":["Plans"],"x-error-codes":["INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","PLAN_NOT_FOUND","PLAN_UNDO_CONFLICT","PLAN_UNDO_BLOCKED"],"x-required-scopes":["plans:commit"]}},"/v1/plans/{id}/release":{"post":{"description":"Releases a committed run: its status becomes `released` and `released_at` is set (kept when\nalready set). Committed runs start `released` until hold ships, so for now this confirms the\nstatus. An undone or failed run answers 409 `PLAN_NOT_HELD`.","operationId":"Plans.release","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-chosen key that makes this mutation safe to retry. Optional — a request without one is processed normally, with no replay protection. Reusing a key with the same body replays the original response for ~24 hours; reusing it with a different body returns `IDEMPOTENCY_CONFLICT`.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"responses":{"400":{"description":"Possible error codes: INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: PLAN_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: IDEMPOTENCY_CONFLICT, PLAN_NOT_HELD","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Release a committed plan run","tags":["Plans"],"x-error-codes":["INVALID_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","PLAN_NOT_FOUND","PLAN_NOT_HELD"],"x-required-scopes":["plans:release"]}},"/v1/plans/preview":{"post":{"description":"Runs a plan — an ordered list of API calls — inside one database transaction that is always\nrolled back, and reports what each step would do. Nothing the plan writes is kept: no rows, no\naudit entries, no idempotency keys. The steps' post-commit work runs inside the same transaction\nand rolls back with it: the jobs it would queue are never kept, and the events it publishes are\nrecorded, not delivered. The only record is the stored preview, whose id is `plan_id`.\n\nEach step is a real call to a `/v1/` route, made with your own credentials, so every route keeps\nits own scopes and validation; this endpoint grants nothing beyond `plans:preview`. A non-GET step\nmust call a route marked `x-plannable` in this contract, otherwise the step fails with\n`PLAN_ROUTE_NOT_PLANNABLE`.\n\nA later step uses an earlier response by writing a whole string `\"$<ref>/<json-pointer>\"` in its\nbody, or a path segment `$<ref>` followed by the pointer (`/v1/legal-entities/$e1/data/id`). A\nfailed step rolls back only itself; steps that reference it are skipped, independent steps still\nrun.\n\nThe report puts `summary` (counts, `first_error` with its `pointer` into the submitted plan and\nits `next_action`) and `diff_summary` (one line per step) first, then the capped detail:\n`steps`, `writes` (every captured row, grouped), `journal_entries`, `scheduled_effects` (the\nenabled scheduled jobs that will act on the plan's rows, and when they next run) and `would_fire`\n(the jobs and events the post-commit work would queue and publish, per step). A plan that runs\nout of its time budget answers 504 `PLAN_TIMEOUT` with the report of what did run in\n`context.report`.","operationId":"Plans.preview","parameters":[{"name":"Idempotency-Key","in":"header","description":"Optional. Seeds each non-GET step's own idempotency key (sha256 of this key, a newline, then the step's ref), so a preview and a later commit of the same plan with the same key derive the same step keys. A preview keeps nothing, so it never replays.","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,255}$","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanPreviewDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PlanReportDto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED, INVALID_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: PLAN_ORG_BUSY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"413":{"description":"Possible error codes: PLAN_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"422":{"description":"Possible error codes: PLAN_ROUTE_NOT_PLANNABLE, PLAN_DUPLICATE_REF, PLAN_REF_FORWARD, PLAN_REF_UNRESOLVED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"500":{"description":"Possible error codes: PLAN_RAW_DB_ACCESS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"504":{"description":"Possible error codes: PLAN_TIMEOUT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Preview a plan","tags":["Plans"],"x-error-codes":["VALIDATION_FAILED","INVALID_IDEMPOTENCY_KEY","PLAN_ROUTE_NOT_PLANNABLE","PLAN_DUPLICATE_REF","PLAN_REF_FORWARD","PLAN_REF_UNRESOLVED","PLAN_TOO_LARGE","PLAN_TIMEOUT","PLAN_ORG_BUSY","PLAN_RAW_DB_ACCESS"],"x-required-scopes":["plans:preview"]}},"/mcp":{"post":{"description":"Model Context Protocol endpoint for AI connectors (JSON-RPC over Streamable HTTP, stateless). Its tools call the /v1 operations documented here; see the MCP connector spec.","operationId":"mcpEndpoint","parameters":[],"responses":{"200":{"description":"A JSON-RPC 2.0 response (MCP)."}},"security":[{"access-token":[]}],"summary":"MCP Streamable HTTP endpoint (stub)","tags":["MCP"]}},"/v1/connector-uploads/{id}":{"get":{"description":"Returns an upload link an AI connector asked the signed-in person for: where the file will go (`target`), its status, and when it expires. Only the person it was issued to can read it; any other id is 404. Refused to AI connector tokens.","operationId":"ConnectorUploads.get","parameters":[{"name":"id","required":true,"in":"path","description":"The upload id from the AI connector's `upload_file` link.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ConnectorUploadV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"403":{"description":"Possible error codes: MCP_CONFIRMATION_SELF","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Get a connector upload link","tags":["Auth"],"x-connector-forbidden":true,"x-error-codes":["NOT_FOUND","MCP_CONFIRMATION_SELF"],"x-required-scopes":["org:read"]}},"/v1/connector-uploads/{id}/file":{"post":{"description":"The signed-in person uploads the file their AI connector asked for. The link's target operation runs now, as the person (with their own scopes and the org's AI-connector level), and is recorded as done through the connector. Answers 200 with the link: `uploaded` with the operation's `result`, or `failed` with its `error`. A link takes one file, once, within 30 minutes (`MCP_UPLOAD_INVALID` otherwise); any other id is 404. Refused to AI connector tokens.","operationId":"ConnectorUploads.uploadFile","parameters":[{"name":"id","required":true,"in":"path","description":"The upload id from the AI connector's `upload_file` link.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"The file. The target operation's own type and size rules apply."}}}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ConnectorUploadV1Dto"},"meta":{"$ref":"#/components/schemas/EnvelopeMetaDto"}},"required":["data","meta"]}}}},"400":{"description":"Possible error codes: VALIDATION_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"403":{"description":"Possible error codes: MCP_CONFIRMATION_SELF","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"404":{"description":"Possible error codes: NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}},"409":{"description":"Possible error codes: MCP_UPLOAD_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetailsDto"}}}}},"security":[{"access-token":[]}],"summary":"Upload the file for a connector upload link","tags":["Auth"],"x-connector-forbidden":true,"x-error-codes":["NOT_FOUND","MCP_UPLOAD_INVALID","MCP_CONFIRMATION_SELF","VALIDATION_FAILED"],"x-required-scopes":["org:read"]}}},"info":{"title":"Acreum ERP API","description":"Multi-industry ERP backend. The same API serves the Acreum frontend,\ncustomer backends, and AI agents — credentials differ (Supabase JWT or\n`live_*` API key), the contract is identical.\n\n**Authentication.** Send `Authorization: Bearer <token>` on every request.\nA token starting with `live_` resolves through the API-key strategy; any\nother token resolves through the Supabase JWT strategy. Both produce the\nsame internal `Principal` abstraction; downstream behaviour does not\nbranch on credential type.\n\n**Versioning.** Every public endpoint is mounted under `/v1`. Breaking\nchanges require a new major version with a written deprecation policy.\nPre-GA, the contract is in flux; post-GA, it is a contract.\n\n**Responses.** Every success uses `{ \"data\": ..., \"meta\": { ... } }`.\nEvery error uses RFC 7807 Problem+JSON with a stable `code` field and a\n`request_id` for support correlation.\n\n**Lists.** Cursor pagination via `?cursor=...&limit=...`. Cursors are\nopaque; do not parse them.\n\n**Mutations.** Send an `Idempotency-Key` header on every `POST` and\nstate-changing action. The key is any client-chosen string matching\n`^[A-Za-z0-9_-]{1,255}$` — a UUID v4 is the simplest correct choice, but\nthe server does not require one. The same key replays the same response\nwithin a 24-hour window; a different body with the same key returns 409.\nWhether an operation *demands* the header is machine-readable: it is the\n`required` flag on its `Idempotency-Key` parameter. Operations that\ndeclare it optional honour a key when you send one and process the\nrequest unprotected when you do not.","version":"1.0","contact":{}},"tags":[{"name":"Auth","description":"Authentication primitives owned by the API. The frontend sign-in, session refresh, and password reset flows continue to use Supabase end-to-end and are NOT surfaced under this tag."},{"name":"API Keys","description":"First-party admin endpoints for issuing, listing, rotating, and revoking customer API keys. Governed by the `admin:keys` scope. Secrets are shown exactly once at creation; only the `live_XXXX` prefix is retained for audit."},{"name":"Org","description":"Per-org settings owned by the calling principal — name, industry, configuration. One org per tenant; multi-tenancy is enforced at the data layer via `org_id` plus row-level security."},{"name":"Legal Entities","description":"Legal-entity (LLC, corporation, trust, sole-proprietorship) records, beneficial-owner cap-table membership, and member roles. LE-scoped API keys are bound to one of these."},{"name":"Parties","description":"Tenants, vendors, owners, and other counterparties. Parties are organization-scoped; legal-entity selection happens at document creation time."},{"name":"Party Categories","description":"Per-org reference data — the taxonomy used to categorise parties. Seed rows are immutable."},{"name":"Accounting","description":"Read-only access to the immutable General Ledger — chart of accounts plus account-type / detail-type reference data and aggregated GL activity. The journals catalogue lives under a sibling tag."},{"name":"Documents","description":"Invoices, bills, expenses, payments, credit memos, vendor credits, and journal-entry documents. Lifecycle: `draft → approved? → posting_pending → posted | posting_failed | voided`. State changes route through RPC actions (`/post`, `/void`, `/reverse`, `/duplicate`); journals tables are append-only — corrections require new documents."},{"name":"Journals","description":"Posted journal entries and their lines. Append-only by architectural invariant — corrections route through credit memos, vendor credits, or new journal-entry documents that drain through the posting engine. No write surface here."},{"name":"Reports","description":"Read-only aggregations over the GL — Profit & Loss, beneficial-owner-income allocation, and other accountant-shaped views."},{"name":"Items","description":"Chart of items — reusable line-item templates referenced from documents and contract terms."},{"name":"Tax Rates","description":"Tax-rate definitions used at line-item level on documents. The list endpoint is shipped as a placeholder pending the schema; the FE consumes it today and the backing table lands in a follow-up."},{"name":"Properties","description":"The buildings and land the org owns. A property does not nest — the subsections inside it are `Spaces`."},{"name":"Spaces","description":"Subsections of a property — floors, suites, units. A space always knows its root property, and nests inside another space via `parent_space_id`."},{"name":"Dimensions","description":"Generic tagging system. Dimensions tag transactions with arbitrary categorisation; an entity-typed dimension names a `value_source` (`property` | `space`) and pulls its values from that table."},{"name":"Bank Accounts","description":"Bank-account configuration — Plaid-linked or manually-created cash accounts owned by a legal entity."},{"name":"Banking Transactions","description":"Bank transactions imported from Plaid or created manually. State-transition RPC actions (`/process`, `/revert`, `/exclude`, `/include`, `/categorize-as-ic-settlement`) live alongside the CRUD."},{"name":"Contract Types","description":"Per-org reference data — the list of valid contract-type codes (`management`, `lease`, etc.). Seed taxonomy (system rows) is immutable from the HTTP surface."},{"name":"Term Types","description":"Per-org reference data for contract-term type codes (rent, management fee, expense reimbursement, etc.). Used by the contracts module."},{"name":"Contracts","description":"Contracts, contract terms, and the properties and spaces a contract is on. Lifecycle: draft → active → ended. Contract terms drive billing schedules and accounting recognition."},{"name":"Billing Schedules","description":"Recurring-billing automation. Generates invoice and bill documents on cadence from contract terms; idempotent by document key so the scheduler can safely re-run."},{"name":"Intercompany","description":"Intercompany transactions and settlements between two legal entities. Settlement RPC actions (`/approve`, `/dispute`, `/post`, `/void`) and aggregate reports (`/position`, `/aging`) live alongside the CRUD."},{"name":"Health","description":"Liveness and readiness probes. `/health` is `@Public()` and outside `/v1` so load balancers and uptime monitors can poll without auth."},{"name":"Metrics","description":"Prometheus metrics endpoint (`/metrics`). `@Public()` and outside `/v1`; production deployments should gate this at the ingress."},{"name":"App","description":"Internal-only utility endpoints (root landing page, version probe, queue example). Outside the versioned `/v1` contract; not part of the public surface."},{"name":"Ping","description":"Synthetic endpoints used by the API-first program's contract pipeline tests. Internal verification surface; not part of the customer-facing contract."}],"servers":[],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"LoginDto":{"type":"object","properties":{"email":{"type":"string","example":"usuario@ejemplo.com"},"password":{"type":"string","example":"mi-password-seguro","minLength":6}},"required":["email","password"]},"MeOrgV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"time_zone":{"type":"string","description":"IANA time zone the org's \"today\" is computed in, e.g. America/New_York."}},"required":["id","name","time_zone"]},"MeV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["user","api_key","sparkiq_internal"]},"org_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"allowed_legal_entity_ids":{"nullable":true,"description":"Legal entities this principal may act on. null = every legal entity in the org.","type":"array","items":{"type":"string"}},"is_spark_staff":{"type":"boolean"},"scopes":{"type":"array","items":{"type":"string"}},"role":{"type":"string","nullable":true,"enum":["owner","admin","accountant","clerk","viewer","facility"],"description":"Org-member role; null for API-key principals."},"include_managed_entities":{"type":"boolean","description":"Whether managed (non-owned) legal entities appear in this principal's legal-entity pickers. Resolved from the principal's `managed-entities` preference, falling back to the org's `default_include_managed_entities`."},"include_managed_entities_source":{"type":"string","enum":["user","org"],"description":"Where `include_managed_entities` came from. 'org' means the principal has expressed no preference and the org default applies."},"org":{"description":"Session context: the org this principal acts in — only what identifies it. Org settings belong on GET /v1/org; do not add them here (see erp-be CLAUDE.md House Style, 'Session context on /v1/me').","allOf":[{"$ref":"#/components/schemas/MeOrgV1Dto"}]}},"required":["id","kind","org_id","legal_entity_id","allowed_legal_entity_ids","is_spark_staff","scopes","role","include_managed_entities","include_managed_entities_source","org"]},"CursorDto":{"type":"object","properties":{"next":{"type":"string","nullable":true,"example":"eyJpZCI6ICJhYmMifQ=="},"has_more":{"type":"boolean","example":true}},"description":"DEPRECATED — never returned by any endpoint. Cursor-paginated lists return `next_cursor` and `limit` directly on `meta` (see CursorEnvelopeMetaDto). Scheduled for removal in the next major version.","required":["next","has_more"]},"EnvelopeMetaDto":{"type":"object","properties":{"request_id":{"type":"string","example":"018f0b3d-2b1e-7c8a-9d4b-1a2b3c4d5e6f"},"api_version":{"type":"string","example":"2026-04-23"},"cursor":{"$ref":"#/components/schemas/CursorDto"},"total_count":{"type":"number","example":1234,"deprecated":true}},"required":["request_id","api_version"]},"MeOrgMembershipV1Dto":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"role":{"type":"string","nullable":true,"enum":["owner","admin","accountant","clerk","viewer","facility"],"description":"The caller's role in this org; null for API-key principals."},"is_current":{"type":"boolean","description":"True for the org this request acts in (the X-Org-Id selection, or the default org)."}},"required":["org_id","name","role","is_current"]},"ValidationErrorDto":{"type":"object","properties":{"field":{"type":"string","example":"amount"},"code":{"type":"string","example":"INVALID_VALUE"},"message":{"type":"string","example":"must be > 0"}},"required":["field","code","message"]},"ProblemDetailsDto":{"type":"object","properties":{"type":{"type":"string","example":"https://docs.acreum.io/errors/DOCUMENT_ALREADY_POSTED"},"title":{"type":"string","example":"Document already posted"},"status":{"type":"number","example":409},"detail":{"type":"string","example":"Document doc_01 is already posted."},"code":{"type":"string","example":"DOCUMENT_ALREADY_POSTED"},"request_id":{"type":"string","example":"018f0b3d-2b1e-7c8a-9d4b-1a2b3c4d5e6f"},"instance":{"type":"string","example":"/v1/documents/doc_01/post"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/ValidationErrorDto"}},"retryable":{"type":"boolean","description":"Whether the same request can succeed unchanged later. Sent only by codes that declare it (the `PLAN_*` codes)."},"next_action":{"type":"string","enum":["fix_step","re_preview","retry_later","split_plan","use_plan_mode","release_first","contact_operator"],"description":"What the caller does next. Sent only by codes that declare it (the `PLAN_*` codes)."}},"required":["type","title","status","detail","code","request_id","instance"]},"ConnectorClientV1Dto":{"type":"object","properties":{"client_id":{"type":"string","description":"The OAuth client id that was looked up."},"client_name":{"type":"string","nullable":true,"description":"The name the client registered with, or null when it has none or could not be read."},"redirect_uris":{"description":"The redirect URIs the client registered. Empty when the client could not be read.","type":"array","items":{"type":"string"}},"allowed":{"type":"boolean","description":"Whether this client may connect: true only when every registered redirect URI is on the connector allowlist. An unknown client, or one that could not be verified, is false."}},"required":["client_id","client_name","redirect_uris","allowed"]},"ConnectorConfirmationV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The confirmation id."},"status":{"type":"string","enum":["pending","confirmed","declined","consumed","expired"],"description":"`pending` until the person confirms or declines; `confirmed` until the connector re-sends the call; `consumed` once that re-send ran; `declined` when the person said no; `expired` when a pending or confirmed confirmation passed `expires_at` unused."},"operation_id":{"type":"string","description":"The operation the AI connector asked to run (its `operationId` in this contract)."},"summary":{"type":"object","additionalProperties":true,"description":"What the person is confirming, shown before the click. Its shape is set by the server and may change: for a single call `{ operation_summary, method, path, path_params, query, key_body_fields, omitted_body_fields, omitted_body_fields_more, target }`, where `query` is every query parameter as text (repeats as an array), `key_body_fields` the top-level body fields (a nested value as its JSON text; a body that is an array or a scalar is one field, `(body)`), `omitted_body_fields` the names of body fields left out (past 20 fields, over 1000 characters of JSON, or a name over 200 characters, shown cut), at most 50, `omitted_body_fields_more` how many more were left out beyond those 50, and `target` is the record the call acts on (read by its own GET, or null); for a plan commit, `{ kind: \"plan\", plan_id, steps: [{ ref?, method, path, status, summary? }], step_count, truncated }`, capped at 8 KB with no step responses (the full report is `GET /v1/plans/{id}/report`)."},"expires_at":{"type":"string","format":"date-time","description":"When the confirmation stops being usable (15 minutes after it was issued)."},"created_at":{"type":"string","format":"date-time","description":"When it was issued."}},"required":["id","status","operation_id","summary","expires_at","created_at"]},"PermissionItemDto":{"type":"object","properties":{"resource":{"type":"string","description":"A resource catalog key (see GET /v1/permissions/catalog), or '*' for every resource.","example":"documents"},"action":{"type":"string","enum":["view","create","edit","delete","*"]}},"required":["resource","action"]},"SecurityGroupResponseDto":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"is_system":{"type":"boolean","description":"True for the six system-seeded groups (one per legacy org role); false for custom groups."},"base_role":{"type":"string","nullable":true,"description":"The legacy OrgRole this system group mirrors, or null for a custom group."},"permissions":{"type":"array","items":{"$ref":"#/components/schemas/PermissionItemDto"}},"legal_entity_ids":{"description":"Legal entities this group is scoped to. Empty = all entities.","type":"array","items":{"type":"string","format":"uuid"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","description","is_system","base_role","permissions","legal_entity_ids","created_at","updated_at"]},"CreateSecurityGroupDto":{"type":"object","properties":{"name":{"type":"string","description":"Display name, unique per org (case-insensitive)."},"description":{"type":"string"},"permissions":{"type":"array","items":{"$ref":"#/components/schemas/PermissionItemDto"}},"legal_entity_ids":{"description":"Legal entities this group is scoped to. Empty/omitted = all entities.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["name","permissions"]},"UpdateSecurityGroupDto":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"permissions":{"type":"array","items":{"$ref":"#/components/schemas/PermissionItemDto"}},"legal_entity_ids":{"description":"Legal entities this group is scoped to. Empty/omitted = all entities.","type":"array","items":{"type":"string","format":"uuid"}}}},"ResourceDefResponseDto":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"namespace":{"type":"string"},"actions":{"type":"array","description":"Actions this resource supports. Absent means all four (view/create/edit/delete) are allowed.","items":{"type":"string","enum":["view","create","edit","delete"]}},"hidden":{"type":"boolean","description":"FE display only — a resource that exists purely for round-trip losslessness and should not surface in the security-group editor grid. Defaults to false."},"capabilityOnly":{"type":"boolean","description":"A capability resource (the admin:* family and file deletion): no read/write pair, only a single grantable scope surfaced via the `view` action. The FE groups these under an \"Administration\" section and renders a single toggle rather than a V/C/E/D row. Defaults to false."},"requires":{"description":"Read scopes this resource's write flow functionally needs — the lookup data its create/edit forms fetch from other modules, each gated by its own `<ns>:read`. Advisory: the editor warns when a granted write is missing them and offers a one-click add. Empty when the write has no known cross-module read prerequisite (advisory, not a guarantee of none).","type":"array","items":{"type":"string"}}},"required":["key","label","namespace","requires"]},"PermissionCatalogResponseDto":{"type":"object","properties":{"resources":{"type":"array","items":{"$ref":"#/components/schemas/ResourceDefResponseDto"}},"actions":{"type":"array","items":{"type":"string","enum":["view","create","edit","delete"]}}},"required":["resources","actions"]},"ScopeDefResponseDto":{"type":"object","properties":{"scope":{"type":"string","description":"The scope string to send on an API key, e.g. `documents:read`."},"action":{"type":"string","description":"The segment after the colon, e.g. `read`, `write`, `periods_override`."},"label":{"type":"string","description":"Human label for this action within its group, e.g. `Read`."}},"required":["scope","action","label"]},"ScopeGroupResponseDto":{"type":"object","properties":{"key":{"type":"string","description":"The scope namespace, e.g. `documents`."},"label":{"type":"string","description":"Group heading, e.g. `Documents`."},"admin":{"type":"boolean","description":"True for the `admin` group — administrative capabilities rather than a read/write pair. The FE renders these as a separate section and excludes them from bulk \"select all\" toggles."},"requires":{"description":"Read scopes this group's write flow functionally needs — the cross-module lookup data its create/edit forms fetch, each gated by its own `<ns>:read`. Advisory: the API-key modal warns when a granted write is missing them and offers to add them. Empty when the group has no known write dependency (advisory, not a guarantee of none).","type":"array","items":{"type":"string"}},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/ScopeDefResponseDto"}}},"required":["key","label","admin","requires","scopes"]},"ScopeCatalogResponseDto":{"type":"object","properties":{"groups":{"description":"Every scope a customer principal can be granted, grouped by namespace. Staff-only scopes (`admin:*`, `admin:impersonate`) are excluded. The `admin` group is always last.","type":"array","items":{"$ref":"#/components/schemas/ScopeGroupResponseDto"}}},"required":["groups"]},"PartyAddressV1Dto":{"type":"object","properties":{"line1":{"type":"string","nullable":true},"line2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"state":{"type":"string","nullable":true},"postal_code":{"type":"string","nullable":true},"country":{"type":"string","nullable":true}}},"PartyVendorProfileV1Dto":{"type":"object","properties":{"default_terms":{"type":"string","nullable":true,"enum":["due_on_receipt","net_15","net_30","net_45","net_60","net_95"]},"account_number":{"type":"string","nullable":true},"track_1099":{"type":"boolean","nullable":true},"default_billing_rate":{"type":"number","nullable":true},"default_expense_account_id":{"type":"string","format":"uuid","nullable":true,"description":"The GL account prefilled on new bill lines for this vendor in the app, and AP processing's last-resort suggestion (after this vendor's past coding). Must be one of the org's org-wide accounts (not scoped to one legal entity), active, with no child accounts, and not an AR/AP control account (422 DEFAULT_ACCOUNT_NOT_ELIGIBLE); checked only when the value changes. Never applied to a bill line server-side: a line with no account is still refused."},"terms_days":{"type":"number","nullable":true,"minimum":0,"description":"Payment terms in days (due date = bill date + terms_days). Independent of default_terms."}}},"PartyBankAccountReadV1Dto":{"type":"object","properties":{"payment_method":{"type":"string","enum":["ach","check","wire"]},"wire_scope":{"type":"string","nullable":true,"enum":["domestic","international"]},"account_holder_name":{"type":"string","nullable":true},"account_type":{"type":"string","nullable":true,"enum":["checking","savings"]},"bank_name":{"type":"string","nullable":true},"routing_number_last4":{"type":"string","nullable":true,"description":"Last 4 digits of the routing number."},"account_number_last4":{"type":"string","nullable":true,"description":"Last 4 characters of the account number."},"swift_bic":{"type":"string","nullable":true},"bank_address":{"type":"string","nullable":true},"bank_country":{"type":"string","nullable":true},"intermediary_swift_bic":{"type":"string","nullable":true},"intermediary_bank_name":{"type":"string","nullable":true},"receive_currency_code":{"type":"string","nullable":true}},"required":["payment_method","wire_scope","account_holder_name","account_type","bank_name","routing_number_last4","account_number_last4","swift_bic","bank_address","bank_country","intermediary_swift_bic","intermediary_bank_name","receive_currency_code"]},"PartyCategoryRefDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string"},"name":{"type":"string"}},"required":["id","code","name"]},"PartyBalanceByCurrencyDto":{"type":"object","properties":{"currency_code":{"type":"string"},"amount":{"type":"string","example":"1234.50"},"overdue_amount":{"type":"string","example":"1234.50"}},"required":["currency_code","amount","overdue_amount"]},"PartyBalanceSideDto":{"type":"object","properties":{"primary_currency":{"type":"string","nullable":true,"description":"The single currency for this side when unambiguous; null if none or (when mixed) the largest-amount currency is reported in amount."},"amount":{"type":"string","description":"Open total in primary_currency (0 when none).","example":"1234.50"},"overdue_amount":{"type":"string","description":"Overdue subset of amount, in primary_currency.","example":"1234.50"},"is_multi_currency":{"type":"boolean","description":"True when open documents span more than one currency."},"by_currency":{"type":"array","items":{"$ref":"#/components/schemas/PartyBalanceByCurrencyDto"}}},"required":["primary_currency","amount","overdue_amount","is_multi_currency","by_currency"]},"PartyOpenBalanceDto":{"type":"object","properties":{"receivable":{"$ref":"#/components/schemas/PartyBalanceSideDto"},"payable":{"$ref":"#/components/schemas/PartyBalanceSideDto"}},"required":["receivable","payable"]},"PartyDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"tax_id":{"type":"string","nullable":true},"tax_id_type":{"type":"string","nullable":true,"enum":["ssn","ein"]},"company_name":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"first_name":{"type":"string","nullable":true},"middle_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"suffix":{"type":"string","nullable":true},"print_on_check_name":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"email_cc":{"type":"string","nullable":true},"email_bcc":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"external_ref":{"type":"string","nullable":true,"description":"Another system's key for this record, unique in the org; set by an importer."},"address":{"nullable":true,"description":"Populated on detail responses (get/create/update); null in list responses.","type":"object","allOf":[{"$ref":"#/components/schemas/PartyAddressV1Dto"}]},"vendor_profile":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/PartyVendorProfileV1Dto"}]},"bank_account":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/PartyBankAccountReadV1Dto"}]},"party_category":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/PartyCategoryRefDto"}]},"legal_entity_id":{"type":"string","readOnly":true,"nullable":true,"format":"uuid","description":"Set when this party represents a legal entity (system-managed; not writable)."},"is_entity_owner":{"type":"boolean","description":"True when the party currently owns (a share of) at least one legal entity, including in-group mirror parties. Owners get the Payment step like vendors."},"roles":{"description":"Party role codes, validated against the org's configurable party_role_types.","type":"array","items":{"type":"string"}},"is_active":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","nullable":true,"format":"date-time"},"open_balance":{"description":"Aggregated open + overdue balances (receivable/payable) from posted documents with a positive balance. No FX conversion — grouped by document currency.","allOf":[{"$ref":"#/components/schemas/PartyOpenBalanceDto"}]}},"required":["id","org_id","name","email","phone","tax_id","tax_id_type","company_name","title","first_name","middle_name","last_name","suffix","print_on_check_name","website","email_cc","email_bcc","notes","external_ref","address","vendor_profile","bank_account","party_category","legal_entity_id","is_entity_owner","roles","is_active","created_at","updated_at","open_balance"]},"PartyBankAccountWriteV1Dto":{"type":"object","properties":{"payment_method":{"type":"string","enum":["ach","check","wire"]},"wire_scope":{"type":"string","enum":["domestic","international"],"description":"Required when payment_method is wire."},"account_holder_name":{"type":"string","maxLength":70,"description":"Account holder name. ACH limits it to 22 characters (NACHA individual-name field); wires allow 70."},"account_type":{"type":"string","enum":["checking","savings"],"description":"Required for ACH; null/omitted for check."},"bank_name":{"type":"string","maxLength":64},"routing_number":{"type":"string","description":"9-digit ABA routing number. Optional on update — omit to keep the stored value."},"account_number":{"type":"string","maxLength":34,"description":"Account number or IBAN (≤34, alphanumeric; ACH allows ≤17). Optional on update — omit to keep the stored value. Surrounding whitespace is trimmed server-side."},"swift_bic":{"type":"string","description":"SWIFT/BIC code (8 or 11 characters, upper-cased server-side). Required for international wires."},"bank_address":{"type":"string","maxLength":140},"bank_country":{"type":"string","description":"2-letter ISO 3166 country of the beneficiary bank."},"intermediary_swift_bic":{"type":"string","description":"SWIFT/BIC of the intermediary bank."},"intermediary_bank_name":{"type":"string","maxLength":64},"receive_currency_code":{"type":"string","description":"Currency the beneficiary account receives (ISO 4217). Required for international wires."}},"required":["payment_method"]},"CreatePartyV1Dto":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"email":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"tax_id":{"type":"string","nullable":true},"tax_id_type":{"type":"string","nullable":true,"enum":["ssn","ein"]},"company_name":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"first_name":{"type":"string","nullable":true},"middle_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"suffix":{"type":"string","nullable":true},"print_on_check_name":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"email_cc":{"type":"string","nullable":true},"email_bcc":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"external_ref":{"type":"string","nullable":true,"minLength":1,"maxLength":200,"description":"Another system's key for this record, unique in the org; set by an importer."},"address":{"description":"Full replacement of the party's single address — omitted fields are cleared, not merged; an empty/all-null object omits the address. `country` defaults to 'US' when a row is persisted.","allOf":[{"$ref":"#/components/schemas/PartyAddressV1Dto"}]},"vendor_profile":{"description":"Vendor-only additional info. Omitted/empty → no profile row.","allOf":[{"$ref":"#/components/schemas/PartyVendorProfileV1Dto"}]},"bank_account":{"description":"Vendor bank/ACH details. Omitted/empty → no row.","allOf":[{"$ref":"#/components/schemas/PartyBankAccountWriteV1Dto"}]},"party_category_id":{"type":"string","format":"uuid"},"party_category_code":{"type":"string","description":"Alternative to party_category_id — resolved by lookup within the caller's org."},"roles":{"description":"Party role codes, validated against the org's configurable party_role_types. Unknown or inactive codes are rejected.","type":"array","items":{"type":"string"}},"is_active":{"type":"boolean","default":true}},"required":["name"]},"UpdatePartyV1Dto":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"email":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"tax_id":{"type":"string","nullable":true},"tax_id_type":{"type":"string","nullable":true,"enum":["ssn","ein"]},"company_name":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"first_name":{"type":"string","nullable":true},"middle_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"suffix":{"type":"string","nullable":true},"print_on_check_name":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"email_cc":{"type":"string","nullable":true},"email_bcc":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"external_ref":{"type":"string","nullable":true,"minLength":1,"maxLength":200,"description":"Another system's key for this record, unique in the org; set by an importer."},"address":{"nullable":true,"description":"Full replacement of the party's single address — omitted fields are cleared, not merged; an empty/all-null object (or null on update) removes the address. `country` defaults to 'US' when a row is persisted.","type":"object","allOf":[{"$ref":"#/components/schemas/PartyAddressV1Dto"}]},"vendor_profile":{"nullable":true,"description":"Vendor-only additional info. Omitted/empty → no profile row.","type":"object","allOf":[{"$ref":"#/components/schemas/PartyVendorProfileV1Dto"}]},"bank_account":{"nullable":true,"description":"Vendor bank/ACH details. Omitted/empty → no row.","type":"object","allOf":[{"$ref":"#/components/schemas/PartyBankAccountWriteV1Dto"}]},"party_category_id":{"type":"string","format":"uuid","nullable":true},"party_category_code":{"type":"string"},"roles":{"description":"Party role codes, validated against the org's configurable party_role_types. Unknown or inactive codes are rejected.","type":"array","items":{"type":"string"}},"is_active":{"type":"boolean"}}},"PartyCategoryDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"code":{"type":"string"},"name":{"type":"string"},"is_system":{"type":"boolean","description":"Seed taxonomy rows are marked is_system=true and cannot be mutated or deleted."},"created_at":{"type":"string","format":"date-time"}},"required":["id","org_id","code","name","is_system","created_at"]},"CreatePartyCategoryV1Dto":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":64},"name":{"type":"string","minLength":1,"maxLength":128}},"required":["code","name"]},"UpdatePartyCategoryV1Dto":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":128}}},"PartyRoleTypeDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"code":{"type":"string"},"name":{"type":"string"},"is_active":{"type":"boolean","description":"Inactive role types are retained for historical references but should not be offered for new party-role assignments."},"is_system":{"type":"boolean","description":"Seed taxonomy rows are marked is_system=true and cannot be deleted."},"created_at":{"type":"string","format":"date-time"}},"required":["id","org_id","code","name","is_active","is_system","created_at"]},"CreatePartyRoleTypeV1Dto":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":64},"name":{"type":"string","minLength":1,"maxLength":128}},"required":["code","name"]},"UpdatePartyRoleTypeV1Dto":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":128},"is_active":{"type":"boolean"}}},"PartyContactPortalAccessV1Dto":{"type":"object","properties":{"status":{"type":"string","enum":["invited","active","revoked"]},"access_role":{"type":"string","enum":["primary","viewer","advisor"]},"last_seen_at":{"type":"string","format":"date-time","nullable":true}},"required":["status","access_role","last_seen_at"]},"PartyContactV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string","nullable":true},"role_label":{"type":"string","nullable":true,"description":"Free-text label such as \"Trustee\" or \"CPA\". Not a permission."},"is_primary":{"type":"boolean"},"receives_notices":{"type":"boolean"},"is_active":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"portal_access":{"nullable":true,"description":"Read-only view of this contact's portal login, if any. Managed under /portal-access.","type":"object","allOf":[{"$ref":"#/components/schemas/PartyContactPortalAccessV1Dto"}]}},"required":["id","party_id","first_name","last_name","email","phone","role_label","is_primary","receives_notices","is_active","created_at","updated_at","portal_access"]},"CreatePartyContactV1Dto":{"type":"object","properties":{"first_name":{"type":"string","minLength":1,"maxLength":120},"last_name":{"type":"string","minLength":1,"maxLength":120},"email":{"type":"string","maxLength":320},"phone":{"type":"string","nullable":true,"maxLength":64},"role_label":{"type":"string","nullable":true,"maxLength":80},"is_primary":{"type":"boolean","default":false},"receives_notices":{"type":"boolean","default":true}},"required":["first_name","last_name","email"]},"UpdatePartyContactV1Dto":{"type":"object","properties":{"first_name":{"type":"string","minLength":1,"maxLength":120},"last_name":{"type":"string","minLength":1,"maxLength":120},"email":{"type":"string","maxLength":320},"phone":{"type":"string","nullable":true,"maxLength":64},"role_label":{"type":"string","nullable":true,"maxLength":80},"is_primary":{"type":"boolean"},"receives_notices":{"type":"boolean"},"is_active":{"type":"boolean","description":"false marks the contact inactive and locks the person out of any portal access they hold."}}},"VendorIdentifierV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["name_alias","sender_email","domain","remit_address","tax_id","bank_fingerprint","invoice_pattern"]},"value_norm":{"type":"string","nullable":true,"description":"The normalized value the identifier is matched on. Null for `bank_fingerprint`: that value is a keyed hash of the bank account and is never shown."},"status":{"type":"string","enum":["learned","confirmed","blocked"],"description":"`learned` — recorded from documents; `confirmed` — stated by a user or derived from the bank account; `blocked` — must never match this party."},"evidence_count":{"type":"number","description":"How many times the identifier has been seen for this party."},"verified_by":{"type":"string","format":"uuid","nullable":true,"description":"The user who last confirmed or blocked it."},"last_seen_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"}},"required":["id","party_id","kind","value_norm","status","evidence_count","verified_by","last_seen_at","created_at"]},"CreateVendorIdentifierV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["name_alias","sender_email","domain","remit_address","tax_id","bank_fingerprint","invoice_pattern"],"description":"`bank_fingerprint` is refused (422): it is derived from the bank account."},"value":{"type":"string","maxLength":500,"description":"The raw value; it is normalized by kind (a name drops corporate suffixes, an email or domain is lower-cased, anything else is trimmed and upper-cased)."}},"required":["kind","value"]},"UpdateVendorIdentifierV1Dto":{"type":"object","properties":{"status":{"type":"string","enum":["confirmed","blocked"]}},"required":["status"]},"WorkItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"module":{"type":"string","description":"Producing module, e.g. \"re_tax\"."},"type":{"type":"string","description":"Producer-defined exception type."},"severity":{"type":"string","enum":["info","warning","critical"]},"entity_type":{"type":"string"},"entity_id":{"type":"string","format":"uuid"},"state":{"type":"string","enum":["open","snoozed","resolved","dismissed"],"description":"Effective state (a lapsed snooze reads as open)."},"payload":{"type":"object","additionalProperties":true},"snoozed_until":{"type":"string","format":"date-time","nullable":true},"resolved_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"due_date":{"type":"string","nullable":true,"format":"date"},"target_roles":{"type":"array","items":{"type":"string"}},"assignee_id":{"type":"string","nullable":true,"format":"uuid"},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"The legal entity this item belongs to; null for an org-wide item."},"dismissed_at":{"type":"string","nullable":true,"format":"date-time"},"dismiss_reason":{"type":"string","nullable":true},"reviewed_at":{"type":"string","nullable":true,"format":"date-time","description":"When a person marked the item reviewed in its routine cycle (spec §4.3); cleared when the cycle closes or the facts change. In a module's undated group there is no cycle, so the mark lasts until the item's facts change."},"reviewed_by":{"type":"string","nullable":true,"format":"uuid","description":"Principal that marked it reviewed — a user id, or an API key's id for a key caller."},"carried_from_objective_id":{"type":"string","nullable":true,"format":"uuid","description":"The FIRST routine occurrence this item was carried out of undecided (spec §8.2 L1). Set once and kept on every later move, decided or not."},"exit_policy":{"type":"string","enum":["dismissible","requires_scope","not_dismissible"],"description":"Who may dismiss or manually resolve this item: anyone with work-items:write, only a caller holding exit_scope, or nobody (it clears when the underlying condition is fixed). Snooze is always allowed."},"exit_scope":{"type":"string","nullable":true,"description":"Scope required to dismiss or resolve, when exit_policy is requires_scope."},"exit_reason":{"type":"string","nullable":true,"description":"Producer-supplied sentence explaining a restrictive exit policy; render verbatim."},"aggregate":{"type":"boolean","description":"True when this row stands for a set of subjects above the cap (spec §5.1). Its subjects are listed by GET /v1/work-items/{id}/subjects. Never dismissible."},"objective_id":{"type":"string","nullable":true,"format":"uuid","description":"The objective this item was resolved into: a deadline (a close, a reconciliation window) or a routine group. Null only on an item written before objectives existed, until the next sweep fills it."},"objective_type":{"type":"string","nullable":true,"description":"The objective's type, e.g. \"routine\" for a routine group or a declared deadline type. Null when objective_id is."},"harm_date":{"type":"string","nullable":true,"format":"date","description":"When this item starts causing damage, the date the list ranks by: today for a critical item; else its own due_date; else its objective's deadline (then harm_date_inherited is true); else null, sorted last."},"harm_date_inherited":{"type":"boolean","description":"True when harm_date is borrowed from the objective's deadline rather than the item's own; show it as \"inherited\"."}},"required":["id","module","type","severity","entity_type","entity_id","state","payload","created_at","updated_at","due_date","target_roles","assignee_id","legal_entity_id","dismissed_at","dismiss_reason","reviewed_at","reviewed_by","carried_from_objective_id","exit_policy","exit_scope","exit_reason","aggregate","objective_id","objective_type","harm_date","harm_date_inherited"]},"NotificationSettingsV1Dto":{"type":"object","properties":{"digest":{"type":"string","enum":["daily","weekly","off"],"example":"daily","description":"How often the Work Center digest notification is sent, at 07:00 in the org's time zone: 'daily' every day, 'weekly' on Mondays only, 'off' never."},"immediates":{"type":"boolean","example":true,"description":"Whether immediate notifications reach the user: a critical item of a type flagged for immediate notice, and an objective going overdue. They are capped per user per org day; over the cap they roll into the next digest. False stops them; the before-deadline and due-today countdown notices are scheduled and still arrive."}},"required":["digest","immediates"]},"PutNotificationSettingsV1Dto":{"type":"object","properties":{"digest":{"type":"string","enum":["daily","weekly","off"],"example":"weekly","description":"How often the Work Center digest notification is sent, at 07:00 in the org's time zone: 'daily' every day, 'weekly' on Mondays only, 'off' never."},"immediates":{"type":"boolean","example":false,"description":"Whether immediate notifications reach the user: a critical item of a type flagged for immediate notice, and an objective going overdue. They are capped per user per org day; over the cap they roll into the next digest. False stops them; the before-deadline and due-today countdown notices are scheduled and still arrive."}},"required":["digest","immediates"]},"WorkItemModuleCountsV1Dto":{"type":"object","properties":{"critical":{"type":"number","example":2},"warning":{"type":"number","example":5},"info":{"type":"number","example":0},"total":{"type":"number","example":7}},"required":["critical","warning","info","total"]},"WorkItemSeverityCountsV1Dto":{"type":"object","properties":{"critical":{"type":"number","example":2},"warning":{"type":"number","example":5},"info":{"type":"number","example":0}},"required":["critical","warning","info"]},"WorkItemsSummaryV1Dto":{"type":"object","properties":{"total":{"type":"number","example":7},"by_severity":{"$ref":"#/components/schemas/WorkItemSeverityCountsV1Dto"},"by_module":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/WorkItemModuleCountsV1Dto"},"example":{"re_tax":{"total":6,"critical":2,"warning":4,"info":0},"expense_recovery":{"total":1,"critical":0,"warning":1,"info":0}}}},"required":["total","by_severity","by_module"]},"WorkItemModulePauseV1Dto":{"type":"object","properties":{"reason":{"type":"string","example":"Bank feed down"},"paused_by":{"type":"string","format":"uuid","nullable":true,"description":"Who paused it; null when not recorded."},"paused_at":{"type":"string","format":"date-time"}},"required":["reason","paused_by","paused_at"]},"WorkItemModuleFreshnessV1Dto":{"type":"object","properties":{"module":{"type":"string","example":"insurance"},"last_run_at":{"type":"string","format":"date-time","nullable":true},"last_run_status":{"type":"string","enum":["succeeded","partial","failed"],"nullable":true},"last_checked_at":{"type":"string","format":"date-time","nullable":true,"description":"When this module last checked cleanly. Show it; an empty module with a stale stamp is not an all-clear."},"stale":{"type":"boolean"},"stale_reason":{"type":"string","enum":["never_run","failed","silent","paused"],"nullable":true,"description":"Why the module is stale. `paused`: the org paused its sweep on purpose (see `paused`); its items stay visible but are not being refreshed."},"paused":{"nullable":true,"description":"The org's pause on this module's sweep, or null when it is not paused.","type":"object","allOf":[{"$ref":"#/components/schemas/WorkItemModulePauseV1Dto"}]}},"required":["module","last_run_at","last_run_status","last_checked_at","stale","stale_reason","paused"]},"WorkItemsFreshnessV1Dto":{"type":"object","properties":{"as_of":{"type":"string","format":"date-time"},"stale_after_hours":{"type":"number","example":36},"modules":{"description":"One entry per sweep provider module, sorted by module. Modules fed only by events (no sweep), and modules the org has switched off, are not listed.","type":"array","items":{"$ref":"#/components/schemas/WorkItemModuleFreshnessV1Dto"}}},"required":["as_of","stale_after_hours","modules"]},"ObjectiveGroupBlockerV1Dto":{"type":"object","properties":{"group_key":{"type":"string","description":"The blocking group, as in this list."},"objective_type":{"type":"string","description":"The blocking group's objective type."},"active_item_count":{"type":"number","example":2,"description":"Active items in the blocking group; always above zero."}},"required":["group_key","objective_type","active_item_count"]},"ObjectiveGroupObjectiveV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The objective. Its items: GET /v1/work-items?objective_id=<id>."},"entity_type":{"type":"string","nullable":true,"description":"What the objective is about; null for a routine objective."},"entity_id":{"type":"string","nullable":true,"format":"uuid"},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"Null for an org-wide objective."},"state":{"type":"string","enum":["open","completed","satisfied_with_exceptions"]},"active_item_count":{"type":"number","example":1,"description":"Open and lapsed-snoozed items you can see; 0 means clear."},"carried_item_count":{"type":"number","example":0,"description":"Active items carrying a carried-from tag (spec §8.2 L1): items once carried out of a routine occurrence undecided. The tag keeps the FIRST occurrence an item was carried out of and stays on later moves, decided or not."},"reviewed_item_count":{"type":"number","example":0,"description":"Active items a person marked reviewed this cycle (spec §4.3) — an assertion, not a cleared condition."}},"required":["id","entity_type","entity_id","legal_entity_id","state","active_item_count","carried_item_count","reviewed_item_count"]},"ObjectiveGroupV1Dto":{"type":"object","properties":{"group_key":{"type":"string","description":"Stable group id: `<type>:<starts_on>` for a deadline group, the objective key for a routine occurrence, `routine:<module>` for a module's undated group.","example":"bank_statement_period:2026-07-01"},"kind":{"type":"string","enum":["deadline","routine"]},"objective_type":{"type":"string","description":"The declared deadline objective type, or \"routine\" for a routine group."},"module":{"type":"string","description":"The objectives' module, e.g. \"banking\"."},"series_key":{"type":"string","nullable":true,"description":"The routine series of a routine occurrence; null otherwise."},"starts_on":{"type":"string","nullable":true,"format":"date","description":"First day of the period; null for an undated group."},"ends_on":{"type":"string","nullable":true,"format":"date","description":"Last day of the period (inclusive), the latest among the group's objectives; null for an undated group."},"due_date":{"type":"string","nullable":true,"format":"date","description":"The earliest due date among the group's objectives."},"harm_date":{"type":"string","nullable":true,"format":"date","description":"The soonest harm_date among the group's active items (see GET /v1/work-items); the list is ordered by it ascending, then by due_date, nulls last."},"overdue_days":{"type":"number","nullable":true,"example":3,"description":"Days past the earliest due date among the group's still-open objectives, in the org's time zone. That date may differ from due_date, which is the earliest over all objectives, completed ones included. Null when no open objective is late."},"critical":{"type":"boolean","description":"True when the group is overdue. The group escalates, not its items: each item keeps its own severity."},"objective_count":{"type":"number","example":40,"description":"Objectives in the group."},"clear_count":{"type":"number","example":37,"description":"Objectives in the group holding no active item."},"active_item_count":{"type":"number","example":5,"description":"Open and lapsed-snoozed items in the group you can see."},"dismissed_item_count":{"type":"number","example":1,"description":"Dismissed items in the group: a dismissal clears an objective, so show \"4 clear · 1 dismissed\"."},"carried_item_count":{"type":"number","example":0,"description":"Active items carrying a carried-from tag (spec §8.2 L1): items once carried out of a routine occurrence undecided. The tag keeps the FIRST occurrence an item was carried out of and stays on later moves, decided or not. Shown on the header: a group that keeps carrying is a signal."},"reviewed_item_count":{"type":"number","example":0,"description":"Active items a person marked reviewed this cycle (spec §4.3) — an assertion, not a cleared condition."},"blocked_by":{"description":"Groups of a type declared to block this one whose period overlaps it and that still hold active items. Their items stay in their own group.","type":"array","items":{"$ref":"#/components/schemas/ObjectiveGroupBlockerV1Dto"}},"objectives":{"description":"Every objective in the group, those holding items first.","type":"array","items":{"$ref":"#/components/schemas/ObjectiveGroupObjectiveV1Dto"}}},"required":["group_key","kind","objective_type","module","series_key","starts_on","ends_on","due_date","harm_date","overdue_days","critical","objective_count","clear_count","active_item_count","dismissed_item_count","carried_item_count","reviewed_item_count","blocked_by","objectives"]},"WorkItemObjectivePageV1Dto":{"type":"object","properties":{"objective_id":{"type":"string","format":"uuid"},"items":{"description":"Active items, soonest harm_date first (sort=harm_date).","type":"array","items":{"$ref":"#/components/schemas/WorkItemV1Dto"}},"next_cursor":{"type":"string","nullable":true,"description":"Cursor for the next page of this objective: pass it to GET /v1/work-items with objective_id, state=active, sort=harm_date and the same severity. Null when there is no more."}},"required":["objective_id","items","next_cursor"]},"WorkItemSubjectV1Dto":{"type":"object","properties":{"subject_key":{"type":"string","description":"The subject's dedup key. Pass it (URL-encoded) to the subject claim and dismiss routes."},"type":{"type":"string","description":"Producer-defined exception type."},"severity":{"type":"string","enum":["info","warning","critical"]},"entity_type":{"type":"string"},"entity_id":{"type":"string"},"legal_entity_id":{"type":"string","nullable":true,"description":"The legal entity this subject belongs to; null for an org-wide subject."},"due_date":{"type":"string","nullable":true,"format":"date"},"payload":{"type":"object","additionalProperties":true,"description":"Producer-defined detail for this subject."}},"required":["subject_key","type","severity","entity_type","entity_id","legal_entity_id","due_date","payload"]},"WorkItemSubjectsMetaV1Dto":{"type":"object","properties":{"next_cursor":{"type":"string","description":"Opaque cursor for the next page, or null when this is the last page. Pass it back as `?cursor=`. Always present; do not parse it.","nullable":true,"example":"eyJpZCI6ICJhYmMifQ=="},"limit":{"type":"number","description":"Page size used for this response.","example":50},"request_id":{"type":"string","example":"018f0b3d-2b1e-7c8a-9d4b-1a2b3c4d5e6f"},"api_version":{"type":"string","example":"2026-04-23"},"total_count":{"type":"number","nullable":true,"description":"Live count of subjects you can see, excluding promoted ones. Null when stale."},"stale":{"type":"boolean","description":"True when the producer did not answer within the timeout; data is then empty."},"as_of":{"type":"string","format":"date","description":"The org's today, the date the subjects were evaluated for."}},"required":["next_cursor","limit","request_id","api_version","total_count","stale","as_of"]},"DismissWorkItemDto":{"type":"object","properties":{"reason":{"type":"string","description":"Why this item is acceptable. Recorded against the dismissal; required. Must contain at least one non-whitespace character.","minLength":1},"suppression":{"type":"string","enum":["until_changed","until_date","permanently"],"default":"until_changed","description":"Defaults to until_changed, which reopens the item if the underlying facts move. permanently requires an elevated role (attention:dismiss_permanent)."},"until":{"type":"string","format":"date-time","description":"Required when suppression is until_date."}},"required":["reason"]},"SnoozeWorkItemDto":{"type":"object","properties":{"snooze_until":{"type":"string","format":"date-time","description":"ISO-8601 timestamp to snooze the item until."}},"required":["snooze_until"]},"AssignWorkItemDto":{"type":"object","properties":{"assignee_id":{"type":"string","format":"uuid","description":"Org member to assign this item to."}},"required":["assignee_id"]},"RoutineSeriesV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"module":{"type":"string","example":"banking"},"series_key":{"type":"string","example":"monthly_bank_review","description":"Derived from the name on create (a snake_case slug) and never changes, even when the series is renamed."},"name":{"type":"string","example":"Monthly bank review"},"cadence":{"type":"string","enum":["weekly","fortnightly","monthly","quarterly"]},"anchor":{"type":"string","format":"date","description":"Any start day of the cycle; every period starts a whole number of cadence steps from it (a monthly anchor of 2026-01-31 starts Feb 28, then Mar 31)."},"effective_from":{"type":"string","format":"date","description":"The org's today when the series was created or its cadence or anchor last changed; never an input. No occurrence before the one containing it is generated."},"item_types":{"example":["banking.unmatched_transaction"],"type":"array","items":{"type":"string"}}},"required":["id","module","series_key","name","cadence","anchor","effective_from","item_types"]},"ModulePolicyV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","nullable":true,"description":"The stored policy row. Null while the module has never been configured (it is on and not paused)."},"module":{"type":"string","example":"banking"},"enabled":{"type":"boolean","description":"Off hides the module everywhere in the Work Center and stops its sweep; nothing is deleted, and turning it back on restores everything."},"paused":{"type":"boolean","description":"Paused stops only the module's provider sweep; its items stay visible and actionable. This is the stored switch: while enabled is false the module is hidden and its sweep skipped whatever paused says, and the pause is kept for when it is turned back on."},"paused_reason":{"type":"string","nullable":true},"paused_by":{"type":"string","format":"uuid","nullable":true},"paused_at":{"type":"string","format":"date-time","nullable":true,"description":"When the pause began. Re-pausing to edit the reason keeps it."},"routine_series":{"description":"The module's routine series, by series_key.","type":"array","items":{"$ref":"#/components/schemas/RoutineSeriesV1Dto"}}},"required":["id","module","enabled","paused","paused_reason","paused_by","paused_at","routine_series"]},"PutModulePolicyV1Dto":{"type":"object","properties":{"enabled":{"type":"boolean"},"paused":{"type":"boolean"},"paused_reason":{"type":"string","description":"Why the sweep is paused. Required when paused is true, and must contain a non-whitespace character; ignored otherwise.","minLength":1,"maxLength":500}},"required":["enabled","paused"]},"DryRunItemV1Dto":{"type":"object","properties":{"type":{"type":"string","example":"ar.unapplied_cash"},"dedup_key":{"type":"string","description":"The item's dedup key: what makes it the same item from one sweep to the next."},"severity":{"type":"string","enum":["info","warning","critical"]},"legal_entity_id":{"type":"string","format":"uuid","nullable":true},"entity_type":{"type":"string","nullable":true},"entity_id":{"type":"string","nullable":true},"aggregate":{"type":"boolean","description":"An aggregate stands for a set of subjects above the per-check cap."},"payload":{"type":"object","additionalProperties":true,"description":"The item's facts, as the provider wrote them; a title is rendered from type and payload, as for a live item."}},"required":["type","dedup_key","severity","legal_entity_id","entity_type","entity_id","aggregate","payload"]},"DryRunV1Dto":{"type":"object","properties":{"module":{"type":"string","example":"banking"},"as_of":{"type":"string","format":"date","description":"The date the provider ran as of: today's UTC date, as the nightly sweep uses, so this previews tonight's run."},"would_create":{"description":"The items the run would create, at most 500; would_create_count is exact past that.","type":"array","items":{"$ref":"#/components/schemas/DryRunItemV1Dto"}},"would_create_count":{"type":"number","description":"How many items the run would create."},"existing_count":{"type":"number","description":"Items already listed that the run would refresh in place, not create."},"would_resolve_count":{"type":"number","description":"Listed items the run would resolve because their condition no longer holds."},"errored_count":{"type":"integer","description":"Upserts that failed. When above 0 the preview is incomplete: inside the rolled-back transaction a database error aborts every later write."},"truncated":{"type":"boolean","description":"True when would_create was cut at 500."},"error":{"type":"string","nullable":true,"description":"The provider's error when it threw (the counts and items are what it produced before); otherwise, when errored_count is above 0, a note that the preview is incomplete; null on a clean run."}},"required":["module","as_of","would_create","would_create_count","existing_count","would_resolve_count","errored_count","truncated","error"]},"WorkItemsReplayV1Dto":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid","description":"The queued sweep job: the one this request created, or the one it joined."},"deduped":{"type":"boolean","description":"True when a re-run for the org was already queued (this request joined it) or running (this request asked it to run once more when it ends)."}},"required":["job_id","deduped"]},"CreateRoutineSeriesV1Dto":{"type":"object","properties":{"module":{"type":"string","example":"banking","description":"A configurable Work Center module — one GET /v1/work-items/policies lists."},"name":{"type":"string","minLength":1,"maxLength":100,"description":"Display name, 1–100 characters after trimming. On create the series_key is derived from it."},"cadence":{"type":"string","enum":["weekly","fortnightly","monthly","quarterly"]},"anchor":{"type":"string","format":"date","description":"Any start day of the cycle; every period starts a whole number of cadence steps from it (a monthly anchor of 2026-01-31 starts Feb 28, then Mar 31)."},"item_types":{"description":"Work-item types of the module this series homes: each item of one of these types counts toward the series' current occurrence. A type may belong to one series of the org at most. May be empty.","type":"array","items":{"type":"string"}}},"required":["module","name","cadence","anchor","item_types"]},"UpdateRoutineSeriesV1Dto":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Renames the series; its series_key stays."},"cadence":{"type":"string","enum":["weekly","fortnightly","monthly","quarterly"],"description":"A cadence or anchor change takes effect today: effective_from becomes the org's today."},"anchor":{"type":"string","format":"date","description":"Any start day of the cycle; every period starts a whole number of cadence steps from it (a monthly anchor of 2026-01-31 starts Feb 28, then Mar 31)."},"item_types":{"description":"Work-item types of the module this series homes: each item of one of these types counts toward the series' current occurrence. A type may belong to one series of the org at most. May be empty. Replaces the whole list; an item already in an occurrence moves to its type's new home when that occurrence closes.","type":"array","items":{"type":"string"}}}},"TickSummaryV1Dto":{"type":"object","properties":{"scheduledRun":{"type":"number","description":"Scheduled jobs whose cron fired this tick."},"drained":{"type":"number","description":"Queued jobs drained this tick."},"failed":{"type":"number","description":"Jobs that threw during this tick."},"reclaimed":{"type":"number","description":"Stuck `running` jobs whose lease was reclaimed."},"released":{"type":"number","description":"Claimed jobs handed back unstarted (tick budget spent or reserve did not fit)."},"deadlineHit":{"type":"boolean","description":"True when the tick stopped on its 60s budget with work still pending."}},"required":["scheduledRun","drained","failed","reclaimed","released","deadlineHit"]},"NotificationV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"link":{"type":"string"},"deliver_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"read":{"type":"boolean"},"read_at":{"type":"string","nullable":true,"format":"date-time"}},"required":["id","type","title","body","link","deliver_at","created_at","read","read_at"]},"UnreadCountV1Dto":{"type":"object","properties":{"count":{"type":"number"}},"required":["count"]},"MarkReadResultV1Dto":{"type":"object","properties":{"marked":{"type":"number","description":"Number of notifications marked read."}},"required":["marked"]},"UserPreferenceV1Dto":{"type":"object","properties":{"key":{"type":"string","description":"Preference key (e.g. \"dashboard\")"},"value":{"type":"object","description":"Opaque preference value. Shape is owned by the consumer (e.g. the FE dashboard layout).","additionalProperties":true},"updated_at":{"type":"string","format":"date-time"}},"required":["key","value","updated_at"]},"PutUserPreferenceV1Dto":{"type":"object","properties":{"value":{"type":"object","description":"Opaque preference value. Must be a non-null JSON value.","additionalProperties":true}},"required":["value"]},"JournalSourceDocumentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_number":{"type":"string","nullable":true},"document_type":{"type":"string"}},"required":["id","document_number","document_type"]},"JournalListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","nullable":true},"entry_date":{"type":"string","format":"date"},"status":{"type":"string","description":"Posting lifecycle only — `draft` or `posted`. It does NOT say whether the entry was later reversed: a reversed entry stays `posted` and keeps counting toward the ledger, offset by its contra entry, so that totals net instead of the entry disappearing. Read `reversed_by_journal_entry_id` for that."},"reversed_by_journal_entry_id":{"type":"string","nullable":true,"format":"uuid","description":"The contra entry that reversed this one, or null while it is live. Both entries stay effective and sum to zero, so a reversal offsets the original in the ledger rather than removing it."},"reverses_journal_entry_id":{"type":"string","nullable":true,"format":"uuid","description":"Set when this entry IS a contra entry: the entry it reverses. Null on an original."},"posted_at":{"type":"string","nullable":true,"format":"date-time"},"source_type":{"type":"string","nullable":true},"source_id":{"type":"string","nullable":true,"format":"uuid"},"source_document":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/JournalSourceDocumentV1Dto"}]},"currency_code":{"type":"string"},"memo":{"type":"string","nullable":true},"type":{"type":"string","enum":["standard","intercompany"]},"created_at":{"type":"string","format":"date-time"}},"required":["id","org_id","legal_entity_id","legal_entity_name","entry_date","status","reversed_by_journal_entry_id","reverses_journal_entry_id","posted_at","source_type","source_id","source_document","currency_code","memo","type","created_at"]},"UntaggedIntercompanyBalanceV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"balance":{"type":"string","description":"Debit minus credit on posted, effective lines of this entity that name no counterparty entity. Positive on Due From is owed to the entity; negative on Due To is owed by it.","example":"1234.50"}},"required":["account_id","balance"]},"UntaggedIntercompanyBalancesV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"balances":{"type":"array","items":{"$ref":"#/components/schemas/UntaggedIntercompanyBalanceV1Dto"}}},"required":["legal_entity_id","balances"]},"JournalLineV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"account_code":{"type":"string"},"account_name":{"type":"string"},"debit":{"type":"string"},"credit":{"type":"string"},"description":{"type":"string","nullable":true}},"required":["id","account_id","account_code","account_name","debit","credit","description"]},"JournalDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","nullable":true},"entry_date":{"type":"string","format":"date"},"status":{"type":"string","description":"Posting lifecycle only — `draft` or `posted`. It does NOT say whether the entry was later reversed: a reversed entry stays `posted` and keeps counting toward the ledger, offset by its contra entry, so that totals net instead of the entry disappearing. Read `reversed_by_journal_entry_id` for that."},"reversed_by_journal_entry_id":{"type":"string","nullable":true,"format":"uuid","description":"The contra entry that reversed this one, or null while it is live. Both entries stay effective and sum to zero, so a reversal offsets the original in the ledger rather than removing it."},"reverses_journal_entry_id":{"type":"string","nullable":true,"format":"uuid","description":"Set when this entry IS a contra entry: the entry it reverses. Null on an original."},"posted_at":{"type":"string","nullable":true,"format":"date-time"},"source_type":{"type":"string","nullable":true},"source_id":{"type":"string","nullable":true,"format":"uuid"},"source_document":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/JournalSourceDocumentV1Dto"}]},"currency_code":{"type":"string"},"memo":{"type":"string","nullable":true},"type":{"type":"string","enum":["standard","intercompany"]},"created_at":{"type":"string","format":"date-time"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/JournalLineV1Dto"}}},"required":["id","org_id","legal_entity_id","legal_entity_name","entry_date","status","reversed_by_journal_entry_id","reverses_journal_entry_id","posted_at","source_type","source_id","source_document","currency_code","memo","type","created_at","lines"]},"AccountListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"code":{"type":"string"},"name":{"type":"string"},"system_role":{"type":"string","nullable":true},"account_type_code":{"type":"string"},"account_type_name":{"type":"string"},"account_detail_type_code":{"type":"string"},"account_detail_type_name":{"type":"string"},"is_active":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"parent_account_id":{"type":"string","nullable":true,"format":"uuid"},"depth":{"type":"number","description":"Depth in the account tree; 0 = top-level root."},"is_ancestor_only":{"type":"boolean","description":"True when this row is included only as an ancestor of a filtered match (context row), not itself a match. Always false in unfiltered listings."},"cash_flow_category":{"type":"string","nullable":true,"enum":["operating","investing","financing","cash"],"description":"Manual cash-flow classification override; null = use derived."},"cash_flow_category_derived":{"type":"string","enum":["operating","investing","financing","cash"],"description":"Category derived from account type + system role + bank link."}},"required":["id","org_id","legal_entity_id","code","name","system_role","account_type_code","account_type_name","account_detail_type_code","account_detail_type_name","is_active","created_at","parent_account_id","depth","is_ancestor_only","cash_flow_category","cash_flow_category_derived"]},"AccountTypeV1Dto":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"normal_balance":{"type":"string","enum":["debit","credit"]},"financial_statement":{"type":"string"}},"required":["code","name","normal_balance","financial_statement"]},"AccountDetailTypeV1Dto":{"type":"object","properties":{"code":{"type":"string"},"account_type_code":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true}},"required":["code","account_type_code","name","description"]},"SystemRoleMetaV1Dto":{"type":"object","properties":{"code":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"}},"required":["code","label","description"]},"AccountMetaV1Dto":{"type":"object","properties":{"account_types":{"type":"array","items":{"$ref":"#/components/schemas/AccountTypeV1Dto"}},"account_detail_types":{"type":"array","items":{"$ref":"#/components/schemas/AccountDetailTypeV1Dto"}},"system_roles":{"type":"array","items":{"$ref":"#/components/schemas/SystemRoleMetaV1Dto"}}},"required":["account_types","account_detail_types","system_roles"]},"AccountDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"parent_account_id":{"type":"string","nullable":true,"format":"uuid"},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"code":{"type":"string"},"name":{"type":"string"},"account_type_code":{"type":"string"},"account_detail_type_code":{"type":"string"},"system_role":{"type":"string","nullable":true},"is_active":{"type":"boolean"},"cash_flow_category":{"type":"string","nullable":true,"enum":["operating","investing","financing","cash"],"description":"Manual cash-flow classification override; null = use derived."},"cash_flow_category_derived":{"type":"string","enum":["operating","investing","financing","cash"],"description":"Category derived from account type + system role + bank link."}},"required":["id","parent_account_id","legal_entity_id","code","name","account_type_code","account_detail_type_code","system_role","is_active","cash_flow_category","cash_flow_category_derived"]},"CreateAccountV1Dto":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":64},"name":{"type":"string","minLength":1,"maxLength":200},"account_type_code":{"type":"string"},"account_detail_type_code":{"type":"string"},"parent_account_id":{"type":"string","format":"uuid","nullable":true},"legal_entity_id":{"type":"string","format":"uuid","nullable":true,"description":"Optional legal entity scope. When omitted or null, the account is org-wide."},"is_active":{"type":"boolean","default":true}},"required":["code","name","account_type_code","account_detail_type_code"]},"UpdateAccountV1Dto":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"is_active":{"type":"boolean"},"cash_flow_category":{"type":"string","nullable":true,"enum":["operating","investing","financing","cash"],"description":"Cash-flow classification override; send null to revert to derived."}}},"SystemRoleAssignmentAccountV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string"},"name":{"type":"string"},"account_type_code":{"type":"string"},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"is_active":{"type":"boolean"}},"required":["id","code","name","account_type_code","legal_entity_id","is_active"]},"SystemRoleAssignmentV1Dto":{"type":"object","properties":{"role":{"type":"string","enum":["accounts_receivable","accounts_payable","customer_refunds_payable","cash_operating","cash_trust","intercompany_due_from","intercompany_due_to","deferred_revenue","retained_earnings","opening_balance_equity","undeposited_funds","ic_rounding_adjustment","distributions_payable","distributions_held","incentive_fee_payable","incentive_fee_expense","owner_distributions_equity","distributions_receivable","contributed_capital","contributions_receivable","contributions_payable","investment_in_subsidiary","dividend_income","accrued_rent_receivable","cam_recovery_income","percentage_rent_income","administrative_fee_income","late_fee_income","loan_clearing","notes_payable","notes_receivable","interest_expense","interest_income","accrued_interest_payable","accrued_interest_receivable","property_tax_expense","insurance_expense","fixed_assets","accumulated_depreciation","depreciation_expense","construction_in_progress","gain_loss_on_disposal","impairment_loss","asset_disposal_clearing","debt_service_payable","prepayment_penalty_expense","prepayment_fee_income","loan_late_fee_expense","loan_late_fee_income","loan_escrow_asset","loan_escrow_liability","hedge_settlement_expense","hedge_premium_asset","hedge_termination_gain_loss","fixed_asset_transfer_clearing"]},"label":{"type":"string"},"description":{"type":"string"},"compatible_account_types":{"type":"array","items":{"type":"string"}},"assignments":{"description":"All accounts currently holding this role across buckets. Org-wide first (legal_entity_id=null), then LE-scoped overrides.","type":"array","items":{"$ref":"#/components/schemas/SystemRoleAssignmentAccountV1Dto"}}},"required":["role","label","description","compatible_account_types","assignments"]},"SystemRoleReassignResultV1Dto":{"type":"object","properties":{"role":{"type":"string","enum":["accounts_receivable","accounts_payable","customer_refunds_payable","cash_operating","cash_trust","intercompany_due_from","intercompany_due_to","deferred_revenue","retained_earnings","opening_balance_equity","undeposited_funds","ic_rounding_adjustment","distributions_payable","distributions_held","incentive_fee_payable","incentive_fee_expense","owner_distributions_equity","distributions_receivable","contributed_capital","contributions_receivable","contributions_payable","investment_in_subsidiary","dividend_income","accrued_rent_receivable","cam_recovery_income","percentage_rent_income","administrative_fee_income","late_fee_income","loan_clearing","notes_payable","notes_receivable","interest_expense","interest_income","accrued_interest_payable","accrued_interest_receivable","property_tax_expense","insurance_expense","fixed_assets","accumulated_depreciation","depreciation_expense","construction_in_progress","gain_loss_on_disposal","impairment_loss","asset_disposal_clearing","debt_service_payable","prepayment_penalty_expense","prepayment_fee_income","loan_late_fee_expense","loan_late_fee_income","loan_escrow_asset","loan_escrow_liability","hedge_settlement_expense","hedge_premium_asset","hedge_termination_gain_loss","fixed_asset_transfer_clearing"]},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"account_id":{"type":"string","nullable":true,"format":"uuid","description":"Account this reassignment is anchored to — the new holder when assigning, or the cleared account when clearing. Null when the operation was a no-op (clearing an already-empty bucket). Used as the audit-log resource id."},"previous":{"nullable":true,"description":"Account that previously held this role in the bucket.","type":"object","allOf":[{"$ref":"#/components/schemas/SystemRoleAssignmentAccountV1Dto"}]},"current":{"nullable":true,"description":"Account that now holds this role in the bucket. `null` when the role was cleared.","type":"object","allOf":[{"$ref":"#/components/schemas/SystemRoleAssignmentAccountV1Dto"}]}},"required":["role","legal_entity_id","account_id","previous","current"]},"ReassignSystemRoleV1Dto":{"type":"object","properties":{"account_id":{"type":"string","nullable":true,"format":"uuid","description":"Account that should hold the role in the requested bucket. `null` clears the role."},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"Bucket to manage. `null` or omitted means the org-wide default. When non-null, the target account must be scoped to this legal entity."}},"required":["account_id"]},"GlActivityRowV1Dto":{"type":"object","properties":{"journal_entry_id":{"type":"string","format":"uuid","description":"The journal entry. On `basis=cash`, a row recognized from a payment, refund payment or debt-service payment carries that CASH EVENT's entry (the entry the cash-basis P&L dates the row on), not the entry of the invoice, bill or refund line it recognizes."},"journal_line_id":{"type":"string","format":"uuid","description":"The journal line. On `basis=cash` a recognized row has no line of its own: this is the invoice, bill or refund line whose share the payment recognizes, or, for debt-service interest, the debt-service entry's accrued-interest relief line. One payment applied twice to the same invoice yields two rows with the same `journal_entry_id` and `journal_line_id`, so the pair is not a unique key on `basis=cash`."},"date":{"type":"string","format":"date","description":"The entry date. On `basis=cash`, a recognized row is dated on the cash event (the payment), as the cash-basis P&L dates it."},"transaction_id":{"type":"string","format":"uuid","description":"Same value as `journal_entry_id`, on both bases."},"transaction_type":{"type":"string","nullable":true},"doc_num":{"type":"string","nullable":true},"customer_vendor":{"type":"string","nullable":true},"account_id":{"type":"string","format":"uuid"},"account_code":{"type":"string"},"account_name":{"type":"string"},"debit":{"type":"string","description":"On `basis=cash`, a recognized row carries the recognized share, not the full amount of the line it names."},"credit":{"type":"string","description":"On `basis=cash`, a recognized row carries the recognized share, not the full amount of the line it names."},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","nullable":true},"memo":{"type":"string","nullable":true}},"required":["journal_entry_id","journal_line_id","date","transaction_id","transaction_type","doc_num","customer_vendor","account_id","account_code","account_name","debit","credit","legal_entity_id","legal_entity_name","memo"]},"GlActivityTotalsV1Dto":{"type":"object","properties":{"debit":{"type":"string"},"credit":{"type":"string"}},"required":["debit","credit"]},"GlActivityMetaV1Dto":{"type":"object","properties":{"next_cursor":{"type":"string","nullable":true,"description":"Opaque cursor for the next page, or null when this is the last page. Pass it back as `?cursor=`. Always present; do not parse it.","example":"eyJpZCI6ICJhYmMifQ=="},"limit":{"type":"number","description":"Page size used for this response."},"totals":{"description":"Debit and credit sums over the whole filtered set, not just this page.","allOf":[{"$ref":"#/components/schemas/GlActivityTotalsV1Dto"}]},"basis":{"type":"string","enum":["accrual","cash"],"description":"The basis these rows were listed on — the `basis` query parameter, `accrual` when omitted."},"request_id":{"type":"string","example":"018f0b3d-2b1e-7c8a-9d4b-1a2b3c4d5e6f"},"api_version":{"type":"string","example":"2026-04-23"}},"required":["next_cursor","limit","totals","basis","request_id","api_version"]},"YearEndCloseCreatedV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"fiscal_year":{"type":"number"},"start_date":{"type":"string","description":"First day of the fiscal year, inclusive."},"end_date":{"type":"string","description":"Last day of the fiscal year, inclusive."},"locked_period_count":{"type":"number","description":"How many accounting periods this close moved from `closed` to `locked`. A period that was ALREADY locked is not counted, because the close did not change it — and reversing will not unlock it either."},"retained_earnings_amount":{"type":"string","description":"The year's net result as a numeric string, REPORTED not posted — closing the year writes no journal entry. This is the same figure the balance sheet derives and shows as Retained Earnings once the year is past. \"0.00\" when revenue exactly equalled expense."},"retained_earnings_side":{"type":"string","enum":["debit","credit","zero"],"description":"Direction of the year's result: 'credit' for net income, 'debit' for net loss, 'zero' when they cancelled."}},"required":["id","fiscal_year","start_date","end_date","locked_period_count","retained_earnings_amount","retained_earnings_side"]},"CreateYearEndCloseV1Dto":{"type":"object","properties":{"fiscal_year":{"type":"number","description":"Fiscal year to close. Resolved against the LE/org fiscal_year_start_month — for FYSM=1 this is the calendar year; for FYSM=4 this names the year that started Apr 1.","minimum":1900,"maximum":2200,"example":2026}},"required":["fiscal_year"]},"YearEndCloseReversedV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"fiscal_year":{"type":"number"},"restored_period_count":{"type":"number","description":"How many periods were returned from `locked` to `closed`. Only periods this close locked are touched, so this can be lower than the original `locked_period_count` if somebody reopened one by hand first."}},"required":["id","fiscal_year","restored_period_count"]},"ReverseYearEndCloseV1Dto":{"type":"object","properties":{"fiscal_year":{"type":"number","minimum":1900,"maximum":2200,"example":2026},"reason":{"type":"string","description":"Why the close is being reversed. Recorded on audit_log and surfaced on the closing-date exceptions report.","minLength":1,"maxLength":500}},"required":["fiscal_year","reason"]},"ReconciliationRowV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"subledger":{"type":"string","enum":["ar","ap"]},"subledger_total":{"type":"string","description":"Sum of balance_amount over every document of a type that posts to this control account AND that actually reached the general ledger (it has a posted journal entry), including zero and negative balances. `paid`, `voided` and `reversed` documents are all still counted — only a document that was never posted is excluded, because its balance has no journal lines behind it to tie to. Payments and credit memos are summed as negatives: their stored balance is positive but their posting reduces the control account. This is deliberately NOT the AR aging widget query, which filters to posted invoices with a positive balance and therefore cannot tie to a control account.","example":"1234.50"},"control_account_total":{"type":"string","description":"Sum of posted, effective journal lines on the control account, for this legal entity. Credit-normal for ap, debit-normal for ar.","example":"1234.50"},"variance":{"type":"string","description":"subledger_total - control_account_total — the RAW difference, before anything is explained. Positive means the subledger claims more than the general ledger does. This number is normally large and normally fine: most of it is control-account movement the subledger has no way to represent. Read `residual_variance` to find out how much of it is actually unexplained.","example":"1234.50"},"unrepresentable_gl_movement":{"type":"string","description":"Control-account movement that NO subledger document could ever account for, measured on the same signed magnitude as control_account_total. Two sources: manual journal entries posted straight at the control account, which have no document balance behind them at all; and document types that reach the control account but are settled on creation — `expense` and `deposit` — whose balance_amount is always zero by design. Adding those types to the tie-out would not help; they would contribute exactly zero. This is structural, not drift, and a large value here is not a finding.","example":"1234.50"},"residual_variance":{"type":"string","description":"variance + unrepresentable_gl_movement — **this is the number that should be zero, and the one to investigate.** It is the part of the difference that nothing structural explains, so a non-zero value means the subledger and the general ledger genuinely disagree about documents they can both see. It is also what makes an incomplete bearing-type list visible: a type that posts to the control account and is missing from the tie-out shows up here rather than passing silently.","example":"1234.50"},"control_account_ids":{"description":"The control account summed: at most one, the account posting resolves for this legal entity (its own role holder, else the org-wide one). A balance left on any other account with the role is not summed, so it shows up as variance.","type":"array","items":{"type":"string","format":"uuid"}},"unperioded_line_count":{"type":"number","description":"Journal lines counted here whose entry has no period_id. Always 0 in a healthy org; a non-zero value is its own finding, because such a row is invisible to period close."}},"required":["legal_entity_id","legal_entity_name","subledger","subledger_total","control_account_total","variance","unrepresentable_gl_movement","residual_variance","control_account_ids","unperioded_line_count"]},"ReconciliationMetaV1Dto":{"type":"object","properties":{"computed_at":{"type":"string","format":"date-time","description":"When this tie-out was computed. The numbers are not as of a period close, and re-running will move them the moment a document balance or a journal line changes. The two sides are separate reads, so a document posting between them can show up on one side only — treat a variance seen once as worth re-running before investigating.","example":"2026-09-12T14:03:27.115Z"},"request_id":{"type":"string","example":"018f0b3d-2b1e-7c8a-9d4b-1a2b3c4d5e6f"},"api_version":{"type":"string","example":"2026-04-23"}},"required":["computed_at","request_id","api_version"]},"TaxRateV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"label":{"type":"string"},"rate":{"type":"number","description":"Tax rate as a decimal (e.g., 0.0825 for 8.25%)."},"code":{"type":"string","maxLength":32,"example":"FL-COM-5.5"},"tax_payable_account_id":{"type":"string","format":"uuid"},"is_active":{"type":"boolean","default":true}},"required":["id","label","rate"]},"CreateTaxRateV1Dto":{"type":"object","properties":{"code":{"type":"string","maxLength":32,"example":"FL-COM-5.5"},"label":{"type":"string","maxLength":128,"example":"Florida Commercial Rent 5.5%"},"rate":{"type":"number","description":"Tax rate as a decimal (e.g., 0.055 for 5.5%).","example":0.055,"minimum":0,"maximum":1},"tax_payable_account_id":{"type":"string","format":"uuid"}},"required":["code","label","rate","tax_payable_account_id"]},"UpdateTaxRateV1Dto":{"type":"object","properties":{"code":{"type":"string","maxLength":32},"label":{"type":"string","maxLength":128},"rate":{"type":"number","minimum":0,"maximum":1},"tax_payable_account_id":{"type":"string","format":"uuid"},"is_active":{"type":"boolean"}}},"DeadLifecycleDeliveryBlockerV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["dead_lifecycle_delivery"]},"delivery_id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"participant":{"type":"string","description":"The module that never received the change, e.g. expense-recovery."},"event_type":{"type":"string","enum":["activated","termination_scheduled","termination_revoked","terminated","expired"]},"event_effective_date":{"type":"string","format":"date","description":"The date the undelivered change takes effect, which is why it falls in this period."},"last_error":{"type":"string","nullable":true,"description":"The last delivery error, or null if none was recorded."}},"required":["kind","delivery_id","contract_id","participant","event_type","event_effective_date","last_error"]},"DepreciationNotPostedBlockerV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["depreciation_not_posted"]},"legal_entity_id":{"type":"string","format":"uuid"},"period_id":{"type":"string","format":"uuid"},"asset_count":{"type":"number","description":"How many assets have unposted projected depreciation in this period."},"amount":{"type":"string","description":"The total unposted projected depreciation for this period.","example":"1234.50"}},"required":["kind","legal_entity_id","period_id","asset_count","amount"]},"PendingDocumentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_number":{"type":"string","nullable":true},"incoming_intercompany":{"type":"boolean","description":"True when the document belongs to another legal entity and blocks this one only because it posts its intercompany second entry here."}},"required":["id","document_number","incoming_intercompany"]},"PendingDocumentsBlockerV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["pending_documents"]},"period_id":{"type":"string","format":"uuid"},"documents":{"type":"array","items":{"$ref":"#/components/schemas/PendingDocumentV1Dto"}}},"required":["kind","period_id","documents"]},"PreviousPeriodNotClosedBlockerV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["previous_period_not_closed"]},"period_id":{"type":"string","format":"uuid"},"previous_period_id":{"type":"string","format":"uuid"},"previous_period_name":{"type":"string"},"previous_period_end":{"type":"string","format":"date"}},"required":["kind","period_id","previous_period_id","previous_period_name","previous_period_end"]},"PercentageRentAttentionWarningV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["percentage_rent_attention"]},"runs_due":{"type":"number","description":"Leases of this legal entity with a percentage rent run due (open or snoozed run_due work items)."},"lines_blocked":{"type":"number","description":"Percentage rent lines blocked, ending on or before the period end, on a property of this legal entity."},"lines_held":{"type":"number","description":"Percentage rent lines held for review, ending on or before the period end, on a property of this legal entity."},"lines_pending":{"type":"number","description":"Percentage rent lines computed and awaiting approval (pending), ending on or before the period end, on a property of this legal entity."},"approved_unbilled":{"type":"number","description":"Approved percentage rent lines ending on or before the period end, on a property of this legal entity, with a charge not yet invoiced or settled. Counts lines, not charges."}},"required":["kind","runs_due","lines_blocked","lines_held","lines_pending","approved_unbilled"]},"EntityCloseReadinessV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"closed_through":{"type":"string","format":"date","nullable":true,"description":"The last date this entity is closed through, or null when nothing is closed yet."},"periods_behind":{"type":"number","description":"Open periods of this entity ending on or before through_date."},"next_period_id":{"type":"string","format":"uuid","nullable":true,"description":"The oldest of those open periods — the one this entity's close chain would attempt first — or null when there is nothing to close."},"can_close":{"type":"boolean","description":"True when nothing blocks closing next_period_id. Means \"the next period in this entity's chain can close\", not \"the whole range will close\" — a later period in range may have its own blockers, unreachable until this one closes."},"blockers":{"type":"array","description":"What kind of blocker this is discriminates which of the fields below are present — `kind` is an enum so a future kind is additive. The same union `CloseReadinessV1Dto.blockers` uses.","items":{"oneOf":[{"$ref":"#/components/schemas/DeadLifecycleDeliveryBlockerV1Dto"},{"$ref":"#/components/schemas/DepreciationNotPostedBlockerV1Dto"},{"$ref":"#/components/schemas/PendingDocumentsBlockerV1Dto"},{"$ref":"#/components/schemas/PreviousPeriodNotClosedBlockerV1Dto"}]}}},"required":["legal_entity_id","closed_through","periods_behind","next_period_id","can_close","blockers"]},"BulkCloseReadinessV1Dto":{"type":"object","properties":{"legal_entity_ids":{"minItems":1,"maxItems":500,"description":"At least one legal entity id, at most 500. The cap exists for query planning, not merely payload size: each entity adds one OR branch to the readiness reads' pending-document/dead-delivery scans, and a 500-branch OR over a busy `documents` table can degrade to a sequential scan.","type":"array","items":{"type":"string","format":"uuid"}},"through_date":{"type":"string","format":"date","description":"Inclusive: every open period ending on or before this date is in scope."}},"required":["legal_entity_ids","through_date"]},"PeriodCloseRunV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"principal_id":{"type":"string","format":"uuid","description":"The principal (user or API key) who committed this run."},"through_date":{"type":"string","format":"date","description":"Inclusive: every period with end_date <= this date was in scope."},"status":{"type":"string","enum":["queued","running","completed","cancelled","failed"],"description":"Lifecycle of the run itself, not of its entities. 'queued': committed, no entity has reported yet. 'running': at least one entity has reported and others are still outstanding. 'completed': every entity reported — the NORMAL terminal status, whatever mix of 'applied', 'skipped_blocked' and 'failed' those results are. 'cancelled': cancellation was requested. This is stamped AT THE MOMENT OF THE REQUEST, together with finished_at, without waiting for the outstanding entities — so a cancelled run normally has entities that never reported, and its entities_closed + entities_skipped + entities_failed sums to LESS than entities_total. 'failed' is RESERVED and is not produced: it described an orchestration failure that can no longer happen, because a run and the jobs for every one of its entities are committed together. An entity that failed while its job ran never makes the run 'failed'; read entities_failed and each entity's result/detail for that."},"entities_total":{"type":"number","description":"Size of the committed selection."},"entities_closed":{"type":"number","description":"Entities whose result is 'applied'."},"entities_skipped":{"type":"number","description":"Entities whose result is 'skipped_blocked' or 'cancelled'."},"entities_failed":{"type":"number","description":"Entities whose result is 'failed'."},"periods_closed":{"type":"number","description":"Sum of periods_closed over every entity."},"cancel_requested_at":{"type":"string","format":"date-time","nullable":true,"description":"When cancellation was requested (D9). Null while no cancel was asked for."},"created_at":{"type":"string","format":"date-time"},"started_at":{"type":"string","format":"date-time","nullable":true,"description":"Set when the run leaves 'queued' on its first entity result."},"finished_at":{"type":"string","format":"date-time","nullable":true,"description":"Set once the run reaches a terminal status."}},"required":["id","principal_id","through_date","status","entities_total","entities_closed","entities_skipped","entities_failed","periods_closed","cancel_requested_at","created_at","started_at","finished_at"]},"CreateCloseRunV1Dto":{"type":"object","properties":{"legal_entity_ids":{"minItems":1,"maxItems":500,"description":"At least one legal entity id, at most 500 (spec D11, the same BULK_MAX used by close-readiness/bulk).","type":"array","items":{"type":"string","format":"uuid"}},"through_date":{"type":"string","format":"date","description":"Inclusive: every open period ending on or before this date is in scope."}},"required":["legal_entity_ids","through_date"]},"PeriodCloseRunEntityV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"result":{"type":"string","enum":["applied","skipped_blocked","failed","cancelled"],"nullable":true,"description":"Null while this entity is still pending."},"periods_closed":{"type":"number","description":"How far this entity’s close chain got."},"blocker_kind":{"type":"string","nullable":true,"description":"The readiness blocker kind that stopped this entity, if any."},"detail":{"type":"string","nullable":true,"description":"Human-readable reason, set alongside result."},"finished_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","legal_entity_id","result","periods_closed","blocker_kind","detail","finished_at"]},"PeriodCloseRunDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"principal_id":{"type":"string","format":"uuid","description":"The principal (user or API key) who committed this run."},"through_date":{"type":"string","format":"date","description":"Inclusive: every period with end_date <= this date was in scope."},"status":{"type":"string","enum":["queued","running","completed","cancelled","failed"],"description":"Lifecycle of the run itself, not of its entities. 'queued': committed, no entity has reported yet. 'running': at least one entity has reported and others are still outstanding. 'completed': every entity reported — the NORMAL terminal status, whatever mix of 'applied', 'skipped_blocked' and 'failed' those results are. 'cancelled': cancellation was requested. This is stamped AT THE MOMENT OF THE REQUEST, together with finished_at, without waiting for the outstanding entities — so a cancelled run normally has entities that never reported, and its entities_closed + entities_skipped + entities_failed sums to LESS than entities_total. 'failed' is RESERVED and is not produced: it described an orchestration failure that can no longer happen, because a run and the jobs for every one of its entities are committed together. An entity that failed while its job ran never makes the run 'failed'; read entities_failed and each entity's result/detail for that."},"entities_total":{"type":"number","description":"Size of the committed selection."},"entities_closed":{"type":"number","description":"Entities whose result is 'applied'."},"entities_skipped":{"type":"number","description":"Entities whose result is 'skipped_blocked' or 'cancelled'."},"entities_failed":{"type":"number","description":"Entities whose result is 'failed'."},"periods_closed":{"type":"number","description":"Sum of periods_closed over every entity."},"cancel_requested_at":{"type":"string","format":"date-time","nullable":true,"description":"When cancellation was requested (D9). Null while no cancel was asked for."},"created_at":{"type":"string","format":"date-time"},"started_at":{"type":"string","format":"date-time","nullable":true,"description":"Set when the run leaves 'queued' on its first entity result."},"finished_at":{"type":"string","format":"date-time","nullable":true,"description":"Set once the run reaches a terminal status."},"entities":{"description":"One page of this run's entity rows (meta.next_cursor pages it further). Two things a naive client must not assume: `data` here is a single object, not an array, so a `while (meta.next_cursor)` accumulator that just concatenates `data` pages will collect the run's top-level fields (including its counters) once per page rather than once overall — accumulate `data.entities` across pages, not `data` itself. And every page re-sends the run's LIVE counters (entities_closed/_skipped/_failed, periods_closed, status), which can have moved on between page 1 and a later page of the same poll if the run is still active — they are not a snapshot taken once at the start of pagination.","type":"array","items":{"$ref":"#/components/schemas/PeriodCloseRunEntityV1Dto"}}},"required":["id","principal_id","through_date","status","entities_total","entities_closed","entities_skipped","entities_failed","periods_closed","cancel_requested_at","created_at","started_at","finished_at","entities"]},"ExceptionRowV1Dto":{"type":"object","properties":{"id":{"type":"string"},"action":{"type":"string","enum":["period.override_post","period.reopen"]},"resource_type":{"type":"string"},"resource_id":{"type":"string"},"actor_principal_id":{"type":"string"},"actor_kind":{"type":"string","enum":["user","api_key","sparkiq_internal"]},"changes_summary":{"type":"object","additionalProperties":true,"nullable":true,"description":"Opt-in, handler-supplied summary of what changed. Shape is defined by the handler that wrote the row, so it is deliberately unconstrained."},"created_at":{"type":"string"}},"required":["id","action","resource_type","resource_id","actor_principal_id","actor_kind","changes_summary","created_at"]},"AccountingPeriodV1Dto":{"type":"object","properties":{"id":{"type":"string"},"legal_entity_id":{"type":"string"},"period_name":{"type":"string"},"start_date":{"type":"string","format":"date"},"end_date":{"type":"string","format":"date"},"status":{"type":"string","enum":["open","closed","locked"]},"closed_at":{"type":"string","nullable":true},"closed_by":{"type":"string","nullable":true},"locked_at":{"type":"string","nullable":true},"locked_by":{"type":"string","nullable":true},"created_at":{"type":"string"}},"required":["id","legal_entity_id","period_name","start_date","end_date","status","closed_at","closed_by","locked_at","locked_by","created_at"]},"TransitionAccountingPeriodV1Dto":{"type":"object","properties":{"note":{"type":"string","description":"Optional reason, recorded in the period's history."},"period_override_reason":{"type":"string","description":"Required only when the period has close blockers. Recorded in the audit log as period.override_close alongside every blocker it stepped over, and requires the accounting:periods_override scope. Same field name and consent semantics as CreateDocumentDto.period_override_reason on the posting path."}}},"CloseReadinessV1Dto":{"type":"object","properties":{"can_close":{"type":"boolean","description":"True when nothing blocks closing this period."},"blockers":{"type":"array","description":"What kind of blocker this is discriminates which of the fields below are present — `kind` is an enum so a future kind is additive.","items":{"oneOf":[{"$ref":"#/components/schemas/DeadLifecycleDeliveryBlockerV1Dto"},{"$ref":"#/components/schemas/DepreciationNotPostedBlockerV1Dto"},{"$ref":"#/components/schemas/PendingDocumentsBlockerV1Dto"},{"$ref":"#/components/schemas/PreviousPeriodNotClosedBlockerV1Dto"}]}},"warnings":{"type":"array","description":"Worth a look before closing, but never blocking: can_close reads blockers only. `kind` is an enum so a future kind is additive.","items":{"oneOf":[{"$ref":"#/components/schemas/PercentageRentAttentionWarningV1Dto"}]}}},"required":["can_close","blockers","warnings"]},"PeriodHistoryActorV1Dto":{"type":"object","properties":{"principal_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["user","api_key","sparkiq_internal"]},"display_name":{"type":"string","description":"Member name, else email, else \"Unknown user\"; \"API key\" for a key and \"System\" for a system actor."},"email":{"type":"string","nullable":true}},"required":["principal_id","kind","display_name","email"]},"PeriodHistoryPersonV1Dto":{"type":"object","properties":{"principal_id":{"type":"string","format":"uuid"},"display_name":{"type":"string"}},"required":["principal_id","display_name"]},"PeriodHistoryEntryV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"action":{"type":"string","enum":["close","override_close","lock","reopen","year_end_lock","unlock","status_change_unrecorded"],"description":"`status_change_unrecorded` is a change recorded before statuses and reasons were kept: it says the status changed, not how, and every status, reason and source field on it is null."},"previous_status":{"type":"string","enum":["open","closed","locked"],"nullable":true},"new_status":{"type":"string","enum":["open","closed","locked"],"nullable":true},"reason":{"type":"string","nullable":true,"description":"The reason given. On `override_close` it is the override justification; on close and lock it is the optional note."},"note":{"type":"string","nullable":true,"description":"Only on `override_close`: the optional operator note."},"source":{"type":"string","enum":["manual","bulk_close","year_end_close","year_end_close_reversal"],"nullable":true,"description":"What made the change; null when it was not recorded."},"actor":{"$ref":"#/components/schemas/PeriodHistoryActorV1Dto"},"previous_closed_by":{"nullable":true,"description":"Only on `reopen`: who had closed the period.","type":"object","allOf":[{"$ref":"#/components/schemas/PeriodHistoryPersonV1Dto"}]},"previous_closed_at":{"type":"string","format":"date-time","nullable":true},"previous_locked_by":{"nullable":true,"description":"Only on `reopen`: who had locked the period.","type":"object","allOf":[{"$ref":"#/components/schemas/PeriodHistoryPersonV1Dto"}]},"previous_locked_at":{"type":"string","format":"date-time","nullable":true},"year_end_close_id":{"type":"string","format":"uuid","nullable":true,"description":"On year-end `year_end_lock` and `unlock`: the year-end close."},"fiscal_year":{"type":"number","nullable":true},"created_at":{"type":"string","format":"date-time"}},"required":["id","action","previous_status","new_status","reason","note","source","actor","previous_closed_by","previous_closed_at","previous_locked_by","previous_locked_at","year_end_close_id","fiscal_year","created_at"]},"ReopenAccountingPeriodV1Dto":{"type":"object","properties":{"reason":{"type":"string","description":"Required reason for reopening a closed or locked period. Persisted on the audit_log row."}},"required":["reason"]},"ApUploadUrlV1Dto":{"type":"object","properties":{"storage_path":{"type":"string","description":"Where the file will live: `{org_id}/files/{file_id}.{ext}`. Pass it to `POST /v1/ap-files` once the upload has finished."},"upload_url":{"type":"string","description":"A signed URL to PUT the file to, straight to Storage. It cannot overwrite an existing object."},"expires_at":{"type":"string","format":"date-time","description":"When the upload URL stops working (two hours after issue)."}},"required":["storage_path","upload_url","expires_at"]},"ApUploadUrlRequestV1Dto":{"type":"object","properties":{"filename":{"type":"string","maxLength":255,"description":"The file name on the client. Informational only."},"content_type":{"type":"string","enum":["application/pdf","image/png","image/jpeg","image/webp"],"description":"The declared type. It chooses the path extension and fails early; what is admitted is decided later from the uploaded bytes."},"size_bytes":{"type":"integer","minimum":1,"maximum":26214400,"description":"The declared size in bytes; at most 25 MiB."}},"required":["filename","content_type","size_bytes"]},"ApFileV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["upload","email","api"],"description":"`upload` — sent from the app; `api` — sent with an API key; `email` — received at an intake address."},"original_filename":{"type":"string","nullable":true},"mime_type":{"type":"string","enum":["application/pdf","image/png","image/jpeg","image/webp"],"description":"The type the bytes were identified as, whatever was declared."},"size_bytes":{"type":"integer"},"sha256":{"type":"string","description":"Lower-case hex sha256 of the bytes."},"page_count":{"type":"integer","nullable":true,"description":"Null until the file has been read."},"created_at":{"type":"string","format":"date-time"}},"required":["id","source","original_filename","mime_type","size_bytes","sha256","page_count","created_at"]},"ApItemSummaryV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"file_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["bill","credit_memo","statement","w9","receipt","reminder","other"]},"status":{"type":"string","enum":["processing","ready","needs_review","flagged","duplicate","not_a_bill","accepted","rejected","archived"],"description":"`processing` until the item has been read and checked."},"page_from":{"type":"integer","nullable":true,"description":"First page of the item in its file. Null (with `page_to`) means the whole file, not split yet."},"page_to":{"type":"integer","nullable":true},"attempt_count":{"type":"integer","description":"Failed processing attempts since the last (re)start."},"error_message":{"type":"string","nullable":true,"description":"Why the last attempt failed."},"version":{"type":"integer","description":"Concurrency token: send it as `If-Match` when editing."},"created_at":{"type":"string","format":"date-time"}},"required":["id","file_id","kind","status","page_from","page_to","attempt_count","error_message","version","created_at"]},"ApFileWithItemsV1Dto":{"type":"object","properties":{"file":{"$ref":"#/components/schemas/ApFileV1Dto"},"items":{"description":"The items found in the file. Right after upload this is one placeholder `processing` item covering the whole file.","type":"array","items":{"$ref":"#/components/schemas/ApItemSummaryV1Dto"}}},"required":["file","items"]},"ApFileCreateV1Dto":{"type":"object","properties":{"storage_path":{"type":"string","maxLength":255,"description":"The `storage_path` returned by `POST /v1/ap-invoices/upload-url`, after the file was PUT to its upload URL."},"original_filename":{"type":"string","maxLength":255,"description":"The file name to show reviewers."}},"required":["storage_path","original_filename"]},"ApCheckActionItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["processing","ready","needs_review","flagged","duplicate","not_a_bill","accepted","rejected","archived"],"description":"The status after the action: re-staged from the open checks, or `archived` after a confirmed duplicate."},"stp_confidence":{"type":"string","nullable":true,"description":"Straight-through confidence, a decimal string from 0 to 1. `0.0000` while any block or warn is open."},"fraud_risk":{"type":"string","enum":["low","elevated","high"],"nullable":true,"description":"The fraud risk of the item; null before it was checked."},"version":{"type":"integer","description":"Concurrency token after the action."}},"required":["id","status","stp_confidence","fraud_risk","version"]},"ApItemCheckV1Dto":{"type":"object","properties":{"code":{"type":"string","enum":["payment_details_changed","sender_lookalike","duplicate_invoice","duplicate_probable","duplicate_content","does_not_foot","extraction_low_confidence","extraction_invalid","suggestion_failed","remit_to_new","remit_to_name_mismatch","sender_freemail","vendor_unmatched","new_vendor","vendor_unverified","unusual_amount","unusual_frequency","legal_entity_conflict","closed_period","inactive_record","under_threshold","invoice_number_regression","past_due","missing_w9"],"description":"Which check fired."},"severity":{"type":"string","enum":["block","warn","info"],"description":"`block` stops the item (resolve it); `warn` needs a look (acknowledge it); `info` is shown only."},"state":{"type":"string","enum":["open","acknowledged","resolved"],"description":"`open` until a person acknowledges (warn) or resolves (block) it. Checking the item again keeps the decision while the check fires with the same evidence, and reopens it when the evidence changes."},"evidence":{"type":"object","additionalProperties":true,"description":"What the check saw. The shape is check-defined (caller-defined per `code`), for example `{ invoice: \"····4421\", on_file: [\"····9087\"] }` for bank details."},"note":{"type":"string","nullable":true,"description":"The note given when it was acknowledged or resolved."},"resolved_at":{"type":"string","format":"date-time","nullable":true,"description":"When it was acknowledged or resolved; null while open."},"exit":{"type":"string","description":"What a person does to clear the check."}},"required":["code","severity","state","evidence","note","resolved_at","exit"]},"ApCheckActionResponseV1Dto":{"type":"object","properties":{"item":{"$ref":"#/components/schemas/ApCheckActionItemV1Dto"},"checks":{"description":"The item's checks after the action, in code order.","type":"array","items":{"$ref":"#/components/schemas/ApItemCheckV1Dto"}}},"required":["item","checks"]},"ApCheckAcknowledgeV1Dto":{"type":"object","properties":{"note":{"type":"string","maxLength":2000,"description":"Why the warning is safe to accept. Required (non-empty) for a fraud-class check, such as `remit_to_new` or `vendor_unverified`."}}},"ApCheckResolveV1Dto":{"type":"object","properties":{"note":{"type":"string","maxLength":2000,"description":"How the blocking problem was cleared, for example who was called."}},"required":["note"]},"ApDuplicateDismissV1Dto":{"type":"object","properties":{"reason":{"type":"string","maxLength":2000,"description":"Why the item is not a duplicate of the bill or item it matched."}},"required":["reason"]},"ApOpenCheckV1Dto":{"type":"object","properties":{"code":{"type":"string","enum":["payment_details_changed","sender_lookalike","duplicate_invoice","duplicate_probable","duplicate_content","does_not_foot","extraction_low_confidence","extraction_invalid","suggestion_failed","remit_to_new","remit_to_name_mismatch","sender_freemail","vendor_unmatched","new_vendor","vendor_unverified","unusual_amount","unusual_frequency","legal_entity_conflict","closed_period","inactive_record","under_threshold","invoice_number_regression","past_due","missing_w9"]},"severity":{"type":"string","enum":["block","warn","info"]}},"required":["code","severity"]},"ApInvoiceListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"file_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["bill","credit_memo","statement","w9","receipt","reminder","other"]},"status":{"type":"string","enum":["processing","ready","needs_review","flagged","duplicate","not_a_bill","accepted","rejected","archived"]},"vendor_party_id":{"type":"string","format":"uuid","nullable":true},"vendor_name":{"type":"string","nullable":true,"description":"The linked vendor's name, else the name read off the invoice."},"legal_entity_id":{"type":"string","format":"uuid","nullable":true},"vendor_invoice_number":{"type":"string","nullable":true},"invoice_date":{"type":"string","format":"date","nullable":true},"due_date":{"type":"string","format":"date","nullable":true},"currency_code":{"type":"string","nullable":true},"total":{"type":"string","nullable":true,"example":"1234.50"},"stp_confidence":{"type":"string","nullable":true,"description":"Straight-through confidence, a decimal string from 0 to 1 with four places."},"fraud_risk":{"type":"string","enum":["low","elevated","high"],"nullable":true},"quick_approvable":{"type":"boolean","description":"True when one-click approval may be offered: `ready`, confident, low fraud risk and under the amount cap. Accepting still runs every gate."},"version":{"type":"integer","description":"Concurrency token for `If-Match`."},"created_at":{"type":"string","format":"date-time"},"file_name":{"type":"string","nullable":true,"description":"The source file's name as uploaded or attached, so a row reads before extraction fills the vendor; null for an invoice read from an email body."},"page_from":{"type":"integer","nullable":true,"description":"First page of the file this item covers (1-based); null until it is read."},"page_to":{"type":"integer","nullable":true,"description":"Last page of the file this item covers; null until it is read."},"checks":{"description":"The checks still open on the item, in code order.","type":"array","items":{"$ref":"#/components/schemas/ApOpenCheckV1Dto"}}},"required":["id","file_id","kind","status","vendor_party_id","vendor_name","legal_entity_id","vendor_invoice_number","invoice_date","due_date","currency_code","total","stp_confidence","fraud_risk","quick_approvable","version","created_at","file_name","page_from","page_to","checks"]},"ApInvoiceListMetaV1Dto":{"type":"object","properties":{"next_cursor":{"type":"string","nullable":true,"description":"Opaque cursor for the next page, or null when this is the last page. Pass it back as `?cursor=`. Always present; do not parse it.","example":"eyJpZCI6ICJhYmMifQ=="},"limit":{"type":"number","description":"Page size used for this response."},"counts":{"type":"object","properties":{"processing":{"type":"integer"},"ready":{"type":"integer"},"needs_review":{"type":"integer"},"flagged":{"type":"integer"},"duplicate":{"type":"integer"},"not_a_bill":{"type":"integer"},"accepted":{"type":"integer"},"rejected":{"type":"integer"},"archived":{"type":"integer"}},"required":["processing","ready","needs_review","flagged","duplicate","not_a_bill","accepted","rejected","archived"],"description":"Items per status over the whole organization (or the caller’s legal entity), ignoring every other filter, so each tab can show its total."},"request_id":{"type":"string","example":"018f0b3d-2b1e-7c8a-9d4b-1a2b3c4d5e6f"},"api_version":{"type":"string","example":"2026-04-23"}},"required":["next_cursor","limit","request_id","api_version"]},"ApEffectiveLineV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid","nullable":true},"item_id":{"type":"string","format":"uuid","nullable":true},"dimensions":{"type":"object","additionalProperties":{"type":"string","nullable":true},"description":"Dimension value by dimension id; null is an explicit none."}},"required":["account_id","item_id","dimensions"]},"ApEffectiveCodingV1Dto":{"type":"object","properties":{"vendor_party_id":{"type":"string","format":"uuid","nullable":true},"legal_entity_id":{"type":"string","format":"uuid","nullable":true},"dimensions":{"type":"object","additionalProperties":{"type":"string","nullable":true},"description":"Header dimension value by dimension id."},"tax_account_id":{"type":"string","format":"uuid","nullable":true,"description":"The account the tax line is coded to."},"lines":{"description":"One entry per extracted line (one when none was extracted), in line order.","type":"array","items":{"$ref":"#/components/schemas/ApEffectiveLineV1Dto"}}},"required":["vendor_party_id","legal_entity_id","dimensions","tax_account_id","lines"]},"ApExtractionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["passed","repaired","failed"],"description":"Whether the extraction passed the validation rules."},"errors":{"description":"What validation found wrong; empty when it passed.","type":"array","items":{"type":"string"}},"model":{"type":"string"},"created_at":{"type":"string","format":"date-time"}},"required":["id","status","errors","model","created_at"]},"ApInvoiceDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"file_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["bill","credit_memo","statement","w9","receipt","reminder","other"]},"status":{"type":"string","enum":["processing","ready","needs_review","flagged","duplicate","not_a_bill","accepted","rejected","archived"]},"vendor_party_id":{"type":"string","format":"uuid","nullable":true},"vendor_name":{"type":"string","nullable":true,"description":"The linked vendor's name, else the name read off the invoice."},"legal_entity_id":{"type":"string","format":"uuid","nullable":true},"vendor_invoice_number":{"type":"string","nullable":true},"invoice_date":{"type":"string","format":"date","nullable":true},"due_date":{"type":"string","format":"date","nullable":true},"currency_code":{"type":"string","nullable":true},"total":{"type":"string","nullable":true,"example":"1234.50"},"stp_confidence":{"type":"string","nullable":true,"description":"Straight-through confidence, a decimal string from 0 to 1 with four places."},"fraud_risk":{"type":"string","enum":["low","elevated","high"],"nullable":true},"quick_approvable":{"type":"boolean","description":"True when one-click approval may be offered: `ready`, confident, low fraud risk and under the amount cap. Accepting still runs every gate."},"version":{"type":"integer","description":"Concurrency token for `If-Match`."},"created_at":{"type":"string","format":"date-time"},"page_from":{"type":"integer","nullable":true},"page_to":{"type":"integer","nullable":true},"subtotal":{"type":"string","nullable":true,"example":"1234.50"},"tax_total":{"type":"string","nullable":true,"example":"1234.50"},"final_fields":{"type":"object","additionalProperties":true,"description":"The reviewer-editable working copy of the extracted fields, plus the coding overlay (`vendor_party_id`, `legal_entity_id`, `dimensions`, `tax_account_id` and per-line `account_id`, `item_id`, `dimensions`). Caller-defined shape."},"effective_coding":{"$ref":"#/components/schemas/ApEffectiveCodingV1Dto"},"suggestion":{"type":"object","additionalProperties":true,"nullable":true,"description":"What the classifier suggested (decisions with their ranked candidates and the confidence). Caller-defined shape; null before the item was processed."},"checks":{"description":"Every check of the item with its state and evidence.","type":"array","items":{"$ref":"#/components/schemas/ApItemCheckV1Dto"}},"extraction":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/ApExtractionV1Dto"}]},"file":{"description":"The file the item was found in.","allOf":[{"$ref":"#/components/schemas/ApFileV1Dto"}]},"sibling_item_ids":{"description":"The other items found in the same file, whole-file placeholder first, then by page.","type":"array","items":{"type":"string","format":"uuid"}},"bill_document_id":{"type":"string","format":"uuid","nullable":true},"duplicate_of_invoice_id":{"type":"string","format":"uuid","nullable":true},"duplicate_of_document_id":{"type":"string","format":"uuid","nullable":true},"decided_via":{"type":"string","enum":["person","straight_through"],"nullable":true},"accepted_at":{"type":"string","format":"date-time","nullable":true},"rejected_at":{"type":"string","format":"date-time","nullable":true},"rejection_reason":{"type":"string","nullable":true},"error_message":{"type":"string","nullable":true}},"required":["id","file_id","kind","status","vendor_party_id","vendor_name","legal_entity_id","vendor_invoice_number","invoice_date","due_date","currency_code","total","stp_confidence","fraud_risk","quick_approvable","version","created_at","page_from","page_to","subtotal","tax_total","final_fields","effective_coding","suggestion","checks","extraction","file","sibling_item_ids","bill_document_id","duplicate_of_invoice_id","duplicate_of_document_id","decided_via","accepted_at","rejected_at","rejection_reason","error_message"]},"ApInvoicePatchV1Dto":{"type":"object","properties":{"final_fields":{"type":"object","additionalProperties":true,"description":"The fields to change; every other field keeps its value. Top-level keys replace; `line_items` merges per index (an element merges into the line at that index, send `{}` for a line you leave as it is; a shorter array is refused and a longer one adds lines). Keys: the extracted fields (`vendor`, `invoice_number`, `invoice_date`, `due_date`, `currency_code`, `subtotal`, `tax`, `total`, `payment_terms`, `po_number`, `bill_to`, `remit_to`, `line_items`) and the coding overlay (`vendor_party_id`, `legal_entity_id`, `dimensions`, `tax_account_id`, and per line `account_id`, `item_id`, `dimensions`). `null` clears a coding pick and it stays cleared. Caller-defined shape."}},"required":["final_fields"]},"ApInvoiceRejectV1Dto":{"type":"object","properties":{"reason":{"type":"string","maxLength":2000,"description":"Why the item is not a bill to pay."},"fraud":{"type":"boolean","description":"True when the item is fraudulent: the sender’s email (and its domain, when a row holds it) is blocked on the item’s vendor. With no vendor on the item nothing is blocked."}},"required":["reason","fraud"]},"ApInvoiceAcceptResultV1Dto":{"type":"object","properties":{"item":{"description":"The item after the accept, as `GET /v1/ap-invoices/{id}` shows it.","allOf":[{"$ref":"#/components/schemas/ApInvoiceDetailV1Dto"}]},"bill_document_id":{"type":"string","format":"uuid","description":"The bill (or vendor credit, for a credit memo) the item became."},"bill_status":{"type":"string","enum":["posted","pending_approval"],"description":"Status of the bill: `posted`, or `pending_approval` when an approval rule holds it."}},"required":["item","bill_document_id","bill_status"]},"ApInvoiceAcceptV1Dto":{"type":"object","properties":{"final_fields":{"type":"object","additionalProperties":true,"description":"Edits applied before accepting, exactly as `PATCH /v1/ap-invoices/{id}` applies them (same keys, same merge, same validation, one correction per changed field, and the item is re-checked). Omit to accept the item as it stands. Caller-defined shape."}}},"ApAuditEntryV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"at":{"type":"string","format":"date-time"},"kind":{"type":"string","enum":["correction","audit"],"description":"`correction` is a reviewer edit (with `field_path`, `before` and `after`); `audit` is an action recorded in the audit log."},"action":{"type":"string","description":"`correction`, or the audit action such as `ap_invoices.resolve_check`."},"field_path":{"type":"string","nullable":true},"line_index":{"type":"integer","nullable":true},"before":{"type":"object","description":"The suggested value of a correction; caller-defined JSON, null otherwise.","nullable":true,"additionalProperties":true},"after":{"type":"object","description":"The final value of a correction; caller-defined JSON, null otherwise.","nullable":true,"additionalProperties":true},"actor_id":{"type":"string","format":"uuid","nullable":true},"actor_name":{"type":"string","nullable":true},"summary":{"type":"object","additionalProperties":true,"nullable":true,"description":"Handler-supplied summary of an audit row; caller-defined shape."}},"required":["id","at","kind","action","field_path","line_index","before","after","actor_id","actor_name","summary"]},"ApIntakeAddressV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"address":{"type":"string","description":"The inbound email address, `ap-<10 characters>@<inbound domain>`, server-generated and lower-case."},"legal_entity_id":{"type":"string","format":"uuid","nullable":true,"description":"The legal entity bills arriving at this address default to; null for none. An active legal entity of the organization."},"sender_policy":{"type":"string","enum":["anyone","known_only"],"description":"`anyone` ingests mail from any sender; `known_only` holds mail whose sender is not a known vendor (`unknown_sender`)."},"is_active":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","address","legal_entity_id","sender_policy","is_active","created_at","updated_at"]},"CursorEnvelopeMetaDto":{"type":"object","properties":{"next_cursor":{"type":"string","description":"Opaque cursor for the next page, or null when this is the last page. Pass it back as `?cursor=`. Always present; do not parse it.","nullable":true,"example":"eyJpZCI6ICJhYmMifQ=="},"limit":{"type":"number","description":"Page size used for this response.","example":50},"request_id":{"type":"string","example":"018f0b3d-2b1e-7c8a-9d4b-1a2b3c4d5e6f"},"api_version":{"type":"string","example":"2026-04-23"}},"required":["next_cursor","limit","request_id","api_version"]},"ApIntakeAddressCreateV1Dto":{"type":"object","properties":{"sender_policy":{"type":"string","enum":["anyone","known_only"],"default":"anyone","description":"`anyone` ingests mail from any sender; `known_only` holds mail whose sender is not a known vendor (`unknown_sender`)."},"legal_entity_id":{"type":"string","format":"uuid","nullable":true,"description":"The legal entity bills arriving at this address default to; null for none. An active legal entity of the organization."}}},"ApIntakeAddressPatchV1Dto":{"type":"object","properties":{"sender_policy":{"type":"string","enum":["anyone","known_only"],"description":"`anyone` ingests mail from any sender; `known_only` holds mail whose sender is not a known vendor (`unknown_sender`)."},"legal_entity_id":{"type":"string","format":"uuid","nullable":true,"description":"The legal entity bills arriving at this address default to; null for none. An active legal entity of the organization. Send null to clear it."},"is_active":{"type":"boolean","description":"False stops the address receiving mail (addresses are never deleted); true turns it back on."}}},"DimensionOptionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dimension_id":{"type":"string","format":"uuid"},"value":{"type":"string"},"is_active":{"type":"boolean"},"sort_order":{"type":"number"},"created_at":{"type":"string","nullable":true,"format":"date-time"}},"required":["id","dimension_id","value","is_active","sort_order","created_at"]},"DimensionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"code":{"type":"string"},"name":{"type":"string"},"scope":{"type":"string","enum":["entry","line"]},"data_type":{"type":"string","enum":["text","number","date","boolean","entity","dropdown_list"]},"value_source":{"type":"string","nullable":true,"enum":["property","space","loan","loan_escrow"]},"category":{"type":"string","enum":["transaction","party"]},"applies_to_header":{"type":"boolean"},"applies_to_line":{"type":"boolean"},"is_required":{"type":"boolean"},"is_active":{"type":"boolean"},"created_at":{"type":"string","nullable":true,"format":"date-time"},"options":{"type":"array","items":{"$ref":"#/components/schemas/DimensionOptionV1Dto"}},"document_types":{"type":"array","items":{"type":"string"}}},"required":["id","org_id","code","name","scope","data_type","value_source","category","applies_to_header","applies_to_line","is_required","is_active","created_at","options","document_types"]},"CreateOptionInlineDto":{"type":"object","properties":{"value":{"type":"string","maxLength":200},"is_active":{"type":"boolean"},"sort_order":{"type":"number"}},"required":["value"]},"CreateDimensionV1Dto":{"type":"object","properties":{"code":{"type":"string","maxLength":64},"name":{"type":"string","maxLength":200},"scope":{"type":"string","enum":["entry","line"]},"data_type":{"type":"string","enum":["text","number","date","boolean","entity","dropdown_list"]},"value_source":{"type":"string","enum":["property","space","loan","loan_escrow"]},"category":{"type":"string","enum":["transaction","party"],"default":"transaction"},"applies_to_header":{"type":"boolean","default":true},"applies_to_line":{"type":"boolean","default":false},"is_required":{"type":"boolean"},"is_active":{"type":"boolean"},"options":{"type":"array","items":{"$ref":"#/components/schemas/CreateOptionInlineDto"}},"document_types":{"type":"array","items":{"type":"string","enum":["invoice","credit_memo","vendor_credit","bill","expense","sales_receipt","payment_in","payment_out","journal_entry","intercompany_transaction","intercompany_settlement","transfer","deposit","refund","owner_distribution","refund_payment","distribution_receipt","distribution_refund","distribution_refund_payable","straight_line_adjustment","debt_service","loan_drawdown","loan_payoff","loan_accrual","depreciation","asset_disposal","asset_reclass","capital_contribution","investment_in_subsidiary","debt_service_bill","debt_service_payment","loan_prepayment","hedge_settlement","hedge_premium","hedge_premium_amortization","hedge_termination"]}}},"required":["code","name","scope","data_type"]},"UpdateDimensionV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":200},"value_source":{"type":"string","nullable":true,"enum":["property","space","loan","loan_escrow"]},"category":{"type":"string","enum":["transaction","party"]},"applies_to_header":{"type":"boolean"},"applies_to_line":{"type":"boolean"},"is_required":{"type":"boolean"},"is_active":{"type":"boolean"},"document_types":{"type":"array","items":{"type":"string","enum":["invoice","credit_memo","vendor_credit","bill","expense","sales_receipt","payment_in","payment_out","journal_entry","intercompany_transaction","intercompany_settlement","transfer","deposit","refund","owner_distribution","refund_payment","distribution_receipt","distribution_refund","distribution_refund_payable","straight_line_adjustment","debt_service","loan_drawdown","loan_payoff","loan_accrual","depreciation","asset_disposal","asset_reclass","capital_contribution","investment_in_subsidiary","debt_service_bill","debt_service_payment","loan_prepayment","hedge_settlement","hedge_premium","hedge_premium_amortization","hedge_termination"]}}}},"CreateDimensionOptionV1Dto":{"type":"object","properties":{"value":{"type":"string","maxLength":200},"is_active":{"type":"boolean","default":true},"sort_order":{"type":"number"}},"required":["value"]},"UpdateDimensionOptionV1Dto":{"type":"object","properties":{"value":{"type":"string","maxLength":200},"is_active":{"type":"boolean"},"sort_order":{"type":"number"}}},"DocumentNumberDto":{"type":"object","properties":{"document_number":{"type":"string"}},"required":["document_number"]},"SummaryMetricGroupV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"Decimal string."},"count":{"type":"number"}},"required":["amount","count"]},"SummaryAgingV1Dto":{"type":"object","properties":{"current":{"type":"string","description":"Decimal string; not yet due or no due date."},"d30":{"type":"string","description":"1–30 days overdue."},"d60":{"type":"string","description":"31–60 days overdue."},"d90":{"type":"string","description":"61+ days overdue."}},"required":["current","d30","d60","d90"]},"SummaryOpenV1Dto":{"type":"object","properties":{"outstanding":{"$ref":"#/components/schemas/SummaryMetricGroupV1Dto"},"past_due":{"$ref":"#/components/schemas/SummaryMetricGroupV1Dto"},"due_7d":{"$ref":"#/components/schemas/SummaryMetricGroupV1Dto"},"aging":{"$ref":"#/components/schemas/SummaryAgingV1Dto"}},"required":["outstanding","past_due","due_7d","aging"]},"SummaryRecentV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"Decimal string."},"count":{"type":"number"},"days":{"type":"number"}},"required":["amount","count","days"]},"SummaryPeriodV1Dto":{"type":"object","properties":{"billed":{"type":"string","description":"Σ total_amount of posted docs in range."},"outstanding":{"type":"string","description":"Σ balance_amount of posted docs in range."},"count":{"type":"number"}},"required":["billed","outstanding","count"]},"DocumentsSummaryV1Dto":{"type":"object","properties":{"open":{"$ref":"#/components/schemas/SummaryOpenV1Dto"},"drafts":{"$ref":"#/components/schemas/SummaryMetricGroupV1Dto"},"recent":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/SummaryRecentV1Dto"}]},"period":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/SummaryPeriodV1Dto"}]}},"required":["open","drafts","recent","period"]},"DocumentLockDto":{"type":"object","properties":{"reason":{"type":"string","enum":["reconciled","bank_matched","period_locked","period_closed"],"description":"`reconciled` — cleared on a completed bank reconciliation; `bank_matched` — matched to a bank transaction; `period_locked` / `period_closed` — the accounting period of the document’s legal entity that contains its document_date is locked / closed."}},"required":["reason"]},"DocumentListItemDto":{"type":"object","properties":{"id":{"type":"string"},"lock":{"nullable":true,"description":"Why the UI treats this document as read-only, or null when nothing does. Advisory and computed on read: it is not an enforcement contract, and the API decides each action (edit, void, reopen, post) on its own rules. `period_locked` / `period_closed` reflect the accounting period status of the document's legal entity and document_date. Precedence: `period_locked`, `reconciled`, `bank_matched`, `period_closed`.","type":"object","allOf":[{"$ref":"#/components/schemas/DocumentLockDto"}]},"is_intercompany":{"type":"boolean","description":"True when the document is in-group: an intercompany transaction, or any document naming another legal entity of the org as counterparty (`counterparty_legal_entity_id` is set). Computed for every document type."},"document_type":{"type":"string"},"document_number":{"type":"string","nullable":true},"document_date":{"type":"string"},"due_date":{"type":"string","nullable":true},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"legal_entity_name":{"type":"string","nullable":true,"description":"Display name of the issuing legal entity (joined from `legal_entities.name`). Null when the FK is unset or the join misses."},"party_id":{"type":"string","nullable":true,"format":"uuid"},"party_name":{"type":"string","nullable":true},"total_amount":{"type":"string","example":"1234.50"},"balance_amount":{"type":"string","description":"Remaining balance after payments/applications. Equals total_amount for unpaid documents and 0 for fully-applied/-paid documents. Always present.","example":"1234.50"},"reserved_amount":{"type":"string","description":"Money already committed to a payment run; a bill with a non-zero value has a payment in flight. Sum of the active (unreleased) reservations against this document, where a pay-in-full reservation counts as the whole balance. `0.00` when nothing is reserved, and for every document type other than bill. Always present.","example":"1234.50"},"currency_code":{"type":"string"},"status":{"type":"string"},"created_at":{"type":"string"},"memo":{"type":"string","nullable":true,"description":"Free-text memo. Returned for every document type; null when the document has no memo."},"replaces_document_id":{"type":"string","nullable":true,"format":"uuid","description":"The posted document this one replaced (a reissue: `PUT` on a posted document voids it and issues this one). Null when it replaces nothing."},"replaces_document_number":{"type":"string","nullable":true,"description":"The number of the document this one replaced. Null when it replaces nothing."},"replaced_by_document_id":{"type":"string","nullable":true,"format":"uuid","description":"The replacement of this document, if it was reissued: posted, still awaiting approval, or posted and since replaced in turn (so the link holds along a chain: in O → R1 → R2, O reads R1 and R1 reads R2). A replacement voided without ever posting (an abandoned reissue) reads as null."},"replaced_by_document_number":{"type":"string","nullable":true,"description":"The number of the replacement in `replaced_by_document_id`. Null when it has none."},"intercompany_from_entity_id":{"type":"string","nullable":true},"intercompany_to_entity_id":{"type":"string","nullable":true},"from_entity_name":{"type":"string","nullable":true},"to_entity_name":{"type":"string","nullable":true},"email_status":{"type":"string","enum":["sent","failed","not_sent"],"description":"Derived from the latest row in document_email_sends for this document: 'sent' if a successful send exists, 'failed' if the latest attempt failed with no later success, 'not_sent' if no attempts exist. Present on invoice responses only."},"email_last_sent_at":{"type":"string","format":"date-time","nullable":true,"description":"Timestamp of the latest successful email send. Null when email_status is not \"sent\". Present on invoice responses only."},"email_outdated":{"type":"boolean","description":"True when the invoice was re-posted (edited) since the last successful email send — the delivered PDF no longer reflects the current posted journal. Present on invoice responses only."}},"required":["id","lock","is_intercompany","document_type","document_date","total_amount","balance_amount","reserved_amount","currency_code","status","created_at","memo","replaces_document_id","replaces_document_number","replaced_by_document_id","replaced_by_document_number"]},"DocumentReconciliationRefDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"statement_ending_date":{"type":"string","format":"date"},"completion_mode":{"type":"string","enum":["auto","manual"],"description":"How the reconciliation was completed: auto when it closed by itself from its statement, manual when a person finished it (including every completion from before automatic reconciliation existed)."}},"required":["id","statement_ending_date","completion_mode"]},"DocumentPairedPaymentReconciledDto":{"type":"object","properties":{"partner_payment_id":{"type":"string","format":"uuid"},"partner_payment_number":{"type":"string","nullable":true},"bank_account_name":{"type":"string","nullable":true,"description":"The bank account of the line the partner is matched to."}},"required":["partner_payment_id","partner_payment_number","bank_account_name"]},"DocumentMatchedBankTransactionDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"transaction_date":{"type":"string","format":"date"},"amount":{"type":"string","example":"1234.50"},"direction":{"type":"string","enum":["in","out"]},"description":{"type":"string","nullable":true},"bank_account_name":{"type":"string","nullable":true}},"required":["id","transaction_date","amount","direction"]},"RefundSummaryDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_number":{"type":"string","nullable":true},"document_date":{"type":"string","format":"date"},"total_amount":{"type":"string","example":"100.00"},"status":{"type":"string","description":"Document lifecycle status. Voided/reversed refunds appear in this list (so users see why a refund didn't reduce the cap) but don't count against refunded_amount."},"memo":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"}},"required":["id","document_date","total_amount","status","created_at"]},"DocumentDimensionDto":{"type":"object","properties":{"code":{"type":"string","description":"Dimension catalog code (stable key)."},"name":{"type":"string","description":"Human-readable dimension label."},"data_type":{"type":"string","description":"Dimension data type: text | number | date | boolean | entity | dropdown_list."},"value":{"type":"string","description":"Raw stored value. For entity dimensions this is the property or space id. Null when the dimension is answered with \"None\".","nullable":true},"display_value":{"type":"string","description":"Display-ready value: the property or space name for entity dimensions, otherwise equal to value. Null when value is null.","nullable":true}},"required":["code","name","data_type","value","display_value"]},"DocumentLineResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The document line id (what charges reference as billed_document_line_id)."},"account_id":{"type":"string","nullable":true},"item_id":{"type":"string","nullable":true},"item_name":{"type":"string","nullable":true},"account_name":{"type":"string","nullable":true},"account_code":{"type":"string","nullable":true},"quantity":{"type":"number"},"rate":{"type":"number"},"line_amount":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"legal_entity_id":{"type":"string","nullable":true},"counterparty_legal_entity_id":{"type":"string","nullable":true},"tax_rate_id":{"type":"string","format":"uuid","nullable":true,"description":"The sales tax rate applied to this line; null = untaxed."},"tax_rate":{"type":"string","nullable":true,"description":"The rate as it was when the line was written (a decimal fraction, e.g. `0.07000`). Later edits to the rate do not change it."},"tax_amount":{"type":"string","description":"Tax on this line, signed like the line amount.","example":"1234.50"},"dimensions":{"description":"Line-level dimensions attached to this line at creation.","type":"array","items":{"$ref":"#/components/schemas/DocumentDimensionDto"}}},"required":["id","quantity","rate","tax_rate_id","tax_rate","tax_amount","dimensions"]},"DocumentDetailDto":{"type":"object","properties":{"id":{"type":"string"},"lock":{"nullable":true,"description":"Why the UI treats this document as read-only, or null when nothing does. Advisory and computed on read: it is not an enforcement contract, and the API decides each action (edit, void, reopen, post) on its own rules. `period_locked` / `period_closed` reflect the accounting period status of the document's legal entity and document_date. Precedence: `period_locked`, `reconciled`, `bank_matched`, `period_closed`.","type":"object","allOf":[{"$ref":"#/components/schemas/DocumentLockDto"}]},"org_id":{"type":"string"},"entity_id":{"type":"string"},"party_id":{"type":"string","nullable":true},"party_name":{"type":"string","nullable":true},"document_type":{"type":"string"},"document_number":{"type":"string","nullable":true},"vendor_invoice_number":{"type":"string","nullable":true,"description":"The vendor's own invoice number on a bill or vendor credit, as printed; null on other types and on bills entered without one. `document_number` is the ERP's."},"document_date":{"type":"string"},"due_date":{"type":"string","nullable":true},"status":{"type":"string"},"posting_error":{"type":"string","nullable":true,"description":"Why the last post attempt failed, as `<CODE>: <detail>` — set when `status` is `posting_failed`, null otherwise, and cleared by a successful post. The operator remedy depends on it: fix the cause (reopen the period, map the account), then `POST /v1/documents/:id/post`, which accepts `posting_failed`."},"source_type":{"type":"string","enum":["manual","api","contract","loan","expense_recovery_run","bank_transaction","distribution","re_tax","payment_run","expense_recovery_billing","insurance","fixed_asset","payment_reversal","ap_pipeline","percentage_rent","opening_balance"],"nullable":true,"description":"What created this document. `manual` — a user action or a user-initiated flow (for example an intercompany transaction or marking a bill paid, which stamp `manual` whoever calls them); `api` — `POST /v1/documents` called with an API key or by a Acreum internal principal; any other value names the module that generated it (for example `contract`, `loan` or `fixed_asset`), and `source_id` then identifies the record in that module that generated it. Null when the row did not record what created it: rows from before provenance was stamped, and documents the equity module writes directly — capital contributions and investments in a subsidiary (whose `source_id` holds the equity position) and opening-balance journal entries. Read-only: the matching create/update fields are reserved and rejected with DOCUMENT_SOURCE_FIELDS_RESERVED."},"source_id":{"type":"string","format":"uuid","nullable":true,"description":"The record that generated this document, in the module `source_type` names — for example the contract for `contract`, or the fixed-asset event, disposal batch or depreciation run for `fixed_asset`. What it points at depends on `source_type`, so read the two together. Null for `manual` and `api` documents and for opening-balance journal entries. It can be set while `source_type` is null: a capital contribution or an investment in a subsidiary may carry its equity position here, and `document_type` says which it is. Read-only, like `source_type`."},"is_reconciled":{"type":"boolean","description":"True when the document is cleared on a completed bank reconciliation. Such documents cannot be edited or voided until the reconciliation is undone. True exactly when `reconciliation` is non-null."},"reconciliation":{"nullable":true,"description":"The completed bank reconciliation that locks this document. Non-null exactly when `is_reconciled` is true.","type":"object","allOf":[{"$ref":"#/components/schemas/DocumentReconciliationRefDto"}]},"is_bank_matched":{"type":"boolean","description":"True when a bank transaction is matched to this document — either the document a transaction generated, or an invoice/bill paid by a bank-generated payment. Such documents cannot be edited or voided until the match is reverted in Banking — except an `intercompany_settlement`, which stays non-editable but is voided or deleted through its own void, which releases its bank lines. True exactly when `matched_bank_transactions` is non-empty."},"paired_payment_reconciled":{"nullable":true,"description":"Posted payment_in / payment_out only, null otherwise: the in-group partner of this payment (paired payments) when it is matched to a bank line. While it is set, voiding this payment refuses with `PAIRED_PAYMENT_RECONCILED`: revert that match in Banking first, then void either payment and both are voided.","type":"object","allOf":[{"$ref":"#/components/schemas/DocumentPairedPaymentReconciledDto"}]},"matched_bank_transactions":{"description":"Bank transactions matched to this document. Empty when `is_bank_matched` is false.","type":"array","items":{"$ref":"#/components/schemas/DocumentMatchedBankTransactionDto"}},"subtotal_amount":{"type":"string"},"tax_amount":{"type":"string"},"total_amount":{"type":"string"},"reserved_amount":{"type":"string","description":"Money already committed to a payment run; a bill with a non-zero value has a payment in flight. Sum of the active (unreleased) reservations against this document, where a pay-in-full reservation counts as the whole balance. `0.00` when nothing is reserved, and for every document type other than bill. Always present.","example":"1234.50"},"currency_code":{"type":"string"},"memo":{"type":"string","nullable":true},"counterparty_legal_entity_id":{"type":"string","nullable":true},"is_intercompany":{"type":"boolean","description":"True when the document is in-group: an intercompany transaction, or any document naming another legal entity of the org as counterparty (`counterparty_legal_entity_id` is set). Computed for every document type."},"intercompany_from_entity_id":{"type":"string","nullable":true},"intercompany_to_entity_id":{"type":"string","nullable":true},"from_entity_name":{"type":"string","nullable":true},"to_entity_name":{"type":"string","nullable":true},"legal_entity_name":{"type":"string","nullable":true},"refunded_amount":{"type":"string","description":"Sum of refund totals against this document (posting_pending + posted refunds; voided excluded). Present on invoice responses only.","example":"50.00"},"refundable_remaining":{"type":"string","description":"total_amount minus refunded_amount. Present on invoice responses only.","example":"450.00"},"refunds":{"description":"Refund documents linked to this invoice (every status, including voided/reversed, so the drawer can show full history). Most-recent first. Present on invoice responses only.","type":"array","items":{"$ref":"#/components/schemas/RefundSummaryDto"}},"email_status":{"type":"string","enum":["sent","failed","not_sent"],"description":"Derived from the latest row in document_email_sends for this document: 'sent' if a successful send exists, 'failed' if the latest attempt failed with no later success, 'not_sent' if no attempts exist. Present on invoice responses only."},"email_last_sent_at":{"type":"string","format":"date-time","nullable":true,"description":"Timestamp of the latest successful email send. Null when email_status is not \"sent\". Present on invoice responses only."},"email_outdated":{"type":"boolean","description":"True when the invoice was re-posted (edited) since the last successful email send — the delivered PDF no longer reflects the current posted journal. Present on invoice responses only."},"replaces_document_id":{"type":"string","nullable":true,"format":"uuid","description":"The posted document this one replaced (a reissue: `PUT` on a posted document voids it and issues this one). Null when it replaces nothing."},"replaces_document_number":{"type":"string","nullable":true,"description":"The number of the document this one replaced. Null when it replaces nothing."},"replaced_by_document_id":{"type":"string","nullable":true,"format":"uuid","description":"The replacement of this document, if it was reissued: posted, still awaiting approval, or posted and since replaced in turn (so the link holds along a chain: in O → R1 → R2, O reads R1 and R1 reads R2). A replacement voided without ever posting (an abandoned reissue) reads as null."},"replaced_by_document_number":{"type":"string","nullable":true,"description":"The number of the replacement in `replaced_by_document_id`. Null when it has none."},"items":{"type":"array","items":{"$ref":"#/components/schemas/DocumentLineResponseDto"}},"dimensions":{"description":"Header-level dimensions attached to this document at creation.","type":"array","items":{"$ref":"#/components/schemas/DocumentDimensionDto"}}},"required":["id","lock","org_id","entity_id","document_type","vendor_invoice_number","document_date","status","source_type","source_id","is_reconciled","is_bank_matched","paired_payment_reconciled","matched_bank_transactions","subtotal_amount","tax_amount","total_amount","reserved_amount","currency_code","is_intercompany","replaces_document_id","replaces_document_number","replaced_by_document_id","replaced_by_document_number","items","dimensions"]},"EmailPdfUrlDto":{"type":"object","properties":{"url":{"type":"string","nullable":true,"description":"Short-lived Supabase signed URL to the PDF that was actually emailed for this invoice. Null when the invoice has never been sent successfully."},"sent_at":{"type":"string","nullable":true,"format":"date-time","description":"Timestamp of the most recent successful send. Null when the invoice has never been sent successfully."}},"required":["url","sent_at"]},"DocumentCreatedDto":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","description":"Status of the created document: 'posted' when it posted synchronously, 'pending_approval' when an approval rule held it, or the created status for a draft."}},"required":["id","status"]},"DocumentLineItemDto":{"type":"object","properties":{"item_id":{"type":"string","description":"ID of the item (product/service)"},"account_id":{"type":"string","description":"ID of the account (alternative to item_id)"},"debit_amount":{"type":"string","description":"For journal_entry: debit amount","example":"1234.50"},"credit_amount":{"type":"string","description":"For journal_entry: credit amount","example":"1234.50"},"quantity":{"type":"number","example":1},"rate":{"type":"string","example":"100.50"},"item_total":{"type":"string","description":"Total line amount (computed as quantity * rate when omitted)","example":"1234.50"},"tax_rate_id":{"type":"string","format":"uuid","nullable":true,"description":"Sales tax rate for this line (invoice and credit_memo only). The server calculates the tax; send no amount. Omit or null for an untaxed line."},"credits_document_line_id":{"type":"string","format":"uuid","nullable":true,"description":"credit_memo lines only: the invoice line this line credits back. The line copies that line's tax rate, so the credit cancels exactly the tax billed even after a rate edit."},"description":{"type":"string"},"dimensions":{"type":"object","additionalProperties":{"type":"string","nullable":true},"description":"Dimension values keyed by dimensions.code (UUIDs for data_type=entity). Three states: omit the key = unanswered; key with null = explicit \"None\" answer (satisfies is_required); key with a string = a value. Entity-typed values are auto-completed server-side with the row's parent chain: each ancestor lands in the sibling dimension matching its value_source (when bound to this document type); caller-supplied values (including explicit None) are never overwritten. Line level."},"destination_account_id":{"type":"string","description":"For intercompany lines: the receiving entity's account (debited on the to-entity's journal). Required on every line of an `intercompany_transaction` (400 VALIDATION_FAILED otherwise)."},"counterparty_legal_entity_id":{"type":"string","description":"Intercompany tag for this line: the OTHER group entity it trades with. Overrides the header value on a journal_entry line. Must be an entity of the org (400 VALIDATION_FAILED) and must differ from the document's entity_id, which every line books on (422 DOCUMENT_COUNTERPARTY_IS_OWN_ENTITY)."},"legal_entity_id":{"type":"string","description":"Legal entity owner of this line (required for manual intercompany journal_entry)"}}},"CreateDocumentV1Dto":{"type":"object","properties":{"org_id":{"type":"string","description":"Optional in API body. Backend resolves org_id from authenticated user."},"entity_id":{"type":"string","description":"ID of the legal entity (entity_id from the PDF)"},"party_id":{"type":"string","nullable":true,"description":"Party (tenant/vendor). For management contracts use counterparty_legal_entity_id. On PUT of a journal_entry an explicit null removes the party and an omitted key keeps it; every other document type ignores null."},"dimensions":{"type":"object","additionalProperties":{"type":"string","nullable":true},"description":"Dimension values keyed by dimensions.code (UUIDs for data_type=entity). Three states: omit the key = unanswered; key with null = explicit \"None\" answer (satisfies is_required); key with a string = a value. Entity-typed values are auto-completed server-side with the row's parent chain: each ancestor lands in the sibling dimension matching its value_source (when bound to this document type); caller-supplied values (including explicit None) are never overwritten. Document (header) level."},"counterparty_legal_entity_id":{"type":"string","description":"Intercompany tag: the OTHER group entity this document trades with. Must be an entity of the org (400 VALIDATION_FAILED) and must differ from entity_id (422 DOCUMENT_COUNTERPARTY_IS_OWN_ENTITY)."},"intercompany_from_entity_id":{"type":"string","description":"For intercompany_transaction: from entity (income side). Must equal entity_id, and cannot change on a draft (400 VALIDATION_FAILED)."},"intercompany_to_entity_id":{"type":"string","description":"For intercompany_transaction: to entity (expense side). Cannot change on a draft (400 VALIDATION_FAILED)."},"cash_account_id":{"type":"string","description":"For deposit/refund: override the cash account used for the cash leg. Defaults to the org's cash_operating system-role account when omitted. Ignored on other document types."},"document_type":{"type":"string","enum":["invoice","bill","credit_memo","vendor_credit","expense","sales_receipt","payment_in","payment_out","journal_entry","intercompany_transaction","transfer","deposit","refund","refund_payment","straight_line_adjustment","debt_service","debt_service_bill","debt_service_payment","loan_drawdown","loan_payoff","loan_prepayment","loan_accrual","hedge_settlement","hedge_premium","hedge_premium_amortization","hedge_termination","depreciation","asset_disposal","asset_reclass","capital_contribution","investment_in_subsidiary"]},"document_number":{"type":"string","description":"Omit to have a number assigned when the document is saved. The number from next-number is a preview, not a reservation. Send document_number only to use your own number."},"document_date":{"type":"string"},"due_date":{"type":"string"},"memo":{"type":"string"},"party_note":{"type":"string","description":"Note for the counterparty"},"internal_note":{"type":"string","description":"Internal note"},"items":{"description":"Document lines.","type":"array","items":{"$ref":"#/components/schemas/DocumentLineItemDto"}},"rule_id":{"type":"string"},"discount_type":{"type":"string","enum":["percentage","amount"]},"discount_value":{"type":"number"},"total":{"type":"string","description":"Overrides the computed total. `discount_value` is still a number — it pairs with `discount_type`, so it is money in one mode and a percentage in the other and is typed with the discount engine.","example":"1234.50"},"send_notification":{"type":"boolean","default":false},"post":{"type":"boolean","description":"Drives whether the document is posted to the GL. Semantics depend on the HTTP verb:\n- On `POST /v1/documents`: omitted defaults to `true`. `true` posts immediately (status `posting_pending` → `posted`); `false` creates a `draft` (no journal entry until the caller invokes `POST /v1/documents/:id/post`).\n- On `PUT /v1/documents/:id`: omitted defaults to `false` — the update changes lines/header but leaves posting status alone. `true` posts after update (draft → posted, or posting_pending → posted). On a `posted` document, the post flag is ignored: every PUT triggers a reversal-and-repost.","default":true},"source_type":{"type":"string","deprecated":true,"description":"RESERVED — do not send. Derived server-side from the authenticated principal (`manual` for users, `api` for API keys) or stamped by internal generators (`contract`, `loan`, `expense_recovery_run`, `bank_transaction`, `distribution`). Requests supplying it are rejected with 422 DOCUMENT_SOURCE_FIELDS_RESERVED."},"source_id":{"type":"string","deprecated":true,"description":"RESERVED — do not send. Set server-side to the originating record id (contract, loan, recovery run, bank transaction, distribution declaration). Requests supplying it are rejected with 422 DOCUMENT_SOURCE_FIELDS_RESERVED."},"period_override_reason":{"type":"string","description":"Reason for posting into a closed accounting period. Non-empty value indicates override intent and requires the accounting:periods_override scope.","maxLength":500}},"required":["entity_id","document_type"]},"DocumentUpdatedDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The document the PUT left in force: the same id for a draft; for a reissued posted document, the NEW replacement (the original is voided)."},"document_number":{"type":"string","nullable":true,"description":"The document's number. A reissue's replacement always takes a new number, never the original's."},"status":{"type":"string","enum":["draft","posted","pending_approval"],"description":"The document's status after the PUT. A draft edit stays `draft`; with `post: true` it is `posted`, or `pending_approval` when an approval rule held it. For a reissue, `posted`, or `pending_approval` when an approval rule held the replacement (the original then stays posted until it is approved). A failed post rolls the PUT back, so no other status is returned."},"replaces_document_id":{"type":"string","nullable":true,"format":"uuid","description":"The posted document this one replaces — set when the PUT reissued a posted document, null for a draft edit."}},"required":["id","document_number","status","replaces_document_id"]},"UpdateDocumentV1Dto":{"type":"object","properties":{"org_id":{"type":"string","description":"Optional in API body. Backend resolves org_id from authenticated user."},"entity_id":{"type":"string","description":"ID of the legal entity (entity_id from the PDF)"},"party_id":{"type":"string","nullable":true,"description":"Party (tenant/vendor). For management contracts use counterparty_legal_entity_id. On PUT of a journal_entry an explicit null removes the party and an omitted key keeps it; every other document type ignores null."},"dimensions":{"type":"object","additionalProperties":{"type":"string","nullable":true},"description":"Dimension values keyed by dimensions.code (UUIDs for data_type=entity). Three states: omit the key = unanswered; key with null = explicit \"None\" answer (satisfies is_required); key with a string = a value. Entity-typed values are auto-completed server-side with the row's parent chain: each ancestor lands in the sibling dimension matching its value_source (when bound to this document type); caller-supplied values (including explicit None) are never overwritten. Document (header) level."},"counterparty_legal_entity_id":{"type":"string","description":"Intercompany tag: the OTHER group entity this document trades with. Must be an entity of the org (400 VALIDATION_FAILED) and must differ from entity_id (422 DOCUMENT_COUNTERPARTY_IS_OWN_ENTITY)."},"intercompany_from_entity_id":{"type":"string","description":"For intercompany_transaction: from entity (income side). Must equal entity_id, and cannot change on a draft (400 VALIDATION_FAILED)."},"intercompany_to_entity_id":{"type":"string","description":"For intercompany_transaction: to entity (expense side). Cannot change on a draft (400 VALIDATION_FAILED)."},"cash_account_id":{"type":"string","description":"For deposit/refund: override the cash account used for the cash leg. Defaults to the org's cash_operating system-role account when omitted. Ignored on other document types."},"document_type":{"type":"string","enum":["invoice","bill","credit_memo","vendor_credit","expense","sales_receipt","payment_in","payment_out","journal_entry","intercompany_transaction","transfer","deposit","refund","refund_payment","straight_line_adjustment","debt_service","debt_service_bill","debt_service_payment","loan_drawdown","loan_payoff","loan_prepayment","loan_accrual","hedge_settlement","hedge_premium","hedge_premium_amortization","hedge_termination","depreciation","asset_disposal","asset_reclass","capital_contribution","investment_in_subsidiary"]},"document_number":{"type":"string","description":"Omit to have a number assigned when the document is saved. The number from next-number is a preview, not a reservation. Send document_number only to use your own number."},"document_date":{"type":"string"},"due_date":{"type":"string"},"memo":{"type":"string"},"party_note":{"type":"string","description":"Note for the counterparty"},"internal_note":{"type":"string","description":"Internal note"},"items":{"description":"Document lines.","type":"array","items":{"$ref":"#/components/schemas/DocumentLineItemDto"}},"rule_id":{"type":"string"},"discount_type":{"type":"string","enum":["percentage","amount"]},"discount_value":{"type":"number"},"total":{"type":"string","description":"Overrides the computed total. `discount_value` is still a number — it pairs with `discount_type`, so it is money in one mode and a percentage in the other and is typed with the discount engine.","example":"1234.50"},"send_notification":{"type":"boolean","default":false},"post":{"type":"boolean","description":"Drives whether the document is posted to the GL. Semantics depend on the HTTP verb:\n- On `POST /v1/documents`: omitted defaults to `true`. `true` posts immediately (status `posting_pending` → `posted`); `false` creates a `draft` (no journal entry until the caller invokes `POST /v1/documents/:id/post`).\n- On `PUT /v1/documents/:id`: omitted defaults to `false` — the update changes lines/header but leaves posting status alone. `true` posts after update (draft → posted, or posting_pending → posted). On a `posted` document, the post flag is ignored: every PUT triggers a reversal-and-repost.","default":true},"source_type":{"type":"string","deprecated":true,"description":"RESERVED — do not send. Derived server-side from the authenticated principal (`manual` for users, `api` for API keys) or stamped by internal generators (`contract`, `loan`, `expense_recovery_run`, `bank_transaction`, `distribution`). Requests supplying it are rejected with 422 DOCUMENT_SOURCE_FIELDS_RESERVED."},"source_id":{"type":"string","deprecated":true,"description":"RESERVED — do not send. Set server-side to the originating record id (contract, loan, recovery run, bank transaction, distribution declaration). Requests supplying it are rejected with 422 DOCUMENT_SOURCE_FIELDS_RESERVED."},"period_override_reason":{"type":"string","description":"Reason for posting into a closed accounting period. Non-empty value indicates override intent and requires the accounting:periods_override scope.","maxLength":500}},"required":["entity_id","document_type"]},"DocumentPostedDto":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["posting_pending","posted","pending_approval","rejected"],"description":"Usually `posted` (posting is synchronous in-request); `posting_pending` is a transient internal status. When the document matches an approval rule it is held and returns `pending_approval` (no journal yet); `rejected` can surface on resubmit paths."}},"required":["id","status"]},"MarkBillPaidResponseV1Dto":{"type":"object","properties":{"payment_document_id":{"type":"string","format":"uuid"},"application_id":{"type":"string","format":"uuid"},"bill_balance_amount":{"type":"string","example":"0.00","description":"Document balance remaining after the payment is applied."}},"required":["payment_document_id","application_id","bill_balance_amount"]},"MarkBillPaidV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid","description":"Cash/bank account the payment is received into (invoice) or drawn from (bill, distribution leg or investment in a subsidiary)."},"payment_date":{"type":"string","example":"2026-07-15","description":"Payment date (YYYY-MM-DD)."},"amount":{"type":"string","description":"Amount to pay; must be > 0 and <= the document balance.","example":"1804.05"},"memo":{"type":"string","description":"Optional note; defaults to \"Manually marked as paid\"."},"paired_payment_date":{"type":"string","format":"date","description":"Only used when the document is an in-group distribution leg or an investment in a subsidiary: the date of the receiving entity's payment. Defaults to payment_date."},"paired_bank_account_id":{"type":"string","format":"uuid","description":"Only used when the document is an in-group distribution leg or an investment in a subsidiary: the bank account the receiving entity's payment posts to. Defaults to that entity's default bank account."}},"required":["account_id","payment_date","amount"]},"PayBillSparkPayResponseV1Dto":{"type":"object","properties":{"payment_run_id":{"type":"string","format":"uuid","description":"The payment run of one that was created for this bill."},"status":{"type":"string","enum":["sent","pending_approval","approved_awaiting_send","approved_not_sent"],"description":"Where the run came to rest. `sent` — handed to the Spark Pay rail. `pending_approval` — an approval rule matched and it waits. `approved_awaiting_send` — approved, but the caller is not an owner or admin, so releasing the money is someone else’s act. `approved_not_sent` — approved, the send was attempted and failed; re-pressing send on the run is the recovery path."},"party_id":{"type":"string","format":"uuid","description":"The vendor the bill is owed to."}},"required":["payment_run_id","status","party_id"]},"PayBillSparkPayV1Dto":{"type":"object","properties":{"bank_account_id":{"type":"string","description":"The Moov-linked bank account the money leaves from. Must belong to the same legal entity as the bill.","format":"uuid"}},"required":["bank_account_id"]},"DocumentSubmittedDto":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]},"DocumentReopenedDto":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]},"DocumentVoidedDto":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"reversal_moved_to_current_period":{"type":"boolean","description":"True when the reversing entry was posted into the CURRENT open period rather than the original entry’s, because that period is closed or locked. Callers that display the reversal need this: without it they will assume it landed on the original’s date. False for a document whose period is still open, and for a deliberate in-place restatement."}},"required":["id","status","reversal_moved_to_current_period"]},"VoidDocumentV1Dto":{"type":"object","properties":{"memo":{"type":"string","description":"Memo for the reversing journal entry. Required when voiding a posted document."},"reverse_in_original_period":{"type":"boolean","description":"Post the reversing entry into the ORIGINAL entry’s period instead of the current open one — a deliberate prior-period restatement, and only meaningful when that period is closed. Requires the accounting:periods_override scope. Default false: the reversal lands in the current open period, so a closed period’s reported figures never change.","default":false}}},"SendDocumentEmailResultDto":{"type":"object","properties":{"sent_at":{"type":"string","format":"date-time"}},"required":["sent_at"]},"CreditApplicationDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"payment_document_id":{"type":"string","format":"uuid"},"applied_document_id":{"type":"string","format":"uuid"},"applied_amount":{"type":"string","example":"100.00"},"applied_at":{"type":"string","description":"ISO timestamp when this application was created.","format":"date-time"},"unapplied_at":{"type":"string","description":"ISO timestamp when this application was reversed via /reverse-apply, or null if still active.","format":"date-time","nullable":true}},"required":["id","payment_document_id","applied_document_id","applied_amount","applied_at"]},"CreditApplyResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_type":{"type":"string","enum":["credit_memo","vendor_credit"]},"status":{"type":"string","enum":["posted","settled"]},"balance_amount":{"type":"string","example":"0.00"},"applications":{"type":"array","items":{"$ref":"#/components/schemas/CreditApplicationDto"}}},"required":["id","document_type","status","balance_amount","applications"]},"CreditApplicationLineDto":{"type":"object","properties":{"document_id":{"type":"string","description":"The target document (invoice for credit memos, bill for vendor credits) to apply this portion of the credit against.","format":"uuid"},"amount":{"type":"string","description":"Amount of the credit to apply to this target. Decimal string with up to 2 decimal places. Sum across all entries must equal the credit's remaining balance.","example":"100.00"}},"required":["document_id","amount"]},"ApplyCreditDto":{"type":"object","properties":{"applications":{"description":"One row per target. Sum of amounts must equal the credit's remaining balance.","type":"array","items":{"$ref":"#/components/schemas/CreditApplicationLineDto"}}},"required":["applications"]},"DocumentAttachmentDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"file_name":{"type":"string","description":"Original filename supplied by the client."},"content_type":{"type":"string","enum":["application/pdf","image/png","image/jpeg","image/webp"]},"file_size_bytes":{"type":"number","description":"File size in bytes."},"uploaded_at":{"type":"string","format":"date-time"},"uploaded_by":{"type":"string","nullable":true,"format":"uuid"}},"required":["id","document_id","file_name","content_type","file_size_bytes","uploaded_at"]},"DocumentAttachmentDownloadUrlDto":{"type":"object","properties":{"url":{"type":"string","description":"Short-lived Supabase signed URL. Treat as opaque; do not bookmark."},"expires_at":{"type":"string","format":"date-time","description":"Timestamp at which the signed URL expires."}},"required":["url","expires_at"]},"RefundInvoiceLineV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"amount":{"type":"string","example":"100.00"},"description":{"type":"string"},"dimensions":{"type":"object","additionalProperties":{"type":"string","nullable":true},"description":"Dimension values keyed by dimensions.code. Key with null = explicit \"None\" answer."}},"required":["account_id","amount"]},"RefundInvoiceV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"Refund amount in invoice currency.","example":"500.00"},"document_date":{"type":"string","format":"date","example":"2026-05-19"},"memo":{"type":"string"},"reason":{"type":"string","description":"Free-text reason. FE dropdown typically constrains to duplicate / returned / service_issue / goodwill / other."},"lines":{"description":"Custom refund lines. Optional — if omitted, lines are derived by proportional scaling from the source invoice. When supplied, sum(line.amount) must equal amount.","type":"array","items":{"$ref":"#/components/schemas/RefundInvoiceLineV1Dto"}}},"required":["amount"]},"AppliedDocRefDto":{"type":"object","properties":{"id":{"type":"string"},"document_type":{"type":"string"},"document_number":{"type":"string","nullable":true},"balance_amount":{"type":"string"}},"required":["id","document_type","document_number","balance_amount"]},"PaymentApplicationCreatedDto":{"type":"object","properties":{"id":{"type":"string"},"payment_document":{"$ref":"#/components/schemas/AppliedDocRefDto"},"applied_document":{"$ref":"#/components/schemas/AppliedDocRefDto"}},"required":["id","payment_document","applied_document"]},"CreatePaymentApplicationV1Dto":{"type":"object","properties":{"payment_document_id":{"type":"string","format":"uuid"},"applied_document_id":{"type":"string","format":"uuid"},"applied_amount":{"type":"string","example":"1804.05"},"paired_payment_date":{"type":"string","format":"date","description":"Only used when the applied document is one side of an in-group pair: the date of the other entity's payment. Defaults to this payment's date."},"paired_bank_account_id":{"type":"string","format":"uuid","description":"Only used when the applied document is one side of an in-group pair: the bank account the other entity's payment posts to. Defaults to that entity's default bank account."}},"required":["payment_document_id","applied_document_id","applied_amount"]},"ApprovalInboxDocumentDto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"document_number":{"type":"string","nullable":true},"total":{"type":"string","nullable":true,"description":"Document total amount.","example":"1234.50"},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"submitted_at":{"type":"string","description":"When the approval request was submitted."}},"required":["document_id","document_type","total","submitted_at"]},"ApprovalInboxPaymentRunDto":{"type":"object","properties":{"payment_run_id":{"type":"string","format":"uuid"},"run_number":{"type":"string"},"total":{"type":"string","description":"Run total over every entity: per bill, the stamped amount paid, else the amount to pay, else the live balance.","example":"1234.50"},"amount":{"type":"string","description":"This request's amount, the one an approver's authority limit is checked against: the entity's share for an entity request, the sum of the group members' shares for a group request, the run total for an org-wide request.","example":"1234.50"},"bank_account_name":{"type":"string","nullable":true,"description":"The entity's paying bank account for an entity request; null for a group or org-wide request."},"bill_count":{"type":"number","description":"Bills in this request's scope."},"vendor_count":{"type":"number","description":"Vendors in this request's scope."},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"The legal entity of an entity request; null otherwise."},"legal_entity_name":{"type":"string","nullable":true},"entity_group_id":{"type":"string","nullable":true,"format":"uuid","description":"The payment group of a group request; null otherwise."},"entity_group_name":{"type":"string","nullable":true},"submitted_at":{"type":"string","description":"When the approval request was submitted."}},"required":["payment_run_id","run_number","total","amount","bank_account_name","bill_count","vendor_count","legal_entity_id","legal_entity_name","entity_group_id","entity_group_name","submitted_at"]},"ApprovalInboxDistributionBatchDueDatesDto":{"type":"object","properties":{"from":{"type":"string","nullable":true,"format":"date"},"to":{"type":"string","nullable":true,"format":"date"}}},"ApprovalInboxDistributionBatchDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"item_count":{"type":"integer"},"total":{"type":"string","description":"The batch total (Σ of its items’ amounts).","example":"1234.50"},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"The batch’s single legal entity; null when its items span several entities."},"due_dates":{"$ref":"#/components/schemas/ApprovalInboxDistributionBatchDueDatesDto"},"submitted_at":{"type":"string","format":"date-time","description":"When the approval request was submitted."}},"required":["id","item_count","total","due_dates","submitted_at"]},"ApprovalInboxPortalPackageDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","nullable":true,"description":"Null defensively — the name lookup found nothing for the legal entity id; should not happen in practice."},"window_start":{"type":"string","format":"date"},"window_end_inclusive":{"type":"string","format":"date"},"period_label":{"type":"string","nullable":true,"description":"The window named the way the period generator names a monthly or quarterly cadence under the org's fiscal year — the package's notifications use: a month window `Jun 2026`, a quarter `Q<n> <fiscal year>` counted from the fiscal-year start (`Q1 2026` for Apr–Jun 2026 under an April fiscal year). A 3-month window not aligned to a fiscal quarter reads as its month span (`Feb 2026 – Apr 2026` under a January fiscal year) — a defensive fallback: a window is drafted aligned, and the org's fiscal-year start freezes once a period is closed, which drafting a package requires. An org on a 4-4-5 calendar names its own periods `P<n> <FY>`; its packages still read as these month and quarter names. Show it as is for an existing package; the only client-side naming is of a window not yet drafted, which has no package. Null defensively — the stored window could not be read as two real dates; should not happen in practice."},"submitted_at":{"type":"string","description":"When this publish request was submitted: an instant, in the Postgres timestamptz text form every approvals timestamp uses (e.g. `2026-10-26 13:24:02.927142+00`). For the package’s LATEST request it is the instant the package page shows as `approval_request.requested_at`, which the portal routes emit as ISO 8601 — compare them as instants, never as strings."},"publish_outcome":{"type":"string","enum":["published","publish_failed"],"nullable":true,"description":"What THIS request's approval did to the package, recorded on the request when its publish ran: `published` — the publish it authorized succeeded (directly on approval, or by `Portal.retryPublish`); `publish_failed` — that publish failed and the package went back to `draft` (publishing again needs a new request). Null while the request is pending, when it was rejected or withdrawn, when it is approved but its publish has not run, and when it was approved before outcomes were recorded. Per request and permanent: a later request's outcome, a later publish without approval, and Refresh figures on the draft never change it — unlike the package page's last-failure notice, which a refresh retires. Null unless the caller holds `portal:manage` and may act on the package's legal entity."},"publish_failed_at":{"type":"string","nullable":true,"description":"When this request's publish failed, as recorded on the request: an instant, in the same Postgres timestamptz text form as `submitted_at` — compare it as an instant, never as a string. Set only when `publish_outcome` is `publish_failed`; null otherwise, and null unless the caller holds `portal:manage` and may act on the package's legal entity."}},"required":["id","legal_entity_id","window_start","window_end_inclusive","period_label","submitted_at","publish_outcome","publish_failed_at"]},"ApprovalInboxPortalPublishRunDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"entities_total":{"type":"integer","description":"The size of the selection this run authorizes."},"window_start":{"type":"string","format":"date"},"window_end_inclusive":{"type":"string","format":"date"},"submitted_at":{"type":"string","description":"When this publish run was submitted."}},"required":["id","entities_total","window_start","window_end_inclusive","submitted_at"]},"ApprovalInboxWaterfallVersionDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The waterfall version id."},"waterfall_id":{"type":"string","format":"uuid"},"waterfall_name":{"type":"string"},"version_no":{"type":"number","description":"The version number within its waterfall."},"legal_entity_id":{"type":"string","format":"uuid"},"effective_from":{"type":"string","format":"date"}},"required":["id","waterfall_id","waterfall_name","version_no","legal_entity_id","effective_from"]},"ApprovalInboxItemDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The row id: equal to `task_id`. The inbox has one row per task, so this is the id `ids` filters by and the paging key."},"request_id":{"type":"string","format":"uuid"},"task_id":{"type":"string","format":"uuid"},"step_name":{"type":"string"},"step_order":{"type":"number"},"require_authority":{"type":"boolean","description":"Whether the step requires the approver to have authority for the document/run total."},"actionable":{"type":"boolean","description":"True when the caller can actually act on this task: the step does not require authority, or the caller’s approval limit covers the document/run total — and, for a portal-package publish request or a bulk publish run, the caller did not submit it (a submitter can never approve their own publish — a single package or a bulk run of many — even when eligible by role; separation of duties applies unchanged to a run) and holds `portal:manage` (a member named on the rule, or one demoted after it was written, is never shown as able to approve a publish the decision route would then refuse)."},"document":{"nullable":true,"description":"Present iff the request targets a document; exactly one of document/payment_run/distribution_batch/portal_package/portal_publish_run/waterfall_version is non-null.","type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxDocumentDto"}]},"payment_run":{"nullable":true,"description":"Present iff the request targets a payment run; exactly one of document/payment_run/distribution_batch/portal_package/portal_publish_run/waterfall_version is non-null.","type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxPaymentRunDto"}]},"distribution_batch":{"nullable":true,"description":"Present iff the request targets a distribution batch; exactly one of document/payment_run/distribution_batch/portal_package/portal_publish_run/waterfall_version is non-null.","type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxDistributionBatchDto"}]},"portal_package":{"nullable":true,"description":"Present iff the request targets an investor-portal package publish; exactly one of document/payment_run/distribution_batch/portal_package/portal_publish_run/waterfall_version is non-null.","type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxPortalPackageDto"}]},"portal_publish_run":{"nullable":true,"description":"Present iff the request targets a bulk publish run (Task 4); exactly one of document/payment_run/distribution_batch/portal_package/portal_publish_run/waterfall_version is non-null.","type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxPortalPublishRunDto"}]},"waterfall_version":{"nullable":true,"description":"Present iff the request targets a waterfall version activation; exactly one of document/payment_run/distribution_batch/portal_package/portal_publish_run/waterfall_version is non-null.","type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxWaterfallVersionDto"}]}},"required":["id","request_id","task_id","step_name","step_order","require_authority","actionable"]},"ApprovalRequestListItemDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","approved","rejected","cancelled"]},"document_id":{"type":"string","nullable":true,"format":"uuid"},"rule_id":{"type":"string","nullable":true,"format":"uuid"},"current_step_order":{"type":"number"},"submitted_by":{"type":"string","format":"uuid"},"submitted_at":{"type":"string"},"actionable":{"type":"boolean","description":"Whether the current caller can act on this request now: it is pending and the caller holds an active task on it that passes the inbox `actionable` rule."},"resolved_at":{"type":"string","nullable":true},"approved_by":{"description":"Distinct user ids that recorded an `approve` decision, earliest first.","type":"array","items":{"type":"string"}},"document":{"nullable":true,"description":"Present iff the request targets a document; exactly one of document/payment_run/distribution_batch/portal_package/portal_publish_run/waterfall_version is non-null — these six cover every approval subject. Filter with `document_type=portal_publish_run` or `document_type=waterfall_version` to find those requests.","type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxDocumentDto"}]},"payment_run":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxPaymentRunDto"}]},"distribution_batch":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxDistributionBatchDto"}]},"portal_package":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxPortalPackageDto"}]},"portal_publish_run":{"nullable":true,"description":"Present iff the request targets a bulk publish run (Task 4); exactly one of document/payment_run/distribution_batch/portal_package/portal_publish_run/waterfall_version is non-null — these six cover every approval subject.","type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxPortalPublishRunDto"}]},"waterfall_version":{"nullable":true,"description":"Present iff the request targets a waterfall version activation.","type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxWaterfallVersionDto"}]}},"required":["id","status","current_step_order","submitted_by","submitted_at","actionable","approved_by"]},"ApprovalCountDto":{"type":"object","properties":{"actionable":{"type":"number","description":"The caller’s active tasks on pending requests they can act on now."},"pending":{"type":"number","description":"The caller’s active tasks on pending requests."}},"required":["actionable","pending"]},"ApprovalApproverSnapshotDto":{"type":"object","properties":{"kind":{"type":"string","enum":["role","user"]},"role":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true,"format":"uuid"}},"required":["kind"]},"ApprovalDetailTaskDto":{"type":"object","properties":{"task_id":{"type":"string","format":"uuid"},"step_order":{"type":"number"},"name":{"type":"string"},"status":{"type":"string","enum":["pending","active","approved","rejected"]},"approvals_required":{"type":"number"},"approvals_received":{"type":"number"},"require_authority":{"type":"boolean"},"approvers_snapshot":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalApproverSnapshotDto"}}},"required":["task_id","step_order","name","status","approvals_required","approvals_received","require_authority","approvers_snapshot"]},"ApprovalDetailDecisionDto":{"type":"object","properties":{"task_id":{"type":"string","format":"uuid"},"step_order":{"type":"number"},"approver_user_id":{"type":"string","format":"uuid"},"decision":{"type":"string","enum":["approve","reject"]},"note":{"type":"string","nullable":true},"decided_at":{"type":"string"}},"required":["task_id","step_order","approver_user_id","decision","decided_at"]},"ApprovalDetailDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_id":{"type":"string","nullable":true,"format":"uuid"},"payment_run_id":{"type":"string","nullable":true,"format":"uuid"},"distribution_batch_id":{"type":"string","nullable":true,"format":"uuid"},"portal_package_id":{"type":"string","nullable":true,"format":"uuid"},"portal_publish_run_id":{"type":"string","nullable":true,"format":"uuid","description":"The bulk investor-portal publish run this request authorizes; null for every other subject."},"waterfall_version_id":{"type":"string","nullable":true,"format":"uuid"},"rule_id":{"type":"string","nullable":true,"format":"uuid"},"status":{"type":"string","enum":["pending","approved","rejected","cancelled"]},"current_step_order":{"type":"number"},"submitted_by":{"type":"string","format":"uuid"},"submitted_at":{"type":"string"},"resolved_at":{"type":"string","nullable":true},"payment_run":{"nullable":true,"description":"Present iff the request targets a payment run; null for a document request (document fields are the flat `document_id` above, unchanged).","type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxPaymentRunDto"}]},"distribution_batch":{"nullable":true,"description":"Present iff the request targets a distribution batch; null otherwise.","type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxDistributionBatchDto"}]},"portal_package":{"nullable":true,"description":"Present iff the request targets an investor-portal package publish; null otherwise.","type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxPortalPackageDto"}]},"portal_publish_run":{"nullable":true,"description":"Present iff the request targets a bulk investor-portal publish run; null otherwise. Exactly one of document_id/payment_run/distribution_batch/portal_package/portal_publish_run/waterfall_version identifies the subject.","type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxPortalPublishRunDto"}]},"waterfall_version":{"nullable":true,"description":"Present iff the request targets a waterfall version activation; null otherwise.","type":"object","allOf":[{"$ref":"#/components/schemas/ApprovalInboxWaterfallVersionDto"}]},"tasks":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalDetailTaskDto"}},"decisions":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalDetailDecisionDto"}}},"required":["id","status","current_step_order","submitted_by","submitted_at","tasks","decisions"]},"ApprovalActionResultDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]},"DecideApprovalDto":{"type":"object","properties":{"decision":{"type":"string","enum":["approve","reject"],"description":"The decision the approver is recording against the active task."},"note":{"type":"string","nullable":true,"maxLength":2000,"description":"Optional free-text note recorded with the decision."}},"required":["decision"]},"ApprovalRuleIdDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]},"ApprovalConditionDto":{"type":"object","properties":{"conditionType":{"type":"string","enum":["amount","legal_entity","property","gl_account","vendor","rolling_window","entity_group"]},"operator":{"type":"string","enum":["eq","in","gte","lte","between"]},"value":{"description":"Matcher-shaped comparison value (jsonb). amount: { min?, max? } numbers (gte uses min, lte uses max, between uses both). rolling_window: { min, days } (gte) — requires approval once this run plus every completed run for the same legal entity within the trailing window reaches `min`; the window is a rolling `days`×24h span ending at the moment of evaluation, not calendar days. eq: a single id string. in: an array of id strings.","oneOf":[{"type":"object"},{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["conditionType","operator","value"]},"ApprovalApproverDto":{"type":"object","properties":{"kind":{"type":"string","enum":["role","user"]},"role":{"type":"string","description":"Org role to satisfy this approver when kind = 'role'.","nullable":true},"userId":{"type":"string","description":"Specific user when kind = 'user'.","format":"uuid","nullable":true}},"required":["kind"]},"ApprovalStepDto":{"type":"object","properties":{"stepOrder":{"type":"number","description":"Step ordering within the rule (must be unique per rule)."},"name":{"type":"string"},"approvalsRequired":{"type":"number","description":"N-of-M approvals required to clear the step."},"requireAuthority":{"type":"boolean","description":"When true, approvers must have an approval authority limit covering the document total."},"approvers":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalApproverDto"}}},"required":["stepOrder","name","approvalsRequired","approvers"]},"ApprovalAudienceDto":{"type":"object","properties":{"kind":{"type":"string","enum":["role","user"]},"role":{"type":"string","description":"Org role this audience entry targets when kind = 'role'.","nullable":true},"userId":{"type":"string","description":"Specific user this audience entry targets when kind = 'user'.","format":"uuid","nullable":true}},"required":["kind"]},"CreateApprovalRuleDto":{"type":"object","properties":{"subjectType":{"type":"string","enum":["invoice","credit_memo","vendor_credit","bill","expense","sales_receipt","payment_in","payment_out","journal_entry","intercompany_transaction","intercompany_settlement","transfer","deposit","refund","owner_distribution","refund_payment","distribution_receipt","straight_line_adjustment","debt_service","payment_run","distribution_batch","portal_package","waterfall_version","portal_publish_run","depreciation","asset_disposal","asset_reclass"],"description":"The kind of subject this rule applies to (bill, invoice, payment_run, …)."},"name":{"type":"string"},"enabled":{"type":"boolean","default":true},"priority":{"type":"number","description":"Higher priority wins when multiple rules match. Default 0.","default":0},"conditions":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalConditionDto"}},"steps":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalStepDto"}},"appliesTo":{"description":"Submitters this rule applies to (users and/or roles, ORed). Omit or send [] to apply to everyone. Matched against the document's submitter.","type":"array","items":{"$ref":"#/components/schemas/ApprovalAudienceDto"}}},"required":["subjectType","name","conditions","steps"]},"ApprovalRuleConditionResponseDto":{"type":"object","properties":{"condition_type":{"type":"string","enum":["amount","legal_entity","property","gl_account","vendor","rolling_window","entity_group"]},"operator":{"type":"string","enum":["eq","in","gte","lte","between"]},"value":{"description":"Matcher-shaped comparison value (jsonb). amount: { min?, max? } numbers (gte uses min, lte uses max, between uses both). rolling_window: { min, days } (gte) — requires approval once this run plus every completed run for the same legal entity within the trailing window reaches `min`; the window is a rolling `days`×24h span ending at the moment of evaluation, not calendar days. eq: a single id string. in: an array of id strings.","oneOf":[{"type":"object"},{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["condition_type","operator","value"]},"ApprovalRuleApproverResponseDto":{"type":"object","properties":{"kind":{"type":"string","enum":["role","user"]},"role":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true,"format":"uuid"}},"required":["kind"]},"ApprovalRuleStepResponseDto":{"type":"object","properties":{"step_order":{"type":"number"},"name":{"type":"string"},"approvals_required":{"type":"number"},"require_authority":{"type":"boolean"},"approvers":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalRuleApproverResponseDto"}}},"required":["step_order","name","approvals_required","require_authority","approvers"]},"ApprovalRuleAudienceResponseDto":{"type":"object","properties":{"kind":{"type":"string","enum":["role","user"]},"role":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true,"format":"uuid"}},"required":["kind"]},"ApprovalRuleDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"subject_type":{"type":"string","description":"The kind of subject this rule applies to."},"name":{"type":"string"},"enabled":{"type":"boolean"},"priority":{"type":"number"},"conditions":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalRuleConditionResponseDto"}},"steps":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalRuleStepResponseDto"}},"applies_to":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalRuleAudienceResponseDto"}}},"required":["id","subject_type","name","enabled","priority","conditions","steps","applies_to"]},"UpdateApprovalRuleDto":{"type":"object","properties":{"subjectType":{"type":"string","enum":["invoice","credit_memo","vendor_credit","bill","expense","sales_receipt","payment_in","payment_out","journal_entry","intercompany_transaction","intercompany_settlement","transfer","deposit","refund","owner_distribution","refund_payment","distribution_receipt","straight_line_adjustment","debt_service","payment_run","distribution_batch","portal_package","waterfall_version","portal_publish_run","depreciation","asset_disposal","asset_reclass"],"description":"The kind of subject this rule applies to (bill, invoice, payment_run, …)."},"name":{"type":"string"},"enabled":{"type":"boolean","default":true},"priority":{"type":"number","description":"Higher priority wins when multiple rules match. Default 0.","default":0},"conditions":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalConditionDto"}},"steps":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalStepDto"}},"appliesTo":{"description":"Submitters this rule applies to (users and/or roles, ORed). Omit or send [] to apply to everyone. Matched against the document's submitter.","type":"array","items":{"$ref":"#/components/schemas/ApprovalAudienceDto"}}},"required":["subjectType","name","conditions","steps"]},"EquityClassV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"code":{"type":"string","maxLength":32,"example":"COMMON"},"name":{"type":"string","maxLength":120,"example":"Common"},"kind":{"type":"string","enum":["gp","lp","common","preferred","co_invest","promote","profits_interest"]},"seniority_rank":{"type":"number","description":"Seniority in the distribution waterfall — lower numbers sort first."},"unit_based":{"type":"boolean","description":"True when positions on this class carry a `units` count priced by `default_unit_price`; false when a position is a plain dollar-denominated capital account. **The flag is the class's intent, not an assertion about the data**: nothing writes a unit count in this release (spec §17), so `units` reads `0.000000` on a `unit_based` class too."},"default_unit_price":{"type":"string","nullable":true,"example":"10.000000","description":"Price per unit as a decimal string (numeric(18,6)), or null when the class is not unit-based or has no default price."},"counts_toward_ownership":{"type":"boolean","description":"Whether positions on this class count toward the ownership-percentage roll-up."},"distribution_bucket_policy":{"type":"string","enum":["capital_first","profit_first"]},"contributed_capital_account_id":{"type":"string","format":"uuid","nullable":true,"description":"Intended override for the class contributed-capital GL account, or null. STORED AND VALIDATED, but not yet honoured: posting resolves the legal entity's/org's `contributed_capital` system-role account regardless of this value. Honoured from PR 0.6."},"status":{"type":"string","enum":["active","closed"]}},"required":["id","legal_entity_id","code","name","kind","seniority_rank","unit_based","default_unit_price","counts_toward_ownership","distribution_bucket_policy","contributed_capital_account_id","status"]},"CreateEquityClassV1Dto":{"type":"object","properties":{"code":{"type":"string","maxLength":32,"example":"COMMON"},"name":{"type":"string","maxLength":120,"example":"Common"},"kind":{"type":"string","enum":["gp","lp","common","preferred","co_invest","promote","profits_interest"]},"seniority_rank":{"type":"number","default":0},"unit_based":{"type":"boolean","default":false},"default_unit_price":{"type":"string","example":"10.000000","description":"Price per unit as a non-negative decimal string with up to 6 fractional digits (numeric(18,6)), e.g. \"10.000000\". Not money — this is a unit price, not a GL amount, so it validates against this column's own precision (numeric(18,6)) rather than the shared 2dp money example ApiMoney() carries."},"counts_toward_ownership":{"type":"boolean","description":"Whether the class counts toward the cap-table ownership percentages. When omitted it defaults per kind: `true` for capital-side kinds, `false` for `promote` and `profits_interest`. A `promote` class never counts toward ownership, so `true` is refused for it."},"distribution_bucket_policy":{"type":"string","enum":["capital_first","profit_first"],"default":"capital_first"},"contributed_capital_account_id":{"type":"string","format":"uuid","description":"Intended override for the class contributed-capital account. STORED AND VALIDATED, but not yet honoured: posting resolves the `contributed_capital` system-role account for the legal entity/org regardless of this value. Honoured from PR 0.6."}},"required":["code","name","kind"]},"UpdateEquityClassV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"kind":{"type":"string","enum":["gp","lp","common","preferred","co_invest","promote","profits_interest"]},"seniority_rank":{"type":"number"},"unit_based":{"type":"boolean"},"default_unit_price":{"type":"string","nullable":true,"example":"10.000000","description":"Price per unit as a non-negative decimal string with up to 6 fractional digits (numeric(18,6)). Set, change, or clear (`null`) it."},"counts_toward_ownership":{"type":"boolean","description":"Whether the class counts toward the cap-table ownership percentages. The resulting (kind, flag) pair is checked: a `promote` class never counts toward ownership, so `true` is refused when the class is or becomes `promote`."},"distribution_bucket_policy":{"type":"string","enum":["capital_first","profit_first"]},"contributed_capital_account_id":{"type":"string","format":"uuid","nullable":true,"description":"Set, change, or clear (`null`) the intended account override. Stored and validated, but not yet honoured by posting — see the create DTO."},"status":{"type":"string","enum":["active","closed"],"description":"Close (or reopen) the class."}}},"WaterfallVersionSummaryV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"version_no":{"type":"number"},"status":{"type":"string","enum":["draft","pending_approval","active","superseded"]},"effective_from":{"type":"string","format":"date"}},"required":["id","version_no","status","effective_from"]},"WaterfallListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"distribution_type":{"type":"string","enum":["operating_income","capital_event","any"]},"name":{"type":"string"},"status":{"type":"string","enum":["active","archived"]},"active_version":{"nullable":true,"description":"The version in force today, or null before the first activation.","type":"object","allOf":[{"$ref":"#/components/schemas/WaterfallVersionSummaryV1Dto"}]},"open_version":{"nullable":true,"description":"The draft or pending-approval version being designed, or null. A waterfall has at most one.","type":"object","allOf":[{"$ref":"#/components/schemas/WaterfallVersionSummaryV1Dto"}]}},"required":["id","legal_entity_id","distribution_type","name","status","active_version","open_version"]},"WaterfallV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"distribution_type":{"type":"string","enum":["operating_income","capital_event","any"]},"name":{"type":"string"},"status":{"type":"string","enum":["active","archived"]}},"required":["id","legal_entity_id","distribution_type","name","status"]},"CreateWaterfallV1Dto":{"type":"object","properties":{"distribution_type":{"type":"string","enum":["operating_income","capital_event","any"],"description":"The distribution type this waterfall governs. A legal entity has at most one waterfall per type."},"name":{"type":"string","maxLength":120,"example":"Operating income waterfall"}},"required":["distribution_type","name"]},"WaterfallTierParticipantResponseV1Dto":{"type":"object","properties":{"class_id":{"type":"string","format":"uuid"},"weight_basis":{"type":"string","enum":["ownership_pct","units","capital","fixed_pct","vested_units"]}},"required":["class_id","weight_basis"]},"WaterfallTierRateStepResponseV1Dto":{"type":"object","properties":{"from_deal_year":{"type":"number","nullable":true},"from_date":{"type":"string","format":"date","nullable":true},"rate":{"type":"string","nullable":true,"example":"0.080000000"},"amount":{"type":"string","nullable":true,"example":"1234.50"}},"required":["from_deal_year","from_date","rate","amount"]},"WaterfallTierOpeningResponseV1Dto":{"type":"object","properties":{"entitled_to_date":{"type":"string","example":"1234.50"},"paid_to_date":{"type":"string","example":"1234.50"},"forfeited_to_date":{"type":"string","example":"1234.50"},"note":{"type":"string","nullable":true}},"required":["entitled_to_date","paid_to_date","forfeited_to_date","note"]},"WaterfallTierResponseV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"tier_key":{"type":"string","format":"uuid"},"seq":{"type":"number"},"kind":{"type":"string","enum":["return_of_capital","preferred_return","catch_up","split","priority_share","pro_rata"]},"label":{"type":"string","nullable":true},"measure":{"type":"string","nullable":true},"amount":{"type":"string","nullable":true,"example":"1234.50"},"loss_recovery":{"type":"string","nullable":true},"on_shortfall":{"type":"string","enum":["carry","forfeit"]},"cap_amount":{"type":"string","nullable":true,"example":"1234.50"},"participants":{"type":"array","items":{"$ref":"#/components/schemas/WaterfallTierParticipantResponseV1Dto"}},"rate_steps":{"type":"array","items":{"$ref":"#/components/schemas/WaterfallTierRateStepResponseV1Dto"}},"opening":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/WaterfallTierOpeningResponseV1Dto"}]}},"required":["id","tier_key","seq","kind","label","measure","amount","loss_recovery","on_shortfall","cap_amount","participants","rate_steps","opening"]},"VersionIssueV1Dto":{"type":"object","properties":{"tier_key":{"type":"string","format":"uuid","nullable":true},"code":{"type":"string","example":"measure_missing"},"detail":{"type":"string"}},"required":["tier_key","code","detail"]},"WaterfallVersionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"waterfall_id":{"type":"string","format":"uuid"},"version_no":{"type":"number"},"status":{"type":"string","enum":["draft","pending_approval","active","superseded"]},"source":{"type":"string","enum":["manual","template","agent_proposal","deal"]},"effective_from":{"type":"string","format":"date"},"economics_start_date":{"type":"string","format":"date"},"year_anchor":{"type":"string","enum":["economics_start","calendar","fiscal"]},"agreement_file_id":{"type":"string","format":"uuid","nullable":true},"tiers":{"type":"array","items":{"$ref":"#/components/schemas/WaterfallTierResponseV1Dto"}},"issues":{"description":"Everything the designer validation finds wrong with an open (draft or pending approval) version; always empty for an active or superseded one. Submit refuses a version with issues.","type":"array","items":{"$ref":"#/components/schemas/VersionIssueV1Dto"}}},"required":["id","waterfall_id","version_no","status","source","effective_from","economics_start_date","year_anchor","agreement_file_id","tiers","issues"]},"WaterfallDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"distribution_type":{"type":"string","enum":["operating_income","capital_event","any"]},"name":{"type":"string"},"status":{"type":"string"},"versions":{"description":"Every version, oldest first.","type":"array","items":{"$ref":"#/components/schemas/WaterfallVersionV1Dto"}}},"required":["id","legal_entity_id","distribution_type","name","status","versions"]},"UpdateWaterfallV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":120}},"required":["name"]},"CreateWaterfallVersionV1Dto":{"type":"object","properties":{"from_version_id":{"type":"string","format":"uuid","description":"The version whose tiers (and tier keys) the new draft starts from. Defaults to the waterfall's active version; with none, the draft starts empty. Opening state is not copied."},"effective_from":{"type":"string","format":"date","description":"A calendar date, YYYY-MM-DD."},"economics_start_date":{"type":"string","format":"date","description":"A calendar date, YYYY-MM-DD."},"year_anchor":{"type":"string","enum":["economics_start","calendar","fiscal"]}},"required":["effective_from","economics_start_date","year_anchor"]},"UpdateWaterfallVersionV1Dto":{"type":"object","properties":{"effective_from":{"type":"string","format":"date"},"economics_start_date":{"type":"string","format":"date"},"year_anchor":{"type":"string","enum":["economics_start","calendar","fiscal"]},"agreement_file_id":{"type":"string","format":"uuid","nullable":true,"description":"A file of the same legal entity holding the signed agreement, or `null` to clear it."}}},"WaterfallTierParticipantV1Dto":{"type":"object","properties":{"class_id":{"type":"string","format":"uuid"},"weight_basis":{"type":"string","enum":["ownership_pct","units","capital","fixed_pct","vested_units"]}},"required":["class_id","weight_basis"]},"WaterfallTierRateStepV1Dto":{"type":"object","properties":{"from_deal_year":{"type":"number","nullable":true,"description":"The deal year (1-based) the step starts in."},"from_date":{"type":"string","format":"date","nullable":true,"description":"Reserved: a step by date is stored but refused as an issue for now."},"rate":{"type":"string","nullable":true,"example":"0.080000000","description":"A fraction of the measure, not money. Exactly one of `rate` and `amount` is set."},"amount":{"type":"string","nullable":true,"example":"1234.50"}}},"WaterfallTierOpeningV1Dto":{"type":"object","properties":{"entitled_to_date":{"type":"string","example":"1234.50"},"paid_to_date":{"type":"string","example":"1234.50"},"forfeited_to_date":{"type":"string","example":"1234.50"},"note":{"type":"string","nullable":true}},"required":["entitled_to_date","paid_to_date","forfeited_to_date"]},"WaterfallTierInputV1Dto":{"type":"object","properties":{"tier_key":{"type":"string","format":"uuid","description":"The tier's identity across versions. A new tier carries a key the client generated; an existing tier keeps its key."},"seq":{"type":"number"},"kind":{"type":"string","enum":["return_of_capital","preferred_return","catch_up","split","priority_share","pro_rata"]},"label":{"type":"string","nullable":true},"measure":{"type":"string","enum":["net_income","noi","this_distribution","fixed_amount"],"nullable":true,"description":"What a `priority_share` tier is measured on. A missing measure is stored and reported as an issue on the version."},"amount":{"type":"string","nullable":true,"example":"1234.50"},"loss_recovery":{"type":"string","enum":["carry_forward","none"],"nullable":true},"on_shortfall":{"type":"string","enum":["carry","forfeit"]},"cap_amount":{"type":"string","nullable":true,"example":"1234.50"},"participants":{"type":"array","items":{"$ref":"#/components/schemas/WaterfallTierParticipantV1Dto"}},"rate_steps":{"type":"array","items":{"$ref":"#/components/schemas/WaterfallTierRateStepV1Dto"}},"opening":{"nullable":true,"description":"Carried-in state of a `priority_share` tier (first version only).","type":"object","allOf":[{"$ref":"#/components/schemas/WaterfallTierOpeningV1Dto"}]}},"required":["tier_key","seq","kind","on_shortfall","participants","rate_steps"]},"ReplaceWaterfallTiersV1Dto":{"type":"object","properties":{"tiers":{"description":"The complete tier set; whatever is not listed is removed.","type":"array","items":{"$ref":"#/components/schemas/WaterfallTierInputV1Dto"}}},"required":["tiers"]},"SubmitWaterfallVersionResultV1Dto":{"type":"object","properties":{"status":{"type":"string","enum":["pending_approval","active"],"description":"`pending_approval` while an approval request is open; `active` when the organization has no matching approval rule and the version took effect at once."},"request_id":{"type":"string","format":"uuid","nullable":true,"description":"The approval request that was opened; null when none was."}},"required":["status","request_id"]},"ReconcileWaterfallVersionResultV1Dto":{"type":"object","properties":{"status":{"type":"string","enum":["draft","active"],"description":"The version's status after the repair."}},"required":["status"]},"WaterfallTemplateParticipantV1Dto":{"type":"object","properties":{"role":{"type":"string","description":"The template-local role label."},"weight_basis":{"type":"string","enum":["ownership_pct","units","capital","fixed_pct","vested_units"]}},"required":["role","weight_basis"]},"WaterfallTemplateTierV1Dto":{"type":"object","properties":{"seq":{"type":"number"},"kind":{"type":"string","enum":["return_of_capital","preferred_return","catch_up","split","priority_share","pro_rata"]},"label":{"type":"string","nullable":true},"measure":{"type":"string","nullable":true},"amount":{"type":"string","nullable":true,"example":"1234.50"},"loss_recovery":{"type":"string","nullable":true},"on_shortfall":{"type":"string","enum":["carry","forfeit"]},"cap_amount":{"type":"string","nullable":true,"example":"1234.50"},"participants":{"type":"array","items":{"$ref":"#/components/schemas/WaterfallTemplateParticipantV1Dto"}},"rate_steps":{"type":"array","items":{"$ref":"#/components/schemas/WaterfallTierRateStepResponseV1Dto"}}},"required":["seq","kind","label","measure","amount","loss_recovery","on_shortfall","cap_amount","participants","rate_steps"]},"WaterfallTemplateV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"role_labels":{"description":"The role labels the template uses, derived from its tiers.","type":"array","items":{"type":"string"}},"tiers":{"type":"array","items":{"$ref":"#/components/schemas/WaterfallTemplateTierV1Dto"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","name","description","role_labels","tiers","created_at","updated_at"]},"CreateWaterfallTemplateV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":120,"example":"Promote over preferred return"},"description":{"type":"string","nullable":true,"maxLength":1000},"version_id":{"type":"string","format":"uuid","description":"The version (any status, of a waterfall you can reach) whose tiers are saved. Opening state is never copied."},"roles":{"type":"object","additionalProperties":{"type":"string"},"example":{"3f2c8a0e-0000-4000-8000-000000000001":"Sponsor"},"description":"A role label for every class the version names, keyed by class id. Labels are non-empty and no two classes share one."}},"required":["name","version_id","roles"]},"UpdateWaterfallTemplateV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"description":{"type":"string","nullable":true,"maxLength":1000}}},"ApplyWaterfallTemplateV1Dto":{"type":"object","properties":{"waterfall_id":{"type":"string","format":"uuid","description":"The waterfall to draft into. It must have no active or superseded version and no open one."},"effective_from":{"type":"string","format":"date"},"economics_start_date":{"type":"string","format":"date"},"year_anchor":{"type":"string","enum":["economics_start","calendar","fiscal"]},"classes":{"type":"object","additionalProperties":{"type":"string","format":"uuid"},"description":"A class of the waterfall's legal entity for every role label of the template, keyed by label."}},"required":["waterfall_id","effective_from","economics_start_date","year_anchor","classes"]},"EquityPositionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"equity_class_id":{"type":"string","format":"uuid"},"holder_party_id":{"type":"string","format":"uuid"},"commitment_amount":{"type":"string","nullable":true,"description":"The capital commitment this holder was admitted with, or null when none was stated.","example":"1234.50"},"commitment_date":{"type":"string","format":"date","nullable":true},"admission_date":{"type":"string","format":"date"},"units":{"type":"string","example":"0.000000","description":"Unit count (numeric(18,6)). **`0.000000` for every position in this release, unit-based class or not** — nothing writes this column yet (spec §17). Do not read a zero here as \"this class does not use units\"."},"status":{"type":"string","enum":["active","transferred","redeemed","defaulted"]},"exit_effective_date":{"type":"string","format":"date","nullable":true,"description":"The business date the transfer or redemption took effect. Set when `status` is `transferred` or `redeemed`; null otherwise (R74)."},"notes":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","legal_entity_id","equity_class_id","holder_party_id","commitment_amount","commitment_date","admission_date","units","status","exit_effective_date","notes","created_at","updated_at"]},"CreateEquityPositionV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"equity_class_id":{"type":"string","format":"uuid"},"holder_party_id":{"type":"string","format":"uuid"},"commitment_amount":{"type":"string","description":"The capital commitment this holder is admitted with. Omit for no stated commitment — `unfunded_commitment` on the resulting capital-account row then defaults to `0`.","example":"1234.50"},"commitment_date":{"type":"string","format":"date"},"admission_date":{"type":"string","format":"date"},"notes":{"type":"string"}},"required":["legal_entity_id","equity_class_id","holder_party_id","admission_date"]},"UpdateEquityPositionV1Dto":{"type":"object","properties":{"commitment_amount":{"type":"string","nullable":true,"description":"Set, change, or clear (`null`) the stated commitment.","example":"1234.50"},"commitment_date":{"type":"string","format":"date","nullable":true,"description":"Set, change, or clear (`null`) the commitment date."},"notes":{"type":"string","nullable":true,"description":"Set, change, or clear (`null`) the free-text notes."},"status":{"type":"string","enum":["active","transferred","redeemed","defaulted"],"description":"Transition the position — e.g. transferred out, redeemed."},"exit_effective_date":{"type":"string","format":"date","nullable":true,"description":"The business date the transfer or redemption took effect. Defaults to today in the org's time zone when `status` moves to `transferred` or `redeemed`, and must be on or after the position's `admission_date`. `null` or omitting the field on an already-exited position keeps the stored date unchanged. Moving `status` to a non-exit status (`active` or `defaulted`) clears the stored date; sending a non-null `exit_effective_date` with a non-exit status is refused with `VALIDATION_FAILED`."}}},"OpeningBalanceV1Dto":{"type":"object","properties":{"event_ids":{"description":"One id per bucket that carried a non-zero amount, in bucket order. Zero buckets record nothing and appear here as nothing.","type":"array","items":{"type":"string","format":"uuid"}},"gl_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The posted `journal_entry` document carrying the 3100 offset, when `post_offsetting_entry` was set — `null` otherwise, which is the subledger-only case. When it is present the `capital` event names it as its `gl_document_id` and is counted by the tie-out; when it is null nothing here is."}},"required":["event_ids","gl_document_id"]},"OpeningBalanceBucketsV1Dto":{"type":"object","properties":{"capital":{"type":"string","description":"Contributed capital still standing in the account as of `as_of` — what the holder put in, less what has been returned. This is the ONLY bucket with a general-ledger side: it is what `post_offsetting_entry` offsets, and what the tie-out compares against the `contributed_capital` account. May be negative.","example":"1234.50"},"pref":{"type":"string","description":"Preferred return accrued and unpaid as of `as_of`. A memo balance, never a liability, so it has no general-ledger side and is never offset.","example":"1234.50"},"profit":{"type":"string","description":"Allocated profit not yet distributed as of `as_of`. Reaches the general ledger when it is distributed, not when it is opened.","example":"1234.50"},"promote":{"type":"string","description":"Carried interest accrued to a promote class as of `as_of`. Promote classes carry no capital and do not count toward ownership (D13).","example":"1234.50"},"unallocated":{"type":"string","description":"Anything the operator's own records do not split into the buckets above. It folds into the capital account total and stays visible as its own line, rather than being guessed into a bucket that would then drive a waterfall.","example":"1234.50"}}},"RecordOpeningBalanceV1Dto":{"type":"object","properties":{"as_of":{"type":"string","format":"date","description":"The date the stated balances were true — the `effective_date` of every event written, and the document date of the offsetting entry when one is posted.\n\n**This is the one write in this module that may precede the legal entity's `ledger_start_date`**, and normally does: an opening balance is by definition what the books held before they began here. No `EQUITY_BEFORE_LEDGER_START` is raised from this endpoint. The accounting period is only consulted when `post_offsetting_entry` is set, because only then is there a journal entry to gate.\n\n**`operations_start_date` is a different date, and it still applies.** With `post_offsetting_entry` set, an `as_of` before the legal entity's `operations_start_date` — when the entity began to exist, not when its books began here — is refused with `POSTING_BEFORE_LEGAL_ENTITY_START` by the posting path. On a default-seeded entity that date is recent, so this is the guard an operator converting a live ledger hits first."},"buckets":{"description":"The balances to open with, one per bucket. Each non-zero bucket becomes one `opening_balance` capital event; a bucket sent as zero records nothing, and a request whose buckets are all zero is refused (`EQUITY_OPENING_BALANCE_EMPTY`) rather than reported as a successful onboarding that wrote no events.","allOf":[{"$ref":"#/components/schemas/OpeningBalanceBucketsV1Dto"}]},"post_offsetting_entry":{"type":"boolean","description":"Post the offsetting journal entry — DR `opening_balance_equity` (3100) / CR `contributed_capital`, for the `capital` bucket only, dated `as_of`. Set it when converting a LIVE general ledger that does not already carry this capital.\n\nLeave it off (the default) and the opening balance is subledger-only: the events carry no `gl_document_id`, so they stay outside the tie-out by construction. That is what stops an operator importing history from breaking their own tie-out on day one — the tie-out counts only capital-account events (the `capital` and `unallocated` buckets) that carry a general-ledger document.\n\nWith it set, the `capital` event carries the posted document and enters the tie-out normally. The other buckets never do. Asking for it with no non-zero `capital` bucket is refused (`EQUITY_OPENING_BALANCE_OFFSET_EMPTY`)."},"memo":{"type":"string","description":"Carried onto every event written, and onto the offsetting entry when one is posted. Where the stated balances came from — the statement, the spreadsheet, the closing date — is what a later reader needs."},"period_override_reason":{"type":"string","description":"Why the offsetting entry is being posted into a CLOSED accounting period. Only consulted when `post_offsetting_entry` is set, since only then is a journal entry written; ignored when the period is open. A locked period rejects every post, reason or not, and a missing period fails closed."}},"required":["as_of","buckets"]},"LegalEntityEquityPositionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"equity_class_id":{"type":"string","format":"uuid"},"holder_party_id":{"type":"string","format":"uuid"},"commitment_amount":{"type":"string","nullable":true,"description":"The capital commitment this holder was admitted with, or null when none was stated.","example":"1234.50"},"contributed":{"type":"string","description":"Cash contributed to date, read from this position's capital account balance.","example":"1234.50"},"unfunded_commitment":{"type":"string","description":"`commitment_amount − contributed`, materialised on the capital account balance — not recomputed here. This is the settled-events figure, not \"awaiting settlement\" (spec D28) — a second number the same name would have confused.","example":"1234.50"},"stale":{"type":"boolean","description":"True when this position's capital account balance is BEHIND its capital events — its stamped `last_event_id` is not the position's newest event. The balance cache is materialised post-commit and is not retried when it fails, so `contributed` and `unfunded_commitment` on this row can lag or be permanently behind. This response reports the lag and never repairs it: `GET /v1/equity-positions/{id}/capital-account` returns a guaranteed-fresh figure for one position, and the capital-balances rebuild command is the repair path. `true` also when the position has no balance row at all, which cannot be judged fresh."},"commitment_date":{"type":"string","format":"date","nullable":true},"admission_date":{"type":"string","format":"date"},"status":{"type":"string","enum":["active","transferred","redeemed","defaulted"]}},"required":["id","equity_class_id","holder_party_id","commitment_amount","contributed","unfunded_commitment","stale","commitment_date","admission_date","status"]},"LegalEntityEquityTotalsV1Dto":{"type":"object","properties":{"commitment":{"type":"string","description":"Sum of `commitment_amount` across the ACTIVE positions on this legal entity. Closed positions (`transferred` / `redeemed` / `defaulted`) are excluded — they still appear in `positions`, which is a complete history.","example":"1234.50"},"contributed":{"type":"string","description":"Sum of `contributed` across the capital account balances of the ACTIVE positions on this legal entity. Closed positions are excluded.","example":"1234.50"},"contributed_closed":{"type":"string","description":"Sum of `contributed` across the capital account balances of the CLOSED (`transferred` / `redeemed` / `defaulted`) positions on this legal entity — the exact complement of `contributed` above, and the bridge to the sibling `tie_out`, which spans the WHOLE legal entity. Without it, redeeming a holder who contributed 40,000 through the general ledger leaves `contributed: \"0.00\"` sitting beside `tie_out.subledger_with_gl: \"40000.00\"` on the same response, with nothing saying the two count different populations. Not part of any of the three totals above, and not something to add into them — a closed position can share its holder and class with a live one, which is why the totals exclude it in the first place.","example":"1234.50"},"unfunded_commitment":{"type":"string","description":"Sum of `unfunded_commitment` across the capital account balances of the ACTIVE positions on this legal entity. Closed positions are excluded.","example":"1234.50"},"any_stale":{"type":"boolean","description":"True when at least one of the ACTIVE positions these three totals sum is `stale` — so the totals themselves are behind the capital events they describe. It spans exactly the rows the totals do; a stale CLOSED position carries its own `stale` in `positions` without setting this. Read it as a qualifier on the three sums above, not as a health check on the legal entity."}},"required":["commitment","contributed","contributed_closed","unfunded_commitment","any_stale"]},"LegalEntityEquityTieOutV1Dto":{"type":"object","properties":{"subledger_with_gl":{"type":"string","description":"Sum of this legal entity's capital-account capital events that carry a GL document, signed the way the general ledger moved. The capital account spans the `capital` AND `unallocated` buckets — `unallocated` is where an importer states history they cannot split, and it folds into `contributed` exactly as `capital` does. Opening balances and imports without a GL document are excluded — see `imported_without_gl`. So are distributions and their reversals, although they carry a GL document: a distribution posts to the owner distributions account and never moves `contributed_capital`.","example":"1234.50"},"gl_contributed_capital":{"type":"string","description":"Balance of this legal entity's `contributed_capital` system-role account, counting only journal entries booked on this legal entity. `0.00` when the organization has no account carrying that role.","example":"1234.50"},"difference":{"type":"string","description":"`subledger_with_gl − gl_contributed_capital`. Signed, so it says which side is short. Anything other than `0.00` raises an attention item on the daily sweep. `imported_without_gl` is NEVER part of this figure.","example":"1234.50"},"imported_without_gl":{"type":"string","description":"Sum of this legal entity's capital-account capital events that carry NO GL document — opening balances and imported history. Same bucket scope as `subledger_with_gl` (`capital` and `unallocated`), so the two halves of the split describe one population and only the GL document separates them. Shown separately and deliberately outside `difference`: history stated without an offsetting journal entry has no general-ledger half to tie out against.","example":"1234.50"}},"required":["subledger_with_gl","gl_contributed_capital","difference","imported_without_gl"]},"LegalEntityEquityTieOutUnavailableV1Dto":{"type":"object","properties":{"code":{"type":"string","description":"The registered error code the tie-out refused with, e.g. `EQUITY_TIE_OUT_UNCLASSIFIED_EVENT`. Route it to support, not to a retry: nothing the caller sent is wrong and retrying reads the same rows."},"reason":{"type":"string","description":"Human-readable detail naming the offending kinds, for an operator or a support ticket. Not a stable contract — branch on `code`."}},"required":["code","reason"]},"LegalEntityEquityV1Dto":{"type":"object","properties":{"classes":{"type":"array","items":{"$ref":"#/components/schemas/EquityClassV1Dto"}},"positions":{"type":"array","items":{"$ref":"#/components/schemas/LegalEntityEquityPositionV1Dto"}},"totals":{"$ref":"#/components/schemas/LegalEntityEquityTotalsV1Dto"},"tie_out":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/LegalEntityEquityTieOutV1Dto"}]},"tie_out_unavailable":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/LegalEntityEquityTieOutUnavailableV1Dto"}]}},"required":["classes","positions","totals","tie_out","tie_out_unavailable"]},"CapitalContributionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The posted `capital_contribution` document. Its `balance_amount` starts at the full amount and falls as payments apply — each fall writes one capital event."},"journal_entry_id":{"type":"string","format":"uuid","description":"The journal entry the contribution posted: DR contributions receivable (or the intercompany bridge, when the holder is one of the org's own legal entities) / CR contributed capital."},"mirror_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The parent's `investment_in_subsidiary` mirror, written when the holder is another legal entity in this org — `null` when it is not. The mirror posts on the parent's books in the SAME transaction as the contribution: one side alone is never recorded."},"payment_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The `payment_in` that settled the contribution, written when `bank_transaction_id` was sent — `null` when it was not, which is the document-first case where the contribution waits open for a bank match. When it is present the document balance is `0.00` and exactly one capital event exists for the full amount."}},"required":["id","journal_entry_id","mirror_document_id","payment_document_id"]},"CreateCapitalContributionV1Dto":{"type":"object","properties":{"position_id":{"type":"string","format":"uuid","description":"The equity position being funded. It IS the capital account, so the legal entity, the holder and the commitment all come from it — none of them is sent on this request."},"amount":{"type":"string","description":"The amount committed by this contribution. Must be greater than zero; it becomes the document's total AND its opening balance, because the money has not arrived yet.","example":"1234.50"},"effective_date":{"type":"string","format":"date","description":"The date the contribution takes effect — the document date, the journal entry date, and the date the accounting period is gated on. Must be on or after the legal entity's `ledger_start_date` when one is set."},"bank_transaction_id":{"type":"string","format":"uuid","description":"The bank transaction the money arrived on. Send it when the deposit is already in the feed: a `payment_in` is posted and applied in the SAME action, the balance falls to zero, and the capital event is written from that fall. Omit it for the document-first case — the contribution then waits open until a bank match settles it.\n\nThe transaction must be unlinked (`EQUITY_BANK_TRANSACTION_ALREADY_LINKED` otherwise), and it must be a posted, non-excluded, non-intercompany deposit for exactly `amount`, on a bank account belonging to the position's legal entity with a cash account configured (`EQUITY_BANK_TRANSACTION_NOT_SETTLEABLE` otherwise)."},"memo":{"type":"string"},"acknowledge_over_commitment":{"type":"boolean","description":"Record the contribution even though `amount` exceeds the position's unfunded commitment. Without it such a request is refused with `EQUITY_CONTRIBUTION_EXCEEDS_COMMITMENT` (422). When the overage is real, the acknowledgement is written onto the document memo — it is the only place it survives the request."},"period_override_reason":{"type":"string","description":"Why this is being posted into a CLOSED accounting period. Required by the period gate to post into one at all (`PERIOD_CLOSED` otherwise); ignored when the period is open. A locked period rejects every post, reason or not."}},"required":["position_id","amount","effective_date"]},"CapitalContributionReversalV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The `capital_contribution` document that was reversed."},"status":{"type":"string","enum":["reversed"],"description":"Always `reversed`. The documents themselves carry `voided` — this is the outcome of the operation, not a document status."},"voided_document_count":{"type":"number","description":"How many documents this call voided. A rule rather than a fixed number: the `capital_contribution` itself, the parent-side `investment_in_subsidiary` mirror when the holder is an in-org legal entity, and every settling payment still live on either of them — each counted only if it was not already terminal, since a resumed reversal only finishes what an earlier one left. One contribution can be settled by more than one payment, so an intercompany contribution funded in two instalments voids more documents than a single-payment one, and an open non-intercompany one voids a single document. The parent-side `payment_out` that settled the mirror counts like any other settling payment."}},"required":["id","status","voided_document_count"]},"ReverseCapitalContributionV1Dto":{"type":"object","properties":{"memo":{"type":"string","description":"Why the contribution is being reversed. Stamped on every reversing journal entry this produces and used as the accounting-period override reason when one of the periods involved is closed, so it is the audit record for both. Cannot be blank.","minLength":1,"maxLength":2000,"pattern":"\\S"}},"required":["memo"]},"CapitalAccountFoldV1Dto":{"type":"object","properties":{"contributed":{"type":"string","description":"Cash and in-kind capital contributed to date. The ONE column with a general-ledger side (via the events that carry a `gl_document_id`).","example":"1234.50"},"returned_capital":{"type":"string","description":"Capital returned to date — `distribution`/`redemption`/`transfer_out` events accumulate here as a POSITIVE amount of money returned, regardless of the sign they carry on the ledger.","example":"1234.50"},"unreturned_capital":{"type":"string","description":"`contributed − returned_capital`, DERIVED every time the fold runs — never accumulated as its own running total.","example":"1234.50"},"pref_accrued":{"type":"string","description":"Preferred return accrued and unpaid to date. A memo balance, never a liability.","example":"1234.50"},"pref_paid":{"type":"string","description":"Preferred return paid out to date.","example":"1234.50"},"profit_distributed":{"type":"string","description":"Allocated profit distributed to date.","example":"1234.50"},"promote_received":{"type":"string","description":"Carried interest received to date, on a promote class. Promote classes carry no capital and do not count toward ownership.","example":"1234.50"},"units":{"type":"string","example":"0.000000","description":"Unit count (numeric(18,6)), folded from `capital_events.units_delta`. **`0.000000` for every position in this release, unit-based class or not** — no writer sets `units_delta` yet, so the fold has nothing to accumulate. Do not read a zero here as \"this class does not use units\". The field is not deprecated: the fold already accumulates the column, so it starts reporting real counts with no change to this contract in the release that teaches the writer."},"last_event_id":{"type":"string","format":"uuid","nullable":true,"description":"The newest `capital_events` row folded into this total, in `recorded_at, id` order — `null` when the position has no events yet."}},"required":["contributed","returned_capital","unreturned_capital","pref_accrued","pref_paid","profit_distributed","promote_received","units","last_event_id"]},"CapitalAccountRollForwardRowV1Dto":{"type":"object","properties":{"event_id":{"type":"string","format":"uuid"},"effective_date":{"type":"string","format":"date","description":"The calendar date this event took effect (`effective_date`)."},"recorded_at":{"type":"string","format":"date-time","description":"The instant the ledger learned of this event (`recorded_at`)."},"kind":{"type":"string","enum":["opening_balance","contribution","contribution_in_kind","call_funded","distribution","pref_accrual","recallable_flag","transfer_out","transfer_in","redemption","default_penalty","reversal","vesting","forfeiture","escrow_hold","escrow_release","distribution_refund"]},"bucket":{"type":"string","enum":["capital","pref","profit","promote","unallocated"]},"amount":{"type":"string","description":"This event's own signed amount, exactly as recorded — NOT a running total. See `balance` for the running total after this event.","example":"1234.50"},"balance":{"description":"The fold after this event and every one before it, in `recorded_at, id` order.","allOf":[{"$ref":"#/components/schemas/CapitalAccountFoldV1Dto"}]}},"required":["event_id","effective_date","recorded_at","kind","bucket","amount","balance"]},"CapitalAccountV1Dto":{"type":"object","properties":{"contributed":{"type":"string","description":"Cash and in-kind capital contributed to date. The ONE column with a general-ledger side (via the events that carry a `gl_document_id`).","example":"1234.50"},"returned_capital":{"type":"string","description":"Capital returned to date — `distribution`/`redemption`/`transfer_out` events accumulate here as a POSITIVE amount of money returned, regardless of the sign they carry on the ledger.","example":"1234.50"},"unreturned_capital":{"type":"string","description":"`contributed − returned_capital`, DERIVED every time the fold runs — never accumulated as its own running total.","example":"1234.50"},"pref_accrued":{"type":"string","description":"Preferred return accrued and unpaid to date. A memo balance, never a liability.","example":"1234.50"},"pref_paid":{"type":"string","description":"Preferred return paid out to date.","example":"1234.50"},"profit_distributed":{"type":"string","description":"Allocated profit distributed to date.","example":"1234.50"},"promote_received":{"type":"string","description":"Carried interest received to date, on a promote class. Promote classes carry no capital and do not count toward ownership.","example":"1234.50"},"units":{"type":"string","example":"0.000000","description":"Unit count (numeric(18,6)), folded from `capital_events.units_delta`. **`0.000000` for every position in this release, unit-based class or not** — no writer sets `units_delta` yet, so the fold has nothing to accumulate. Do not read a zero here as \"this class does not use units\". The field is not deprecated: the fold already accumulates the column, so it starts reporting real counts with no change to this contract in the release that teaches the writer."},"last_event_id":{"type":"string","format":"uuid","nullable":true,"description":"The newest `capital_events` row folded into this total, in `recorded_at, id` order — `null` when the position has no events yet."},"position_id":{"type":"string","format":"uuid"},"stale":{"type":"boolean","description":"Whether the cache disagreed with `capital_events` and had to be refolded synchronously before answering (Ruling C). Always `false` on a bounded (`as_of`/`as_recorded`) read — that path never reads the cache, so staleness does not apply to it."},"roll_forward":{"type":"array","items":{"$ref":"#/components/schemas/CapitalAccountRollForwardRowV1Dto"}}},"required":["contributed","returned_capital","unreturned_capital","pref_accrued","pref_paid","profit_distributed","promote_received","units","last_event_id","position_id","stale","roll_forward"]},"CapitalEventTransferCounterpartyV1Dto":{"type":"object","properties":{"position_id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"},"party_name":{"type":"string","description":"The other position's holder."}},"required":["position_id","party_id","party_name"]},"CapitalEventV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["opening_balance","contribution","contribution_in_kind","call_funded","distribution","pref_accrual","recallable_flag","transfer_out","transfer_in","redemption","default_penalty","reversal","vesting","forfeiture","escrow_hold","escrow_release","distribution_refund"]},"bucket":{"type":"string","enum":["capital","pref","profit","promote","unallocated"]},"amount":{"type":"string","description":"This event's own signed amount, exactly as recorded — never a running total.","example":"1234.50"},"units_delta":{"type":"string","example":"0.000000","description":"Unit count delta (numeric(18,6)) this event carries. **`0.000000` on every event in this release** — no writer sets the column yet (spec §17), which is why the folded `units` on a capital account is likewise always zero."},"effective_date":{"type":"string","format":"date","description":"The calendar date this event took effect."},"recorded_at":{"type":"string","format":"date-time","description":"The instant the ledger learned of this event."},"gl_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The journal entry this event posted, if any — lets a reader jump from this event to the GL entry behind it. `null` for an event that never touched the ledger (e.g. most opening-balance buckets, or a preferred-return accrual, which is a memo balance and never a liability)."},"reverses_event_id":{"type":"string","format":"uuid","nullable":true,"description":"The event this one reverses, if any — lets the UI strike through the reversed row rather than showing it and its correction as two contradictory lines. `null` on every event that is not a reversal."},"memo":{"type":"string","nullable":true,"description":"Free-text note attached to this event, if any."},"source_type":{"type":"string","enum":["contribution","distribution","opening_balance","import","manual","transfer"],"description":"What wrote this event: a contribution, a distribution (refunds and non-cash distributions included), an opening balance, an import, a manual entry, or a transfer between holders. A reversal carries its target's source."},"source_id":{"type":"string","format":"uuid","nullable":true,"description":"The record behind the event, read with `source_type`: for a `transfer`, the `/v1/equity-transfers` id. `null` when there is none."},"reversed_by_event_id":{"type":"string","format":"uuid","nullable":true,"description":"The reversal that undoes this event, if any — so a reversed event is marked even when its reversal is on another page. `null` while it stands."},"transfer_counterparty":{"nullable":true,"description":"For a transfer event (and its reversal), the other position of the transfer and its holder; both positions are of the same entity. `null` on every other event.","type":"object","allOf":[{"$ref":"#/components/schemas/CapitalEventTransferCounterpartyV1Dto"}]}},"required":["id","kind","bucket","amount","units_delta","effective_date","recorded_at","gl_document_id","reverses_event_id","memo","source_type","source_id","reversed_by_event_id","transfer_counterparty"]},"PartyCapitalAccountRowV1Dto":{"type":"object","properties":{"contributed":{"type":"string","description":"Cash and in-kind capital contributed to date. The ONE column with a general-ledger side (via the events that carry a `gl_document_id`).","example":"1234.50"},"returned_capital":{"type":"string","description":"Capital returned to date — `distribution`/`redemption`/`transfer_out` events accumulate here as a POSITIVE amount of money returned, regardless of the sign they carry on the ledger.","example":"1234.50"},"unreturned_capital":{"type":"string","description":"`contributed − returned_capital`, DERIVED every time the fold runs — never accumulated as its own running total.","example":"1234.50"},"pref_accrued":{"type":"string","description":"Preferred return accrued and unpaid to date. A memo balance, never a liability.","example":"1234.50"},"pref_paid":{"type":"string","description":"Preferred return paid out to date.","example":"1234.50"},"profit_distributed":{"type":"string","description":"Allocated profit distributed to date.","example":"1234.50"},"promote_received":{"type":"string","description":"Carried interest received to date, on a promote class. Promote classes carry no capital and do not count toward ownership.","example":"1234.50"},"units":{"type":"string","example":"0.000000","description":"Unit count (numeric(18,6)), folded from `capital_events.units_delta`. **`0.000000` for every position in this release, unit-based class or not** — no writer sets `units_delta` yet, so the fold has nothing to accumulate. Do not read a zero here as \"this class does not use units\". The field is not deprecated: the fold already accumulates the column, so it starts reporting real counts with no change to this contract in the release that teaches the writer."},"last_event_id":{"type":"string","format":"uuid","nullable":true,"description":"The newest `capital_events` row folded into this total, in `recorded_at, id` order — `null` when the position has no events yet."},"position_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","example":"Elm Street Holdings LLC"},"equity_class_id":{"type":"string","format":"uuid"},"equity_class_name":{"type":"string","example":"Limited Partner"},"stale":{"type":"boolean","description":"Whether this row's `capital_account_balances` cache disagreed with `capital_events` at read time (Ruling C's staleness probe). Unlike the single-position read, a stale row here is reported, NOT refolded — refolding an investor's whole portfolio inside this read is the wrong trade; read the position directly (`GET /v1/equity-positions/{id}/capital-account`) for a guaranteed-fresh number, or run the rebuild command to repair the cache."}},"required":["contributed","returned_capital","unreturned_capital","pref_accrued","pref_paid","profit_distributed","promote_received","units","last_event_id","position_id","legal_entity_id","legal_entity_name","equity_class_id","equity_class_name","stale"]},"NonCashMovementV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["contribution","distribution"]},"legal_entity_id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"},"position_id":{"type":"string","format":"uuid","nullable":true,"description":"The position the capital event landed on; null when none was written (no position, an entity without equity, or a date before the ledger start)."},"movement_date":{"type":"string","format":"date"},"capital_amount":{"type":"string","description":"What the voucher lines leave over: the capital moved.","example":"1234.50"},"bucket":{"type":"string","enum":["capital","profit"]},"memo":{"type":"string","nullable":true},"external_ref":{"type":"string","nullable":true,"description":"Another system's key for this record, unique in the org; set by an importer."},"holder_external_ref":{"type":"string","nullable":true},"entity_document_id":{"type":"string","format":"uuid","description":"The entity's `journal_entry`."},"holder_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The in-group holder's `journal_entry`; null for an outside holder or when the holder's side was omitted."},"capital_event_id":{"type":"string","format":"uuid","nullable":true},"voided_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","kind","legal_entity_id","party_id","position_id","movement_date","capital_amount","bucket","memo","external_ref","holder_external_ref","entity_document_id","holder_document_id","capital_event_id","voided_at","created_at","updated_at"]},"NonCashLineV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"debit":{"type":"string","description":"The debit, greater than zero. Exactly one of debit and credit.","example":"1234.50"},"credit":{"type":"string","description":"The credit, greater than zero. Exactly one of debit and credit.","example":"1234.50"},"memo":{"type":"string","maxLength":2000},"counterparty_legal_entity_id":{"type":"string","format":"uuid","description":"The other group entity this line is with, for an intercompany account."}},"required":["account_id"]},"CreateNonCashContributionV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid","description":"The entity whose capital moves."},"party_id":{"type":"string","format":"uuid","description":"The holder."},"position_id":{"type":"string","format":"uuid","description":"The holder's position in the entity. Needed only when the holder has more than one active position there."},"lines":{"description":"The voucher's lines on the entity's books, at book value (no gain or loss). The capital line is added: its amount is what the lines leave over.","type":"array","items":{"$ref":"#/components/schemas/NonCashLineV1Dto"}},"memo":{"type":"string","maxLength":2000},"external_ref":{"type":"string","nullable":true,"minLength":1,"maxLength":200,"description":"Another system's key for this record, unique in the org; set by an importer."},"holder_side":{"type":"boolean","description":"In-group holder only: record the holder's own entry. Default true; false when the holder has no counterpart in its books."},"holder_date":{"type":"string","format":"date","description":"In-group holder only: the date of the holder's entry on its own books. Defaults to the movement's date."},"holder_external_ref":{"type":"string","minLength":1,"maxLength":200,"description":"In-group holder only: the loader's reference for the holder's side, unique per org like `external_ref`."},"holder_lines":{"description":"In-group holder side only, and then required: the holder's own voucher lines on its books. They must net to the capital amount against its balancing line.","type":"array","items":{"$ref":"#/components/schemas/NonCashLineV1Dto"}},"contribution_date":{"type":"string","format":"date","description":"The contribution's date on the entity's books (YYYY-MM-DD)."}},"required":["legal_entity_id","party_id","lines","contribution_date"]},"CreateNonCashDistributionV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid","description":"The entity whose capital moves."},"party_id":{"type":"string","format":"uuid","description":"The holder."},"position_id":{"type":"string","format":"uuid","description":"The holder's position in the entity. Needed only when the holder has more than one active position there."},"lines":{"description":"The voucher's lines on the entity's books, at book value (no gain or loss). The capital line is added: its amount is what the lines leave over.","type":"array","items":{"$ref":"#/components/schemas/NonCashLineV1Dto"}},"memo":{"type":"string","maxLength":2000},"external_ref":{"type":"string","nullable":true,"minLength":1,"maxLength":200,"description":"Another system's key for this record, unique in the org; set by an importer."},"holder_side":{"type":"boolean","description":"In-group holder only: record the holder's own entry. Default true; false when the holder has no counterpart in its books."},"holder_date":{"type":"string","format":"date","description":"In-group holder only: the date of the holder's entry on its own books. Defaults to the movement's date."},"holder_external_ref":{"type":"string","minLength":1,"maxLength":200,"description":"In-group holder only: the loader's reference for the holder's side, unique per org like `external_ref`."},"holder_lines":{"description":"In-group holder side only, and then required: the holder's own voucher lines on its books. They must net to the capital amount against its balancing line.","type":"array","items":{"$ref":"#/components/schemas/NonCashLineV1Dto"}},"distribution_date":{"type":"string","format":"date","description":"The distribution's date on the entity's books (YYYY-MM-DD)."},"bucket":{"type":"string","enum":["capital","profit"],"description":"`capital` for a return of capital (the holder books it against its investment), `profit` for a distribution of profit (the holder books it per its received-distribution treatment)."}},"required":["legal_entity_id","party_id","lines","distribution_date","bucket"]},"EquityTransferV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"from_position_id":{"type":"string","format":"uuid"},"to_position_id":{"type":"string","format":"uuid"},"effective_date":{"type":"string","format":"date"},"amount":{"type":"string","example":"1234.50"},"bucket":{"type":"string","enum":["capital"]},"memo":{"type":"string","nullable":true},"external_ref":{"type":"string","nullable":true,"description":"Another system's key for this record, unique in the org; set by an importer."},"out_event_id":{"type":"string","format":"uuid","nullable":true},"in_event_id":{"type":"string","format":"uuid","nullable":true},"voided_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","legal_entity_id","from_position_id","to_position_id","effective_date","amount","bucket","memo","external_ref","out_event_id","in_event_id","voided_at","created_at","updated_at"]},"CreateEquityTransferV1Dto":{"type":"object","properties":{"from_position_id":{"type":"string","format":"uuid","description":"The position the capital leaves."},"to_position_id":{"type":"string","format":"uuid","description":"The position the capital goes to, in the same entity."},"effective_date":{"type":"string","format":"date","description":"YYYY-MM-DD."},"amount":{"type":"string","description":"The capital moved. Greater than zero.","example":"1234.50"},"bucket":{"type":"string","enum":["capital"],"default":"capital","description":"Only `capital` for now."},"memo":{"type":"string","maxLength":2000},"external_ref":{"type":"string","nullable":true,"minLength":1,"maxLength":200,"description":"Another system's key for this record, unique in the org; set by an importer."}},"required":["from_position_id","to_position_id","effective_date","amount"]},"EntityOwnershipListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"parent_entity_id":{"type":"string","format":"uuid"},"parent_entity_name":{"type":"string","nullable":true},"owner_party_id":{"type":"string","format":"uuid"},"owner_party_name":{"type":"string","nullable":true},"ownership_percentage":{"type":"string"},"effective_from":{"type":"string","format":"date"},"effective_to":{"type":"string","format":"date","nullable":true},"created_at":{"type":"string"}},"required":["id","parent_entity_id","owner_party_id","ownership_percentage","effective_from","created_at"]},"EntityOwnershipV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"parent_entity_id":{"type":"string","format":"uuid"},"owner_party_id":{"type":"string","format":"uuid"},"owner_party_name":{"type":"string","nullable":true},"ownership_percentage":{"type":"string","description":"Ownership percentage with exactly 15 decimals (e.g. \"60.000000000000000\")."},"effective_from":{"type":"string","format":"date"},"effective_to":{"type":"string","format":"date","nullable":true},"change_reason":{"type":"string","nullable":true},"created_by":{"type":"string","format":"uuid"},"created_at":{"type":"string"}},"required":["id","org_id","parent_entity_id","owner_party_id","ownership_percentage","effective_from","created_by","created_at"]},"EntityOwnershipCreatedDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]},"CreateEntityOwnershipV1Dto":{"type":"object","properties":{"parent_entity_id":{"type":"string","format":"uuid"},"owner_party_id":{"type":"string","format":"uuid"},"ownership_percentage":{"type":"string","description":"Ownership percentage as a decimal string with up to 15 decimals (e.g. \"33.333333333333333\"). Returned with exactly 15 decimals."},"effective_from":{"type":"string","format":"date"},"change_reason":{"type":"string"}},"required":["parent_entity_id","owner_party_id","ownership_percentage","effective_from"]},"EntityOwnershipBatchCreatedDto":{"type":"object","properties":{"ids":{"description":"Created row ids in input order.","type":"array","items":{"type":"string"}}},"required":["ids"]},"EntityOwnershipMemberInputV1Dto":{"type":"object","properties":{"owner_party_id":{"type":"string","format":"uuid"},"ownership_percentage":{"type":"string","description":"Ownership percentage as a decimal string with up to 15 decimals (e.g. \"33.333333333333333\"). Returned with exactly 15 decimals."}},"required":["owner_party_id","ownership_percentage"]},"CreateEntityOwnershipBatchV1Dto":{"type":"object","properties":{"parent_entity_id":{"type":"string","format":"uuid"},"effective_from":{"type":"string","format":"date"},"change_reason":{"type":"string"},"members":{"type":"array","items":{"$ref":"#/components/schemas/EntityOwnershipMemberInputV1Dto"}}},"required":["parent_entity_id","effective_from","members"]},"EntityOwnershipActiveMemberV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"owner_party_id":{"type":"string","format":"uuid"},"owner_party_name":{"type":"string","nullable":true},"ownership_percentage":{"type":"string","description":"Ownership percentage with exactly 15 decimals (e.g. \"60.000000000000000\")."},"effective_from":{"type":"string","format":"date"}},"required":["id","owner_party_id","ownership_percentage","effective_from"]},"EntityOwnershipTransferResultDto":{"type":"object","properties":{"active_set":{"description":"The resulting active ownership set after the transfer.","type":"array","items":{"$ref":"#/components/schemas/EntityOwnershipActiveMemberV1Dto"}}},"required":["active_set"]},"TransferEntityOwnershipV1Dto":{"type":"object","properties":{"parent_entity_id":{"type":"string","format":"uuid"},"from_party_id":{"type":"string","format":"uuid","description":"Owner giving up the stake."},"to_party_id":{"type":"string","format":"uuid","description":"Owner receiving the stake (existing owner or new)."},"percentage":{"type":"string","description":"Percentage to transfer, as a decimal string with up to 15 decimals."},"effective_from":{"type":"string","format":"date","description":"Must be a valid date strictly after the latest ownership change for the entity."},"change_reason":{"type":"string","description":"Required audit note describing the transfer."}},"required":["parent_entity_id","from_party_id","to_party_id","percentage","effective_from","change_reason"]},"EntityOwnershipReplacedDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]},"CloseAndReplaceEntityOwnershipV1Dto":{"type":"object","properties":{"effective_from":{"type":"string","format":"date"},"change_reason":{"type":"string"},"owner_party_id":{"type":"string","format":"uuid"},"ownership_percentage":{"type":"string","description":"Ownership percentage as a decimal string with up to 15 decimals (e.g. \"33.333333333333333\"). Returned with exactly 15 decimals."}},"required":["effective_from","change_reason","owner_party_id","ownership_percentage"]},"ReplayResultV1Dto":{"type":"object","properties":{"job_id":{"type":"string","description":"BullMQ job id (= scope_hash for collapsing)."},"scope_hash":{"type":"string","description":"Stable hash of the materialization scope."}},"required":["job_id","scope_hash"]},"ReplayV1Dto":{"type":"object","properties":{"affected_from":{"type":"string","format":"date","description":"YYYY-MM-DD. Meaningful when `legal_entity_id` is set. Limits the materialization sweep to lines whose entry_date >= this value."},"journal_entry_ids":{"description":"Re-materialize allocations for these specific journal entries. Use after a corrective backfill or when chasing a known-bad set of entries.","type":"array","items":{"type":"string","format":"uuid"}},"accounting_period_id":{"type":"string","format":"uuid","description":"Re-materialize every line whose entry_date falls inside the given accounting period. Used after a period unlock."},"legal_entity_id":{"type":"string","format":"uuid","description":"Re-materialize every journal line whose entry belongs to this legal entity, regardless of trackable_id. Used by the org-wide replay flow under the LE-default allocation model (2026-05-12 spec). Combine with `affected_from` to limit the date range."}}},"StatusV1Dto":{"type":"object","properties":{"total_runs":{"type":"number","description":"Total runs considered (capped at 100)."},"success":{"type":"number","description":"Runs whose outcome was `success`."},"failed":{"type":"number","description":"Runs whose outcome was `failed`."},"stalled":{"type":"number","description":"Runs whose outcome was `stalled` (re-enqueued by the recovery sweep)."},"pending":{"type":"number","description":"Runs that started but have not completed yet (started_at IS NOT NULL, completed_at IS NULL)."},"not_started":{"type":"number","description":"Runs that are queued but a worker has not yet picked them up (started_at IS NULL)."},"last_run_at":{"type":"string","nullable":true,"description":"ISO timestamp of the most-recently-enqueued run, or null when no runs exist for the caller org."}},"required":["total_runs","success","failed","stalled","pending","not_started","last_run_at"]},"LegalEntityV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"code":{"type":"string","nullable":true,"description":"An operator-assigned code for this entity — e.g. for a bulk importer to resolve it by something shorter and more stable than its name. Unique per ORG, case-insensitively (`LE-001` and `le-001` cannot coexist in this org, though a different org may also use `LE-001`); a duplicate is 409 LEGAL_ENTITY_CODE_TAKEN. Null when nobody has set one — it is never backfilled or derived from `name`."},"aliases":{"default":[],"description":"Alternate names for this legal entity. Used by the AP bill-to extractor to match invoices whose recipient name is an abbreviation or DBA of the canonical entity name.","type":"array","items":{"type":"string"}},"entity_type":{"type":"string","enum":["llc","corp","partnership","trust","other"]},"default_currency":{"type":"string","nullable":true},"address_line1":{"type":"string","nullable":true},"address_line2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"state":{"type":"string","nullable":true},"postal_code":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"operations_start_date":{"type":"string","format":"date","description":"Earliest date this entity can record transactions. Backdated entries before this date are blocked by the period gate."},"status":{"type":"string","enum":["active","inactive","in_process","dissolved"]},"dissolved_at":{"type":"string","nullable":true,"format":"date"},"tax_id":{"type":"string","nullable":true},"federal_tax_class":{"type":"string","nullable":true,"enum":["disregarded_entity","partnership","s_corp","c_corp","unknown"]},"received_distribution_treatment":{"type":"string","enum":["income","return_of_investment"],"description":"How this entity books a distribution it receives from another entity of the group: 'income' credits dividend income; 'return_of_investment' credits its investment in the paying entity. Applies to receipts posted after it is set."},"ownership_kind":{"type":"string","enum":["owned","managed"],"description":"'owned' = one of the customer's own entities; 'managed' = an external owner's entity whose books the customer keeps."},"managing_legal_entity_id":{"type":"string","format":"uuid","nullable":true,"description":"The owned legal entity administering this managed entity. Null for owned entities."},"managing_legal_entity_name":{"type":"string","nullable":true,"description":"Name of the managing legal entity. Null for owned entities."},"created_at":{"type":"string","nullable":true,"format":"date-time"}},"required":["id","org_id","name","code","aliases","entity_type","default_currency","address_line1","address_line2","city","state","postal_code","country","operations_start_date","status","dissolved_at","tax_id","federal_tax_class","received_distribution_treatment","ownership_kind","managing_legal_entity_id","managing_legal_entity_name","created_at"]},"LegalEntityOptionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"ownership_kind":{"type":"string","enum":["owned","managed"],"description":"Whether this is one of the customer's own entities or an externally-owned, fee-managed one. Picker UIs mark a managed entity so a user notices they are posting into client books (spec §6.4)."}},"required":["id","name","ownership_kind"]},"LegalEntityOwnedExpansionImpliedV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]},"LegalEntityOwnedExpansionV1Dto":{"type":"object","properties":{"seeds":{"description":"Echoes the queried `ids`.","type":"array","items":{"type":"string"}},"implied":{"description":"Legal entities transitively owned by the seeds, not already in `seeds`.","type":"array","items":{"$ref":"#/components/schemas/LegalEntityOwnedExpansionImpliedV1Dto"}}},"required":["seeds","implied"]},"CreateLegalEntityV1Dto":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":500},"code":{"type":"string","maxLength":100,"description":"An operator-assigned code for this entity, e.g. for a bulk CSV importer to resolve it by something shorter and more stable than its name. Unique per ORG, case-insensitively — a duplicate is 409 LEGAL_ENTITY_CODE_TAKEN. Omit it and it stays null; it is never derived from `name`."},"aliases":{"type":"array","items":{"type":"string"}},"entity_type":{"type":"string","enum":["llc","corp","partnership","trust","other"],"description":"Required for owned entities. Optional for managed (defaults to 'other')."},"ownership_kind":{"type":"string","enum":["owned","managed"],"description":"Defaults to 'owned'. 'managed' = an external owner's entity whose books this org keeps; requires managing_legal_entity_id and relaxes entity_type/operations_start_date. Immutable after creation."},"managing_legal_entity_id":{"type":"string","format":"uuid","description":"The owned legal entity administering this managed entity. Required iff ownership_kind = 'managed'."},"default_currency":{"type":"string","pattern":"^[A-Z]{3}$","example":"USD","description":"ISO 4217 code. Cannot change once the entity has journal entries (one currency per entity)."},"address_line1":{"type":"string","maxLength":500},"address_line2":{"type":"string","maxLength":500},"city":{"type":"string","maxLength":200},"state":{"type":"string","maxLength":100},"postal_code":{"type":"string","maxLength":50},"country":{"type":"string","maxLength":10},"operations_start_date":{"type":"string","format":"date","description":"Earliest date this entity can record transactions. Accounting periods materialize from this date forward; backdated posting before this date is blocked. Required for owned entities; optional for managed (defaults to the first of the current month)."},"status":{"type":"string","enum":["active","inactive","in_process","dissolved"]},"dissolved_at":{"type":"string","format":"date"},"tax_id":{"type":"string","maxLength":20},"federal_tax_class":{"type":"string","enum":["disregarded_entity","partnership","s_corp","c_corp","unknown"]},"seed_equity_classes":{"type":"boolean","default":true,"description":"Seed the standard equity classes for the entity's type in the same transaction: Common units for an LLC, General partner and Limited partners for a partnership, Common stock for a corporation, Common otherwise. Default true. A loader that creates its own classes passes false, or its first class code collides with a seeded one."}},"required":["name"]},"UpdateLegalEntityV1Dto":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":500},"code":{"type":"string","nullable":true,"maxLength":100,"description":"An operator-assigned code for this entity, e.g. for a bulk CSV importer to resolve it by something shorter and more stable than its name. Unique per ORG, case-insensitively — a duplicate is 409 LEGAL_ENTITY_CODE_TAKEN. Send null to release the code so another entity may claim it."},"aliases":{"type":"array","items":{"type":"string"}},"entity_type":{"type":"string","enum":["llc","corp","partnership","trust","other"]},"default_currency":{"type":"string","nullable":true,"pattern":"^[A-Z]{3}$","example":"USD","description":"ISO 4217 code. Cannot change once the entity has journal entries (one currency per entity); re-sending the current code is accepted."},"address_line1":{"type":"string","nullable":true,"maxLength":500},"address_line2":{"type":"string","nullable":true,"maxLength":500},"city":{"type":"string","nullable":true,"maxLength":200},"state":{"type":"string","nullable":true,"maxLength":100},"postal_code":{"type":"string","nullable":true,"maxLength":50},"country":{"type":"string","nullable":true,"maxLength":10},"status":{"type":"string","enum":["active","inactive","in_process","dissolved"]},"dissolved_at":{"type":"string","nullable":true,"format":"date"},"tax_id":{"type":"string","nullable":true,"maxLength":20},"federal_tax_class":{"type":"string","nullable":true,"enum":["disregarded_entity","partnership","s_corp","c_corp","unknown"]},"received_distribution_treatment":{"type":"string","enum":["income","return_of_investment"],"description":"How this entity books a distribution it receives from another entity of the group ('income' or 'return_of_investment'). Applies to receipts posted after the change."}}},"OrgCurrentV1Dto":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid"}},"required":["org_id"]},"ProvisionOrgResultV1Dto":{"type":"object","properties":{"ok":{"type":"boolean"},"org_id":{"type":"string","format":"uuid"}},"required":["ok","org_id"]},"ProvisionOrgV1Dto":{"type":"object","properties":{"industry":{"type":"string","nullable":true,"maxLength":100}}},"OrgV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"industry":{"type":"string","nullable":true},"plaid_backfill_days":{"type":"number"},"allow_bank_rule_auto_post":{"type":"boolean","description":"Org-wide gate for bank rule auto-posting. Both this and the per-rule mode must be true for the suggestion engine to auto-post."},"fiscal_year_start_month":{"type":"number","description":"Month (1-12) when the fiscal year starts. Default 1 (calendar year).","minimum":1,"maximum":12},"period_cadence":{"type":"string","description":"Default period cadence. Used by the period auto-generator (Phase 2).","enum":["monthly","quarterly","four_four_five","custom"]},"period_horizon_months":{"type":"number","description":"How many months ahead the period auto-generator extends the rolling window. Default 12.","minimum":1,"maximum":36},"sequential_close_enforced":{"type":"boolean","description":"When true, closing period N requires period N-1 in the same bucket to already be closed or locked."},"default_reporting_basis":{"type":"string","enum":["accrual","cash"]},"time_zone":{"type":"string","description":"The org's IANA timezone. Defines what \"today\" means for this org: the overdue filter, aging buckets, and the date stamped on a document created without one. Defaults to America/New_York.","example":"America/New_York"},"default_include_managed_entities":{"type":"boolean","description":"Org-wide default for whether managed (non-owned) legal entities appear in legal-entity pickers. A per-user preference overrides it; GET /v1/me returns the resolved value."},"ap_straight_through_max_amount":{"type":"string","nullable":true,"description":"Straight-through ceiling for AP: an incoming bill whose total is at or under this amount, and that passes every check, is accepted without a person. null = off (every bill waits for review).","example":"500.00"},"sales_reminder_emails_enabled":{"type":"boolean","description":"Org-wide switch for tenant sales reminder emails. A lease whose reminder setting is `inherit` follows it; a lease set to `on` or `off` overrides it. Default false (no automatic emails)."},"sales_reminder_lead_days":{"type":"number","minimum":0,"maximum":60,"description":"How many days before a sales report is due the due-soon reminder email goes out (never before the reporting period has ended). Default 5."},"pct_rent_invoice_mode":{"type":"string","enum":["next_rent_invoice","separate"],"description":"How approved percentage rent is invoiced for a lease whose own invoice mode is `inherit`: `separate` = on an invoice of its own, posted but not emailed; `next_rent_invoice` = added to the lease's next rent invoice. Termination and audit lines always bill separately. Default `separate`."},"created_at":{"type":"string","format":"date-time"}},"required":["id","name","industry","plaid_backfill_days","allow_bank_rule_auto_post","fiscal_year_start_month","period_cadence","period_horizon_months","sequential_close_enforced","default_reporting_basis","time_zone","default_include_managed_entities","ap_straight_through_max_amount","sales_reminder_emails_enabled","sales_reminder_lead_days","pct_rent_invoice_mode","created_at"]},"UpdateOrgV1Dto":{"type":"object","properties":{"allow_bank_rule_auto_post":{"type":"boolean"},"sequential_close_enforced":{"type":"boolean","description":"When true, closing period N requires period N-1 in the same bucket to already be closed or locked."},"default_reporting_basis":{"type":"string","enum":["accrual","cash"]},"time_zone":{"type":"string","description":"The org's IANA timezone, e.g. America/New_York. Changing it changes which invoices read as overdue and which calendar day a server-stamped document gets. Set to UTC to restore the pre-2026-09 behaviour. Only canonical IANA names are accepted (validated against Intl.supportedValuesOf('timeZone')); legacy aliases such as US/Eastern are rejected with a 400.","example":"America/New_York"},"period_horizon_months":{"type":"number","minimum":1,"maximum":36,"description":"How many months ahead the period auto-generator extends the rolling window. Raising it does not materialize periods immediately — the generate-periods scheduler sweep picks up the new value on its next run."},"default_include_managed_entities":{"type":"boolean","description":"Org-wide default for whether managed (non-owned) legal entities appear in legal-entity pickers. A user who has set their own preference keeps it."},"ap_straight_through_max_amount":{"type":"string","nullable":true,"description":"Straight-through ceiling for AP bills, a decimal string. null turns straight-through processing off. A negative amount is refused with 422 ORG_AP_STRAIGHT_THROUGH_NEGATIVE.","example":"500.00"},"sales_reminder_emails_enabled":{"type":"boolean","description":"Org-wide switch for tenant sales reminder emails. Leases set to `inherit` follow it; a lease's own `on`/`off` wins."},"sales_reminder_lead_days":{"type":"number","minimum":0,"maximum":60,"description":"Days before a sales report is due that the due-soon reminder goes out, an integer 0-60."},"pct_rent_invoice_mode":{"type":"string","enum":["next_rent_invoice","separate"],"description":"How approved percentage rent is invoiced for leases set to `inherit`. `inherit` itself is not an org value."}}},"PeriodConfigV1Dto":{"type":"object","properties":{"fiscal_year_start_month":{"type":"number","minimum":1,"maximum":12},"period_cadence":{"type":"string","enum":["monthly","quarterly","four_four_five","custom"]},"is_set":{"type":"boolean","description":"True once the fiscal config has been set: confirmed by the org owner in Org Settings, set by Spark staff when they created or provisioned the org (POST /v1/internal/orgs, POST /v1/internal/orgs/{id}/provision), or locked by posted journals or closed periods. LE creation is blocked while this is false."},"is_locked":{"type":"boolean","description":"True when fiscal config is locked from edits because period activity has begun (any closed/locked period or any posted journal entry in the org)."},"lock_reason":{"type":"string","nullable":true}},"required":["fiscal_year_start_month","period_cadence","is_set","is_locked","lock_reason"]},"UpdatePeriodConfigV1Dto":{"type":"object","properties":{"fiscal_year_start_month":{"type":"number","minimum":1,"maximum":12},"period_cadence":{"type":"string","enum":["monthly","quarterly","four_four_five","custom"]}},"required":["fiscal_year_start_month","period_cadence"]},"McpSettingsV1Dto":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid","description":"The org these settings belong to."},"mcp_access_level":{"type":"string","enum":["off","read","write","full"],"description":"The most an AI connector may do in this org. `off` blocks every connector token; `read` allows only read requests; `write` also allows create/update; `full` also allows deletes and other destructive calls. A ceiling only: the signed-in user's own scopes still apply."}},"required":["org_id","mcp_access_level"]},"UpdateMcpSettingsV1Dto":{"type":"object","properties":{"mcp_access_level":{"type":"string","enum":["off","read","write","full"],"description":"The new AI-connector access-level ceiling for the org."}},"required":["mcp_access_level"]},"OrgMemberV1Dto":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"display_name":{"type":"string","nullable":true,"description":"Derived from the membership first/last name; null when no name is on file."},"email":{"type":"string","nullable":true,"description":"Email from auth.users; null when the auth row isn't readable."},"role":{"type":"string","enum":["owner","admin","accountant","clerk","viewer","facility"]},"approval_limit":{"type":"number","nullable":true,"description":"Per-member document-approval authority cap. NULL means no cap configured."}},"required":["user_id","display_name","email","role","approval_limit"]},"CreatedOrgOwnerV1Dto":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"email_status":{"type":"string","enum":["sent","skipped","failed"],"description":"`sent`: the invitation went out. `skipped`: the owner already has an account they signed in with. `failed`: the org exists but the email did not go out — re-send it."}},"required":["user_id","email","email_status"]},"ProvisionedRowCountsV1Dto":{"type":"object","properties":{"party_categories":{"type":"number"},"party_role_types":{"type":"number"},"contract_types":{"type":"number"},"term_types":{"type":"number"},"security_groups":{"type":"number"},"accounts":{"type":"number"},"asset_classes":{"type":"number"},"dimensions":{"type":"number"},"items":{"type":"number"},"deal_stages":{"type":"number"},"deal_role_types":{"type":"number"},"deal_lost_reasons":{"type":"number"}},"required":["party_categories","party_role_types","contract_types","term_types","security_groups","accounts","asset_classes","dimensions","items","deal_stages","deal_role_types","deal_lost_reasons"]},"FiscalCalendarV1Dto":{"type":"object","properties":{"fiscal_year_start_month":{"type":"number","minimum":1,"maximum":12},"period_cadence":{"type":"string","enum":["monthly","quarterly","four_four_five","custom"]},"stored":{"type":"boolean","description":"Whether this call set it (on a dry run, would). False when the org already had a fiscal config."}},"required":["fiscal_year_start_month","period_cadence","stored"]},"CreateOrgResultV1Dto":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"industry":{"type":"string","enum":["real_estate","generic"]},"owner":{"$ref":"#/components/schemas/CreatedOrgOwnerV1Dto"},"provisioned":{"description":"Rows the org holds in each seeded table after creation.","allOf":[{"$ref":"#/components/schemas/ProvisionedRowCountsV1Dto"}]},"fiscal_calendar":{"description":"The new org's fiscal-period config, so its owner can create legal entities right away.","allOf":[{"$ref":"#/components/schemas/FiscalCalendarV1Dto"}]},"chart_of_accounts":{"type":"string","enum":["standard","empty"],"description":"The chart-of-accounts choice the org was created with and keeps."}},"required":["org_id","name","industry","owner","provisioned","fiscal_calendar","chart_of_accounts"]},"CreateOrgOwnerV1Dto":{"type":"object","properties":{"email":{"type":"string","format":"email"},"first_name":{"type":"string","maxLength":120},"last_name":{"type":"string","maxLength":120},"phone":{"type":"string","maxLength":40,"description":"Free-form."}},"required":["email"]},"CreateOrgV1Dto":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"industry":{"type":"string","enum":["real_estate","generic"],"description":"Which catalogs to seed; stored on the org."},"fiscal_year_start_month":{"type":"number","minimum":1,"maximum":12,"description":"Month the fiscal year starts (1 = January), a JSON integer; defaults to 1. Setting it counts as the owner's confirmation — they are not asked again — and the first posted journal freezes it, so pass the customer's real fiscal year. `null` is refused (400)."},"period_cadence":{"type":"string","enum":["monthly","quarterly","four_four_five"],"description":"Accounting period cadence; defaults to `monthly`. `custom` is not accepted: it generates no periods. `null` is refused (400)."},"chart_of_accounts":{"type":"string","enum":["standard","empty"],"description":"`standard` (default) seeds the default chart of accounts, one account per system role. `empty` creates none — for a customer who brings their own chart — and the org keeps that choice: provisioning it again never seeds accounts. Its system items (late fee, administrative fee) are created when their role is given an org-wide account. `null` is refused (400)."},"owner":{"$ref":"#/components/schemas/CreateOrgOwnerV1Dto"}},"required":["name","industry","owner"]},"ProvisionOrgByIdResultV1Dto":{"type":"object","properties":{"fiscal_calendar":{"description":"The org's fiscal-period config after this call. Legal entities can be created only once an org has one.","allOf":[{"$ref":"#/components/schemas/FiscalCalendarV1Dto"}]},"org_id":{"type":"string","format":"uuid"},"industry":{"type":"string","enum":["real_estate","generic"],"description":"The industry the org was provisioned for."},"dry_run":{"type":"boolean"},"industry_stored":{"type":"boolean","description":"Whether `industry` was written to the org (on a dry run, would be): it had none, a legacy spelling, or unrecognised text."},"before":{"description":"Rows the org held before this call in each table provisioning seeds — every row, including ones the org created itself, not only seeded ones.","allOf":[{"$ref":"#/components/schemas/ProvisionedRowCountsV1Dto"}]},"after":{"nullable":true,"description":"Rows after this call; null on a dry run.","type":"object","allOf":[{"$ref":"#/components/schemas/ProvisionedRowCountsV1Dto"}]},"members_assigned":{"type":"number","description":"Members put in the system group matching their role (on a dry run, members that would be)."}},"required":["fiscal_calendar","org_id","industry","dry_run","industry_stored","before","after","members_assigned"]},"ProvisionOrgByIdV1Dto":{"type":"object","properties":{"industry":{"type":"string","enum":["real_estate","generic"],"description":"Which catalogs to seed. Required only when the org has neither a seeded (system) catalog nor a recognised stored industry, and then stored on it. Otherwise omit the key — `null` is refused (400) — since a different value is refused with ORG_INDUSTRY_CONFLICT."},"fiscal_year_start_month":{"type":"number","minimum":1,"maximum":12,"description":"Month the fiscal year starts (1 = January), a JSON integer. Applied only when the org has no fiscal config yet; when omitted, the value stored on the org is used (1 unless set by hand). Setting it counts as the owner's confirmation — they are not asked again — and the first posted journal freezes it, so pass the customer's real fiscal year. An org whose config is set keeps it; a different value is refused with ORG_FISCAL_CONFIG_CONFLICT. `null` is refused (400)."},"period_cadence":{"type":"string","enum":["monthly","quarterly","four_four_five"],"description":"Accounting period cadence. Applied only when the org has no fiscal config yet; when omitted, the cadence stored on the org is used (monthly unless set by hand; a stored `custom` becomes monthly). `custom` is not accepted: it generates no periods. An org whose config is set keeps it; a different value is refused with ORG_FISCAL_CONFIG_CONFLICT. `null` is refused (400)."},"dry_run":{"type":"boolean","default":false,"description":"Report what is there and which members would be grouped, without writing anything. A JSON boolean only."}}},"ResendOwnerInviteResultV1Dto":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"email_status":{"type":"string","enum":["sent","failed"]}},"required":["org_id","user_id","email","email_status"]},"ResendOwnerInviteV1Dto":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"The pending owner to re-invite."}},"required":["email"]},"AssetClassV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string","maxLength":32,"example":"BLDG"},"name":{"type":"string","maxLength":128,"example":"Building"},"kind":{"type":"string","enum":["tangible","intangible","land","cip"]},"default_life_months":{"type":"number","nullable":true,"description":"Default depreciable life in months, or null if class-level life is not set."},"method":{"type":"string","enum":["straight_line","declining_balance_150","declining_balance_200"]},"convention":{"type":"string","enum":["full_month","mid_month","actual_days"]},"default_salvage_pct":{"type":"string","example":"0.0000","description":"Default salvage value as a decimal string (numeric(7,4)) — a fraction of cost, e.g. \"0.1000\" for 10%."},"asset_account_id":{"type":"string","format":"uuid","nullable":true},"accumulated_account_id":{"type":"string","format":"uuid","nullable":true},"expense_account_id":{"type":"string","format":"uuid","nullable":true},"linkage_kind":{"type":"string","enum":["entity","property","property_space","property_space_lease"]},"life_bound_by_lease":{"type":"boolean"},"is_active":{"type":"boolean"},"sort_order":{"type":"number"}},"required":["id","code","name","kind","default_life_months","method","convention","default_salvage_pct","asset_account_id","accumulated_account_id","expense_account_id","linkage_kind","life_bound_by_lease","is_active","sort_order"]},"CreateAssetClassV1Dto":{"type":"object","properties":{"code":{"type":"string","maxLength":32,"example":"BLDG"},"name":{"type":"string","maxLength":128,"example":"Building"},"kind":{"type":"string","enum":["tangible","intangible","land","cip"]},"default_life_months":{"type":"number","nullable":true,"description":"Default depreciable life in months."},"method":{"type":"string","enum":["straight_line","declining_balance_150","declining_balance_200"],"default":"straight_line"},"convention":{"type":"string","enum":["full_month","mid_month","actual_days"]},"default_salvage_pct":{"type":"string","example":"0.075","default":"0","description":"Default salvage as a ratio of cost — a non-negative decimal string with up to 4 fractional digits (numeric(7,4)), e.g. \"0.075\" for 7.5% salvage."},"asset_account_id":{"type":"string","format":"uuid","nullable":true},"accumulated_account_id":{"type":"string","format":"uuid","nullable":true},"expense_account_id":{"type":"string","format":"uuid","nullable":true},"linkage_kind":{"type":"string","enum":["entity","property","property_space","property_space_lease"]},"life_bound_by_lease":{"type":"boolean","default":false},"sort_order":{"type":"number","default":0}},"required":["code","name","kind","convention","linkage_kind"]},"UpdateAssetClassV1Dto":{"type":"object","properties":{"code":{"type":"string","maxLength":32},"name":{"type":"string","maxLength":128},"kind":{"type":"string","enum":["tangible","intangible","land","cip"]},"default_life_months":{"type":"number","nullable":true},"method":{"type":"string","enum":["straight_line","declining_balance_150","declining_balance_200"]},"convention":{"type":"string","enum":["full_month","mid_month","actual_days"]},"default_salvage_pct":{"type":"string","example":"0.075","description":"Default salvage as a ratio of cost — a non-negative decimal string with up to 4 fractional digits (numeric(7,4)), e.g. \"0.075\" for 7.5% salvage."},"asset_account_id":{"type":"string","format":"uuid","nullable":true},"accumulated_account_id":{"type":"string","format":"uuid","nullable":true},"expense_account_id":{"type":"string","format":"uuid","nullable":true},"linkage_kind":{"type":"string","enum":["entity","property","property_space","property_space_lease"]},"life_bound_by_lease":{"type":"boolean"},"sort_order":{"type":"number"},"is_active":{"type":"boolean","description":"Deactivate (false) or reactivate (true) the class. Classes are never hard-deleted once created."}}},"FixedAssetImportTotalV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"asset_account_id":{"type":"string","format":"uuid","nullable":true},"asset_account_code":{"type":"string","nullable":true},"asset_account_name":{"type":"string","nullable":true},"accumulated_account_id":{"type":"string","format":"uuid","nullable":true},"accumulated_account_code":{"type":"string","nullable":true},"accumulated_account_name":{"type":"string","nullable":true},"asset_count":{"type":"number","description":"Accepted rows in this group."},"cost":{"type":"string","example":"1234.50"},"accumulated":{"type":"string","description":"Accumulated depreciation carried in.","example":"1234.50"},"net_book_value":{"type":"string","description":"Cost minus accumulated.","example":"1234.50"}},"required":["legal_entity_id","legal_entity_name","asset_account_id","asset_account_code","asset_account_name","accumulated_account_id","accumulated_account_code","accumulated_account_name","asset_count","cost","accumulated","net_book_value"]},"FixedAssetImportV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"file_name":{"type":"string"},"status":{"type":"string","enum":["staged","committed","discarded"],"description":"`staged` while it can still be reviewed, committed or discarded; `committed` once its assets exist; `discarded` when abandoned (its file may then be uploaded again)."},"row_count":{"type":"number"},"rows_accepted":{"type":"number"},"rows_rejected":{"type":"number"},"warnings_count":{"type":"number","description":"Warnings on accepted rows (for example a closed period)."},"assets_created":{"type":"number"},"created_at":{"type":"string","format":"date-time"},"committed_at":{"type":"string","format":"date-time","nullable":true},"totals":{"description":"Accepted rows grouped by legal entity and asset account, for reconciling against the legacy ledger.","type":"array","items":{"$ref":"#/components/schemas/FixedAssetImportTotalV1Dto"}}},"required":["id","file_name","status","row_count","rows_accepted","rows_rejected","warnings_count","assets_created","created_at","committed_at","totals"]},"FixedAssetImportIssueV1Dto":{"type":"object","properties":{"field":{"type":"string","description":"The CSV column the message is about."},"message":{"type":"string","description":"A complete sentence a user can act on."}},"required":["field","message"]},"FixedAssetImportRowV1Dto":{"type":"object","properties":{"row_number":{"type":"number","description":"The physical CSV line; the header is line 1."},"status":{"type":"string","enum":["accepted","rejected"]},"legacy_ref":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"errors":{"type":"array","items":{"$ref":"#/components/schemas/FixedAssetImportIssueV1Dto"}},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/FixedAssetImportIssueV1Dto"}},"asset_id":{"type":"string","format":"uuid","nullable":true,"description":"The asset this row created; null until the import commits."},"asset_code":{"type":"string","nullable":true}},"required":["row_number","status","legacy_ref","name","errors","warnings","asset_id","asset_code"]},"FixedAssetImportListMetaV1Dto":{"type":"object","properties":{"next_cursor":{"type":"string","description":"Opaque cursor for the next page, or null when this is the last page. Pass it back as `?cursor=`. Always present; do not parse it.","nullable":true,"example":"eyJpZCI6ICJhYmMifQ=="},"limit":{"type":"number","description":"Page size used for this response.","example":50},"request_id":{"type":"string","example":"018f0b3d-2b1e-7c8a-9d4b-1a2b3c4d5e6f"},"api_version":{"type":"string","example":"2026-04-23"},"import":{"$ref":"#/components/schemas/FixedAssetImportV1Dto"}},"required":["next_cursor","limit","request_id","api_version","import"]},"FixedAssetImportCommitV1Dto":{"type":"object","properties":{"import":{"$ref":"#/components/schemas/FixedAssetImportV1Dto"},"assets_created":{"type":"number","description":"Assets this import created."},"already_committed":{"type":"boolean","description":"True when the import had already been committed and this call only returned the stored result; nothing was created by it."}},"required":["import","assets_created","already_committed"]},"FixedAssetSourceDocumentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"number":{"type":"string","nullable":true,"description":"The document number, null until one is assigned."},"type":{"type":"string","description":"The document type, for example `bill`."}},"required":["id","number","type"]},"FixedAssetV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string","maxLength":64,"example":"FA-2026-000001"},"name":{"type":"string","maxLength":256},"description":{"type":"string","nullable":true},"legal_entity_id":{"type":"string","format":"uuid"},"class_id":{"type":"string","format":"uuid","nullable":true},"property_id":{"type":"string","format":"uuid","nullable":true},"space_id":{"type":"string","format":"uuid","nullable":true},"contract_id":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["pending","cip","active","suspended","fully_depreciated","disposed","transferred"]},"in_service_date":{"type":"string","format":"date","nullable":true,"description":"Date the asset was placed in service, or null before then."},"life_months":{"type":"number","nullable":true,"description":"Depreciable life in months, or null before place-in-service."},"method":{"type":"string","enum":["straight_line","declining_balance_150","declining_balance_200"],"nullable":true},"convention":{"type":"string","enum":["full_month","mid_month","actual_days"],"nullable":true},"salvage_amount":{"type":"string","nullable":true,"description":"Estimated residual value at the end of the useful life.","example":"1234.50"},"cost_basis":{"type":"string","description":"Total capitalized cost, the sum of claimed cost sources.","example":"1234.50"},"accumulated_depreciation":{"type":"string","description":"Depreciation recognized to date.","example":"1234.50"},"net_book_value":{"type":"string","description":"Computed: cost_basis − accumulated_depreciation.","example":"1234.50"},"origin":{"type":"string","enum":["auto_shell","manual","acquisition_template","split","migrated","intercompany_transfer"]},"legacy_ref":{"type":"string","nullable":true,"description":"The asset’s id in the legacy register it was imported from (`origin` `migrated`); null for every other asset. Unique per organization."},"disposed_on":{"type":"string","format":"date","nullable":true},"disposal_event_id":{"type":"string","format":"uuid","nullable":true},"transferred_to_asset_id":{"type":"string","format":"uuid","nullable":true,"description":"On a `transferred` asset: its successor in the receiving legal entity (spec 2026-10-01). Null otherwise, and null when the caller may not read the receiving entity (an API key scoped to this asset’s entity)."},"transferred_to_asset_code":{"type":"string","nullable":true,"description":"The successor’s code. Null whenever `transferred_to_asset_id` is."},"transferred_from_asset_id":{"type":"string","format":"uuid","nullable":true,"description":"On a successor opened by an intercompany transfer: the asset it came from, in the sending legal entity, which keeps the history and the attached files. Null otherwise, and null when the caller may not read the sending entity (an API key scoped to this asset’s entity)."},"transferred_from_asset_code":{"type":"string","nullable":true,"description":"The source asset’s code. Null whenever `transferred_from_asset_id` is."},"source_document":{"nullable":true,"description":"The document the asset was capitalized from: the document behind its earliest cost-source line. Null for an asset with no cost source (for example a migrated one) or none backed by a document.","type":"object","allOf":[{"$ref":"#/components/schemas/FixedAssetSourceDocumentV1Dto"}]},"vendor_party_id":{"type":"string","format":"uuid","nullable":true},"serial_number":{"type":"string","nullable":true},"tag_number":{"type":"string","nullable":true},"warranty_expires_on":{"type":"string","format":"date","nullable":true},"attributes":{"type":"object","additionalProperties":true,"nullable":true,"description":"Caller-defined free-form attributes."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","code","name","description","legal_entity_id","class_id","property_id","space_id","contract_id","status","in_service_date","life_months","method","convention","salvage_amount","cost_basis","accumulated_depreciation","net_book_value","origin","legacy_ref","disposed_on","disposal_event_id","transferred_to_asset_id","transferred_to_asset_code","transferred_from_asset_id","transferred_from_asset_code","source_document","vendor_party_id","serial_number","tag_number","warranty_expires_on","attributes","created_at","updated_at"]},"FixedAssetDocumentLockAssetV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string","example":"FA-2026-000033"},"name":{"type":"string"},"status":{"type":"string","enum":["pending","cip","active","suspended","fully_depreciated","disposed","transferred"]},"release":{"type":"string","enum":["undo_placement","remove_cost"],"nullable":true,"description":"The action that releases this asset's hold: `undo_placement` (POST /v1/fixed-assets/{id}/undo-placement; active, nothing posted, no other history), `remove_cost` (DELETE /v1/fixed-assets/{id}/cost-sources/{cost_source_id}; pending or cip; an auto-created asset only while it keeps a cost line off this document), or null when nothing releases it."},"cost_source_ids":{"description":"The asset's cost sources on this document's entries (what Remove takes). Empty unless `release` is `remove_cost`.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["id","code","name","status","release","cost_source_ids"]},"FixedAssetDocumentLockV1Dto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid"},"assets":{"description":"The assets holding the document, ordered by code. An untouched auto-created asset never holds its bill — it follows an edit or a void — so it is not listed.","type":"array","items":{"$ref":"#/components/schemas/FixedAssetDocumentLockAssetV1Dto"}}},"required":["document_id","assets"]},"FixedAssetsSummaryCountsV1Dto":{"type":"object","properties":{"pending":{"type":"number"},"cip":{"type":"number"},"active":{"type":"number"},"suspended":{"type":"number"},"fully_depreciated":{"type":"number"},"disposed":{"type":"number"},"transferred":{"type":"number"}},"required":["pending","cip","active","suspended","fully_depreciated","disposed","transferred"]},"FixedAssetsSummaryTotalsV1Dto":{"type":"object","properties":{"cost_basis":{"type":"string","description":"Sum of `cost_basis` over the on-book assets.","example":"1000.00"},"accumulated_depreciation":{"type":"string","description":"Sum of `accumulated_depreciation` over the on-book assets.","example":"250.50"},"net_book_value":{"type":"string","description":"`cost_basis − accumulated_depreciation`.","example":"749.50"}},"required":["cost_basis","accumulated_depreciation","net_book_value"]},"FixedAssetsSummaryV1Dto":{"type":"object","properties":{"counts":{"description":"Assets per status; every status is present, zero-filled.","allOf":[{"$ref":"#/components/schemas/FixedAssetsSummaryCountsV1Dto"}]},"totals":{"description":"Money totals over the assets still on the books: pending, cip, active, suspended and fully_depreciated.","allOf":[{"$ref":"#/components/schemas/FixedAssetsSummaryTotalsV1Dto"}]}},"required":["counts","totals"]},"ClaimableLineV1Dto":{"type":"object","properties":{"journal_line_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"entry_date":{"type":"string","format":"date"},"amount":{"type":"string","description":"Signed (debit − credit) amount of the journal line.","example":"1234.50"},"remaining_fraction":{"type":"string","example":"1.0000000000","description":"Fraction of the line not yet claimed by a cost source (1 − the sum of claimed fractions). Drops to 0 once fully claimed, at which point the line no longer appears in this list."},"class_codes":{"example":["BLDG-IMP","EQUIP"],"description":"Codes of every ACTIVE asset class whose `asset_account_id` is this line’s account, ascending. Usually one, but an org may map several classes to a single \"1500 Fixed Assets\" account, in which case all of them are listed and the line itself is still returned exactly once. **May be empty**: a line is also offered when its account merely holds the `fixed_assets` system role, which is the account a class with a null `asset_account_id` falls back to — the state a freshly provisioned org is in until its classes are mapped. An empty array therefore means \"capitalizable, but no class names this account\", and the caller picks the class on the asset instead.","type":"array","items":{"type":"string"}}},"required":["journal_line_id","account_id","legal_entity_id","entry_date","amount","remaining_fraction","class_codes"]},"CreateCostSourceV1Dto":{"type":"object","properties":{"journal_line_id":{"type":"string","format":"uuid"},"fraction":{"type":"string","example":"1.0000000000","description":"Share of the journal line claimed by this asset, a decimal in (0, 1] with up to 10 decimals (numeric(12,10))."}},"required":["journal_line_id","fraction"]},"CreateFixedAssetV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":256},"legal_entity_id":{"type":"string","format":"uuid"},"class_id":{"type":"string","format":"uuid","nullable":true},"property_id":{"type":"string","format":"uuid","nullable":true},"space_id":{"type":"string","format":"uuid","nullable":true},"contract_id":{"type":"string","format":"uuid","nullable":true},"as_cip":{"type":"boolean","default":false,"description":"Create in construction-in-progress status (`cip`) instead of `pending`."},"vendor_party_id":{"type":"string","format":"uuid","nullable":true},"description":{"type":"string","nullable":true},"serial_number":{"type":"string","maxLength":128,"nullable":true},"tag_number":{"type":"string","maxLength":64,"nullable":true},"warranty_expires_on":{"type":"string","format":"date","nullable":true},"attributes":{"type":"object","additionalProperties":true,"nullable":true,"description":"Caller-defined free-form attributes."},"cost_sources":{"description":"Journal lines claimed as this asset’s initial cost. `cost_basis` is the sum of the resulting claimed amounts.","type":"array","items":{"$ref":"#/components/schemas/CreateCostSourceV1Dto"}}},"required":["name","legal_entity_id"]},"PlaceInServiceV1Dto":{"type":"object","properties":{"in_service_date":{"type":"string","format":"date","description":"The date depreciation starts. May be backdated into a closed period — the charge for closed periods is folded forward as catch-up into the earliest open period (`catch_up_amount` on that schedule row)."},"class_id":{"type":"string","format":"uuid","description":"Required when the asset has no class yet, and must match the asset’s existing class otherwise — placement confirms a class, it does not reclassify. The class supplies every depreciation default and the three GL accounts."},"property_id":{"type":"string","format":"uuid"},"space_id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"life_months":{"type":"number","minimum":1,"maximum":1200,"description":"Depreciable life in months. Defaults to the class’s `default_life_months`. Required when the class depreciates (kind `tangible` or `intangible`) and has no `default_life_months` — the lease-derived intangible classes are exactly that shape — otherwise the placement is refused with `ASSET_LIFE_UNRESOLVED` rather than answering 200 with an empty schedule. Rejected outright for a land class (`ASSET_CLASS_NOT_DEPRECIABLE`): land never depreciates and is placed with no schedule rows at all."},"salvage_amount":{"type":"string","description":"Residual value excluded from the depreciable basis. Defaults to `cost_basis × class.default_salvage_pct`, rounded to the cent half away from zero. Must not exceed the asset’s `cost_basis` — the depreciable basis is cost − salvage, so a larger salvage would make it negative (`ASSET_SALVAGE_EXCEEDS_COST`). Equal to `cost_basis` is allowed and means a zero depreciable basis.","example":"1234.50"},"method":{"type":"string","enum":["straight_line","declining_balance_150","declining_balance_200"]},"convention":{"type":"string","enum":["full_month","mid_month","actual_days"]},"reason":{"type":"string","maxLength":1024,"nullable":true,"description":"Why these settings were chosen — stored on the `place_in_service` event. **Required when the body OVERRIDES any of the class defaults** (`life_months`, `method`, `convention`, `salvage_amount`): spec §2 makes those \"overridable with a reason (stored on the event)\", so a placement that departs from what every other asset in the class gets is refused without one (`ASSET_EVENT_REASON_REQUIRED`). Optional for a placement that takes every default, and for a `life_months` on a class that has no `default_life_months` at all (`INPL` / `AMKT`, whose life comes from the lease) — there is no default there to override."}},"required":["in_service_date"]},"PlacementPreviewRowV1Dto":{"type":"object","properties":{"period_id":{"type":"string","format":"uuid","description":"The accounting period the row targets."},"period_start":{"type":"string","format":"date","description":"First day of the period."},"period_end":{"type":"string","format":"date","description":"Last day of the period, inclusive."},"amount":{"type":"string","description":"Depreciation the row would carry. Includes `catch_up_amount` when this is the catch-up row, exactly as the persisted schedule row does.","example":"1234.50"},"is_catch_up":{"type":"boolean","description":"True on the row that carries the folded-forward catch-up for closed periods earlier in the schedule."}},"required":["period_id","period_start","period_end","amount","is_catch_up"]},"PlacementPreviewV1Dto":{"type":"object","properties":{"rows":{"description":"Up to 12 schedule rows in period order, starting at the first row with a non-zero amount — closed periods at the head of a backdated schedule carry 0.00 and are skipped here (their months are still counted in `catch_up_months`). Each is, to the cent, a row the placement would persist. Empty for land. The totals cover every row.","type":"array","items":{"$ref":"#/components/schemas/PlacementPreviewRowV1Dto"}},"catch_up_amount":{"type":"string","description":"Charge folded forward from periods that are already closed, booked in the first open period. `0.00` when the in-service date leaves nothing to catch up.","example":"1234.50"},"catch_up_months":{"type":"number","example":3,"description":"Calendar months of depreciation the catch-up covers, counted from the in-service month. 0 when there is no catch-up."},"monthly_amount":{"type":"string","description":"The amount of the first schedule row after the catch-up row (the first row when there is no catch-up) — the regular charge that follows the catch-up. `0.00` when the schedule has no such row (land).","example":"1234.50"},"total":{"type":"string","description":"Sum of `amount` over EVERY row of the schedule, not only the rows returned.","example":"1234.50"}},"required":["rows","catch_up_amount","catch_up_months","monthly_amount","total"]},"MergeFixedAssetV1Dto":{"type":"object","properties":{"source_asset_id":{"type":"string","format":"uuid","description":"The pending asset to fold into the asset in the path. It is deleted by the merge; its cost sources move to the surviving asset."}},"required":["source_asset_id"]},"AssetEventV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"asset_id":{"type":"string","format":"uuid"},"sequence_no":{"type":"number","description":"The event’s gapless position in this asset’s history, 1-based."},"event_type":{"type":"string","description":"Which event this is. Besides the types `POST /{id}/events` accepts, `place_in_service`, `migrated_opening` (written by the legacy CSV import, carrying the accumulated depreciation the asset arrived with), `intercompany_transfer_out` (on the asset that left for another legal entity) and `intercompany_transfer_in` (on its successor) are written by their own routes.","example":"add_cost"},"effective_date":{"type":"string","format":"date"},"recorded_at":{"type":"string","format":"date-time"},"recorded_by":{"type":"string","format":"uuid","nullable":true,"description":"The user who recorded it. Null when an API key did — a key id is not a user, and the `audit_log` row keeps the full principal."},"reason":{"type":"string","nullable":true},"catch_up_amount":{"type":"string","nullable":true,"description":"The depreciation this event folded forward into the earliest open period, when it was backdated past a closed one. Null means the event folded nothing forward — a prospective `revise` always does.","example":"1234.50"},"accumulated_carried_in":{"type":"string","nullable":true,"description":"The accumulated depreciation this event brought into the asset: the opening balance on `migrated_opening` (legacy import) and the amount moved over on `intercompany_transfer_in`. Null on every other event.","example":"1234.50"},"before":{"type":"object","additionalProperties":true,"nullable":true,"description":"The asset’s setup before the event. Shape is event-defined."},"after":{"type":"object","additionalProperties":true,"nullable":true,"description":"The asset’s setup after the event. Shape is event-defined."},"document_id":{"type":"string","format":"uuid","nullable":true,"description":"The document this event posted, when it posted one. `dispose`, `dispose_partial` and `impair` post one (`asset_disposal` for the two disposals, `asset_reclass` for an impairment); each side of an intercompany transfer carries its own entity’s `asset_reclass`; every other event type writes to the register only and leaves this null. A retirement whose document would carry no lines at all — a zero-basis asset retired for nothing — also records null: there was nothing to post."},"invoice_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The invoice that bills this disposal’s proceeds. Set on `dispose` and `dispose_partial` when there were proceeds — on a bulk disposal every event of an entity that recovered something carries that entity’s one invoice, including an asset that itself recovered nothing. Null on every other event."},"counterpart_asset_id":{"type":"string","format":"uuid","nullable":true,"description":"The other asset of an intercompany transfer: on `intercompany_transfer_out` the successor in the receiving entity, on `intercompany_transfer_in` the asset it came from. Null on every other event — and null when the caller may not read the other asset’s legal entity (an API key scoped to this asset’s entity), together with `counterpart_asset_code`, `counterpart_legal_entity_id` and the keys of `before` / `after` that name the other asset or its entity."},"counterpart_asset_code":{"type":"string","nullable":true,"description":"That asset’s code, so the log can name it without a second read. Null whenever `counterpart_asset_id` is."},"counterpart_legal_entity_id":{"type":"string","format":"uuid","nullable":true,"description":"That asset’s legal entity. Null whenever `counterpart_asset_id` is."},"intercompany_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The `intercompany_transaction` that carries an intercompany transfer’s net book value, on both of its events. Null when that value was zero, and on every other event. It cannot be voided or edited."},"disposal_reason":{"type":"string","enum":["sale","theft","casualty","scrapped","obsolescence","trade_in"],"nullable":true,"description":"Why the asset left the books. Set on `dispose`, `dispose_partial` and `write_off`, null on every other event."},"batch_id":{"type":"string","format":"uuid","nullable":true,"description":"Shared by every event of one bulk disposal, so the assets retired in the same decision can be read back together. Null for a single-asset event."}},"required":["id","asset_id","sequence_no","event_type","effective_date","recorded_at","recorded_by","reason","catch_up_amount","accumulated_carried_in","before","after","document_id","invoice_document_id","counterpart_asset_id","counterpart_asset_code","counterpart_legal_entity_id","intercompany_document_id"]},"CreateAssetEventV1Dto":{"type":"object","properties":{"event_type":{"type":"string","enum":["add_cost","revise","suspend","resume","transfer","impair","dispose_partial","dispose"],"description":"Which event to record. `dispose` retires the asset outright, `dispose_partial` retires a share of it and `impair` writes its carrying amount down — those three POST to the general ledger and need `accounting:write` as well. `add_cost` capitalizes more cost onto the asset (send `cost_sources`) — accepted on a `pending` or `cip` asset too, where it raises `cost_basis` and writes no schedule row, which is how a construction-in-progress asset grows; `revise` records a change in estimate — a new life, salvage or method (send `reason`, plus at least one of `life_months`, `remaining_life_months`, `salvage_amount`, `method`); `suspend` pauses depreciation on an idle or held-for-sale asset (send `reason`); `resume` restarts it; `transfer` moves the asset to another property or space (send `property_id`, `space_id`, or both)."},"effective_date":{"type":"string","format":"date","description":"The date the event takes effect. On `suspend` it is the first day the asset is idle: every projected period STARTING on or after it is marked `skipped`, and a period already under way keeps its charge. On `resume` it is where depreciation restarts, and it may not precede the suspension it ends. On `transfer` it is the event’s record date — the asset’s location changes as of now, and no schedule row moves (property is not on a schedule row; the depreciation run groups its document lines by property, so later depreciation lands at the new one). On `add_cost` this is the event’s record-keeping date only, on both of that event’s branches — it never opens the window. With no schedule row posted yet the re-spread runs from the asset’s own `in_service_date` and whether a row reports catch-up is decided by which periods at the head of the entity’s calendar are already closed, not by this date; once any row has POSTED the re-spread is prospective, carries no catch-up, and is anchored internally at the day after the last posted period (stepped past a lifted suspension’s `skipped` months when one would sit inside the window). On `revise` it is where the prospective re-spread starts: it may not precede the asset’s `in_service_date`, and the remaining life is `life_months` minus the months already elapsed since the in-service date."},"reason":{"type":"string","maxLength":1024,"nullable":true,"description":"Why the event was recorded. **Required on `revise` and `suspend`** — each records somebody’s judgement (a change in estimate, or an asset taken out of service), and an unexplained one is refused with `ASSET_EVENT_REASON_REQUIRED`. Optional on `add_cost`, `resume` and `transfer`."},"cost_sources":{"description":"`add_cost` only, and required there. Journal lines whose cost is capitalized onto this asset; `cost_basis` rises by the claimed amounts. Only posted, effective lines on a capitalizable account may be claimed — an active asset class’s `asset_account_id`, or the account holding the `fixed_assets` system role — and claiming more than 100% of one line across every asset is rejected with `ASSET_COST_FRACTION_EXCEEDED`. Pick from `GET /v1/fixed-assets/claimable-lines`.","type":"array","items":{"$ref":"#/components/schemas/CreateCostSourceV1Dto"}},"life_months":{"type":"number","minimum":1,"maximum":1200,"description":"`revise` only. The new TOTAL depreciable life in months, counted from the in-service date — not the remaining life. The remaining life the schedule is re-spread over is this value minus the months already elapsed at `effective_date`; a value at or below that is refused with `ASSET_REVISED_LIFE_ELAPSED`."},"remaining_life_months":{"type":"number","minimum":1,"maximum":1200,"description":"`revise` only — months to spread the remaining book value over, starting with the month of `effective_date`. Mutually exclusive with `life_months` (the new TOTAL life). The persisted total life becomes the months already elapsed at `effective_date` plus this value."},"salvage_amount":{"type":"string","description":"`revise` only. The new residual value excluded from the depreciable basis. The remaining book value re-spread is `cost_basis − salvage_amount − accumulated_depreciation`, so a salvage that would make it negative is refused with `ASSET_SALVAGE_EXCEEDS_COST`.","example":"1234.50"},"method":{"type":"string","enum":["straight_line","declining_balance_150","declining_balance_200"],"description":"`revise` only. The new depreciation method. Only `straight_line` is implemented; anything else is refused with `DEPRECIATION_SCHEDULE_NOT_COMPUTABLE`."},"property_id":{"type":"string","format":"uuid","description":"`transfer` only. The property the asset moves to. It must belong to this org and to the asset’s own legal entity (`ASSET_LOCATION_INVALID`) — to move an asset to another legal entity, use `POST /v1/fixed-assets/{id}/intercompany-transfer`. Moving to a different property clears `space_id` unless a new one is sent with it, because a space belongs to exactly one property."},"space_id":{"type":"string","format":"uuid","nullable":true,"description":"`transfer` only. The space within the property, or `null` to move the asset up to property level. The space must belong to the property the asset is moving to, or the request is refused with `ASSET_LOCATION_INVALID`."},"disposal_reason":{"type":"string","enum":["sale","theft","casualty","scrapped","obsolescence","trade_in"],"description":"`dispose` and `dispose_partial` only, and **required** on both. Why the asset left the books. The disposals report groups by it, which is what separates an asset sale from an operating write-off — so it is a closed vocabulary rather than free text, and sending it on any other event is refused."},"proceeds_amount":{"type":"string","description":"`dispose` and `dispose_partial` only. What the asset sold for, defaulting to `0.00` — the everyday case is a stolen or scrapped asset with no recovery. The result of the disposal is `proceeds − net book value at the disposal date`, posted to the `gain_loss_on_disposal` account.","example":"1234.50"},"proceeds_account_id":{"type":"string","format":"uuid","deprecated":true,"description":"`dispose` and `dispose_partial` only. Deprecated — refused with `ASSET_DISPOSAL_PROCEEDS_ACCOUNT_DEPRECATED` whenever it is sent. Proceeds always land on the entity’s `asset_disposal_clearing` account, which the proceeds invoice credits. Kept in the schema for one release; it will then be removed."},"bill_to_party_id":{"type":"string","format":"uuid","description":"`dispose` and `dispose_partial` only. Who pays `proceeds_amount` — the buyer, or the insurer. **Required when `proceeds_amount` is above zero** (`ASSET_DISPOSAL_BILL_TO_REQUIRED`): the event then posts an `invoice` billed to this party alongside the disposal document. Must be an active party of this organization and not one of its own legal entities; refused with zero proceeds."},"due_date":{"type":"string","format":"date","description":"`dispose` and `dispose_partial` only. The proceeds invoice’s due date; defaults to `effective_date` and may not precede it. Refused with zero proceeds."},"fraction":{"type":"string","description":"`dispose_partial` only. The share of the asset being retired, as a decimal string in (0, 1) EXCLUSIVE — `1` is a full `dispose` and `0` retires nothing. Send this **or** `cost_amount`, never both (`ASSET_DISPOSAL_SHARE_INVALID`). Cost and accumulated depreciation are both reduced by this share, and the asset keeps the rest over its remaining life."},"cost_amount":{"type":"string","description":"`dispose_partial` only. The cost being retired, as an alternative to `fraction`. Exactly this amount leaves the cost basis, and accumulated depreciation is reduced by the same ratio (`cost_amount ÷ cost_basis`); the event records that ratio as a ten-decimal `fraction` alongside the cost removed. It must be under the asset’s whole cost basis; disposing all of it is a `dispose`.","example":"1234.50"},"new_carrying_amount":{"type":"string","description":"`impair` only. The carrying amount the asset is written DOWN to. It must be below the current net book value — an impairment that raises the carrying amount is not an impairment — and at or above the salvage amount (`ASSET_IMPAIRMENT_INVALID`). Send this **or** `write_down_amount`, never both. The remaining book value is then re-spread over the remaining life.","example":"1234.50"},"write_down_amount":{"type":"string","description":"`impair` only. How much to write the carrying amount DOWN by, as an alternative to `new_carrying_amount`. Must be positive and leave the asset at or above its salvage amount.","example":"1234.50"}},"required":["event_type","effective_date"]},"TransferFiguresV1Dto":{"type":"object","properties":{"cost_basis":{"type":"string","description":"What moves to the receiving entity’s asset account.","example":"1234.50"},"final_depreciation":{"type":"string","description":"The sending entity’s last charge, from its last posted period through the effective date. Zero when that period is already posted and the date is its end.","example":"1234.50"},"accumulated_depreciation":{"type":"string","description":"Accumulated depreciation at the effective date, the final charge included — what moves to the receiving entity’s accumulated account.","example":"1234.50"},"net_book_value":{"type":"string","description":"`cost_basis − accumulated_depreciation`: the intercompany balance, the sending entity due from the receiving one. No gain or loss exists.","example":"1234.50"},"salvage_amount":{"type":"string","description":"Carried over unchanged.","example":"1234.50"},"remaining_life_months":{"type":"number","nullable":true,"description":"What the successor depreciates over, in months, net of the months the asset spent suspended. At least 1 whenever book value above salvage is left: a transfer in the last month of the life hands that remainder to the receiving entity, which depreciates it in its first period after the transfer. With nothing left to depreciate, the months still on the clock (0 once spent), and nothing is spread. Null for a class with no life (land, construction in progress)."},"destination_schedule_from":{"type":"string","format":"date","nullable":true,"description":"Start of the first receiving period that will carry a schedule row. Null when nothing is left to depreciate."},"source_legal_entity_id":{"type":"string","format":"uuid"},"destination_legal_entity_id":{"type":"string","format":"uuid"},"dropped_contract_id":{"type":"string","format":"uuid","nullable":true,"description":"The lease the asset is linked to, which the successor does NOT carry: the lease belongs to the sending entity (spec P8). Null when there is none."}},"required":["cost_basis","final_depreciation","accumulated_depreciation","net_book_value","salvage_amount","remaining_life_months","destination_schedule_from","source_legal_entity_id","destination_legal_entity_id","dropped_contract_id"]},"IntercompanyTransferResultV1Dto":{"type":"object","properties":{"transfer_id":{"type":"string","format":"uuid","description":"The transfer’s id — the `batch_id` both events carry and the intercompany transaction’s `source_id`."},"source_asset_id":{"type":"string","format":"uuid","description":"The asset that left — now `transferred`."},"destination_asset_id":{"type":"string","format":"uuid","description":"The successor in the receiving entity."},"destination_asset_code":{"type":"string","description":"The successor’s own, new code."},"source_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The sending entity’s `asset_reclass`. Null only for a zero-basis asset, whose document would carry no line."},"destination_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The receiving entity’s `asset_reclass`; same null rule."},"intercompany_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The `intercompany_transaction` for the net book value. Null when the net book value is zero — nothing is owed."},"figures":{"$ref":"#/components/schemas/TransferFiguresV1Dto"}},"required":["transfer_id","source_asset_id","destination_asset_id","destination_asset_code","source_document_id","destination_document_id","intercompany_document_id","figures"]},"TransferAssetIntercompanyV1Dto":{"type":"object","properties":{"destination_legal_entity_id":{"type":"string","format":"uuid","description":"The legal entity of this organization that receives the asset — not the asset’s own, and in an active (or in-process) status (`ASSET_TRANSFER_DESTINATION_INVALID`)."},"property_id":{"type":"string","format":"uuid","nullable":true,"description":"A property of the receiving entity (or one with no entity of its own), or omitted / null for an asset the entity holds itself. Required when `space_id` is sent."},"space_id":{"type":"string","format":"uuid","nullable":true,"description":"A space of `property_id`. Refused without a property."},"effective_date":{"type":"string","format":"date","description":"The date of all three documents. The period containing it must be OPEN in both entities (`ASSET_TRANSFER_PERIOD_NOT_OPEN`), and it may not precede the asset’s `in_service_date`. The sending entity charges depreciation through it; the receiving entity continues from the first period after the one containing it."},"reason":{"type":"string","maxLength":1024,"description":"Recorded on both events."}},"required":["destination_legal_entity_id","effective_date"]},"RegeneratedScheduleV1Dto":{"type":"object","properties":{"asset_id":{"type":"string","format":"uuid"},"rows_written":{"type":"number","description":"How many `projected` schedule rows the regeneration wrote. Zero when the asset has no depreciation clock to re-spread — a land asset, one with no class, or one not yet placed in service — which is a no-op, not a failure."},"catch_up_amount":{"type":"string","nullable":true,"description":"What this regeneration folded forward into the earliest open period because the periods at the head of the schedule are already closed. Null when it folded nothing; never 0.00, which would read as a computed zero. It is a SUBSET of that row’s `amount`, not an addend.","example":"1234.50"}},"required":["asset_id","rows_written","catch_up_amount"]},"ScheduleEntryV1Dto":{"type":"object","properties":{"source":{"type":"string","enum":["persisted","projection"],"description":"Whether this entry is a stored schedule row (`persisted`) or a read-only projection for a month no accounting period covers yet (`projection`). Check this first: a `projection` entry has no `id`, `period_id`, `status` or `basis_snapshot`."},"id":{"type":"string","format":"uuid","nullable":true,"description":"The `depreciation_schedule_entries` row id. Null on a `projection` entry — nothing is stored for it."},"period_id":{"type":"string","format":"uuid","nullable":true,"description":"The accounting period this row belongs to. Null on a `projection` entry: the month falls past the end of the entity’s period calendar, so no `accounting_periods` row exists for it yet. These months become persisted rows once the calendar reaches them, which the daily top-up job does on its own — there is no endpoint to force it."},"period_start_date":{"type":"string","format":"date","description":"First day covered by this entry — the accounting period’s start, or the first of the calendar month for a `projection`."},"period_end_date":{"type":"string","format":"date","description":"Last day covered by this entry, inclusive."},"sequence_no":{"type":"number","description":"The entry’s stable position in the asset’s life, counted in calendar months from the in-service month (which is 1) and never below 1. Continuous across the persisted/projected boundary, so the two halves concatenate. On a non-monthly calendar the first period can begin before the in-service month; that single row is floored to 1 rather than carrying the zero-or-negative offset, so it is a position, not an exact month offset."},"amount":{"type":"string","description":"Depreciation for this entry. Includes any `catch_up_amount` rather than sitting alongside it, so summing `amount` over the whole schedule equals the depreciable basis (`cost_basis − salvage_amount`) exactly — WHILE THE ASSET IS DEPRECIATING. A `skipped` row carries 0.00, and while an asset is suspended the skipped months’ share of the basis is not allocated to anything, so the sum need not tie: it falls SHORT by that share when the life ends inside the period calendar, and where a `revise` or `resume` had already re-spread the schedule before the suspension it can differ in EITHER direction. See this endpoint’s own description.","example":"1234.50"},"catch_up_amount":{"type":"string","nullable":true,"description":"The portion of `amount` attributable to earlier periods, folded forward because those periods were already closed. A subset of `amount`, never an addend. Null on a `projection` entry.","example":"1234.50"},"months_weight":{"type":"string","example":"1.0000","description":"How many depreciation-months this entry represents — 0.5 for a mid-month first period, 3 for a quarter, 0 for a `skipped` one. NOT money: it is the arithmetic behind `amount`, shown as such in the UI."},"status":{"type":"string","enum":["projected","posted","skipped"],"nullable":true,"description":"`projected` — computed, not yet in the general ledger. `posted` — a depreciation run has booked it, and it is never rewritten. `skipped` — the asset was suspended for this period, so it carries no depreciation and consumes none of the life. Null on a `projection` entry, which has no stored status."},"run_id":{"type":"string","format":"uuid","nullable":true,"description":"The depreciation run that posted this row — `GET /v1/depreciation-runs/{id}`. Null on a `projected` or `skipped` row, on a `projection` entry, and again on a row a voided run released back to `projected`."},"document_id":{"type":"string","format":"uuid","nullable":true,"description":"The `depreciation` document this row posted through. Null wherever `run_id` is, and cleared with it when a run is voided — the row is about to be re-posted by a new run and must not point at a dead document."},"basis_snapshot":{"type":"object","additionalProperties":true,"nullable":true,"description":"The basis in force when the row was generated — `{cost, salvage, life_months, method, convention}` — so a row can be re-derived after a later event changed the asset. Shape is generator-defined. Null on a `projection` entry, which is derived from the asset’s CURRENT setup at read time."}},"required":["source","id","period_id","period_start_date","period_end_date","sequence_no","amount","catch_up_amount","months_weight","status","run_id","document_id","basis_snapshot"]},"CostSourceV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"asset_id":{"type":"string","format":"uuid"},"kind":{"type":"string","description":"Where the claimed cost came from. `journal_line` is a claim on a posted GL line; anything else is a basis with no journal line behind it, in which case the journal fields below are null.","example":"journal_line"},"fraction":{"type":"string","example":"0.4000000000","description":"The share of the journal line’s amount this asset claims, in (0, 1]. The claims across every asset on one line may not sum to more than 1."},"amount":{"type":"string","description":"The claimed cost — the line’s signed (debit − credit) amount times `fraction`, rounded to the cent. This is what the asset’s `cost_basis` was built from.","example":"1234.50"},"event_id":{"type":"string","format":"uuid","nullable":true,"description":"The `add_cost` event that attached this claim. Null when the claim came in with the asset’s own creation."},"journal_line_id":{"type":"string","format":"uuid","nullable":true,"description":"The journal line claimed."},"journal_entry_id":{"type":"string","format":"uuid","nullable":true,"description":"The journal entry that line belongs to."},"entry_date":{"type":"string","format":"date","nullable":true,"description":"The journal entry’s date."},"account_id":{"type":"string","format":"uuid","nullable":true,"description":"The GL account the claimed line posted to."},"line_amount":{"type":"string","nullable":true,"description":"Signed (debit − credit) amount of the WHOLE journal line, before `fraction` is applied — so a reader can see what share of the line this asset took.","example":"1234.50"},"document_id":{"type":"string","format":"uuid","nullable":true,"description":"The document the journal entry was posted from — the bill or expense the cost arrived on. Null when the entry did not come from a document."},"created_at":{"type":"string","format":"date-time"}},"required":["id","asset_id","kind","fraction","amount","event_id","journal_line_id","journal_entry_id","entry_date","account_id","line_amount","document_id","created_at"]},"PatchFixedAssetV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":256},"description":{"type":"string","nullable":true},"serial_number":{"type":"string","maxLength":128,"nullable":true},"tag_number":{"type":"string","maxLength":64,"nullable":true},"warranty_expires_on":{"type":"string","format":"date","nullable":true},"attributes":{"type":"object","additionalProperties":true,"nullable":true,"description":"Caller-defined free-form attributes."},"vendor_party_id":{"type":"string","format":"uuid","nullable":true}}},"DisposalPreviewRowV1Dto":{"type":"object","properties":{"asset_id":{"type":"string","format":"uuid"},"asset_code":{"type":"string"},"legal_entity_id":{"type":"string","format":"uuid"},"net_book_value":{"type":"string","description":"Net book value AT the disposal date — cost less accumulated depreciation INCLUDING the final charge this disposal still owes. Not the value the register shows today.","example":"1234.50"},"final_depreciation":{"type":"string","description":"The depreciation this disposal charges before the asset leaves the books, for the months no run reached.","example":"1234.50"},"proceeds_amount":{"type":"string","description":"This asset’s share of the recovery.","example":"1234.50"},"gain_loss_amount":{"type":"string","description":"Proceeds less net book value: positive is a gain, negative a loss.","example":"1234.50"}},"required":["asset_id","asset_code","legal_entity_id","net_book_value","final_depreciation","proceeds_amount","gain_loss_amount"]},"DisposeAssetsResultV1Dto":{"type":"object","properties":{"batch_id":{"type":"string","format":"uuid","nullable":true,"description":"Shared by every event this batch wrote, so they can be read back together. Null on a preview, which writes nothing. On a commit it is always present, even when no document posted."},"document_ids":{"description":"One document per legal entity in the selection, because a document belongs to one entity. Empty on a preview, which writes nothing — and SHORTER than the number of entities, possibly empty, on a commit when an entity’s assets all net to zero: a retirement with no lines to post records its events with a null `document_id` rather than posting an empty document. Read each asset’s document from its event, not by position in this array.","type":"array","items":{"type":"string","format":"uuid"}},"invoice_document_ids":{"description":"The invoices that bill the recovery to `bill_to_party_id` — one per legal entity whose assets recovered something, in the same entity order as `document_ids`. Empty on a preview, and when the batch recovered nothing. Each debits accounts receivable and credits the `asset_disposal_clearing` account the disposal debited, so that account nets to zero; it is then collected like any invoice. It cannot be voided or edited — correct it with a credit memo.","type":"array","items":{"type":"string","format":"uuid"}},"rows":{"type":"array","items":{"$ref":"#/components/schemas/DisposalPreviewRowV1Dto"}}},"required":["document_ids","invoice_document_ids","rows"]},"DisposalAllocationV1Dto":{"type":"object","properties":{"asset_id":{"type":"string","format":"uuid"},"proceeds_amount":{"type":"string","description":"What this asset recovered. Send `0.00` for one that recovered nothing.","example":"1234.50"}},"required":["asset_id","proceeds_amount"]},"DisposeAssetsV1Dto":{"type":"object","properties":{"asset_ids":{"uniqueItems":true,"description":"The assets to retire. Every one of them is disposed or none is: if any is refused, the whole batch is refused and `ASSET_DISPOSAL_BATCH_REFUSED` names each offender with its own cause. Ids must be distinct: a repeated id is refused rather than collapsed, so the number of assets asked for is the number of rows that come back.","type":"array","items":{"type":"string","format":"uuid"}},"effective_date":{"type":"string","format":"date","description":"The day the assets left the books. The disposal document is dated here, so the accounting period containing it must be OPEN — unlike the nightly depreciation run, a bulk disposal does not override a closed period, because the caller chose this date."},"disposal_reason":{"type":"string","enum":["sale","theft","casualty","scrapped","obsolescence","trade_in"],"description":"Why the assets left the books. One reason for the whole batch: a selection is one decision, and the disposals report groups by it."},"reason":{"type":"string","maxLength":1024},"recovery_amount":{"type":"string","description":"The whole recovery, allocated pro rata to each asset’s net book value at the disposal date. Send `allocations` instead to override the split; sending both requires them to agree. With neither, the batch disposes at zero proceeds.","example":"1234.50"},"proceeds_account_id":{"type":"string","format":"uuid","deprecated":true,"description":"Deprecated — refused with `ASSET_DISPOSAL_PROCEEDS_ACCOUNT_DEPRECATED` whenever it is sent. Proceeds always land on the entity’s `asset_disposal_clearing` account, which the proceeds invoice credits. Kept in the schema for one release; it will then be removed."},"bill_to_party_id":{"type":"string","format":"uuid","description":"Who pays the recovery — the buyer, or the insurer. **Required whenever the recovery is above zero** (`ASSET_DISPOSAL_BILL_TO_REQUIRED`); optional in the schema only so that adding it was not a breaking change. The batch then posts one `invoice` per legal entity that recovered something, billed to this party: DR accounts receivable, CR the `asset_disposal_clearing` account the disposal debited. Must be an active party of this organization and not one of its own legal entities (`ASSET_DISPOSAL_BILL_TO_INVALID`); refused when the recovery is zero (`ASSET_DISPOSAL_BILL_TO_WITHOUT_PROCEEDS`)."},"due_date":{"type":"string","format":"date","description":"The proceeds invoice’s due date. Defaults to `effective_date`, and may not precede it. Refused when the recovery is zero (`ASSET_DISPOSAL_BILL_TO_WITHOUT_PROCEEDS`)."},"allocations":{"description":"Per-asset recovery amounts, as edited in the dialog. Must cover every selected asset exactly once; a missing or duplicated asset is refused rather than corrected, because an edited allocation is the one input a preview cannot re-derive.","type":"array","items":{"$ref":"#/components/schemas/DisposalAllocationV1Dto"}}},"required":["asset_ids","effective_date","disposal_reason"]},"DepreciationRunV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"period_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["generating","posted","pending_approval","failed","voided","empty"],"description":"`generating` — in flight, or left behind by a process that died (a stale one is reclaimed by the next trigger). `posted` — the period’s depreciation document is in the general ledger. `pending_approval` — the document is held by an approval rule on subject type `depreciation` (spec §7.5); the standard approval flow posts it and the run then reads `posted`. `failed` — the attempt raised, `error_message` says what; the run is REUSED by the next trigger rather than a second one being created. `voided` — the document was voided, the schedule rows went back to `projected`, and the `(legal_entity_id, period_id)` slot is free for a redo. `empty` — terminal and correct: the period had nothing to depreciate, or every group in it netted to zero, so no document was written."},"document_id":{"type":"string","format":"uuid","nullable":true,"description":"The `depreciation` document this run posted. Null until the run reaches `posted`/`pending_approval`, and null forever on an `empty` or `failed` run. A `voided` run KEEPS it: the id is the audit trail of what was posted and then reversed."},"asset_count":{"type":"number","description":"How many distinct assets the run covered. Zero on a run that found no schedule rows at all; non-zero on one whose rows netted to zero, because those assets WERE examined."},"total_amount":{"type":"string","description":"The run’s total depreciation — the sum of the schedule rows it covered, which equals the document’s debits.","example":"1234.50"},"catch_up_total":{"type":"string","description":"The part of `total_amount` that was folded forward from earlier, already-closed periods. A SUBSET of `total_amount`, never an addend: adding the two double-counts and stops agreeing with the document.","example":"1234.50"},"triggered_by":{"type":"string","enum":["scheduler","user","close_readiness"],"description":"What started the run. `scheduler` — the nightly `depreciation_run_generation` job. `user` — Run now from the Runs page. `close_readiness` — Run now from the period-close blocker (§7.3). Only the last two can come from this API."},"error_message":{"type":"string","nullable":true,"description":"Why the last attempt failed, truncated to 1000 characters. Null on every other status, and cleared when the run is retried."},"failure_kind":{"type":"string","enum":["approval_rejected","posted_not_stamped"],"nullable":true,"description":"On a `failed` run, WHICH failures the nightly job will retry on its own and which it never will — the one fact `error_message` cannot be parsed for. Null means an ordinary failure (an unresolvable account mapping, a dropped connection): the nightly `depreciation_run_generation` job re-offers this legal entity × period and retries it without anyone asking. `approval_rejected` means a PERSON refused the run’s document in approval (§7.5), so the nightly job deliberately never retries it — it would rebuild the same document and re-deliver the same approval request every night. `posted_not_stamped` means the run’s document POSTED after approval but the period’s schedule rows could not be stamped, so the general ledger carries this period’s depreciation and the subledger does not; the nightly job never retries that either, because a rebuilt run would post a SECOND document over the same rows and charge the period twice — void the posted document first. In both named cases the period stays undepreciated, and keeps blocking period close, until someone fixes the cause and presses Run now. Null on every status other than `failed`, and cleared when the run is retried."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","legal_entity_id","period_id","status","document_id","asset_count","total_amount","catch_up_total","triggered_by","error_message","failure_kind","created_at","updated_at"]},"RunDepreciationV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid","description":"The legal entity to depreciate. The period must belong to THIS entity’s calendar; a period from another entity is answered 404 rather than recorded against this one."},"period_id":{"type":"string","format":"uuid","description":"The accounting period to depreciate. Its `projected` schedule rows are what the run posts."},"triggered_by":{"type":"string","enum":["user","close_readiness"],"default":"user","description":"Which Run-now surface this is, recorded on the run so the Runs page can tell them apart. Defaults to `user` (the Runs page). Send `close_readiness` from the period-close blocker (§7.3). `scheduler` is NOT accepted — it is the nightly job’s own word for itself, and a request that could claim it would make the column useless as an audit fact."}},"required":["legal_entity_id","period_id"]},"RunEntryV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"asset_id":{"type":"string","format":"uuid"},"asset_name":{"type":"string","description":"The asset's name, joined so a drill-down needs no second read."},"asset_code":{"type":"string"},"period_id":{"type":"string","format":"uuid"},"amount":{"type":"string","description":"The charge for this asset in this period — what the run POSTED when its status is `posted`, and what it would post (the projected charge) for a run that booked nothing.","example":"1234.50"},"catch_up_amount":{"type":"string","description":"The portion of `amount` attributable to earlier, already-closed periods, folded forward into this one. A SUBSET of `amount`, never an addend beside it — adding the two double-counts the catch-up and stops the total agreeing with the run’s document.","example":"1234.50"}},"required":["id","asset_id","asset_name","asset_code","period_id","amount","catch_up_amount"]},"ItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"code":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"item_type":{"type":"string","enum":["income","expense","asset","liability"]},"default_account_id":{"type":"string","format":"uuid"},"default_price":{"type":"string","nullable":true,"description":"Default unit price as a decimal string with 2 decimal places (e.g. \"100.00\"). Optional. Used by document creation forms to pre-fill line amounts when this item is selected."},"system_role":{"type":"string","nullable":true,"description":"Closed, code-owned role this item plays — 'late_fee', 'admin_fee', or null. At most one item per org holds a given role. Read-only: set by provisioning, not by the API. 'late_fee' is resolved by the billing engine when a contract names no override; 'admin_fee' marks the item an administrative-fee lease term should name, and is not resolved server-side — that term always carries its own item_id."},"is_active":{"type":"boolean"},"is_archived":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","org_id","code","name","description","item_type","default_account_id","default_price","system_role","is_active","is_archived","created_at"]},"CreateItemV1Dto":{"type":"object","properties":{"code":{"type":"string","maxLength":64},"name":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"item_type":{"type":"string","enum":["income","expense","asset","liability"]},"default_account_id":{"type":"string","format":"uuid"},"default_price":{"type":"string","nullable":true,"example":"100.00","description":"Default unit price as a decimal string. Optional. Pre-fills the line amount on document creation forms when this item is selected."},"is_active":{"type":"boolean","default":true}},"required":["code","name","item_type","default_account_id"]},"UpdateItemV1Dto":{"type":"object","properties":{"code":{"type":"string","maxLength":64},"name":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"item_type":{"type":"string","enum":["income","expense","asset","liability"]},"default_account_id":{"type":"string","format":"uuid"},"default_price":{"type":"string","nullable":true,"example":"100.00","description":"Default unit price as a decimal string. Pass null to clear."},"is_active":{"type":"boolean"}}},"OrgUserResponseDto":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"email":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","admin","accountant","clerk","viewer","facility"]},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","invited","deactivated"],"description":"'invited' until the user signs in for the first time; 'deactivated' when an admin deactivated the membership (role, group and overrides are kept and return on activation)."},"deactivated_at":{"type":"string","nullable":true,"format":"date-time","description":"When the membership was deactivated; null for live members."},"last_sign_in_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"security_group_id":{"type":"string","nullable":true,"format":"uuid","description":"Assigned custom security group id, or null when the member is still governed by `role` alone (legacy fallback)."},"approval_limit":{"type":"string","nullable":true,"description":"Member's document-approval authority cap. null means NO approval authority. Set it with PUT /v1/org-users/{userId}/approval-limit.","example":"1234.50"},"has_permission_overrides":{"type":"boolean","description":"True when the member has one or more per-user permission override rows (grant/deny) layered on top of their group or role baseline."}},"required":["user_id","email","role","first_name","last_name","phone","status","deactivated_at","last_sign_in_at","created_at","security_group_id","approval_limit","has_permission_overrides"]},"InviteOrgUserResponseDto":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"email":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","admin","accountant","clerk","viewer","facility"]},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","invited","deactivated"],"description":"'invited' until the user signs in for the first time; 'deactivated' when an admin deactivated the membership (role, group and overrides are kept and return on activation)."},"deactivated_at":{"type":"string","nullable":true,"format":"date-time","description":"When the membership was deactivated; null for live members."},"last_sign_in_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"security_group_id":{"type":"string","nullable":true,"format":"uuid","description":"Assigned custom security group id, or null when the member is still governed by `role` alone (legacy fallback)."},"approval_limit":{"type":"string","nullable":true,"description":"Member's document-approval authority cap. null means NO approval authority. Set it with PUT /v1/org-users/{userId}/approval-limit.","example":"1234.50"},"has_permission_overrides":{"type":"boolean","description":"True when the member has one or more per-user permission override rows (grant/deny) layered on top of their group or role baseline."},"email_status":{"type":"string","enum":["sent","skipped","failed"],"description":"Outcome of the branded invite email. 'sent' = delivered; 'skipped' = no email needed (user already active); 'failed' = send errored — the membership was still created and the admin can re-invite the (still-pending) user to retry."}},"required":["user_id","email","role","first_name","last_name","phone","status","deactivated_at","last_sign_in_at","created_at","security_group_id","approval_limit","has_permission_overrides","email_status"]},"InviteOrgUserDto":{"type":"object","properties":{"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["admin","accountant","clerk","viewer","facility"],"description":"Legacy role — owner is not assignable via invite. Phase 2 (spec §15): security_group_id is now the primary field driving the invite; role is optional and, when omitted, is DERIVED from the assigned group (a system group's own base_role, or a neutral 'viewer' default for a custom group) so the legacy role-fallback resolver stays valid. Required only when security_group_id is omitted (the pre-Phase-2 role-only invite still works unchanged)."},"first_name":{"type":"string","description":"Invitee's first name."},"last_name":{"type":"string","description":"Invitee's last name."},"phone":{"type":"string","description":"Invitee's phone number (free-form)."},"security_group_id":{"type":"string","format":"uuid","description":"Primary field (Phase 2, spec §15): the security group to assign on invite — rank-gated the same way a role assignment is (can't assign a group at/above the caller's own rank). When provided, the legacy role column is derived from this group unless role is also explicitly given. Omit to fall back to the legacy role-only invite, which resolves to that role's system group."}},"required":["email"]},"UpdateOrgUserDto":{"type":"object","properties":{"role":{"type":"string","enum":["admin","accountant","clerk","viewer","facility"],"description":"owner is not assignable; role change is hierarchy-guarded."},"first_name":{"type":"string","description":"Member's first name."},"last_name":{"type":"string","description":"Member's last name."},"phone":{"type":"string","description":"Member's phone number (free-form)."},"security_group_id":{"type":"string","format":"uuid","nullable":true,"description":"Assign a custom security group (must belong to the caller's org). null clears the assignment — the member falls back to role-derived scopes."}}},"ApprovalLimitResponseDto":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"approval_limit":{"type":"string","nullable":true,"description":"The stored document-approval authority cap; null means NO approval authority.","example":"1234.50"}},"required":["user_id","approval_limit"]},"SetApprovalLimitDto":{"type":"object","properties":{"approval_limit":{"type":"string","nullable":true,"description":"The new document-approval authority cap, as a decimal string. null clears it, which means NO approval authority.","example":"1234.50"}},"required":["approval_limit"]},"UserPermissionsGroupDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"is_system":{"type":"boolean"},"permissions":{"type":"array","items":{"$ref":"#/components/schemas/PermissionItemDto"}}},"required":["id","name","is_system","permissions"]},"PermissionOverrideItemDto":{"type":"object","properties":{"resource":{"type":"string","description":"A resource catalog key (see GET /v1/permissions/catalog), or '*' for every resource.","example":"documents"},"action":{"type":"string","enum":["view","create","edit","delete","*"]},"effect":{"type":"string","enum":["grant","deny"]}},"required":["resource","action","effect"]},"EffectivePermissionItemDto":{"type":"object","properties":{"resource":{"type":"string","description":"A resource catalog key."},"action":{"type":"string","enum":["view","create","edit","delete"]},"source":{"type":"string","enum":["group","override-grant","override-deny"],"description":"'group' = inherited from the assigned group (or the role fallback when unassigned); 'override-grant' = this user's own grant override turned the cell on. 'override-deny' is reserved for shape symmetry with `overrides` — a deny removes the cell instead of appearing here."}},"required":["resource","action","source"]},"EntityScopeResponseDto":{"type":"object","properties":{"mode":{"type":"string","enum":["inherit","all","custom"],"description":"'inherit' (no per-user override; defers to the group's entity scope, or org-wide when group-less), 'all' (explicit override, org-wide), or 'custom' (explicit override, restricted to `legal_entity_ids`)."},"legal_entity_ids":{"description":"This user's own legal-entity allow-list. Empty unless `mode` is 'custom'.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["mode","legal_entity_ids"]},"UserPermissionsResponseDto":{"type":"object","properties":{"group":{"nullable":true,"description":"The member's assigned security group, or null when governed by `role` alone (legacy fallback).","type":"object","allOf":[{"$ref":"#/components/schemas/UserPermissionsGroupDto"}]},"baseline":{"description":"The pre-override inherited baseline grants as raw cells (may contain wildcards): the assigned group's own grants when the member has a group, else the legacy-role fallback grants. Distinct from `group` — this is always populated (even for a group-less member), so the UI can render what the member already inherits by role. `effective` is this baseline with overrides layered on and denied cells removed.","type":"array","items":{"$ref":"#/components/schemas/PermissionItemDto"}},"overrides":{"type":"array","items":{"$ref":"#/components/schemas/PermissionOverrideItemDto"}},"effective":{"description":"The member's effective ON cells after layering overrides on top of the inherited baseline (group grants, or role fallback).","type":"array","items":{"$ref":"#/components/schemas/EffectivePermissionItemDto"}},"entity_scope":{"description":"This member's own per-user legal-entity scope override.","allOf":[{"$ref":"#/components/schemas/EntityScopeResponseDto"}]},"group_legal_entity_ids":{"description":"The assigned group's legal-entity allow-list (empty = org-wide, or no group assigned). Reference only — this is what `entity_scope: {mode:'inherit'}` resolves to; it is not itself the member's scope.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["group","baseline","overrides","effective","entity_scope","group_legal_entity_ids"]},"EntityScopeInputDto":{"type":"object","properties":{"mode":{"type":"string","enum":["inherit","all","custom"],"description":"'inherit' = defer to the assigned group's entity scope (or org-wide when group-less); 'all' = org-wide regardless of group; 'custom' = this user is restricted to `legal_entity_ids`."},"legal_entity_ids":{"description":"Required and non-empty when `mode` is \"custom\"; ignored for \"all\"/\"inherit\". A `custom` scope with no ids would collapse to `{override:true, legalEntityIds:[]}`, which the resolver treats as org-wide (null) — fail-open — so it is rejected here.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["mode"]},"PutPermissionOverridesDto":{"type":"object","properties":{"overrides":{"type":"array","items":{"$ref":"#/components/schemas/PermissionOverrideItemDto"}},"entity_scope":{"description":"Optional per-user legal-entity scope override. Omit to leave the user's current entity scope unchanged.","allOf":[{"$ref":"#/components/schemas/EntityScopeInputDto"}]}},"required":["overrides"]},"PasswordResetResponseDto":{"type":"object","properties":{"email_status":{"type":"string","enum":["sent","failed"],"description":"Outcome of the branded password-reset email. 'failed' = the link was generated but the send errored; retrying is safe (a new link replaces it)."}},"required":["email_status"]},"UpdateMyProfileDto":{"type":"object","properties":{"first_name":{"type":"string","description":"Your first name."},"last_name":{"type":"string","description":"Your last name."},"phone":{"type":"string","description":"Your phone number (free-form)."}}},"RequestPasswordResetDto":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"The address to send the reset link to."}},"required":["email"]},"UserDirectoryOrgV1Dto":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"role":{"type":"string","description":"The membership role in that org."},"deactivated":{"type":"boolean","description":"True when the membership is deactivated (the user cannot sign in to that org)."}},"required":["org_id","name","role","deactivated"]},"UserDirectoryRowV1Dto":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"email":{"type":"string","nullable":true},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"is_spark_staff":{"type":"boolean"},"last_sign_in_at":{"type":"string","format":"date-time","nullable":true},"orgs":{"description":"Every org the user belongs to, live and deactivated.","type":"array","items":{"$ref":"#/components/schemas/UserDirectoryOrgV1Dto"}},"eligible_as_owner":{"type":"boolean","description":"Whether the user may be made the owner of a new org: true for Spark staff and for users with no membership anywhere. Mirrors the single-home rule; org creation stays the authority."},"ineligible_reason":{"type":"string","enum":["IN_ANOTHER_ORG"],"nullable":true,"description":"`IN_ANOTHER_ORG` when the user belongs to an org (live or deactivated) and is not Spark staff; otherwise null."}},"required":["user_id","email","first_name","last_name","is_spark_staff","last_sign_in_at","orgs","eligible_as_owner","ineligible_reason"]},"DealStageCatalogV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string","description":"Generated from the label at create; never changes."},"label":{"type":"string"},"kind_scope":{"type":"array","items":{"type":"string","enum":["acquisition","disposition","internal_transfer"]}},"sort_order":{"type":"number"},"terminal_outcome":{"type":"string","enum":["closed","dead"],"nullable":true,"description":"Set on Closed and Dead only."},"requirement_keys":{"type":"array","items":{"type":"string"}},"color":{"type":"string","enum":["secondary","info","warning","success","destructive","muted"]},"stale_after_days":{"type":"number","nullable":true},"is_system":{"type":"boolean","description":"Seeded stages cannot be deleted."},"is_active":{"type":"boolean"},"open_deal_count":{"type":"number","description":"In-progress deals currently on this stage."}},"required":["id","code","label","kind_scope","sort_order","terminal_outcome","requirement_keys","color","stale_after_days","is_system","is_active","open_deal_count"]},"DealStageRequirementKeyV1Dto":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"kinds":{"type":"array","items":{"type":"string","enum":["acquisition","disposition","internal_transfer"]}}},"required":["key","label","kinds"]},"CreateDealStageV1Dto":{"type":"object","properties":{"label":{"type":"string","maxLength":120},"kind_scope":{"type":"array","items":{"type":"string","enum":["acquisition","disposition","internal_transfer"]}},"requirement_keys":{"type":"array","items":{"type":"string"}},"color":{"type":"string","enum":["secondary","info","warning","success","destructive","muted"],"description":"Default `secondary`."},"stale_after_days":{"type":"number","nullable":true,"description":"Null or 1 to 365 days."}},"required":["label","kind_scope"]},"DealStageOrderV1Dto":{"type":"object","properties":{"stage_ids":{"description":"The open stages in their stored order after the write.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["stage_ids"]},"ReorderDealStagesV1Dto":{"type":"object","properties":{"stage_ids":{"description":"Every non-terminal stage of the org (active and inactive), in the new order.","type":"array","items":{"type":"string","format":"uuid"}},"expected_stage_ids":{"description":"The open order the client loaded; a different current order is a 409.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["stage_ids"]},"UpdateDealStageV1Dto":{"type":"object","properties":{"label":{"type":"string","maxLength":120},"kind_scope":{"type":"array","items":{"type":"string","enum":["acquisition","disposition","internal_transfer"]}},"requirement_keys":{"type":"array","items":{"type":"string"}},"color":{"type":"string","enum":["secondary","info","warning","success","destructive","muted"]},"stale_after_days":{"type":"number","nullable":true,"description":"Null clears the threshold; omit to leave it unchanged."},"is_active":{"type":"boolean"}}},"DealLostReasonV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string","description":"Generated from the label at create; never changes."},"label":{"type":"string"},"sort_order":{"type":"number"},"is_system":{"type":"boolean","description":"Seeded reasons cannot be deleted."},"is_active":{"type":"boolean"}},"required":["id","code","label","sort_order","is_system","is_active"]},"CreateDealLostReasonV1Dto":{"type":"object","properties":{"label":{"type":"string","maxLength":120}},"required":["label"]},"DealLostReasonOrderV1Dto":{"type":"object","properties":{"reason_ids":{"description":"The reasons in their stored order after the write.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["reason_ids"]},"ReorderDealLostReasonsV1Dto":{"type":"object","properties":{"reason_ids":{"description":"Every lost reason of the org (active and inactive), in the new order.","type":"array","items":{"type":"string","format":"uuid"}},"expected_reason_ids":{"description":"The order the client loaded; a different current order is a 409.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["reason_ids"]},"UpdateDealLostReasonV1Dto":{"type":"object","properties":{"label":{"type":"string","maxLength":120},"is_active":{"type":"boolean"}}},"OrgHolidayV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"holiday_date":{"type":"string","format":"date"},"name":{"type":"string","maxLength":80},"source":{"type":"string","enum":["us_federal","custom"],"description":"`us_federal` rows were seeded from the federal calendar; renaming or moving one keeps its source."}},"required":["id","holiday_date","name","source"]},"CreateOrgHolidayV1Dto":{"type":"object","properties":{"holiday_date":{"type":"string","format":"date"},"name":{"type":"string","minLength":1,"maxLength":80}},"required":["holiday_date","name"]},"UpdateOrgHolidayV1Dto":{"type":"object","properties":{"holiday_date":{"type":"string","format":"date"},"name":{"type":"string","minLength":1,"maxLength":80}}},"AuditLogActorV1Dto":{"type":"object","properties":{"principal_id":{"type":"string"},"kind":{"type":"string","enum":["user","api_key","sparkiq_internal"]},"display_name":{"type":"string"},"email":{"type":"string","nullable":true}},"required":["principal_id","kind","display_name","email"]},"AuditLogRowV1Dto":{"type":"object","properties":{"id":{"type":"string"},"action":{"type":"string"},"resource_type":{"type":"string"},"resource_id":{"type":"string"},"actor":{"$ref":"#/components/schemas/AuditLogActorV1Dto"},"changes_summary":{"type":"object","additionalProperties":true,"nullable":true,"description":"Opt-in, handler-supplied summary of what changed. Shape is defined by the handler that wrote the row, so it is deliberately unconstrained."},"request_id":{"type":"string"},"via_client":{"type":"string","nullable":true,"description":"The connector client the change was made through (mcp:<client name>); null for a normal session."},"created_at":{"type":"string"}},"required":["id","action","resource_type","resource_id","actor","changes_summary","request_id","via_client","created_at"]},"AuditLogFacetsV1Dto":{"type":"object","properties":{"resource_types":{"type":"array","items":{"type":"string"}},"actions":{"type":"array","items":{"type":"string"}},"via_clients":{"description":"Distinct connector clients changes were made through (mcp:<client name>), sorted.","type":"array","items":{"type":"string"}}},"required":["resource_types","actions","via_clients"]},"PortalBrandingV1Dto":{"type":"object","properties":{"display_name":{"type":"string","description":"The sponsor's display name: its DBA, else its legal name."},"logo_url":{"type":"string","format":"uri","nullable":true,"description":"Public URL of the sponsor logo, or null when none is set."},"color_primary":{"type":"string","nullable":true,"description":"Primary brand colour as stored (e.g. `#0B1F3A`). Not contrast-checked."},"color_accent":{"type":"string","nullable":true,"description":"Accent colour as stored. Not contrast-checked."}},"required":["display_name","logo_url","color_primary","color_accent"]},"PortalOrgV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"dba":{"type":"string","nullable":true,"description":"Sponsor display name (DBA) from org branding, trimmed; null when unset or blank."},"portal_slug":{"type":"string","nullable":true,"description":"The sponsor's portal slug (its sign-in address), or null. Returned whether or not the sponsor's portal is switched on."},"branding":{"description":"The same theming `GET /v1/public/portal-branding/{slug}` returns; returned here even while the sponsor's portal is switched off.","allOf":[{"$ref":"#/components/schemas/PortalBrandingV1Dto"}]}},"required":["id","name","dba","portal_slug","branding"]},"PortalContactLinkV1Dto":{"type":"object","properties":{"contact_id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"},"party_name":{"type":"string"},"access_role":{"type":"string","enum":["primary","viewer","advisor"]},"role_label":{"type":"string","nullable":true}},"required":["contact_id","party_id","party_name","access_role","role_label"]},"PortalSponsorV1Dto":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"portal_slug":{"type":"string","nullable":true,"description":"That sponsor's portal slug: match the sign-in subdomain or `?org=` against it, then send its `org_id` as X-Org-Id."}},"required":["org_id","name","portal_slug"]},"PortalMeTermsV1Dto":{"type":"object","properties":{"terms_updated_at":{"type":"string","format":"date-time","nullable":true,"description":"When the sponsor's investor terms last changed (database clock). Null when there are no terms to show: the sponsor's portal is switched off or no terms text is set."},"last_viewed_at":{"type":"string","format":"date-time","nullable":true,"description":"When this login was last shown the terms in this sponsor. Null when it has never been shown them, when its views are older than the 13-month log retention, when a view could not be logged, or when `terms_updated_at` is null."}},"required":["terms_updated_at","last_viewed_at"]},"PortalMeV1Dto":{"type":"object","properties":{"org":{"$ref":"#/components/schemas/PortalOrgV1Dto"},"contacts":{"description":"The contacts this login acts as, in this org only.","type":"array","items":{"$ref":"#/components/schemas/PortalContactLinkV1Dto"}},"party_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"sponsors":{"description":"Every sponsor this login has active access with, for a sponsor switcher. Names only.","type":"array","items":{"$ref":"#/components/schemas/PortalSponsorV1Dto"}},"terms":{"description":"Whether to show the sponsor's terms, without recording a view. Show them — by calling `GET /v1/portal/terms`, which records the view — when `terms_updated_at` is non-null and `last_viewed_at` is null or earlier than it. `/me` itself never records a view.","allOf":[{"$ref":"#/components/schemas/PortalMeTermsV1Dto"}]}},"required":["org","contacts","party_ids","sponsors","terms"]},"PortalAccessContactV1Dto":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"}},"required":["first_name","last_name","email"]},"PortalAccessV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"contact":{"$ref":"#/components/schemas/PortalAccessContactV1Dto"},"user_id":{"type":"string","format":"uuid","description":"The Supabase login this access belongs to."},"access_role":{"type":"string","enum":["primary","viewer","advisor"]},"status":{"type":"string","enum":["invited","active","revoked"]},"invited_at":{"type":"string","format":"date-time"},"accepted_at":{"type":"string","format":"date-time","nullable":true},"revoked_at":{"type":"string","format":"date-time","nullable":true},"last_seen_at":{"type":"string","format":"date-time","nullable":true,"description":"Accurate to about a minute."},"email_status":{"type":"string","enum":["sent","failed","skipped"],"nullable":true,"description":"Present on grant only."},"entity_scope_mode":{"type":"string","enum":["all","selected"],"description":"What this login may SEE, beside access_role (what it may DO). 'all' sees every entity the party is exposed to, including ones added later; 'selected' is narrowed to legal_entity_ids."},"legal_entity_ids":{"nullable":true,"description":"Present only when entity_scope_mode is 'selected'.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["id","contact_id","contact","user_id","access_role","status","invited_at","accepted_at","revoked_at","last_seen_at","email_status","entity_scope_mode","legal_entity_ids"]},"PortalAccessExposureV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid","description":"A legal entity the party is exposed to."},"name":{"type":"string"},"via_legal_entity_id":{"type":"string","format":"uuid","nullable":true,"description":"The TOP holding company of the chain this entity hangs off — the one the party owns directly, not the immediate parent — for grouping the checklist Excel-outline style; null means DIRECT, which is any of three things: the party holds an equity position in it, it owns it outright through a direct entity_ownerships row, or one of its portal package statements names the party. An entity reachable both directly and through a holdco always reports null and appears once, never twice (direct beats indirect). An entity reachable through more than one holdco, and not directly, prefers a chain whose every ownership stake is still in force over one that has ended, then the shortest path, then the lowest holdco id. When non-null, the id is always itself one of the rows in this same response."},"via_name":{"type":"string","nullable":true,"description":"The name of via_legal_entity_id, so the frontend can render a group header without a second lookup. Null exactly when via_legal_entity_id is null."}},"required":["legal_entity_id","name","via_legal_entity_id","via_name"]},"GrantPortalAccessV1Dto":{"type":"object","properties":{"entity_scope_mode":{"type":"string","enum":["all","selected"],"description":"Omitted: a brand-new grant starts at 'all'; an existing grant keeps the scope it already has. Send a value to replace the scope — including 'all' to deliberately widen. Required when legal_entity_ids is sent."},"legal_entity_ids":{"minItems":1,"description":"Required and non-empty when entity_scope_mode is 'selected'; refused (400) when entity_scope_mode is anything else — sending ids alongside 'all' does not narrow the grant, so it is rejected rather than silently ignored. Each id must be one of the party's exposed entities (GET /v1/parties/:id/portal-access/exposure) or the write is refused (422 PORTAL_SCOPE_ENTITY_NOT_EXPOSED).","type":"array","items":{"type":"string","format":"uuid"}},"contact_id":{"type":"string","format":"uuid"},"access_role":{"type":"string","enum":["primary","viewer","advisor"]}},"required":["contact_id","access_role"]},"UpdatePortalAccessV1Dto":{"type":"object","properties":{"entity_scope_mode":{"type":"string","enum":["all","selected"],"description":"Omitted: a brand-new grant starts at 'all'; an existing grant keeps the scope it already has. Send a value to replace the scope — including 'all' to deliberately widen. Required when legal_entity_ids is sent."},"legal_entity_ids":{"minItems":1,"description":"Required and non-empty when entity_scope_mode is 'selected'; refused (400) when entity_scope_mode is anything else — sending ids alongside 'all' does not narrow the grant, so it is rejected rather than silently ignored. Each id must be one of the party's exposed entities (GET /v1/parties/:id/portal-access/exposure) or the write is refused (422 PORTAL_SCOPE_ENTITY_NOT_EXPOSED).","type":"array","items":{"type":"string","format":"uuid"}},"access_role":{"type":"string","enum":["primary","viewer","advisor"]}},"required":["access_role"]},"PortalSettingsV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","nullable":true,"description":"The settings row. `null` until the org is first enabled or its cadence first set."},"enabled":{"type":"boolean","description":"Whether the investor portal is on for this organization. Switched only by Acreum staff (P7); no row reads as `false`."},"enabled_at":{"type":"string","format":"date-time","nullable":true},"grants_available":{"type":"boolean","description":"Server configuration, not org state, and not settable: `true` when this deployment BOTH permits portal grants (`PORTAL_GRANTS_ENABLED`) and has portal auth configured. `false` means `Portal.grantAccess` refuses every grant, in every org, until an operator fixes the deployment — 403 `PORTAL_GRANTS_DISABLED` when the switch is off, 503 `PORTAL_AUTH_NOT_CONFIGURED` when the portal Supabase project or base URL is unset or misconfigured. Distinct from `enabled`, which is this organization's own portal switch. A client should offer an invite only when BOTH are `true`: with `enabled: true` and `grants_available: false` the portal is on for the org but no new login can be issued yet."},"statement_cadence":{"type":"string","enum":["quarterly","monthly"],"description":"How long a statement package's window is: a FISCAL quarter (default) or a FISCAL month, aligned to the org's fiscal-year start."},"portal_slug":{"type":"string","nullable":true,"description":"The sponsor's investor sign-in address (`https://<slug>.<portal host>`, or `?org=<slug>`). `null` until set."},"terms_text":{"type":"string","nullable":true,"description":"Plain-text terms shown to investors in the portal. `null` until set."},"terms_updated_at":{"type":"string","format":"date-time","nullable":true,"description":"When `terms_text` last changed. Set by the server."},"updated_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","enabled","enabled_at","grants_available","statement_cadence","portal_slug","terms_text","terms_updated_at","updated_at"]},"UpdatePortalSettingsV1Dto":{"type":"object","properties":{"statement_cadence":{"type":"string","enum":["quarterly","monthly"]},"portal_slug":{"type":"string","nullable":true,"minLength":3,"maxLength":40,"pattern":"^[a-z0-9](?:[a-z0-9-]{1,38}[a-z0-9])$","description":"3–40 lower-case letters, digits and hyphens, starting and ending with a letter or digit. Unique across organizations; reserved host names are refused. `null` clears it."},"terms_text":{"type":"string","nullable":true,"maxLength":20000,"description":"Plain text, at most 20,000 characters. `null`, or text that is blank after trimming, clears it."}}},"PortalEntityV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","nullable":true,"description":"`null` until the entity is first opted in or out."},"legal_entity_id":{"type":"string","format":"uuid"},"enabled":{"type":"boolean","description":"Whether this legal entity is opted in to the portal. No row reads as `false`. Drafting also needs the org's own switch on."},"enabled_at":{"type":"string","format":"date-time","nullable":true},"disabled_at":{"type":"string","format":"date-time","nullable":true},"updated_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","legal_entity_id","enabled","enabled_at","disabled_at","updated_at"]},"SetPortalEntityV1Dto":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"]},"PortalVisibleThroughBlockV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["open_period","missing_period","no_periods"],"description":"`open_period`: a period is still open; `missing_period`: no period covers a month; `no_periods`: the entity has no periods at all."},"period_id":{"type":"string","format":"uuid","nullable":true,"description":"Set for `open_period`."},"period_name":{"type":"string","nullable":true,"description":"Set for `open_period`."},"month_label":{"type":"string","nullable":true,"description":"Set for `missing_period`, e.g. \"March 2026\"."}},"required":["kind","period_id","period_name","month_label"]},"PortalVisibleThroughV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"visible_through":{"type":"string","format":"date","nullable":true,"description":"The last date (inclusive) the books are closed through, contiguously from `anchor`. `null` when the first month is already blocked. Computed on every read, never stored."},"blocked_by":{"nullable":true,"description":"What stops the closed run from reaching further, or `null` when every period from the anchor is closed.","type":"object","allOf":[{"$ref":"#/components/schemas/PortalVisibleThroughBlockV1Dto"}]},"anchor":{"type":"string","format":"date","nullable":true,"description":"Where the walk starts: the entity's ledger start date, else its earliest period's start. A package window may not start before it. `null` only with `blocked_by.kind = no_periods`."}},"required":["legal_entity_id","visible_through","blocked_by","anchor"]},"PortalReadinessLastReviewV1Dto":{"type":"object","properties":{"party_id":{"type":"string","format":"uuid","description":"The recipient the review was made as."},"party_name":{"type":"string","description":"That recipient's name, or its id when it has none on file."},"reviewed_by_name":{"type":"string","nullable":true,"description":"Who made the review, by name: their first and last name in the organization, from a live or a deactivated membership; null when no name is on file or they were never a member (an API key)."},"reviewed_at":{"type":"string","format":"date-time"},"current":{"type":"boolean","description":"The review was made at the package's current `package_sha256`, so it still counts: true exactly when the `previewed` check is green. False after anything changed what would publish (an exclusion, a document, a refresh that moved figures) and no review exists at the new hash: the check is red until someone reviews again."}},"required":["party_id","party_name","reviewed_by_name","reviewed_at","current"]},"PortalReadinessPreviewedDataV1Dto":{"type":"object","properties":{"package_sha256":{"type":"string","description":"Present only while the check is red: the hash a new review must be made at."},"last_review":{"nullable":true,"description":"The package's last review: the most recent one made at its current `package_sha256` when one exists (`current: true`, even if a later review was made at another hash), else the most recent at any hash (`current: false`). Null when it was never reviewed.","type":"object","allOf":[{"$ref":"#/components/schemas/PortalReadinessLastReviewV1Dto"}]}},"required":["last_review"]},"PortalPackageV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"window_start":{"type":"string","format":"date","description":"The window's first day (a fiscal month or quarter start)."},"window_end_inclusive":{"type":"string","format":"date","description":"The window's last day, inclusive."},"period_label":{"type":"string","description":"The window named the way the period generator names a monthly or quarterly cadence under the org's fiscal year — the same name the approvals summary (`portal_package.period_label`) and the package's notifications use: a month window `Jun 2026`, a quarter `Q<n> <fiscal year>` counted from the fiscal-year start (`Q1 2026` for Apr–Jun 2026 under an April fiscal year). A 3-month window not aligned to a fiscal quarter reads as its month span (`Feb 2026 – Apr 2026` under a January fiscal year) — a defensive fallback: a window is drafted aligned, and the org's fiscal-year start freezes once a period is closed, which drafting a package requires. An org on a 4-4-5 calendar names its own periods `P<n> <FY>`; its packages still read as these month and quarter names. Show it as is for an existing package; the only client-side naming is of a window not yet drafted, which has no package."},"status":{"type":"string","enum":["draft","pending_approval","published"],"description":"Only a `draft` can be edited, refreshed or discarded; `pending_approval` is locked (P17)."},"world":{"type":"string","enum":["equity","ownership"],"description":"`equity`: one capital statement per equity position; `ownership`: one income statement per owner. Fixed at draft."},"built_at":{"type":"string","format":"date-time","description":"The as-recorded instant every statement in the package was built with."},"package_sha256":{"type":"string","description":"SHA-256 over the statement and document hashes plus the included/excluded audience. Changes on any edit that changes what would be published; a preview counts only at the current value."},"amber_reasons":{"type":"object","additionalProperties":{"type":"string"},"nullable":true,"description":"Per readiness check key, the reason given for publishing past an amber check. Set at publish request; `null` in draft."},"publish_failure_reason":{"type":"string","nullable":true},"publish_failed_at":{"type":"string","format":"date-time","nullable":true},"published_at":{"type":"string","format":"date-time","nullable":true},"published_by":{"type":"string","format":"uuid","nullable":true},"published_by_name":{"type":"string","nullable":true,"description":"Who published the package, by name: their first and last name in the organization, from a live or a deactivated membership; null when no name is on file or they were never a member (an API key)."},"created_by":{"type":"string","format":"uuid"},"created_by_name":{"type":"string","nullable":true,"description":"Who drafted the package, by name: their first and last name in the organization, from a live or a deactivated membership; null when no name is on file or they were never a member (an API key)."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","legal_entity_id","window_start","window_end_inclusive","period_label","status","world","built_at","package_sha256","amber_reasons","publish_failure_reason","publish_failed_at","published_at","published_by","published_by_name","created_by","created_by_name","created_at","updated_at"]},"PortalPackageRecipientV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["capital_statement","income_statement"]},"party_id":{"type":"string","format":"uuid"},"party_name":{"type":"string","description":"The party's name, or its id when it has none on file."},"position_id":{"type":"string","format":"uuid","nullable":true,"description":"The equity position (equity world); `null` for an owner."},"snapshot_sha256":{"type":"string"},"excluded":{"type":"boolean","description":"Excluded with a reason (see `exclusions`); the statement stays in the package and is not published to this party."}},"required":["kind","party_id","party_name","position_id","snapshot_sha256","excluded"]},"PortalPackageDocumentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source_file_table":{"type":"string","enum":["legal_entity_files"]},"source_file_id":{"type":"string","format":"uuid"},"file_name":{"type":"string"},"content_type":{"type":"string"},"file_size_bytes":{"type":"number"},"file_sha256":{"type":"string","description":"SHA-256 of the file, copied at add time."},"added_by":{"type":"string","format":"uuid"},"added_by_name":{"type":"string","nullable":true,"description":"Who added the document, by name: their first and last name in the organization, from a live or a deactivated membership; null when no name is on file or they were never a member (an API key)."},"created_at":{"type":"string","format":"date-time"}},"required":["id","source_file_table","source_file_id","file_name","content_type","file_size_bytes","file_sha256","added_by","added_by_name","created_at"]},"PortalPackageExclusionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"},"reason":{"type":"string"},"excluded_by":{"type":"string","format":"uuid"},"excluded_by_name":{"type":"string","nullable":true,"description":"Who excluded the party, by name: their first and last name in the organization, from a live or a deactivated membership; null when no name is on file or they were never a member (an API key)."},"created_at":{"type":"string","format":"date-time"}},"required":["id","party_id","reason","excluded_by","excluded_by_name","created_at"]},"PortalPackageRequesterV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true,"description":"Who requested publishing, by name: their first and last name in the organization, from a live or a deactivated membership; null when no name is on file or they were never a member (an API key)."}},"required":["id","name"]},"PortalPackageRejecterV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true,"description":"The approver who rejected it, by name: their first and last name in the organization, from a live or a deactivated membership; null when no name is on file or they were never a member (an API key)."}},"required":["id","name"]},"PortalPackageApprovalRequestV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The approval request. Decide it with `POST /v1/approvals/{id}/decision`; withdraw it with `POST /v1/approvals/{id}/withdraw`."},"status":{"type":"string","enum":["pending","approved","rejected","withdrawn"],"description":"`withdrawn`: its requester withdrew it. A package still `pending_approval` whose request is not `pending` is stuck — `Portal.retryPublish` finishes it."},"requested_by":{"$ref":"#/components/schemas/PortalPackageRequesterV1Dto"},"requested_at":{"type":"string","format":"date-time"},"resolved_at":{"type":"string","format":"date-time","nullable":true,"description":"When the request reached its terminal status — the approval that completed it (`approved`), the rejecting decision (`rejected`), or the withdrawal (`withdrawn`; who withdrew is `requested_by`, the only one who may). Null while `pending`. Same meaning as `resolved_at` on `GET /v1/approvals/{id}`."},"rejected_by":{"nullable":true,"description":"The approver whose decision rejected the request (`decisions[].approver_user_id` of the `reject` decision on `GET /v1/approvals/{id}`). Null unless `status` is `rejected`.","type":"object","allOf":[{"$ref":"#/components/schemas/PortalPackageRejecterV1Dto"}]},"rejection_note":{"type":"string","nullable":true,"description":"The rejecting decision's note exactly as recorded (`decisions[].note` on `GET /v1/approvals/{id}`) — never trimmed or normalized, so it may be empty or whitespace-only; treat a blank note as absent. Null when the decision carried no note, or unless `status` is `rejected`."},"actionable":{"type":"boolean","description":"Whether the caller can decide this request now — the decision route's own test (`POST /v1/approvals/{id}/decision`): true only while the request is `pending`, for a member who is an eligible approver of its active step, holds `documents:approve`, has not already decided that step, and, when the step requires authority, whose approval limit covers it, and, for a portal package, holds `portal:manage` (owner decision OD6). Never true for the requester (they may not approve their own publish), nor for an API key."},"can_withdraw":{"type":"boolean","description":"Whether the caller can withdraw this request now: true only for its requester, while it is `pending`, holding `documents:write` — the check `POST /v1/approvals/{id}/withdraw` enforces. Always false for an API-key caller; an API key that requested a publish withdraws it through `POST /v1/approvals/{id}/withdraw` directly."}},"required":["id","status","requested_by","requested_at","resolved_at","rejected_by","rejection_note","actionable","can_withdraw"]},"PortalPackageDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"window_start":{"type":"string","format":"date","description":"The window's first day (a fiscal month or quarter start)."},"window_end_inclusive":{"type":"string","format":"date","description":"The window's last day, inclusive."},"period_label":{"type":"string","description":"The window named the way the period generator names a monthly or quarterly cadence under the org's fiscal year — the same name the approvals summary (`portal_package.period_label`) and the package's notifications use: a month window `Jun 2026`, a quarter `Q<n> <fiscal year>` counted from the fiscal-year start (`Q1 2026` for Apr–Jun 2026 under an April fiscal year). A 3-month window not aligned to a fiscal quarter reads as its month span (`Feb 2026 – Apr 2026` under a January fiscal year) — a defensive fallback: a window is drafted aligned, and the org's fiscal-year start freezes once a period is closed, which drafting a package requires. An org on a 4-4-5 calendar names its own periods `P<n> <FY>`; its packages still read as these month and quarter names. Show it as is for an existing package; the only client-side naming is of a window not yet drafted, which has no package."},"status":{"type":"string","enum":["draft","pending_approval","published"],"description":"Only a `draft` can be edited, refreshed or discarded; `pending_approval` is locked (P17)."},"world":{"type":"string","enum":["equity","ownership"],"description":"`equity`: one capital statement per equity position; `ownership`: one income statement per owner. Fixed at draft."},"built_at":{"type":"string","format":"date-time","description":"The as-recorded instant every statement in the package was built with."},"package_sha256":{"type":"string","description":"SHA-256 over the statement and document hashes plus the included/excluded audience. Changes on any edit that changes what would be published; a preview counts only at the current value."},"amber_reasons":{"type":"object","additionalProperties":{"type":"string"},"nullable":true,"description":"Per readiness check key, the reason given for publishing past an amber check. Set at publish request; `null` in draft."},"publish_failure_reason":{"type":"string","nullable":true},"publish_failed_at":{"type":"string","format":"date-time","nullable":true},"published_at":{"type":"string","format":"date-time","nullable":true},"published_by":{"type":"string","format":"uuid","nullable":true},"published_by_name":{"type":"string","nullable":true,"description":"Who published the package, by name: their first and last name in the organization, from a live or a deactivated membership; null when no name is on file or they were never a member (an API key)."},"created_by":{"type":"string","format":"uuid"},"created_by_name":{"type":"string","nullable":true,"description":"Who drafted the package, by name: their first and last name in the organization, from a live or a deactivated membership; null when no name is on file or they were never a member (an API key)."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"recipients":{"description":"One entry per statement in the package (excluded parties included and flagged), ordered by party name. Snapshots are not inlined; preview as a party to read them.","type":"array","items":{"$ref":"#/components/schemas/PortalPackageRecipientV1Dto"}},"documents":{"type":"array","items":{"$ref":"#/components/schemas/PortalPackageDocumentV1Dto"}},"exclusions":{"type":"array","items":{"$ref":"#/components/schemas/PortalPackageExclusionV1Dto"}},"approval_request":{"nullable":true,"description":"The package's latest approval request, with what the caller may do with it; null when it never had one (it published without a rule, or was never sent).","type":"object","allOf":[{"$ref":"#/components/schemas/PortalPackageApprovalRequestV1Dto"}]}},"required":["id","legal_entity_id","window_start","window_end_inclusive","period_label","status","world","built_at","package_sha256","amber_reasons","publish_failure_reason","publish_failed_at","published_at","published_by","published_by_name","created_by","created_by_name","created_at","updated_at","recipients","documents","exclusions","approval_request"]},"CreatePortalPackageV1Dto":{"type":"object","properties":{"window_start":{"type":"string","format":"date","example":"2026-04-01","description":"The window's first day. Must open a FISCAL quarter (quarterly cadence) or FISCAL month (monthly) on the org's fiscal calendar; the cadence derives the end."}},"required":["window_start"]},"AddPortalPackageDocumentV1Dto":{"type":"object","properties":{"source_file_table":{"type":"string","enum":["legal_entity_files"],"description":"Where the file lives. 2a has one source: the entity files."},"source_file_id":{"type":"string","format":"uuid","description":"A file of THIS package's legal entity."}},"required":["source_file_table","source_file_id"]},"ExcludePortalHolderV1Dto":{"type":"object","properties":{"party_id":{"type":"string","format":"uuid","description":"A party in the audience."},"reason":{"type":"string","description":"Why this party is excluded (required, P11).","maxLength":1000}},"required":["party_id","reason"]},"PortalReadinessCheckV1Dto":{"type":"object","properties":{"key":{"type":"string","enum":["period_closed","previewed","equity_tie_out","stale_balances","distributions_posted","holders_have_contacts"],"description":"The six checks of spec §7, always all six, in this order: period_closed, previewed, equity_tie_out, stale_balances, distributions_posted, holders_have_contacts."},"severity":{"type":"string","enum":["red","amber","green"],"description":"`red` blocks publishing; `amber` publishes with a written reason; `green` passes (also used for \"not applicable\")."},"detail":{"type":"string","description":"A sentence naming what blocks, by name."},"data":{"type":"object","additionalProperties":true,"description":"For `previewed` the shape is `PortalReadinessPreviewedDataV1Dto` (always present: it carries `last_review`, null when never reviewed). The other checks' keys are check-specific: facts behind `detail`, keys snake_case: e.g. `positions`/`position_ids` (stale_balances), `parties`/`party_ids` (holders_have_contacts), `documents` (distributions_posted), the `PORTAL_PERIOD_NOT_CLOSED` context (period_closed), the tie-out figures as decimal strings (equity_tie_out). Absent when there is nothing to add."}},"required":["key","severity","detail"]},"PortalReadinessV1Dto":{"type":"object","properties":{"can_publish":{"type":"boolean","description":"No check is red. Amber still publishes, with a reason per amber check."},"approval_required":{"type":"boolean","description":"Whether publishing now, as the caller, would open an approval request instead of publishing — the approval rules' own matcher, the one `Portal.requestPublish` runs (a rule's audience is per submitter, so the answer is the caller's). True until the organization's default approval rule (owners and admins approve) is seeded (orgs enabled before publishing shipped are seeded on their first publish request). A hint for the button, not a promise: a rule changed between this read and the request decides the request."},"checks":{"type":"array","items":{"$ref":"#/components/schemas/PortalReadinessCheckV1Dto"}}},"required":["can_publish","approval_required","checks"]},"PortalPreviewStatementV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["capital_statement","income_statement"]},"position_id":{"type":"string","format":"uuid","nullable":true},"snapshot_sha256":{"type":"string"},"snapshot":{"type":"object","additionalProperties":true,"description":"The frozen statement exactly as stored at draft/refresh time and as it will be published — never rebuilt or re-serialized on read. Its `kind` and `statement_version` say which shape it is. Both kinds carry `ownership_percent` — the holder's share at the window's last day (a capital statement: the position's commitment share; an income statement: the owner's look-through percentage), a percent string with 4 decimals, or `null` when there is none — and `notes`, footnotes to show verbatim under the statement (`[]` when none). `capital_statement` v1 (equity world): `position_id`, `party_id`, `legal_entity_id`, `equity_class_name`, `admission_date`, `commitment`, `unfunded_commitment`, `built_with` {`as_recorded`, `window_start`, `window_end_inclusive`}, `ownership_percent`, `notes` and `columns` {`period`, `ytd`, `itd`}. Each column has `from_date`, `to_date`, `opening_balance` (`null` on `itd`), `contributions`, `return_of_capital`, `preferred_return_paid`, `profit_distributed`, `promote_received`, `transfers_in`, `transfers_out` and `closing_balance`. The `period` column alone adds `trace`, keyed by those seven line names, each a list of the events behind the line: `date`, `description`, `amount` (signed as the line sums it), `document_number` (the GL document's number, `null` when there is none) and `settlement_status` (`paid` or `pending` for an owner distribution, else `null`). `income_statement` v1 (ownership world): `party_id`, `legal_entity_id`, `window_start`, `window_end_inclusive`, `rows` (one per month in the window: `month` as `YYYY-MM`, `pl_share`, `cash_distributed`, `balance_due`), `totals` {`pl_share`, `cash_distributed`, `balance_due`}, `data_as_of`, `ownership_percent` and `notes`. Every money field is a decimal string."}},"required":["kind","position_id","snapshot_sha256","snapshot"]},"PortalPackagePreviewV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The preview record this call wrote."},"package_id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"},"package_sha256":{"type":"string","description":"The package hash this preview counts for. Readiness counts a preview only while it equals the package's current `package_sha256`."},"statements":{"description":"This party's statements, exactly as they would publish.","type":"array","items":{"$ref":"#/components/schemas/PortalPreviewStatementV1Dto"}},"documents":{"description":"The documents every recipient of the package receives.","type":"array","items":{"$ref":"#/components/schemas/PortalPackageDocumentV1Dto"}},"created_at":{"type":"string","format":"date-time"}},"required":["id","package_id","party_id","package_sha256","statements","documents","created_at"]},"PreviewPortalPackageV1Dto":{"type":"object","properties":{"party_id":{"type":"string","format":"uuid","description":"An INCLUDED recipient of the package."}},"required":["party_id"]},"PortalPackageStatementsV1Dto":{"type":"object","properties":{"package_id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"},"package_sha256":{"type":"string","description":"The package's `package_sha256`, read just before the statements: on a draft being refreshed at that moment it may be one refresh behind the statements. Reading statements does not count as a review; only `POST …/previews` records one."},"statements":{"description":"This party's statements, exactly as they would publish.","type":"array","items":{"$ref":"#/components/schemas/PortalPreviewStatementV1Dto"}},"documents":{"description":"The documents every recipient of the package receives.","type":"array","items":{"$ref":"#/components/schemas/PortalPackageDocumentV1Dto"}}},"required":["package_id","party_id","package_sha256","statements","documents"]},"PortalAmberReasonsV1Dto":{"type":"object","properties":{"period_closed":{"type":"string","maxLength":1000,"description":"Why publishing past this amber check is acceptable. Read only when the check is amber; at most 1000 characters."},"previewed":{"type":"string","maxLength":1000,"description":"Why publishing past this amber check is acceptable. Read only when the check is amber; at most 1000 characters."},"equity_tie_out":{"type":"string","maxLength":1000,"description":"Why publishing past this amber check is acceptable. Read only when the check is amber; at most 1000 characters."},"stale_balances":{"type":"string","maxLength":1000,"description":"Why publishing past this amber check is acceptable. Read only when the check is amber; at most 1000 characters."},"distributions_posted":{"type":"string","maxLength":1000,"description":"Why publishing past this amber check is acceptable. Read only when the check is amber; at most 1000 characters."},"holders_have_contacts":{"type":"string","maxLength":1000,"description":"Why publishing past this amber check is acceptable. Read only when the check is amber; at most 1000 characters."}}},"RequestPortalPublishV1Dto":{"type":"object","properties":{"amber_reasons":{"description":"A reason for every readiness check that is amber, keyed by the check (`GET …/readiness`). A red check cannot be overridden; an amber check without a non-blank reason refuses the request (PORTAL_READINESS_FAILED). Reasons for checks that are not amber are ignored.","allOf":[{"$ref":"#/components/schemas/PortalAmberReasonsV1Dto"}]}}},"PortalPublishRunV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"principal_id":{"type":"string","format":"uuid","description":"The principal (user or API key) who committed this run."},"window_start":{"type":"string","format":"date","description":"The window's first day (a fiscal month or quarter start)."},"window_end_inclusive":{"type":"string","format":"date","description":"The window's last day, inclusive."},"status":{"type":"string","enum":["queued","running","completed","cancelled","failed"],"description":"Lifecycle of the run itself, not of its entities. 'queued': committed, no entity's job has STARTED yet. 'running': at least one entity's job has started (markStarted fires when a job begins running, not when it reports its outcome, so this can be true before any entity has actually reported a result) and the run is not yet complete — also what a run returns to after a successful retry. 'completed': every entity has reported a result — the NORMAL terminal status, whatever mix of 'published', 'excepted', 'failed' and 'skipped' those results are. 'cancelled': cancellation was requested, stamped at the moment of the request together with finished_at, without waiting for outstanding entities. 'failed' is the run's OWN orchestration failing (its one-time fan-out after approval could not enqueue every job) — it is not produced by any entity's own result, and `retry` cannot resume it when it has zero excepted/failed entity rows to re-run; create a new run instead."},"entities_total":{"type":"number","description":"Size of the committed selection."},"entities_published":{"type":"number","description":"Entities whose result is 'published'."},"entities_excepted":{"type":"number","description":"Entities whose result is 'excepted' — a known, human-resolvable blocker (`GET …/entities?result=excepted` lists them; `POST …/entities/:legalEntityId/resolve` acts on one)."},"entities_failed":{"type":"number","description":"Entities whose result is 'failed' — an unclassified or repeated error, past this run's own attempt ceiling. `POST …/retry` re-attempts these (and excepted entities) together."},"entities_skipped":{"type":"number","description":"Entities whose result is 'skipped' — already published for this window before this run reached them, excluded by an operator at resolve, or never attempted because the run was cancelled first."},"cancel_requested_at":{"type":"string","format":"date-time","nullable":true,"description":"When cancellation was requested. Null while no cancel was asked for."},"created_at":{"type":"string","format":"date-time"},"started_at":{"type":"string","format":"date-time","nullable":true,"description":"Set when the run's first entity job STARTS running — before that job's own outcome is known, not when it reports a result."},"finished_at":{"type":"string","format":"date-time","nullable":true,"description":"Set once the run reaches a terminal status; cleared back to null by a successful retry."}},"required":["id","principal_id","window_start","window_end_inclusive","status","entities_total","entities_published","entities_excepted","entities_failed","entities_skipped","cancel_requested_at","created_at","started_at","finished_at"]},"CreatePortalPublishRunV1Dto":{"type":"object","properties":{"window_start":{"type":"string","format":"date","description":"The first day of the fiscal month or quarter to publish — the org's statement cadence and fiscal year start decide which it opens, exactly as one draft package window does."},"legal_entity_ids":{"minItems":1,"maxItems":500,"description":"At least one legal entity id, at most 500.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["window_start","legal_entity_ids"]},"PreflightExceptionV1Dto":{"type":"object","properties":{"kind":{"type":"string","description":"A readiness-check key (`period_closed`, `equity_tie_out`, `stale_balances`, `distributions_posted`, `holders_have_contacts`), or `window_mismatch` (an existing package for this entity covers a DIFFERENT window than the one this selection would run under — the statement cadence changed). Not an enum: a new readiness check key is additive and this field already documents the live set in prose."},"count":{"type":"number","description":"How many of the selected entities hit this exception kind."}},"required":["kind","count"]},"PreflightResultV1Dto":{"type":"object","properties":{"total":{"type":"number","description":"Size of the selection previewed."},"clean":{"type":"number","description":"Entities with nothing standing in the way of publishing — a published package already exists for this window, or every readiness check is green."},"exceptions":{"description":"One row per DISTINCT exception kind hit by at least one selected entity, sorted by kind. An entity with more than one would-be exception counts once, under whichever kind this preflight checks first — the same order the run itself would hit them in.","type":"array","items":{"$ref":"#/components/schemas/PreflightExceptionV1Dto"}},"not_yet_assessed":{"type":"number","description":"Entities with NO package drafted yet for this window — neither clean nor an exception. Most entities legitimately have nothing drafted until the run itself creates one; this count is what the run will draft and then evaluate at publish time. Reading only clean and exceptions undercounts the real total — this is the bucket R36 exists to prevent an approver from missing."},"shape_guard_armed":{"type":"boolean","description":"Whether the statement shape has changed since the last bulk publish run anyone actually created in this org (not this preview, and not a new run's own stamp, which always starts equal to the current shape). True is an informational signal to preview a sample statement before approving a run under the new shape — it never blocks this preview, and a run created under a changed shape excepts its own entities on shape_changed independently of this flag."}},"required":["total","clean","exceptions","not_yet_assessed","shape_guard_armed"]},"PreflightPortalPublishRunV1Dto":{"type":"object","properties":{"window_start":{"type":"string","format":"date","description":"The same window_start a create call for this selection would use — derived the identical way, never a caller-supplied window end."},"legal_entity_ids":{"minItems":1,"maxItems":500,"description":"At least one legal entity id, at most 500.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["window_start","legal_entity_ids"]},"PortalPublishRunEntityV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"package_id":{"type":"string","format":"uuid","nullable":true,"description":"The package this entity drafted or reused for the window — null when the entity excepted or failed before any package was drafted."},"result":{"type":"string","enum":["published","excepted","failed","skipped"],"nullable":true,"description":"Null while this entity is still pending."},"exception_kind":{"type":"string","nullable":true,"description":"A readiness-check key for an excepted entity (`period_closed`, `equity_tie_out`, `stale_balances`, `distributions_posted`, `holders_have_contacts`), `window_mismatch` or `shape_changed` for the two run-specific exceptions, or a published-package error code (`PORTAL_BOOKS_CHANGED` and others — see the job handler's classification) for anything else. Null unless result is 'excepted' or 'failed'."},"detail":{"type":"string","nullable":true,"description":"Human-readable reason, set alongside result. WITHHELD for a legal entity the caller may not act on: the readiness checks this is copied from name parties, positions and documents, so a caller restricted to a subset of entities reads \"Withheld: this legal entity is outside your access scope.\" instead. `exception_kind` (a check key, never a name) is never withheld, and an org-wide caller sees every detail in full."},"attempts":{"type":"number","description":"This entity's own attempt counter, independent of the job queue's — reset to 0 by `retry` so a retried entity gets this run's own fresh ceiling rather than immediately re-failing on a stale count. Per-CYCLE, not lifetime: nothing on the entity row or the run itself records how many times `retry` has reopened this entity in total — an operator watching one poisoned entity sees attempts reset to 0 on every retry, never a running total across cycles."},"finished_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","legal_entity_id","package_id","result","exception_kind","detail","attempts","finished_at"]},"PortalPublishRunResolveReasonsV1Dto":{"type":"object","properties":{"period_closed":{"type":"string","maxLength":1000,"description":"Why publishing past this amber check is acceptable. Read only when the check is amber; at most 1000 characters."},"previewed":{"type":"string","maxLength":1000,"description":"Why publishing past this amber check is acceptable. Read only when the check is amber; at most 1000 characters."},"equity_tie_out":{"type":"string","maxLength":1000,"description":"Why publishing past this amber check is acceptable. Read only when the check is amber; at most 1000 characters."},"stale_balances":{"type":"string","maxLength":1000,"description":"Why publishing past this amber check is acceptable. Read only when the check is amber; at most 1000 characters."},"distributions_posted":{"type":"string","maxLength":1000,"description":"Why publishing past this amber check is acceptable. Read only when the check is amber; at most 1000 characters."},"holders_have_contacts":{"type":"string","maxLength":1000,"description":"Why publishing past this amber check is acceptable. Read only when the check is amber; at most 1000 characters."},"shape_changed":{"type":"string","maxLength":1000,"description":"Why this entity may publish although the statement shape changed since the last run — i.e. that a sample was previewed and looks right (spec D4). Clears this run's `shape_changed` exception for this entity on a later `POST …/retry`."}}},"ResolvePortalPublishRunEntityV1Dto":{"type":"object","properties":{"amber_reasons":{"description":"A reason for the amber readiness check that excepted this entity, or for the run's `shape_changed` guard (or any other amber the package might later hit — reasons merge, never replace). Stored on the entity's package so a LATER `POST …/retry` can publish past it; this call does not publish anything itself. Mutually exclusive with `exclude`.","allOf":[{"$ref":"#/components/schemas/PortalPublishRunResolveReasonsV1Dto"}]},"exclude":{"type":"boolean","description":"Give up on this entity for this run: its result moves from excepted to skipped for good, so a later `retry` leaves it alone. Mutually exclusive with `amber_reasons`."}}},"PortalTermsV1Dto":{"type":"object","properties":{"terms_text":{"type":"string","nullable":true,"description":"The sponsor's plain-text investor terms, or null when none are set."},"terms_updated_at":{"type":"string","format":"date-time","nullable":true,"description":"When the terms text last changed (database clock)."},"last_viewed_at":{"type":"string","format":"date-time","nullable":true,"description":"When this login was last shown these terms in this sponsor, before this request. Null when it has never been shown them, when its views are older than the 13-month log retention, or when a view could not be logged — so null means \"show the terms\", not proof of a first sign-in. Show the terms when it is null or earlier than `terms_updated_at`."}},"required":["terms_text","terms_updated_at","last_viewed_at"]},"PortalInvestorDocumentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","description":"The entity's current name."},"file_name":{"type":"string","description":"The name the document is saved under."},"content_type":{"type":"string","example":"application/pdf"},"file_size_bytes":{"type":"number"},"period_label":{"type":"string","description":"The package's period, e.g. `Q1 FY2026` (a fiscal year not starting in January), `Q2 2026`, `June 2026`."},"published_at":{"type":"string","format":"date-time"}},"required":["id","legal_entity_id","legal_entity_name","file_name","content_type","file_size_bytes","period_label","published_at"]},"PortalInvestorDocumentDownloadV1Dto":{"type":"object","properties":{"url":{"type":"string","description":"Signed URL; fetch it directly. Valid for 300 seconds."},"expires_at":{"type":"string","format":"date-time"},"file_name":{"type":"string","description":"The name the browser saves the file under."}},"required":["url","expires_at","file_name"]},"PortalInvestorStatementListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The statement id: read it with `GET /v1/portal/statements/{id}`."},"kind":{"type":"string","enum":["capital_statement","income_statement"]},"party_id":{"type":"string","format":"uuid"},"position_id":{"type":"string","format":"uuid","nullable":true,"description":"The equity position; `null` on an income statement."},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","description":"The entity's current name."},"period_label":{"type":"string","description":"The period, for display only: `Q1 FY2026` (a fiscal year not starting in January), `Q2 2026`, `June 2026`. Address statements by `id` or by date, never by this label."},"window_start":{"type":"string","format":"date"},"window_end":{"type":"string","format":"date","description":"The window's last day, inclusive."},"published_at":{"type":"string","format":"date-time"}},"required":["id","kind","party_id","position_id","legal_entity_id","legal_entity_name","period_label","window_start","window_end","published_at"]},"PortalInvestorTraceEventV1Dto":{"type":"object","properties":{"date":{"type":"string","format":"date"},"description":{"type":"string","description":"What moved the line, from a fixed vocabulary (e.g. `Capital contribution`)."},"amount":{"type":"string","description":"Signed as the line sums it; a line's events sum to the line.","example":"1234.50"},"document_number":{"type":"string","nullable":true,"description":"The number of the event's document, or null when it has none."},"settlement_status":{"type":"string","enum":["paid","pending"],"nullable":true,"description":"For a distribution, whether it was paid as of when the statement was built (frozen); null for any other event."}},"required":["date","description","amount","document_number","settlement_status"]},"PortalInvestorTraceV1Dto":{"type":"object","properties":{"contributions":{"type":"array","items":{"$ref":"#/components/schemas/PortalInvestorTraceEventV1Dto"}},"return_of_capital":{"type":"array","items":{"$ref":"#/components/schemas/PortalInvestorTraceEventV1Dto"}},"preferred_return_paid":{"type":"array","items":{"$ref":"#/components/schemas/PortalInvestorTraceEventV1Dto"}},"profit_distributed":{"type":"array","items":{"$ref":"#/components/schemas/PortalInvestorTraceEventV1Dto"}},"promote_received":{"type":"array","items":{"$ref":"#/components/schemas/PortalInvestorTraceEventV1Dto"}},"transfers_in":{"type":"array","items":{"$ref":"#/components/schemas/PortalInvestorTraceEventV1Dto"}},"transfers_out":{"type":"array","items":{"$ref":"#/components/schemas/PortalInvestorTraceEventV1Dto"}}},"required":["contributions","return_of_capital","preferred_return_paid","profit_distributed","promote_received","transfers_in","transfers_out"]},"PortalInvestorStatementPeriodColumnV1Dto":{"type":"object","properties":{"from_date":{"type":"string","format":"date"},"to_date":{"type":"string","format":"date"},"opening_balance":{"type":"string","nullable":true,"description":"Null on the inception-to-date column, which opens at zero.","example":"1234.50"},"contributions":{"type":"string","example":"1234.50"},"return_of_capital":{"type":"string","example":"1234.50"},"preferred_return_paid":{"type":"string","example":"1234.50"},"profit_distributed":{"type":"string","example":"1234.50"},"promote_received":{"type":"string","example":"1234.50"},"transfers_in":{"type":"string","example":"1234.50"},"transfers_out":{"type":"string","example":"1234.50"},"closing_balance":{"type":"string","example":"1234.50"},"trace":{"$ref":"#/components/schemas/PortalInvestorTraceV1Dto"}},"required":["from_date","to_date","opening_balance","contributions","return_of_capital","preferred_return_paid","profit_distributed","promote_received","transfers_in","transfers_out","closing_balance","trace"]},"PortalInvestorStatementColumnV1Dto":{"type":"object","properties":{"from_date":{"type":"string","format":"date"},"to_date":{"type":"string","format":"date"},"opening_balance":{"type":"string","nullable":true,"description":"Null on the inception-to-date column, which opens at zero.","example":"1234.50"},"contributions":{"type":"string","example":"1234.50"},"return_of_capital":{"type":"string","example":"1234.50"},"preferred_return_paid":{"type":"string","example":"1234.50"},"profit_distributed":{"type":"string","example":"1234.50"},"promote_received":{"type":"string","example":"1234.50"},"transfers_in":{"type":"string","example":"1234.50"},"transfers_out":{"type":"string","example":"1234.50"},"closing_balance":{"type":"string","example":"1234.50"}},"required":["from_date","to_date","opening_balance","contributions","return_of_capital","preferred_return_paid","profit_distributed","promote_received","transfers_in","transfers_out","closing_balance"]},"PortalInvestorStatementColumnsV1Dto":{"type":"object","properties":{"period":{"$ref":"#/components/schemas/PortalInvestorStatementPeriodColumnV1Dto"},"ytd":{"description":"Fiscal year to date.","allOf":[{"$ref":"#/components/schemas/PortalInvestorStatementColumnV1Dto"}]},"itd":{"description":"Inception to date.","allOf":[{"$ref":"#/components/schemas/PortalInvestorStatementColumnV1Dto"}]}},"required":["period","ytd","itd"]},"PortalInvestorIncomeRowV1Dto":{"type":"object","properties":{"month":{"type":"string","example":"2026-04","description":"Calendar month, `YYYY-MM`."},"pl_share":{"type":"string","example":"1234.50"},"cash_distributed":{"type":"string","example":"1234.50"},"balance_due":{"type":"string","example":"1234.50"}},"required":["month","pl_share","cash_distributed","balance_due"]},"PortalInvestorIncomeTotalsV1Dto":{"type":"object","properties":{"pl_share":{"type":"string","example":"1234.50"},"cash_distributed":{"type":"string","example":"1234.50"},"balance_due":{"type":"string","example":"1234.50"}},"required":["pl_share","cash_distributed","balance_due"]},"PortalInvestorStatementV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The statement id: read it with `GET /v1/portal/statements/{id}`."},"kind":{"type":"string","enum":["capital_statement","income_statement"]},"party_id":{"type":"string","format":"uuid"},"position_id":{"type":"string","format":"uuid","nullable":true,"description":"The equity position; `null` on an income statement."},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","description":"The entity's current name."},"period_label":{"type":"string","description":"The period, for display only: `Q1 FY2026` (a fiscal year not starting in January), `Q2 2026`, `June 2026`. Address statements by `id` or by date, never by this label."},"window_start":{"type":"string","format":"date"},"window_end":{"type":"string","format":"date","description":"The window's last day, inclusive."},"published_at":{"type":"string","format":"date-time"},"visible_through":{"type":"string","format":"date","nullable":true,"description":"The last day the entity's books are closed through (inclusive), or null when nothing is closed yet."},"ownership_percent":{"type":"string","nullable":true,"example":"25.0000","description":"The holder's own share in percent with 4 decimals, frozen when the statement was built; `null` when the holder held nothing at the window end, has no commitment, or the entity has no commitments to measure against."},"notes":{"description":"Frozen footnotes, e.g. what a negative balance means.","type":"array","items":{"type":"string"}},"class_name":{"type":"string","nullable":true},"admission_date":{"type":"string","format":"date","nullable":true},"commitment":{"type":"string","nullable":true,"example":"1234.50"},"unfunded_commitment":{"type":"string","nullable":true,"example":"1234.50"},"columns":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/PortalInvestorStatementColumnsV1Dto"}]},"rows":{"nullable":true,"type":"array","items":{"$ref":"#/components/schemas/PortalInvestorIncomeRowV1Dto"}},"totals":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/PortalInvestorIncomeTotalsV1Dto"}]},"documents":{"type":"array","items":{"$ref":"#/components/schemas/PortalInvestorDocumentV1Dto"}}},"required":["id","kind","party_id","position_id","legal_entity_id","legal_entity_name","period_label","window_start","window_end","published_at","visible_through","ownership_percent","notes","class_name","admission_date","commitment","unfunded_commitment","columns","rows","totals","documents"]},"PortalInvestorLatestStatementV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"period_label":{"type":"string"},"window_end":{"type":"string","format":"date","description":"The window's last day, inclusive."},"published_at":{"type":"string","format":"date-time"}},"required":["id","period_label","window_end","published_at"]},"PortalInvestorPositionV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["equity","ownership"]},"position_id":{"type":"string","format":"uuid","nullable":true,"description":"The equity position; null on an ownership row (read its statements by id)."},"party_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","description":"The entity's current name."},"class_name":{"type":"string","nullable":true},"admission_date":{"type":"string","format":"date","nullable":true},"commitment":{"type":"string","nullable":true,"example":"1234.50"},"unfunded_commitment":{"type":"string","nullable":true,"example":"1234.50"},"contributed":{"type":"string","nullable":true,"description":"Inception-to-date contributions.","example":"1234.50"},"distributed_to_date":{"type":"string","description":"Equity: inception-to-date return of capital, preferred return, profit and promote paid, from the latest statement. Ownership: cash distributed, summed over every published income statement.","example":"1234.50"},"capital_account":{"type":"string","nullable":true,"description":"Inception-to-date closing balance of the latest statement.","example":"1234.50"},"ownership_percent":{"type":"string","nullable":true,"example":"25.0000","description":"The holder's own share in percent with 4 decimals, frozen when the statement was built; `null` when the holder held nothing at the window end, has no commitment, or the entity has no commitments to measure against."},"latest_statement":{"$ref":"#/components/schemas/PortalInvestorLatestStatementV1Dto"},"visible_through":{"type":"string","format":"date","nullable":true,"description":"The last day this entity's books are closed through (inclusive), or null."}},"required":["kind","position_id","party_id","legal_entity_id","legal_entity_name","class_name","admission_date","commitment","unfunded_commitment","contributed","distributed_to_date","capital_account","ownership_percent","latest_statement","visible_through"]},"PortalInvestorCapitalAccountV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The statement id: read it with `GET /v1/portal/statements/{id}`."},"kind":{"type":"string","enum":["capital_statement","income_statement"]},"party_id":{"type":"string","format":"uuid"},"position_id":{"type":"string","format":"uuid","nullable":true,"description":"The equity position; `null` on an income statement."},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","description":"The entity's current name."},"period_label":{"type":"string","description":"The period, for display only: `Q1 FY2026` (a fiscal year not starting in January), `Q2 2026`, `June 2026`. Address statements by `id` or by date, never by this label."},"window_start":{"type":"string","format":"date"},"window_end":{"type":"string","format":"date","description":"The window's last day, inclusive."},"published_at":{"type":"string","format":"date-time"},"visible_through":{"type":"string","format":"date","nullable":true,"description":"The last day the entity's books are closed through (inclusive), or null when nothing is closed yet."},"ownership_percent":{"type":"string","nullable":true,"example":"25.0000","description":"The holder's own share in percent with 4 decimals, frozen when the statement was built; `null` when the holder held nothing at the window end, has no commitment, or the entity has no commitments to measure against."},"notes":{"description":"Frozen footnotes, e.g. what a negative balance means.","type":"array","items":{"type":"string"}},"class_name":{"type":"string","nullable":true},"admission_date":{"type":"string","format":"date","nullable":true},"commitment":{"type":"string","nullable":true,"example":"1234.50"},"unfunded_commitment":{"type":"string","nullable":true,"example":"1234.50"},"columns":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/PortalInvestorStatementColumnsV1Dto"}]},"rows":{"nullable":true,"type":"array","items":{"$ref":"#/components/schemas/PortalInvestorIncomeRowV1Dto"}},"totals":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/PortalInvestorIncomeTotalsV1Dto"}]},"documents":{"type":"array","items":{"$ref":"#/components/schemas/PortalInvestorDocumentV1Dto"}},"requested_as_of":{"type":"string","format":"date","nullable":true,"description":"The `as_of` asked for; null when omitted (today was used)."},"effective_as_of":{"type":"string","format":"date","description":"The date served: the one asked for (or today), but never past the later of the entity's `visible_through` and the position's latest published window end."},"clamped":{"type":"boolean","description":"True when `effective_as_of` is earlier than the date asked for (or today)."}},"required":["id","kind","party_id","position_id","legal_entity_id","legal_entity_name","period_label","window_start","window_end","published_at","visible_through","ownership_percent","notes","class_name","admission_date","commitment","unfunded_commitment","columns","rows","totals","documents","requested_as_of","effective_as_of","clamped"]},"PivotColumnV1Dto":{"type":"object","properties":{"key":{"type":"string","description":"Stable key for this column. For entity dimensions, this is the property or space UUID. For other dimension types, this is the raw value. The sentinel string `__unassigned__` is used for journal lines/entries without a value."},"label":{"type":"string","description":"Human-readable label for this column. For entity dimensions, this is the property or space name. For other types, this equals `key`. For `__unassigned__`, this is `\"Unassigned\"`."}},"required":["key","label"]},"PivotAxisV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["system","dimension"],"description":"Whether this axis is a built-in or a user-defined dimension."},"key":{"type":"string","description":"Stable identifier within `kind`. UUID for dimensions; slug for system axes."},"wire_key":{"type":"string","description":"Tagged wire form (e.g. `system:legal_entity` or `dimension:<uuid>`). Matches the `pivot_by` query value that produced this response."},"code":{"type":"string"},"name":{"type":"string"},"scope":{"type":"string","enum":["entry","line"],"description":"Where the dimension's field is offered in the UI: 'entry' on the document header, 'line' on each line. Reporting does not read by it: a journal line's own value for the dimension wins over its entry's, in either scope."},"data_type":{"type":"string","enum":["text","number","date","boolean","entity","dropdown_list"]},"columns":{"type":"array","items":{"$ref":"#/components/schemas/PivotColumnV1Dto"}},"totals_by_column":{"type":"object","description":"Map from column key to that column's totals. Sums across keys reconcile to top-level `totals`.","additionalProperties":{"$ref":"#/components/schemas/PlReportTotalsV1Dto"}}},"required":["kind","key","wire_key","code","name","scope","data_type","columns","totals_by_column"]},"ConsolidationCellV1Dto":{"type":"object","properties":{"combined":{"type":"string","description":"Naive sum across the group's member legal entities."},"eliminations":{"type":"string","description":"Portion of `combined` attributable to intercompany activity between members (counterparty is also a member)."},"consolidated":{"type":"string","description":"`combined` minus `eliminations`."}},"required":["combined","eliminations","consolidated"]},"PlConsolidationTotalsV1Dto":{"type":"object","properties":{"income":{"$ref":"#/components/schemas/ConsolidationCellV1Dto"},"cogs":{"$ref":"#/components/schemas/ConsolidationCellV1Dto"},"expenses":{"$ref":"#/components/schemas/ConsolidationCellV1Dto"},"net_income":{"$ref":"#/components/schemas/ConsolidationCellV1Dto"}},"required":["income","cogs","expenses","net_income"]},"NonControllingInterestMemberV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"nci_percent":{"type":"string","description":"The non-controlling interest in the member, percent at 15 decimals.","example":"20.000000000000000"},"base":{"type":"string","description":"The member's own figure the percent applies to: its net income for the period on the P&L, its net assets (less in-group investments in subsidiaries) on the balance sheet.","example":"1234.50"},"amount":{"type":"string","description":"base × nci_percent, rounded to the cent.","example":"1234.50"}},"required":["legal_entity_id","nci_percent","base","amount"]},"NonControllingInterestV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"The outside owners' share: the sum of the members' amounts. A split of the consolidated figure, not an addition to it.","example":"1234.50"},"members":{"description":"One row per member the parent controls with an outside share.","type":"array","items":{"$ref":"#/components/schemas/NonControllingInterestMemberV1Dto"}}},"required":["amount","members"]},"PlConsolidationV1Dto":{"type":"object","properties":{"group_id":{"type":"string","format":"uuid"},"group_name":{"type":"string"},"currency_code":{"type":"string"},"member_legal_entity_ids":{"type":"array","items":{"type":"string"}},"totals":{"$ref":"#/components/schemas/PlConsolidationTotalsV1Dto"},"non_controlling_interest":{"description":"Net income attributable to outside owners of the members the parent controls: each member's own net income for the period × its non-controlling interest, with ownership read at to_date.","allOf":[{"$ref":"#/components/schemas/NonControllingInterestV1Dto"}]},"net_income_attributable_to_parent":{"type":"string","description":"Consolidated net income less the non-controlling interest: the part attributable to the parent.","example":"1234.50"}},"required":["group_id","group_name","currency_code","member_legal_entity_ids","totals","non_controlling_interest","net_income_attributable_to_parent"]},"PlReportPeriodV1Dto":{"type":"object","properties":{"from_date":{"type":"string","nullable":true},"to_date":{"type":"string","nullable":true}},"required":["from_date","to_date"]},"PlReportTotalsV1Dto":{"type":"object","properties":{"income":{"type":"string"},"expenses":{"type":"string"},"net_income":{"type":"string"},"cogs":{"type":"string"},"operating_expenses":{"type":"string","description":"Every expense-type account in scope — that is, every non-cogs, non-income row — INCLUDING the below-the-line charges also reported in `non_operating_expenses` (interest, depreciation, gain/loss on disposal). This is NOT the NOI-sense operating total: `income - cogs - operating_expenses` equals `net_income`, not `net_operating_income`. For the NOI-sense operating expense total, subtract: `operating_expenses - non_operating_expenses`. Do NOT sum the accounts whose `noi_section` is `operating` — the flag is emitted on every account including income, so that sum is income plus cogs plus operating expenses."},"net_operating_income":{"type":"string","description":"Net operating income: `net_income + non_operating_expenses - non_operating_income`. Operating revenue less operating costs only, with the below-the-line charges (interest, depreciation, gain/loss on disposal) added back and the below-the-line revenue (interest and dividend income) taken out. The identity `net_operating_income - non_operating_expenses + non_operating_income === net_income` always holds. In `legal_entity_ids` group mode this figure is PRE-ELIMINATION: `consolidation.totals` carries a combined/eliminations/consolidated triple for income, cogs, expenses and net income, but none for net operating income, so this is the naive combined figure across the members. The same applies to `non_operating_expenses` and `non_operating_income`."},"non_operating_expenses":{"type":"string","description":"Interest, depreciation and gain/loss-on-disposal activity, below NOI. Normally POSITIVE (a charge), but it can go negative: `gain_loss_on_disposal` is seeded as an EXPENSE detail type, so a disposal GAIN lands there as a credit and nets the figure down — a large enough gain takes it below zero. Add it back to `net_income` either way; the identity holds on the sign, not on the assumption that it is a charge."},"non_operating_income":{"type":"string","description":"Interest and dividend income, below NOI. Normally POSITIVE (revenue), but a contra or reversing entry can take it negative. The mirror of `non_operating_expenses` on the revenue side: without it a lender that earns loan interest would report that interest inside its net operating income while a borrower correctly reports the interest it pays outside."}},"required":["income","expenses","net_income","cogs","operating_expenses"]},"PlReportLineV1Dto":{"type":"object","properties":{"journal_entry_id":{"type":"string","format":"uuid"},"journal_line_id":{"type":"string","format":"uuid"},"entry_date":{"type":"string","format":"date"},"transaction_type":{"type":"string","nullable":true},"doc_num":{"type":"string","nullable":true},"customer_vendor":{"type":"string","nullable":true},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","nullable":true},"memo":{"type":"string","nullable":true},"debit":{"type":"string"},"credit":{"type":"string"},"amount":{"type":"string"}},"required":["journal_entry_id","journal_line_id","entry_date","transaction_type","doc_num","customer_vendor","legal_entity_id","legal_entity_name","memo","debit","credit","amount"]},"PlReportAccountV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"account_code":{"type":"string"},"account_name":{"type":"string"},"account_type_code":{"type":"string","enum":["income","cogs","expense"]},"noi_section":{"type":"string","enum":["operating","non_operating"],"description":"Which side of Net operating income this account falls on. Emitted for EVERY account, income accounts included — interest and dividend income are `non_operating`, as are interest, depreciation and gain/loss on disposal on the expense side; every `cogs` account is `operating`. Absent on a backend that predates NOI classification; treat absence as `operating`."},"parent_account_id":{"type":"string","format":"uuid","nullable":true,"description":"The account this one hangs under in the chart of accounts, or null for a top-level account — so a client can nest the statement. The rows stay a FLAT list and `total` is this account's OWN activity, never a roll-up of its children: a parent and its children each report themselves, and `totals` counts each once. A client that renders a parent total including its descendants sums them itself. A parent whose own activity is zero but whose children have some IS present, with a zero `total`: ancestors are backfilled so every non-null `parent_account_id` resolves to a row in the same payload. The one exception is reference data a P&L cannot represent — a parent that is not an income-statement account is not invented here, and its child is returned as a root. Under `compare=budget` a backfilled row is STRUCTURAL: its `budget` is always null and it never contributes to a group's Budget subtotal, because it is a row the report's own filters did not admit — a budgeted account that they DID admit is returned with its budget as usual."},"total":{"type":"string"},"totals_by_column":{"type":"object","description":"Per-column subtotals for this account. Present iff `pivot_axis` is present at the top level. Keys match `pivot_axis.columns[*].key`. Sums reconcile to `total`.","additionalProperties":{"type":"string"}},"consolidation":{"description":"Consolidation worksheet cell for this account. Present iff `consolidation` is present at the top level.","allOf":[{"$ref":"#/components/schemas/ConsolidationCellV1Dto"}]},"budget":{"type":"string","nullable":true,"description":"Budgeted amount for this account for the report period. Present iff `compare=budget` was requested; null when no active budget resolves."},"variance":{"type":"string","nullable":true,"description":"`total` minus `budget` for this account. Present iff `compare=budget` was requested; null when no active budget resolves."},"variance_pct":{"type":"string","nullable":true,"description":"`variance` expressed as a percentage of `budget`. Present iff `compare=budget` was requested; null when no active budget resolves or `budget` is zero."},"budget_by_column":{"type":"object","description":"Per-column budgeted amount for this account, keyed the same as `totals_by_column`. Present iff `compare=budget` was requested AND `pivot_by=system:month`; null per-column when no active budget resolves.","additionalProperties":{"type":"string","nullable":true}},"variance_by_column":{"type":"object","description":"Per-column `totals_by_column[key]` minus `budget_by_column[key]`. Same presence rule as `budget_by_column`.","additionalProperties":{"type":"string","nullable":true}},"lines":{"type":"array","items":{"$ref":"#/components/schemas/PlReportLineV1Dto"}}},"required":["account_id","account_code","account_name","account_type_code","total","lines"]},"PlReportGroupV1Dto":{"type":"object","properties":{"key":{"type":"string","enum":["income","expenses"]},"label":{"type":"string"},"account_type_codes":{"type":"array","items":{"type":"string","enum":["income","cogs","expense"]}},"total":{"type":"string"},"totals_by_column":{"type":"object","description":"Per-column subtotals for this group. Present iff `pivot_axis` is present at the top level. Keys match `pivot_axis.columns[*].key`. Sums reconcile to `total`.","additionalProperties":{"type":"string"}},"consolidation":{"description":"Consolidation worksheet cell for this group. Present iff `consolidation` is present at the top level.","allOf":[{"$ref":"#/components/schemas/ConsolidationCellV1Dto"}]},"budget":{"type":"string","nullable":true,"description":"Budgeted subtotal for this group for the report period. Present iff `compare=budget` was requested; null when no active budget resolves."},"variance":{"type":"string","nullable":true,"description":"`total` minus `budget` for this group. Present iff `compare=budget` was requested; null when no active budget resolves."},"variance_pct":{"type":"string","nullable":true,"description":"`variance` expressed as a percentage of `budget`. Present iff `compare=budget` was requested; null when no active budget resolves or `budget` is zero."},"budget_by_column":{"type":"object","description":"Per-column budgeted subtotal for this group, keyed the same as `totals_by_column`. Present iff `compare=budget` was requested AND `pivot_by=system:month`; null per-column when no active budget resolves.","additionalProperties":{"type":"string","nullable":true}},"variance_by_column":{"type":"object","description":"Per-column `totals_by_column[key]` minus `budget_by_column[key]`. Same presence rule as `budget_by_column`.","additionalProperties":{"type":"string","nullable":true}},"accounts":{"type":"array","items":{"$ref":"#/components/schemas/PlReportAccountV1Dto"}}},"required":["key","label","account_type_codes","total","accounts"]},"PlReportV1Dto":{"type":"object","properties":{"basis":{"type":"string","enum":["accrual","cash"]},"root_label":{"type":"string"},"period":{"$ref":"#/components/schemas/PlReportPeriodV1Dto"},"totals":{"$ref":"#/components/schemas/PlReportTotalsV1Dto"},"groups":{"type":"array","items":{"$ref":"#/components/schemas/PlReportGroupV1Dto"}},"pivot_axis":{"description":"Pivot metadata. Present iff `pivot_by` resolved to a known axis.","allOf":[{"$ref":"#/components/schemas/PivotAxisV1Dto"}]},"consolidation":{"description":"Consolidation worksheet metadata. Present iff `consolidation_group_id` names a group whose `consolidation_basis` is 'consolidated'; a 'combined' group has no worksheet.","allOf":[{"$ref":"#/components/schemas/PlConsolidationV1Dto"}]},"budget_unfiltered_axes":{"description":"Present only when `compare=budget` resolved a budget and a `filter` condition names an axis the budget cannot be narrowed by (budget lines carry only a property). Lists those axes as `filter` wire keys; the budget figures ignore them. Conditions on a Property-sourced dimension do narrow the budget.","type":"array","items":{"type":"string"}},"generated_at":{"type":"string"}},"required":["basis","root_label","period","totals","groups","generated_at"]},"PivotAxisDescriptorV1Dto":{"type":"object","properties":{"wire_key":{"type":"string","description":"Tagged wire form (e.g. `system:legal_entity` or `dimension:<uuid>`). Pass this verbatim as the `pivot_by` query param. The P&L serves every axis; the Balance Sheet serves `system:legal_entity` and `system:month`."},"code":{"type":"string"},"name":{"type":"string"},"scope":{"type":"string","enum":["entry","line"],"description":"Where the dimension's field is offered in the UI: 'entry' on the document header, 'line' on each line. Reporting does not read by it: a journal line's own value for the dimension wins over its entry's, in either scope."},"data_type":{"type":"string","enum":["text","number","date","boolean","entity","dropdown_list"]}},"required":["wire_key","code","name","scope","data_type"]},"PivotAxesV1Dto":{"type":"object","properties":{"system":{"description":"Built-in axes available to every org.","type":"array","items":{"$ref":"#/components/schemas/PivotAxisDescriptorV1Dto"}},"dimensions":{"description":"User-defined dimensions, active for the requesting org.","type":"array","items":{"$ref":"#/components/schemas/PivotAxisDescriptorV1Dto"}}},"required":["system","dimensions"]},"ReportAxisValueV1Dto":{"type":"object","properties":{"value":{"type":"string","description":"The value, as the `filter` param takes it."},"label":{"type":"string","description":"Display label; equals `value` here."}},"required":["value","label"]},"ReportAxisValuesV1Dto":{"type":"object","properties":{"axis":{"type":"string","description":"The axis wire key that was queried."},"values":{"type":"array","items":{"$ref":"#/components/schemas/ReportAxisValueV1Dto"}},"truncated":{"type":"boolean","description":"True when more values exist than `limit` returned."}},"required":["axis","values","truncated"]},"BsConsolidationTotalsV1Dto":{"type":"object","properties":{"total_assets":{"$ref":"#/components/schemas/ConsolidationCellV1Dto"},"total_liabilities":{"$ref":"#/components/schemas/ConsolidationCellV1Dto"},"total_equity":{"$ref":"#/components/schemas/ConsolidationCellV1Dto"},"liabilities_plus_equity":{"$ref":"#/components/schemas/ConsolidationCellV1Dto"}},"required":["total_assets","total_liabilities","total_equity","liabilities_plus_equity"]},"BsConsolidationV1Dto":{"type":"object","properties":{"group_id":{"type":"string","format":"uuid"},"group_name":{"type":"string"},"currency_code":{"type":"string"},"member_legal_entity_ids":{"type":"array","items":{"type":"string"}},"totals":{"$ref":"#/components/schemas/BsConsolidationTotalsV1Dto"},"intercompany_out_of_balance":{"type":"string","description":"Net residual of eliminated intercompany receivables vs payables across every eliminated pair (due from / due to, distributions receivable / payable, contributions receivable / payable); non-zero means the consolidated balance sheet is out of balance by this amount."},"non_controlling_interest":{"description":"Equity attributable to outside owners of the members the parent controls: each member's net assets (less its in-group investments in subsidiaries) × its non-controlling interest, with ownership read at as_of_date. Accrual basis only.","allOf":[{"$ref":"#/components/schemas/NonControllingInterestV1Dto"}]},"equity_attributable_to_parent":{"type":"string","description":"Consolidated total equity less the non-controlling interest: the part attributable to the parent. Accrual basis only.","example":"1234.50"}},"required":["group_id","group_name","currency_code","member_legal_entity_ids","totals","intercompany_out_of_balance"]},"BalanceSheetTotalsV1Dto":{"type":"object","properties":{"total_assets":{"type":"string"},"total_liabilities":{"type":"string"},"total_equity":{"type":"string"},"liabilities_plus_equity":{"type":"string"},"balanced":{"type":"boolean","description":"Whether the sheet balances. Outside group mode that is `total_assets` against `liabilities_plus_equity`, and so is a 'combined' group. For a 'consolidated' group (`consolidation_group_id` supplied) it is BOTH that and the CONSOLIDATED column, because the combined column is a sum of books that each balanced on their own and can hide a consolidated sheet that does not. `false` for a consolidated group most often means an intercompany leg (bridge, distributions or contributions payable / receivable) was eliminated with no reciprocal on the other side — `consolidation.intercompany_out_of_balance` names the same amount from the elimination side."}},"required":["total_assets","total_liabilities","total_equity","liabilities_plus_equity","balanced"]},"BalanceSheetPivotAxisV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["system","dimension"],"description":"Whether this axis is a built-in or a user-defined dimension."},"key":{"type":"string","description":"Stable identifier within `kind`. UUID for dimensions; slug for system axes."},"wire_key":{"type":"string","description":"Tagged wire form (e.g. `system:legal_entity`). Matches the `pivot_by` query value that produced this response."},"code":{"type":"string"},"name":{"type":"string"},"scope":{"type":"string","enum":["entry","line"],"description":"Where the dimension's field is offered in the UI: 'entry' on the document header, 'line' on each line. Reporting does not read by it: a journal line's own value for the dimension wins over its entry's, in either scope."},"data_type":{"type":"string","enum":["text","number","date","boolean","entity","dropdown_list"]},"columns":{"type":"array","items":{"$ref":"#/components/schemas/PivotColumnV1Dto"}},"totals_by_column":{"type":"object","description":"Map from column key to that column's totals: each column is a balance sheet of its own, with its own `balanced`. On the legal-entity axis the columns sum to the top-level `totals`.","additionalProperties":{"$ref":"#/components/schemas/BalanceSheetTotalsV1Dto"}}},"required":["kind","key","wire_key","code","name","scope","data_type","columns","totals_by_column"]},"BalanceSheetAccountV1Dto":{"type":"object","properties":{"account_id":{"type":"string","nullable":true,"format":"uuid"},"account_code":{"type":"string","nullable":true},"account_name":{"type":"string"},"account_type_code":{"type":"string","enum":["asset","liability","equity"]},"total":{"type":"string","description":"The row's signed balance as of the date. On a Retained Earnings account it also includes the prior-year earnings derived for the entities whose Retained Earnings account it is, so it can differ from the account's posted activity; `prior_year_earnings` is that part."},"prior_year_earnings":{"type":"string","description":"The derived prior-year earnings included in `total`. Present only on the row that received a non-zero amount: a Retained Earnings account, or the synthetic Retained Earnings row. The account's GL activity shows its postings only.","example":"1234.50"},"is_synthetic":{"type":"boolean"},"consolidation":{"description":"Consolidation worksheet cell for this account. Present iff `consolidation` is present at the top level.","allOf":[{"$ref":"#/components/schemas/ConsolidationCellV1Dto"}]},"totals_by_column":{"type":"object","description":"This row's balance in each column. Present iff `pivot_axis` is present at the top level. Keys match `pivot_axis.columns[*].key`, every column present (`\"0.00\"` where the column has nothing). Sums to `total` on the legal-entity axis.","additionalProperties":{"type":"string","example":"1234.50"}}},"required":["account_id","account_code","account_name","account_type_code","total","is_synthetic"]},"BalanceSheetGroupV1Dto":{"type":"object","properties":{"key":{"type":"string","enum":["assets","liabilities","equity"]},"label":{"type":"string"},"total":{"type":"string"},"accounts":{"type":"array","items":{"$ref":"#/components/schemas/BalanceSheetAccountV1Dto"}},"consolidation":{"description":"Consolidation worksheet cell for this group. Present iff `consolidation` is present at the top level.","allOf":[{"$ref":"#/components/schemas/ConsolidationCellV1Dto"}]},"totals_by_column":{"type":"object","description":"This group's total in each column. Present iff `pivot_axis` is present at the top level. Keys match `pivot_axis.columns[*].key`, every column present.","additionalProperties":{"type":"string","example":"1234.50"}}},"required":["key","label","total","accounts"]},"BalanceSheetV1Dto":{"type":"object","properties":{"as_of_date":{"type":"string","format":"date"},"basis":{"type":"string","enum":["accrual","cash"]},"totals":{"$ref":"#/components/schemas/BalanceSheetTotalsV1Dto"},"groups":{"type":"array","items":{"$ref":"#/components/schemas/BalanceSheetGroupV1Dto"}},"pivot_axis":{"description":"The pivot axis and its columns. Present iff `pivot_by` resolved to an axis the balance sheet supports.","allOf":[{"$ref":"#/components/schemas/BalanceSheetPivotAxisV1Dto"}]},"consolidation":{"description":"Consolidation worksheet metadata. Present iff `consolidation_group_id` names a group whose `consolidation_basis` is 'consolidated'; a 'combined' group has no worksheet.","allOf":[{"$ref":"#/components/schemas/BsConsolidationV1Dto"}]},"generated_at":{"type":"string"}},"required":["as_of_date","basis","totals","groups","generated_at"]},"TrialBalanceWindowV1Dto":{"type":"object","properties":{"from_date":{"type":"string","format":"date"},"to_date":{"type":"string","format":"date"},"fiscal_year_start":{"type":"string","format":"date","description":"First day of the fiscal year the window sits in."}},"required":["from_date","to_date","fiscal_year_start"]},"TrialBalanceScopeV1Dto":{"type":"object","properties":{"legal_entity_ids":{"nullable":true,"description":"The entities combined, or null for every entity the caller can read.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["legal_entity_ids"]},"TrialBalanceTotalsV1Dto":{"type":"object","properties":{"opening":{"type":"string","description":"Sum of every row's opening. Zero when the ledger balances before the window.","example":"1234.50"},"debits":{"type":"string","description":"Sum of every row's debits in the window.","example":"1234.50"},"credits":{"type":"string","description":"Sum of every row's credits in the window.","example":"1234.50"},"ending":{"type":"string","description":"Sum of every row's ending. Zero when the ledger balances.","example":"1234.50"},"debit_balances":{"type":"string","description":"Sum of the positive endings.","example":"1234.50"},"credit_balances":{"type":"string","description":"Sum of the negative endings, as a positive amount.","example":"1234.50"},"balanced":{"type":"boolean","description":"Sum of openings is zero and debits equal credits. Exact, no tolerance."},"difference":{"type":"string","description":"Sum of endings: debit_balances - credit_balances. Zero when balanced.","example":"1234.50"}},"required":["opening","debits","credits","ending","debit_balances","credit_balances","balanced","difference"]},"TrialBalanceAccountV1Dto":{"type":"object","properties":{"account_id":{"type":"string","nullable":true,"format":"uuid","description":"Null only on the derived retained-earnings row."},"account_code":{"type":"string","nullable":true},"account_name":{"type":"string"},"account_type_code":{"type":"string","enum":["asset","liability","equity","income","expense"],"description":"The account's type. The derived retained-earnings row is 'equity'."},"normal_balance":{"type":"string","enum":["debit","credit"]},"parent_account_id":{"type":"string","nullable":true,"format":"uuid"},"report_order":{"type":"integer","nullable":true},"is_active":{"type":"boolean"},"is_derived":{"type":"boolean","description":"True on the one row that carries prior-year earnings no retained-earnings account takes. It has no lines."},"opening":{"type":"string","description":"Debit-positive balance at the start of the window.","example":"1234.50"},"debits":{"type":"string","description":"Sum of debits in the window, gross.","example":"1234.50"},"credits":{"type":"string","description":"Sum of credits in the window, gross.","example":"1234.50"},"ending":{"type":"string","description":"opening + debits - credits. Debit-positive; a credit balance is negative.","example":"1234.50"},"prior_year_earnings":{"type":"string","nullable":true,"description":"Prior fiscal years’ income and expense folded into this row’s opening (debit-positive). Set only on a retained-earnings row that received some.","example":"1234.50"}},"required":["account_id","account_code","account_name","account_type_code","normal_balance","parent_account_id","report_order","is_active","is_derived","opening","debits","credits","ending","prior_year_earnings"]},"TrialBalanceLinesTotalsV1Dto":{"type":"object","properties":{"debit":{"type":"string","description":"Sum of debits over every line of the filtered set.","example":"1234.50"},"credit":{"type":"string","description":"Sum of credits over every line of the filtered set.","example":"1234.50"}},"required":["debit","credit"]},"TrialBalanceV1Dto":{"type":"object","properties":{"mode":{"type":"string","enum":["as_of","period"]},"window":{"$ref":"#/components/schemas/TrialBalanceWindowV1Dto"},"scope":{"$ref":"#/components/schemas/TrialBalanceScopeV1Dto"},"accounts":{"type":"array","items":{"$ref":"#/components/schemas/TrialBalanceAccountV1Dto"}},"totals":{"$ref":"#/components/schemas/TrialBalanceTotalsV1Dto"},"generated_at":{"type":"string","format":"date-time"}},"required":["mode","window","scope","accounts","totals","generated_at"]},"TrialBalanceLineV1Dto":{"type":"object","properties":{"journal_entry_id":{"type":"string","format":"uuid"},"journal_line_id":{"type":"string","format":"uuid"},"entry_date":{"type":"string","format":"date"},"document_id":{"type":"string","nullable":true,"format":"uuid"},"transaction_type":{"type":"string","nullable":true,"description":"The source document's type (its document_type, e.g. 'bill'). Null when the entry was not posted from a document."},"doc_num":{"type":"string","nullable":true},"customer_vendor":{"type":"string","nullable":true},"memo":{"type":"string","nullable":true,"description":"The line's description, else the entry's memo."},"account_id":{"type":"string","format":"uuid"},"account_code":{"type":"string","nullable":true},"account_name":{"type":"string"},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","nullable":true},"debit":{"type":"string","example":"1234.50"},"credit":{"type":"string","example":"1234.50"},"running_balance":{"type":"string","description":"meta.opening plus every debit minus credit through this line, across pages.","example":"1234.50"}},"required":["journal_entry_id","journal_line_id","entry_date","document_id","transaction_type","doc_num","customer_vendor","memo","account_id","account_code","account_name","legal_entity_id","legal_entity_name","debit","credit","running_balance"]},"TrialBalanceLinesMetaV1Dto":{"type":"object","properties":{"next_cursor":{"type":"string","nullable":true,"description":"Opaque cursor for the next page, or null on the last. Pass it back as `?cursor=`."},"limit":{"type":"number","description":"Page size used for this response."},"opening":{"type":"string","description":"The account set's opening, from the same computation as the trial balance row.","example":"1234.50"},"totals":{"description":"Debit and credit sums over the whole filtered set, not just this page.","allOf":[{"$ref":"#/components/schemas/TrialBalanceLinesTotalsV1Dto"}]},"ending":{"type":"string","description":"The account set's ending. opening + totals.debit - totals.credit equals it when the books tie.","example":"1234.50"}},"required":["next_cursor","limit","opening","totals","ending"]},"CashFlowLineV1Dto":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"total":{"type":"string"}},"required":["key","label","total"]},"CashFlowActivityV1Dto":{"type":"object","properties":{"key":{"type":"string","enum":["operating","investing","financing"]},"label":{"type":"string"},"total":{"type":"string"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/CashFlowLineV1Dto"}}},"required":["key","label","total","lines"]},"CashFlowReconciliationV1Dto":{"type":"object","properties":{"beginning_cash":{"type":"string"},"net_change":{"type":"string"},"ending_cash":{"type":"string"},"balanced":{"type":"boolean","description":"True when the sum of all activity flows equals the net change in cash (operating + investing + financing === ending − beginning). Goes false when a filter such as `search` removes rows so activities no longer reconcile to the cash delta."}},"required":["beginning_cash","net_change","ending_cash","balanced"]},"CashFlowPivotColumnV1Dto":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"}},"required":["key","label"]},"CashFlowPivotV1Dto":{"type":"object","properties":{"axis_key":{"type":"string"},"columns":{"type":"array","items":{"$ref":"#/components/schemas/CashFlowPivotColumnV1Dto"}},"totals_by_activity":{"type":"object","description":"activity key -> column key -> signed money string. The sentinel column key `__unassigned__` holds untagged flows (same sentinel as the P&L report pivot).","additionalProperties":true}},"required":["axis_key","columns","totals_by_activity"]},"CashFlowV1Dto":{"type":"object","properties":{"from_date":{"type":"string","format":"date"},"to_date":{"type":"string","format":"date"},"activities":{"type":"array","items":{"$ref":"#/components/schemas/CashFlowActivityV1Dto"}},"reconciliation":{"$ref":"#/components/schemas/CashFlowReconciliationV1Dto"},"pivot":{"$ref":"#/components/schemas/CashFlowPivotV1Dto"},"generated_at":{"type":"string"}},"required":["from_date","to_date","activities","reconciliation","generated_at"]},"BeneficialOwnerIncomePeriodV1Dto":{"type":"object","properties":{"from_date":{"type":"string","nullable":true},"to_date":{"type":"string","nullable":true}},"required":["from_date","to_date"]},"BeneficialOwnerOwnershipPathHopV1Dto":{"type":"object","properties":{"parent_legal_entity_id":{"type":"string","format":"uuid"},"parent_legal_entity_name":{"type":"string"},"member_row_id":{"type":"string","format":"uuid"},"membership_effective_from":{"type":"string","format":"date"},"membership_effective_to":{"type":"string","nullable":true,"format":"date"},"ownership_percent_of_parent":{"type":"string","description":"Percent of the parent held, with exactly 15 decimals."},"to_party_id":{"type":"string","format":"uuid"},"to_party_name":{"type":"string"},"to_legal_entity_id":{"type":"string","format":"uuid"},"to_legal_entity_name":{"type":"string"},"effective_percent_of_source":{"type":"string","description":"Effective percent of the source entity, with exactly 15 decimals."}},"required":["parent_legal_entity_id","parent_legal_entity_name","member_row_id","membership_effective_from","membership_effective_to","ownership_percent_of_parent","effective_percent_of_source"]},"BeneficialOwnerIncomeAllocatedRowV1Dto":{"type":"object","properties":{"month_key":{"type":"string"},"source_legal_entity_id":{"type":"string","format":"uuid"},"source_legal_entity_name":{"type":"string"},"party_id":{"type":"string","format":"uuid"},"party_name":{"type":"string"},"allocated_income":{"type":"string"},"allocated_expenses":{"type":"string"},"allocated_net":{"type":"string"},"ownership_path":{"type":"array","items":{"$ref":"#/components/schemas/BeneficialOwnerOwnershipPathHopV1Dto"}},"effective_percent_of_source":{"type":"string","description":"Effective percent of the source entity, with exactly 15 decimals."},"allocation_path_key":{"type":"string"}},"required":["month_key","source_legal_entity_id","source_legal_entity_name","party_id","party_name","allocated_income","allocated_expenses","allocated_net","ownership_path","effective_percent_of_source","allocation_path_key"]},"BeneficialOwnerIncomeUnallocatedRowV1Dto":{"type":"object","properties":{"month_key":{"type":"string"},"source_legal_entity_id":{"type":"string","format":"uuid"},"source_legal_entity_name":{"type":"string"},"at_legal_entity_id":{"type":"string","format":"uuid"},"at_legal_entity_name":{"type":"string"},"amount":{"type":"string"},"reason":{"type":"string","enum":["no_cap_table","cycle","max_depth","ownership_remainder","invalid_member"]}},"required":["month_key","source_legal_entity_id","source_legal_entity_name","at_legal_entity_id","at_legal_entity_name","amount","reason"]},"BeneficialOwnerIncomeTotalsV1Dto":{"type":"object","properties":{"total_gl_income":{"type":"string"},"total_gl_expenses":{"type":"string"},"total_gl_net":{"type":"string"},"total_allocated_income":{"type":"string"},"total_allocated_expenses":{"type":"string"},"total_allocated_net":{"type":"string"},"total_unallocated":{"type":"string"}},"required":["total_gl_income","total_gl_expenses","total_gl_net","total_allocated_income","total_allocated_expenses","total_allocated_net","total_unallocated"]},"BeneficialOwnerIncomeReportV1Dto":{"type":"object","properties":{"period":{"$ref":"#/components/schemas/BeneficialOwnerIncomePeriodV1Dto"},"allocated_rows":{"type":"array","items":{"$ref":"#/components/schemas/BeneficialOwnerIncomeAllocatedRowV1Dto"}},"unallocated_rows":{"type":"array","items":{"$ref":"#/components/schemas/BeneficialOwnerIncomeUnallocatedRowV1Dto"}},"totals":{"$ref":"#/components/schemas/BeneficialOwnerIncomeTotalsV1Dto"},"generated_at":{"type":"string"}},"required":["period","allocated_rows","unallocated_rows","totals","generated_at"]},"InvestorStatementRowV1Dto":{"type":"object","properties":{"period":{"type":"string"},"pl_share":{"type":"string"},"cash_distributed":{"type":"string"},"balance_due":{"type":"string"}},"required":["period","pl_share","cash_distributed","balance_due"]},"InvestorStatementV1Dto":{"type":"object","properties":{"owner_party_id":{"type":"string","format":"uuid"},"period":{"type":"object","properties":{"from_date":{"type":"string","format":"date","nullable":true},"to_date":{"type":"string","format":"date","nullable":true}}},"rows":{"type":"array","items":{"$ref":"#/components/schemas/InvestorStatementRowV1Dto"}},"generated_at":{"type":"string"}},"required":["owner_party_id","period","rows","generated_at"]},"RentRollTenantDto":{"type":"object","properties":{"party_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["name"]},"RentRollSpaceRefDto":{"type":"object","properties":{"space_id":{"type":"string","format":"uuid","description":"The space. Renamed from `trackable_id` — spec D14."},"code":{"type":"string"},"name":{"type":"string"}},"required":["space_id","code","name"]},"RentRollLeaseOptionDto":{"type":"object","properties":{"label":{"type":"string"},"start_date":{"type":"string","format":"date"},"end_date":{"type":"string","nullable":true,"format":"date"},"notice_date":{"type":"string","nullable":true,"format":"date"},"status":{"type":"string","enum":["active","available","exercised","expired","waived","removed"]}},"required":["label","start_date","end_date","notice_date","status"]},"RentRollLeaseRowDto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"tenant":{"$ref":"#/components/schemas/RentRollTenantDto"},"spaces":{"type":"array","items":{"$ref":"#/components/schemas/RentRollSpaceRefDto"}},"lease_type":{"type":"string","nullable":true},"status":{"type":"string"},"start_date":{"type":"string","format":"date"},"end_date":{"type":"string","nullable":true,"format":"date","description":"null = month-to-month (MTM)."},"remaining_months":{"type":"number"},"sqft":{"type":"number","nullable":true},"base_rent_monthly":{"type":"string","example":"1030.00"},"recoveries_monthly":{"type":"string","example":"250.00"},"other_monthly":{"type":"string","example":"0.00"},"total_monthly":{"type":"string","example":"1280.00"},"annualized":{"type":"string","example":"15360.00"},"base_psf":{"type":"string","nullable":true,"example":"24.50"},"options":{"type":"array","items":{"$ref":"#/components/schemas/RentRollLeaseOptionDto"}},"security_deposit":{"type":"string","example":"2500.00"},"flags":{"type":"array","items":{"type":"string","enum":["mtm","intercompany","has_percentage_rent","sqft_mismatch","missing_sqft","missing_rent","multi_space","pre_commencement"]}}},"required":["contract_id","tenant","spaces","lease_type","status","start_date","end_date","remaining_months","sqft","base_rent_monthly","recoveries_monthly","other_monthly","total_monthly","annualized","base_psf","options","flags"]},"RentRollVacantRowDto":{"type":"object","properties":{"vacant":{"type":"boolean","enum":[true]},"space":{"$ref":"#/components/schemas/RentRollSpaceRefDto"},"sqft":{"type":"number"},"flags":{"type":"array","items":{"type":"string","enum":["mtm","intercompany","has_percentage_rent","sqft_mismatch","missing_sqft","missing_rent","multi_space","pre_commencement"]}}},"required":["vacant","space","flags"]},"RentRollOccupancyCountsDto":{"type":"object","properties":{"total":{"type":"number"},"occupied":{"type":"number"},"vacant":{"type":"number"}},"required":["total","occupied","vacant"]},"RentRollOccupancyDto":{"type":"object","properties":{"units":{"$ref":"#/components/schemas/RentRollOccupancyCountsDto"},"sqft":{"$ref":"#/components/schemas/RentRollOccupancyCountsDto"}},"required":["units","sqft"]},"RentRollSummaryDto":{"type":"object","properties":{"occupancy":{"$ref":"#/components/schemas/RentRollOccupancyDto"},"walt_years_rent_weighted":{"type":"string","example":"4.3","description":"Rent-weighted WALT, years, 1 decimal."},"walt_years_sqft_weighted":{"type":"string","example":"3.9","description":"Sqft-weighted WALT, years, 1 decimal."},"monthly_scheduled_rent":{"type":"string","example":"48200.00"},"annualized_rent":{"type":"string","example":"578400.00"},"expiring_12m_pct_of_rent":{"type":"string","example":"12.50","description":"% of current monthly scheduled rent whose leases expire within 12 months."},"unmeasured_spaces":{"type":"number","description":"Leaf spaces excluded from the sqft occupancy denominator for lack of a measured or fallback sqft."}},"required":["occupancy","walt_years_rent_weighted","walt_years_sqft_weighted","monthly_scheduled_rent","annualized_rent","expiring_12m_pct_of_rent","unmeasured_spaces"]},"RentRollSubtotalsDto":{"type":"object","properties":{"monthly_scheduled_rent":{"type":"string","example":"12500.00"},"annualized_rent":{"type":"string","example":"150000.00"},"sqft":{"type":"number","description":"Sum of this property's rendered row sqft — leased rows' sqft plus measured-vacant rows' sqft (an unmeasured vacant row, which omits its own sqft, contributes 0). Foots against the property's own `rows[].sqft` column; not the same basis as `summary.occupancy.sqft.total` (portfolio-wide, includes leases excluded here e.g. intercompany)."}},"required":["monthly_scheduled_rent","annualized_rent","sqft"]},"RentRollPropertyDto":{"type":"object","properties":{"property_id":{"type":"string","format":"uuid","description":"The property. Renamed from `trackable_id` — spec D14."},"name":{"type":"string"},"subtotals":{"$ref":"#/components/schemas/RentRollSubtotalsDto"},"rows":{"type":"array","description":"Lease rows and vacant rows for this property, discriminated by the presence of `vacant: true`.","items":{"oneOf":[{"$ref":"#/components/schemas/RentRollLeaseRowDto"},{"$ref":"#/components/schemas/RentRollVacantRowDto"}]}}},"required":["property_id","name","subtotals","rows"]},"RentRollV1Dto":{"type":"object","properties":{"as_of_date":{"type":"string","format":"date"},"reconstruction":{"type":"boolean","description":"true when as_of_date is in the past — the roll is a best-effort reconstruction from current rows rather than an exact historical record."},"summary":{"$ref":"#/components/schemas/RentRollSummaryDto"},"properties":{"type":"array","items":{"$ref":"#/components/schemas/RentRollPropertyDto"}},"generated_at":{"type":"string","format":"date-time"}},"required":["as_of_date","reconstruction","summary","properties","generated_at"]},"PortfolioSummaryV1Dto":{"type":"object","properties":{"as_of_date":{"type":"string","format":"date","description":"The as-of date used, in the org's own calendar."},"property_count":{"type":"number","description":"Properties matching the filter set — EVERY status, including `inactive` and `archived`, unless the request narrows `status` itself. The occupancy and rent figures in `summary` count only `active` properties, so with no `status` filter this count is a wider universe than their denominator. That is deliberate: this count exists to agree with the rows of `GET /v1/properties`, which also shows every status by default, and an active-only count would break the one guarantee the KPI strip is for. The metrics keep `rentableLocations`' long-standing active-only rule, which is what the rent roll reports too."},"summary":{"description":"The same summary `GET /v1/reports/rent-roll` returns, computed by the same fold over the same economics service — so the two can differ by filter set, never by math. Vacant sqft is `occupancy.sqft.total - occupancy.sqft.occupied`.","allOf":[{"$ref":"#/components/schemas/RentRollSummaryDto"}]}},"required":["as_of_date","property_count","summary"]},"LeaseExpirationBucketDto":{"type":"object","properties":{"key":{"type":"string","example":"2027","description":"'mtm' | 'thereafter' | calendar year ('2027') | year-quarter ('2027-Q1')."},"label":{"type":"string","example":"2027"},"lease_count":{"type":"number"},"sqft":{"type":"number"},"annualized_base_rent":{"type":"string","example":"48200.00"},"pct_of_rent":{"type":"string","example":"12.50"},"pct_of_sqft":{"type":"string","example":"9.80"},"cumulative_pct_of_rent":{"type":"string","example":"62.30"},"contract_ids":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["key","label","lease_count","sqft","annualized_base_rent","pct_of_rent","pct_of_sqft","cumulative_pct_of_rent","contract_ids"]},"LeaseExpirationsSummaryDto":{"type":"object","properties":{"walt_years_rent_weighted":{"type":"string","example":"4.3","description":"Rent-weighted WALT, years, 1 decimal."},"walt_years_sqft_weighted":{"type":"string","example":"3.9","description":"Sqft-weighted WALT, years, 1 decimal."}},"required":["walt_years_rent_weighted","walt_years_sqft_weighted"]},"LeaseExpirationsV1Dto":{"type":"object","properties":{"as_of_date":{"type":"string","format":"date"},"reconstruction":{"type":"boolean","description":"true when as_of_date is in the past — the buckets are a best-effort reconstruction from current rows rather than an exact historical record."},"buckets":{"type":"array","items":{"$ref":"#/components/schemas/LeaseExpirationBucketDto"}},"summary":{"$ref":"#/components/schemas/LeaseExpirationsSummaryDto"},"generated_at":{"type":"string","format":"date-time"}},"required":["as_of_date","reconstruction","buckets","summary","generated_at"]},"StackingBlockDto":{"type":"object","properties":{"space":{"$ref":"#/components/schemas/RentRollSpaceRefDto"},"sqft":{"type":"number","description":"Absent when the space has no measured sqft (see `unmeasured` flag)."},"status":{"type":"string","enum":["vacant","mtm","expiring_12m","expiring_24m","expiring_36m","later"]},"tenant_name":{"type":"string"},"contract_id":{"type":"string","format":"uuid"},"end_date":{"type":"string","format":"date"},"base_rent_monthly":{"type":"string","example":"1030.00"},"flags":{"type":"array","items":{"type":"string","enum":["unmeasured"]}}},"required":["space","status","flags"]},"StackingLegendCountsDto":{"type":"object","properties":{"vacant":{"type":"number"},"mtm":{"type":"number"},"expiring_12m":{"type":"number"},"expiring_24m":{"type":"number"},"expiring_36m":{"type":"number"},"later":{"type":"number"}},"required":["vacant","mtm","expiring_12m","expiring_24m","expiring_36m","later"]},"StackingPlanV1Dto":{"type":"object","properties":{"as_of_date":{"type":"string","format":"date","description":"Resolved as-of date the block statuses are computed against — a block's expiration-horizon color is date-dependent."},"blocks":{"description":"Flat list of every leaf space in the property, sorted by expiration risk (vacant, then mtm, then nearest-to-furthest expiration horizon, `later` last) and, within the same status, by sqft descending.","type":"array","items":{"$ref":"#/components/schemas/StackingBlockDto"}},"legend_counts":{"$ref":"#/components/schemas/StackingLegendCountsDto"},"generated_at":{"type":"string","format":"date-time"}},"required":["as_of_date","blocks","legend_counts","generated_at"]},"LeasingSnapshotListItemDto":{"type":"object","properties":{"period_month":{"type":"string","format":"date","example":"2026-08-01"},"as_of_date":{"type":"string","format":"date","example":"2026-08-31"},"source":{"type":"string","enum":["auto","manual"]},"created_at":{"type":"string","format":"date-time"}},"required":["period_month","as_of_date","source","created_at"]},"LeasingSnapshotListV1Dto":{"type":"object","properties":{"snapshots":{"type":"array","items":{"$ref":"#/components/schemas/LeasingSnapshotListItemDto"}}},"required":["snapshots"]},"LeasingSnapshotV1Dto":{"type":"object","properties":{"period_month":{"type":"string","format":"date"},"as_of_date":{"type":"string","format":"date"},"source":{"type":"string","enum":["auto","manual"]},"schema_version":{"type":"number"},"rent_roll":{"$ref":"#/components/schemas/RentRollV1Dto"},"expirations_summary":{"$ref":"#/components/schemas/LeaseExpirationsSummaryDto"}},"required":["period_month","as_of_date","source","schema_version","rent_roll","expirations_summary"]},"FreezeLeasingSnapshotResultDto":{"type":"object","properties":{"period_month":{"type":"string","format":"date"},"as_of_date":{"type":"string","format":"date"},"source":{"type":"string","enum":["manual"]},"created_at":{"type":"string","format":"date-time"}},"required":["period_month","as_of_date","source","created_at"]},"FreezeLeasingSnapshotBodyDto":{"type":"object","properties":{"period_month":{"type":"string","example":"2026-08","description":"YYYY-MM; defaults to the current month."}}},"OccupancyTrendPointDto":{"type":"object","properties":{"month":{"type":"string","example":"2026-07","description":"YYYY-MM."},"as_of_date":{"type":"string","format":"date","example":"2026-07-31"},"occupancy_units_pct":{"type":"string","example":"90.0","description":"Occupied / total units, fixed-1 percent string."},"occupancy_sqft_pct":{"type":"string","example":"90.0","description":"Occupied / total sqft, fixed-1 percent string."},"unmeasured_spaces":{"type":"number","description":"Leaf spaces excluded from the sqft occupancy denominator for lack of a measured or fallback sqft."},"source":{"type":"string","enum":["frozen","reconstructed"],"description":"`frozen` when read from a `leasing_snapshots` row for this month; `reconstructed` when computed live via `RentRollService.build`."}},"required":["month","as_of_date","occupancy_units_pct","occupancy_sqft_pct","unmeasured_spaces","source"]},"OccupancyTrendV1Dto":{"type":"object","properties":{"from_date":{"type":"string","format":"date"},"to_date":{"type":"string","format":"date"},"points":{"type":"array","items":{"$ref":"#/components/schemas/OccupancyTrendPointDto"}},"reconstruction":{"type":"boolean","description":"True when at least one point required reconstruction."}},"required":["from_date","to_date","points","reconstruction"]},"AgingDocumentDto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"document_number":{"type":"string","nullable":true},"document_date":{"type":"string","format":"date"},"due_date":{"type":"string","nullable":true,"format":"date"},"bucket":{"type":"string","enum":["current","b1_30","b31_60","b61_90","b91_plus"]},"amount":{"type":"string","example":"4575.94"}},"required":["document_id","document_type","document_number","document_date","due_date","bucket","amount"]},"AgingGroupDto":{"type":"object","properties":{"party_id":{"type":"string","format":"uuid"},"party_name":{"type":"string"},"current":{"type":"string","example":"4575.94"},"b1_30":{"type":"string","example":"0.00"},"b31_60":{"type":"string","example":"0.00"},"b61_90":{"type":"string","example":"0.00"},"b91_plus":{"type":"string","example":"0.00"},"total_due":{"type":"string","example":"4575.94"},"documents":{"type":"array","items":{"$ref":"#/components/schemas/AgingDocumentDto"}}},"required":["party_id","party_name","current","b1_30","b31_60","b61_90","b91_plus","total_due","documents"]},"AgingTotalsDto":{"type":"object","properties":{"current":{"type":"string","example":"4575.94"},"b1_30":{"type":"string","example":"0.00"},"b31_60":{"type":"string","example":"0.00"},"b61_90":{"type":"string","example":"0.00"},"b91_plus":{"type":"string","example":"0.00"},"total_due":{"type":"string","example":"4575.94"}},"required":["current","b1_30","b31_60","b61_90","b91_plus","total_due"]},"RelatedPartyAgingDocumentDto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"document_number":{"type":"string","nullable":true},"document_date":{"type":"string","format":"date"},"due_date":{"type":"string","nullable":true,"format":"date"},"bucket":{"type":"string","enum":["current","b1_30","b31_60","b61_90","b91_plus"]},"amount":{"type":"string","example":"4575.94"},"is_opening":{"type":"boolean","description":"An opening balance between the two entities (an intercompany transaction created with `opening: true`)."}},"required":["document_id","document_type","document_number","document_date","due_date","bucket","amount","is_opening"]},"RelatedPartyAgingGroupDto":{"type":"object","properties":{"counterparty_legal_entity_id":{"type":"string","format":"uuid"},"counterparty_name":{"type":"string"},"current":{"type":"string","example":"1234.50"},"b1_30":{"type":"string","example":"1234.50"},"b31_60":{"type":"string","example":"1234.50"},"b61_90":{"type":"string","example":"1234.50"},"b91_plus":{"type":"string","example":"1234.50"},"without_document":{"type":"string","description":"The report entities' GL balance with this counterparty (Due From on ar, Due To on ap) that no open intercompany document explains: GL balance minus the open documents. 0 under a bucket filter.","example":"1234.50"},"total":{"type":"string","description":"The buckets plus `without_document`.","example":"1234.50"},"documents":{"type":"array","items":{"$ref":"#/components/schemas/RelatedPartyAgingDocumentDto"}}},"required":["counterparty_legal_entity_id","counterparty_name","current","b1_30","b31_60","b61_90","b91_plus","without_document","total","documents"]},"RelatedPartyAgingTotalsDto":{"type":"object","properties":{"current":{"type":"string","example":"4575.94"},"b1_30":{"type":"string","example":"0.00"},"b31_60":{"type":"string","example":"0.00"},"b61_90":{"type":"string","example":"0.00"},"b91_plus":{"type":"string","example":"0.00"},"total_due":{"type":"string","example":"4575.94"},"without_document":{"type":"string","example":"1234.50"},"no_counterparty":{"type":"string","description":"GL balance on lines that name no counterparty entity. 0 under a bucket filter.","example":"1234.50"},"total":{"type":"string","description":"The buckets plus `without_document` plus `no_counterparty`. Equals `gl_balance` unless a bucket filter is applied.","example":"1234.50"},"gl_balance":{"type":"string","description":"The report entities' Due From (ar) or Due To (ap, credit minus debit) balance as of the date, from the GL.","example":"1234.50"}},"required":["current","b1_30","b31_60","b61_90","b91_plus","total_due","without_document","no_counterparty","total","gl_balance"]},"RelatedPartiesAgingDto":{"type":"object","properties":{"groups":{"type":"array","items":{"$ref":"#/components/schemas/RelatedPartyAgingGroupDto"}},"totals":{"$ref":"#/components/schemas/RelatedPartyAgingTotalsDto"}},"required":["groups","totals"]},"ApArAgingV1Dto":{"type":"object","properties":{"as_of_date":{"type":"string","format":"date"},"side":{"type":"string","enum":["ap","ar"]},"groups":{"type":"array","items":{"$ref":"#/components/schemas/AgingGroupDto"}},"totals":{"$ref":"#/components/schemas/AgingTotalsDto"},"related_parties":{"nullable":true,"description":"Receivables (ar) or payables (ap) with your own legal entities, from intercompany documents and the Due From / Due To accounts; reconciles to the GL. Null when `party_ids` or `property_id` narrows the report: intercompany documents carry no party, and a GL balance has no property.","type":"object","allOf":[{"$ref":"#/components/schemas/RelatedPartiesAgingDto"}]},"generated_at":{"type":"string","format":"date-time"}},"required":["as_of_date","side","groups","totals","related_parties","generated_at"]},"StatementDocumentDto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid"},"document_type":{"type":"string","enum":["bill","vendor_credit","payment_out","invoice","credit_memo","payment_in"],"description":"What this line is. The credit types (vendor_credit, credit_memo) and an unapplied payment (payment_out, payment_in) carry negative amounts."},"document_number":{"type":"string","nullable":true},"document_date":{"type":"string","format":"date"},"due_date":{"type":"string","nullable":true,"format":"date"},"days_past_due":{"type":"number","nullable":true,"description":"Whole days between due_date and as_of_date, floored at 0. Null — not 0 — when the document carries no due date: \"no due date\" and \"due today\" are different facts and the statement prints them differently.","example":78},"original_amount":{"type":"string","description":"The document total, signed — vendor_credit, credit_memo, payment_out and payment_in negative.","example":"4200.00"},"applied_amount":{"type":"string","description":"original_amount − open_amount as of as_of_date. Derived rather than read back, so the three columns cannot disagree.","example":"1200.00"},"open_amount":{"type":"string","description":"What remains open on this document as of as_of_date.","example":"3000.00"}},"required":["document_id","document_type","document_number","document_date","due_date","days_past_due","original_amount","applied_amount","open_amount"]},"StatementEntityGroupDto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"documents":{"type":"array","items":{"$ref":"#/components/schemas/StatementDocumentDto"}},"entity_total":{"type":"string","description":"The sum of this section's open amounts.","example":"3000.00"}},"required":["legal_entity_id","legal_entity_name","documents","entity_total"]},"StatementPartyDto":{"type":"object","properties":{"party_id":{"type":"string","format":"uuid"},"party_name":{"type":"string"},"entities":{"description":"One section per legal entity the party trades with. Sectioned rather than summed: the counterparty invoices each entity separately and cannot reconcile a blended total against anything on their side.","type":"array","items":{"$ref":"#/components/schemas/StatementEntityGroupDto"}},"party_total":{"type":"string","description":"The sum of this party's entity_total values.","example":"3000.00"}},"required":["party_id","party_name","entities","party_total"]},"PartyStatementV1Dto":{"type":"object","properties":{"as_of_date":{"type":"string","format":"date"},"side":{"type":"string","enum":["ap","ar"]},"parties":{"description":"Empty when no party holds an open balance — a legitimate answer, not an error.","type":"array","items":{"$ref":"#/components/schemas/StatementPartyDto"}},"grand_total":{"type":"string","description":"The sum of every party_total.","example":"3000.00"},"generated_at":{"type":"string","format":"date-time"}},"required":["as_of_date","side","parties","grand_total","generated_at"]},"ActivityStatementLineDto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid","description":"The document this line is — or, for void / payment_returned, the document it reverses."},"document_type":{"type":"string","enum":["invoice","credit_memo","payment_in","bill","vendor_credit","payment_out"]},"line_kind":{"type":"string","enum":["document","void","payment_returned"],"description":"document: the document itself. void / payment_returned: its reversal, on the date the reversal landed."},"document_number":{"type":"string","nullable":true},"document_date":{"type":"string","format":"date","description":"The date of this line."},"due_date":{"type":"string","nullable":true,"format":"date"},"amount":{"type":"string","description":"Signed movement: credits, payments and reversals of charges are negative.","example":"4200.00"},"running_balance":{"type":"string","description":"Section balance after this line.","example":"5400.00"}},"required":["document_id","document_type","line_kind","document_number","document_date","due_date","amount","running_balance"]},"ActivityStatementEntityDto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"opening_balance":{"type":"string","description":"Balance carried in from before from_date.","example":"1200.00"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/ActivityStatementLineDto"}},"closing_balance":{"type":"string","description":"opening_balance plus the sum of the lines.","example":"0.00"}},"required":["legal_entity_id","legal_entity_name","opening_balance","lines","closing_balance"]},"ActivityStatementPartyDto":{"type":"object","properties":{"party_id":{"type":"string","format":"uuid"},"party_name":{"type":"string"},"entities":{"description":"One section per legal entity, never blended: the counterparty reconciles each separately.","type":"array","items":{"$ref":"#/components/schemas/ActivityStatementEntityDto"}},"party_closing_balance":{"type":"string","description":"The sum of this party's closing_balance values.","example":"0.00"}},"required":["party_id","party_name","entities","party_closing_balance"]},"PartyActivityStatementV1Dto":{"type":"object","properties":{"side":{"type":"string","enum":["ap","ar"]},"from_date":{"type":"string","format":"date"},"to_date":{"type":"string","format":"date"},"parties":{"description":"Empty when no party has a balance or activity — a legitimate answer, not an error.","type":"array","items":{"$ref":"#/components/schemas/ActivityStatementPartyDto"}},"grand_closing_balance":{"type":"string","description":"The sum of every party_closing_balance.","example":"0.00"},"generated_at":{"type":"string","format":"date-time"}},"required":["side","from_date","to_date","parties","grand_closing_balance","generated_at"]},"BillingScheduleInitializeResultV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"events_created":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["contract_id","events_created"]},"BillingScheduleRecalculateResultV1Dto":{"type":"object","properties":{"deleted_drafts":{"type":"number","description":"Always 0: recalculation never deletes a document (spec 2026-10-10 §3.1). Kept for compatibility."},"deleted_events":{"type":"number","description":"Future, unbilled pending events removed before the horizon was rebuilt."},"retired_events":{"type":"number","description":"Open past events retired (cancelled) because the lease no longer bills their month."},"events_created":{"type":"array","items":{"type":"string","format":"uuid"}},"adjustments_created":{"description":"rent_adjustment events created for already-invoiced months (§3.3).","type":"array","items":{"type":"string","format":"uuid"}}},"required":["deleted_drafts","deleted_events","retired_events","events_created","adjustments_created"]},"BillingScheduleDocumentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_number":{"type":"string","nullable":true},"document_date":{"type":"string"},"due_date":{"type":"string","nullable":true},"total_amount":{"type":"string"},"status":{"type":"string"}},"required":["id","document_number","document_date","due_date","total_amount","status"]},"BillingScheduleEventV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"event_date":{"type":"string"},"event_type":{"type":"string","enum":["invoice","straight_line_adjustment","late_fee","rent_adjustment"]},"status":{"type":"string","enum":["pending","generated","blocked","cancelled"],"description":"blocked = cannot post now (see blocked_reason); it retries automatically, or Run now / waive it."},"blocked_reason":{"type":"string","enum":["no_open_period","rejected","override_needs_manual_adjustment","target_invoice_not_posted","tax_rate_unusable"],"nullable":true,"description":"Set exactly when status is blocked. no_open_period retries automatically when a period opens; target_invoice_not_posted (a credit waiting on a taxed invoice that has not posted) and tax_rate_unusable (a term names a missing or deactivated tax rate) are retried with Run now once fixed; rejected needs Run now or a waiver; override_needs_manual_adjustment needs a manual correction, then a waiver."},"adjusts_event_id":{"type":"string","nullable":true,"format":"uuid","description":"For a rent_adjustment: the invoice event it corrects."},"generated_document_id":{"type":"string","nullable":true,"format":"uuid"},"generated_document_number":{"type":"string","nullable":true,"description":"Human-readable document number of the generated invoice (null until generated)."},"error_message":{"type":"string","nullable":true,"description":"Why the event failed or is blocked (null otherwise)."},"has_override":{"type":"boolean"},"amount":{"type":"string","nullable":true,"description":"The invoice total the billing engine projects for this event. Null once a document has been generated (read its real total instead), when the event is cancelled, or when no projection could be computed.","example":"1234.50"}},"required":["id","event_date","event_type","status","blocked_reason","adjusts_event_id","generated_document_id","generated_document_number","error_message","has_override","amount"]},"BillingScheduleEventSuggestionV1Dto":{"type":"object","properties":{"v":{"type":"number","enum":[2],"description":"Payload version. v2 items carry a tax_rate_id each; there is no total_tax."},"strategy":{"type":"string","enum":["replace_lines"]},"items":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Document line items, shaped like a document line (item_id or account_id, quantity, rate, item_total, description). Each names its own tax_rate_id (absent or null = untaxed); the server calculates the tax when the invoice is written."}},"required":["v","strategy","items"]},"ActivationMissingItemV1Dto":{"type":"object","properties":{"code":{"type":"string","enum":["start_date_required","no_billable_periods","no_billable_terms","counterparty_party_required","counterparty_legal_entity_required","invalid_term_structure","straight_line_prerequisites_missing","index_linked_config_required","late_fee_item_required","term_account_unresolvable","management_property_required","management_manager_required","management_external_manager","escalation_property_required","billing_start_date_invalid","percentage_rent_config_incomplete"],"description":"Machine-readable activation condition code. Stable API contract: clients (e.g. the FE wizard step registry) branch on code, never on message."},"message":{"type":"string"}},"required":["code","message"]},"ActivationPreviewLineV1Dto":{"type":"object","properties":{"description":{"type":"string"},"amount":{"type":"string","example":"1234.50"},"tax_rate":{"type":"string","nullable":true,"description":"The line's sales tax rate as a decimal fraction (e.g. `0.06500`), from the term's tax rate. Null for an untaxed line."},"tax_amount":{"type":"string","description":"Tax on this line, rounded per line as the invoice will book it; `0.00` when untaxed. The event's lines plus their tax sum to `total`.","example":"1234.50"}},"required":["description","amount","tax_rate","tax_amount"]},"ActivationPreviewEventV1Dto":{"type":"object","properties":{"event_date":{"type":"string"},"event_type":{"type":"string","enum":["invoice","straight_line_adjustment"]},"due_date":{"type":"string","nullable":true},"lines":{"description":"Invoice events carry the projected document lines. Straight-line events carry a single line holding the signed monthly accrual delta (positive builds the accrued-rent receivable, negative unwinds it), or no lines and a zero total for months whose delta is zero — the event is still created on activation, but document generation posts nothing for it.","type":"array","items":{"$ref":"#/components/schemas/ActivationPreviewLineV1Dto"}},"total":{"type":"string","example":"1234.50"},"estimated":{"type":"boolean","description":"True when a management-fee line on this event was priced on an ESTIMATE from the property's current lease schedules, because its period has not happened yet. Actual billing always uses what the property billed or collected; the estimate assumes full collection and leaves out variable charges (percentage rent, recovery true-ups)."}},"required":["event_date","event_type","due_date","lines","total","estimated"]},"ActivationPreviewPeriodV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string"},"label":{"type":"string"},"status":{"type":"string"},"start_date":{"type":"string"},"end_date":{"type":"string","nullable":true}},"required":["id","kind","label","status","start_date","end_date"]},"ActivationPreviewSummaryV1Dto":{"type":"object","properties":{"window_start":{"type":"string","nullable":true},"window_end":{"type":"string","nullable":true},"first_period_total":{"type":"string","nullable":true,"example":"1234.50"},"periods":{"type":"array","items":{"$ref":"#/components/schemas/ActivationPreviewPeriodV1Dto"}}},"required":["window_start","window_end","first_period_total","periods"]},"ActivationPreviewV1Dto":{"type":"object","properties":{"ready":{"type":"boolean"},"missing":{"type":"array","items":{"$ref":"#/components/schemas/ActivationMissingItemV1Dto"}},"projected_events":{"description":"Projected events (invoice + straight-line when enabled) falling in the projection window, measured from the contract's billing start and clamped by its end date. Window length is `projection_months` (default 12). Computed by the real billing engine, nothing persisted. Empty while ready=false.","type":"array","items":{"$ref":"#/components/schemas/ActivationPreviewEventV1Dto"}},"summary":{"$ref":"#/components/schemas/ActivationPreviewSummaryV1Dto"}},"required":["ready","missing","projected_events","summary"]},"BillingScheduleOkV1Dto":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]},"BillingScheduleDeletedV1Dto":{"type":"object","properties":{"deleted":{"type":"boolean"}},"required":["deleted"]},"RetryFinancialEventV1Dto":{"type":"object","properties":{"period_override_reason":{"type":"string","description":"Post into the event’s own CLOSED period, with this reason recorded on the document (requires accounting:periods_override). Without it, a re-bill whose period is closed or locked is dated in the current open period.","maxLength":1000}}},"WaiveFinancialEventV1Dto":{"type":"object","properties":{"reason":{"type":"string","description":"Why this blocked month is not billed. Recorded in the audit log.","maxLength":1000}},"required":["reason"]},"BillingSchedulePendingEventsV1Dto":{"type":"object","properties":{"total":{"type":"number","description":"Pending events across the whole horizon."},"due_today_or_past":{"type":"number","description":"Subset of `total` whose due date is today or already past."},"message":{"type":"string","description":"Human-readable summary of the pending backlog."}},"required":["total","due_today_or_past","message"]},"BillingScheduleDiagnosticsV1Dto":{"type":"object","properties":{"note":{"type":"string"},"cron":{"type":"string"},"scheduler":{"type":"string"},"today":{"type":"string"},"pending_events":{"$ref":"#/components/schemas/BillingSchedulePendingEventsV1Dto"}},"required":["note","cron","scheduler","today","pending_events"]},"BillingScheduleProcessEventsResultV1Dto":{"type":"object","properties":{"processed":{"type":"number"}},"required":["processed"]},"BillingScheduleRunResultV1Dto":{"type":"object","properties":{"processed":{"type":"number"},"results":{"type":"array","items":{"type":"object"}}},"required":["processed","results"]},"LateFeeCandidateV1Dto":{"type":"object","properties":{"invoice_id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"due_date":{"type":"string","format":"date"},"assessment_period_key":{"type":"string"},"already_assessed":{"type":"boolean","description":"A late-fee event already exists for this invoice and period."}},"required":["invoice_id","contract_id","due_date","assessment_period_key","already_assessed"]},"RunLateFeesResultV1Dto":{"type":"object","properties":{"candidates":{"type":"array","items":{"$ref":"#/components/schemas/LateFeeCandidateV1Dto"}},"created_event_ids":{"description":"Pending late_fee events created by this run; empty on a dry run. POST /v1/billing-schedules/process-events turns them into invoices. An invoice on `once` cadence that this run assessed drops out of `candidates` rather than being listed with already_assessed = true.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["candidates","created_event_ids"]},"RunLateFeesV1Dto":{"type":"object","properties":{"as_of":{"type":"string","format":"date","description":"Assess as of this date. Default: the org’s today. A real run refuses a date after the org’s today (400 VALIDATION_FAILED), and a date in a closed or locked accounting period of a legal entity it would bill (409 LATE_FEE_AS_OF_IN_CLOSED_PERIOD); a dry run may preview either."},"dry_run":{"type":"boolean","default":false,"description":"true lists the invoices a run would assess and writes nothing."}}},"WaiveLateFeeResultV1Dto":{"type":"object","properties":{"status":{"type":"string","enum":["waived"]},"credit_memo_id":{"type":"string","nullable":true,"description":"Id of the credit memo created to reverse a charged fee; null when the waived event had not yet been generated (no fee invoice existed)."}},"required":["status","credit_memo_id"]},"WaiveLateFeeV1Dto":{"type":"object","properties":{"note":{"type":"string","description":"Optional note stored as the waive credit-memo memo (charged fees) and on the exemption when exempt_source_invoice is set.","maxLength":500},"exempt_source_invoice":{"type":"boolean","description":"When true, also create a per-invoice exemption for the source invoice and waive any other pending late-fee events on it (stops future assessments).","default":false}}},"LateFeeExemptionResultV1Dto":{"type":"object","properties":{"ok":{"type":"boolean"},"removed":{"type":"boolean","description":"True when a row was removed (DELETE). Idempotent: removing an absent exemption returns ok=true, removed=false."}},"required":["ok","removed"]},"CreateLateFeeExemptionV1Dto":{"type":"object","properties":{"note":{"type":"string","description":"Optional note stored on the exemption row.","maxLength":500}}},"LateFeeAssessmentV1Dto":{"type":"object","properties":{"id":{"type":"string"},"assessment_period_key":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","charged","waived","cancelled","blocked"]},"source_invoice_id":{"type":"string","nullable":true},"source_invoice_number":{"type":"string","nullable":true},"source_invoice_due_date":{"type":"string","nullable":true},"source_invoice_exempt":{"type":"boolean","description":"Whether the source invoice carries a late-fee exemption."},"fee_invoice_id":{"type":"string","nullable":true},"fee_invoice_number":{"type":"string","nullable":true},"fee_invoice_total":{"type":"string","nullable":true},"fee_invoice_balance":{"type":"string","nullable":true},"waived_at":{"type":"string","nullable":true},"waived_by":{"type":"string","nullable":true}},"required":["id","assessment_period_key","status","source_invoice_id","source_invoice_number","source_invoice_due_date","source_invoice_exempt","fee_invoice_id","fee_invoice_number","fee_invoice_total","fee_invoice_balance","waived_at","waived_by"]},"IcAccountMappingV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source_account_id":{"type":"string","format":"uuid"},"destination_account_id":{"type":"string","format":"uuid"},"source_code":{"type":"string"},"source_name":{"type":"string"},"destination_code":{"type":"string"},"destination_name":{"type":"string"},"created_at":{"type":"string"}},"required":["id","source_account_id","destination_account_id","source_code","source_name","destination_code","destination_name","created_at"]},"CreateIcAccountMappingV1Dto":{"type":"object","properties":{"source_account_id":{"type":"string","format":"uuid"},"destination_account_id":{"type":"string","format":"uuid"}},"required":["source_account_id","destination_account_id"]},"IcTransactionListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_date":{"type":"string","format":"date"},"total_amount":{"type":"string"},"balance_amount":{"type":"string"},"status":{"type":"string"},"memo":{"type":"string","nullable":true},"from_entity_id":{"type":"string","nullable":true,"format":"uuid"},"to_entity_id":{"type":"string","nullable":true,"format":"uuid"},"from_entity_name":{"type":"string","nullable":true},"to_entity_name":{"type":"string","nullable":true},"is_opening":{"type":"boolean","description":"An opening balance between the two entities (created with `opening: true`), booked against opening balance equity."}},"required":["id","document_date","total_amount","balance_amount","status","memo","from_entity_id","to_entity_id","from_entity_name","to_entity_name","is_opening"]},"IcCreditCreatedV1Dto":{"type":"object","properties":{"credit_document_id":{"type":"string","format":"uuid","description":"The mirrored credit: an intercompany transaction from the buyer to the seller."},"settlement_document_id":{"type":"string","format":"uuid","description":"The zero-cash settlement that nets the credit against the original."},"amount":{"type":"string","example":"1234.50"}},"required":["credit_document_id","settlement_document_id","amount"]},"CreateIcCreditLineV1Dto":{"type":"object","properties":{"document_line_id":{"type":"string","format":"uuid","description":"A line of the intercompany transaction being credited."},"amount":{"type":"string","description":"How much of that line to credit. More than 0, at most the line.","example":"1234.50"}},"required":["document_line_id","amount"]},"CreateIcCreditV1Dto":{"type":"object","properties":{"document_date":{"type":"string","format":"date"},"memo":{"type":"string","description":"Why the seller credits the buyer (a dispute, a correction)."},"lines":{"type":"array","items":{"$ref":"#/components/schemas/CreateIcCreditLineV1Dto"}}},"required":["document_date","lines"]},"IcCreditV1Dto":{"type":"object","properties":{"credit_document_id":{"type":"string","format":"uuid"},"settlement_document_id":{"type":"string","format":"uuid"},"document_number":{"type":"string","nullable":true},"document_date":{"type":"string","format":"date"},"amount":{"type":"string","example":"1234.50"},"status":{"type":"string","description":"The credit document status (posted, voided)."}},"required":["credit_document_id","settlement_document_id","document_number","document_date","amount","status"]},"IcDocumentSettlementV1Dto":{"type":"object","properties":{"settlement_id":{"type":"string","format":"uuid"},"settlement_number":{"type":"string","nullable":true},"settlement_date":{"type":"string","format":"date"},"status":{"type":"string","enum":["posting_pending","posted","posting_failed"],"description":"The settlement document's lifecycle status. Only a settlement that still draws the document down is listed, so it is waiting to post, posted, or failed to post."},"applied_amount":{"type":"string","example":"1234.50"},"application_method":{"type":"string","enum":["fifo","manual","specific"]}},"required":["settlement_id","settlement_number","settlement_date","status","applied_amount","application_method"]},"IcTransactionCreatedV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"status":{"type":"string"},"total_amount":{"type":"string"},"balance_amount":{"type":"string"},"journal_entry_id":{"type":"string","format":"uuid"}},"required":["id","document_type","status","total_amount","balance_amount","journal_entry_id"]},"CreateIcTransactionLineV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid","description":"Income account on from_entity. Required unless `opening` is true; refused when it is."},"destination_account_id":{"type":"string","format":"uuid","description":"Expense account on to_entity. Required unless `opening` is true; refused when it is."},"amount":{"type":"string","example":"1234.50"},"description":{"type":"string"},"dimensions":{"type":"object","additionalProperties":{"type":"string","nullable":true},"description":"Dimension values keyed by dimension code (line-level). Key with null = explicit \"None\" answer."}},"required":["amount"]},"CreateIcTransactionV1Dto":{"type":"object","properties":{"from_entity_id":{"type":"string","format":"uuid"},"to_entity_id":{"type":"string","format":"uuid"},"document_date":{"type":"string","format":"date"},"due_date":{"type":"string","format":"date"},"dimensions":{"type":"object","additionalProperties":{"type":"string","nullable":true},"description":"Header-level dimension values. Key with null = explicit \"None\" answer."},"memo":{"type":"string"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/CreateIcTransactionLineV1Dto"}},"opening":{"type":"boolean","description":"An opening balance between the two entities: both legs book against each entity's `opening_balance_equity` account (DR Due From / CR opening balance equity on from_entity, DR opening balance equity / CR Due To on to_entity), so nothing reaches income or expense. Lines then send only `amount` (and optional `description` / `dimensions`). The document is stamped `source_type: opening_balance` and lists with `is_opening: true`. An entity with no opening balance equity account is refused with MISSING_SYSTEM_ROLE_ACCOUNT."}},"required":["from_entity_id","to_entity_id","document_date","due_date","lines"]},"IcOpenDocV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_date":{"type":"string","format":"date"},"balance_amount":{"type":"string","example":"1234.50"},"from_entity_id":{"type":"string","format":"uuid"},"to_entity_id":{"type":"string","format":"uuid"}},"required":["id","document_date","balance_amount","from_entity_id","to_entity_id"]},"IcOpenTransactionsBucketV1Dto":{"type":"object","properties":{"from_entity_id":{"type":"string","format":"uuid"},"to_entity_id":{"type":"string","format":"uuid"},"a_to_b":{"type":"array","items":{"$ref":"#/components/schemas/IcOpenDocV1Dto"}},"b_to_a":{"type":"array","items":{"$ref":"#/components/schemas/IcOpenDocV1Dto"}},"net_amount":{"type":"string","example":"1234.50"},"net_direction":{"type":"string","enum":["a_to_b","b_to_a","balanced"]}},"required":["from_entity_id","to_entity_id","a_to_b","b_to_a","net_amount","net_direction"]},"IcSettlementListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_date":{"type":"string","format":"date"},"total_amount":{"type":"string"},"status":{"type":"string"},"settlement_status":{"type":"string","nullable":true,"enum":["pending_approval","approved","disputed"],"description":"The settlement approval status: created pending_approval (approved when it posts on creation), then moved by approve and dispute."},"memo":{"type":"string","nullable":true},"from_entity_id":{"type":"string","nullable":true,"format":"uuid"},"to_entity_id":{"type":"string","nullable":true,"format":"uuid"},"from_entity_name":{"type":"string","nullable":true},"to_entity_name":{"type":"string","nullable":true}},"required":["id","document_date","total_amount","status","settlement_status","memo","from_entity_id","to_entity_id","from_entity_name","to_entity_name"]},"IcSettlementApplicationV1Dto":{"type":"object","properties":{"source_document_id":{"type":"string","format":"uuid"},"source_document_number":{"type":"string","nullable":true},"source_document_date":{"type":"string","format":"date"},"applied_amount":{"type":"string"},"application_method":{"type":"string","enum":["fifo","manual","specific"]},"sequence_applied":{"type":"number","nullable":true}},"required":["source_document_id","source_document_number","source_document_date","applied_amount","application_method","sequence_applied"]},"IcSettlementDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_date":{"type":"string","format":"date"},"total_amount":{"type":"string"},"status":{"type":"string"},"settlement_status":{"type":"string","nullable":true,"enum":["pending_approval","approved","disputed"],"description":"The settlement approval status: created pending_approval (approved when it posts on creation), then moved by approve and dispute."},"memo":{"type":"string","nullable":true},"from_entity_id":{"type":"string","nullable":true,"format":"uuid"},"to_entity_id":{"type":"string","nullable":true,"format":"uuid"},"from_entity_name":{"type":"string","nullable":true},"to_entity_name":{"type":"string","nullable":true},"journal_entry_id":{"type":"string","nullable":true,"format":"uuid"},"bank_transaction_id":{"type":"string","nullable":true,"format":"uuid"},"applications":{"type":"array","items":{"$ref":"#/components/schemas/IcSettlementApplicationV1Dto"}},"created_at":{"type":"string","format":"date-time"}},"required":["id","document_date","total_amount","status","settlement_status","memo","from_entity_id","to_entity_id","from_entity_name","to_entity_name","journal_entry_id","bank_transaction_id","applications","created_at"]},"IcSettlementCreatedV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string"},"journal_entry_id":{"type":"string","format":"uuid"},"total_amount":{"type":"string"},"from_entity_id":{"type":"string","format":"uuid"},"to_entity_id":{"type":"string","format":"uuid"},"applications_count":{"type":"number"}},"required":["id","status","total_amount","from_entity_id","to_entity_id","applications_count"]},"CreateIcManualApplicationV1Dto":{"type":"object","properties":{"source_document_id":{"type":"string","format":"uuid"},"applied_amount":{"type":"string","example":"1234.50"}},"required":["source_document_id","applied_amount"]},"CreateIcSettlementV1Dto":{"type":"object","properties":{"from_entity_id":{"type":"string","format":"uuid"},"to_entity_id":{"type":"string","format":"uuid"},"total_amount":{"type":"string","example":"1234.50"},"document_date":{"type":"string","format":"date"},"memo":{"type":"string"},"bank_transaction_id":{"type":"string","format":"uuid"},"paired_transaction_id":{"type":"string","format":"uuid","description":"Optional. The other side of the same wire: the counterpart bank transaction on the other party's bank (the `paired_transaction_id` of an `ic_transfer_pair` suggestion). Both lines become `accounted` and point at the new settlement. Requires `bank_transaction_id` (on the banking route, the transaction in the URL). Refused with IC_SETTLEMENT_PAIRED_TRANSACTION_INVALID unless it is in this organization, is not the first line, is not pending, is on a bank of the settlement party that does not own the first line's bank, has the first line's amount with the opposite sign (so the payer's bank shows the outflow and the payee's the inflow, and its absolute amount is the settlement total), is on a bank in the settlement's currency, and that bank has a cash account configured — the payee's or payer's cash leg posts to it; refused with IC_SETTLEMENT_BANK_TRANSACTION_ALREADY_PROCESSED if it is already categorized or linked. A refusal writes nothing."},"auto_post":{"type":"boolean","default":false},"application_method":{"type":"string","enum":["fifo","manual"]},"manual_applications":{"type":"array","items":{"$ref":"#/components/schemas/CreateIcManualApplicationV1Dto"}}},"required":["from_entity_id","to_entity_id","total_amount","document_date","application_method"]},"IcSettlementStatusV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"settlement_status":{"type":"string","enum":["pending_approval","approved","disputed"],"description":"The settlement approval status after the review action."}},"required":["id","settlement_status"]},"DisputeIcSettlementV1Dto":{"type":"object","properties":{"note":{"type":"string"}},"required":["note"]},"IcSettlementPostedV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"journal_entry_id":{"type":"string","format":"uuid"}},"required":["id","journal_entry_id"]},"IcSettlementVoidedV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"success":{"type":"boolean"}},"required":["id","success"]},"VoidIcSettlementV1Dto":{"type":"object","properties":{"memo":{"type":"string"}},"required":["memo"]},"IcStatementLineV1Dto":{"type":"object","properties":{"journal_entry_id":{"type":"string","format":"uuid"},"entry_date":{"type":"string","format":"date"},"document_type":{"type":"string","nullable":true,"description":"The source document type (intercompany_transaction, intercompany_settlement, …), null for a journal with no document."},"document_id":{"type":"string","nullable":true,"format":"uuid"},"document_number":{"type":"string","nullable":true},"memo":{"type":"string","nullable":true},"amount":{"type":"string","description":"Change in what the counterparty owes the entity: positive raises it, negative lowers it (or raises what the entity owes).","example":"1234.50"},"running_balance":{"type":"string","example":"1234.50"}},"required":["journal_entry_id","entry_date","document_type","document_id","document_number","memo","amount","running_balance"]},"IcStatementV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"counterparty_legal_entity_id":{"type":"string","format":"uuid"},"from_date":{"type":"string","format":"date"},"to_date":{"type":"string","format":"date"},"opening_balance":{"type":"string","description":"What the counterparty owed the entity before `from_date` (negative: what the entity owed it), from the entity's Due From and Due To lines naming the counterparty.","example":"1234.50"},"closing_balance":{"type":"string","example":"1234.50"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/IcStatementLineV1Dto"}}},"required":["legal_entity_id","counterparty_legal_entity_id","from_date","to_date","opening_balance","closing_balance","lines"]},"IcPositionRowV1Dto":{"type":"object","properties":{"creditor_entity_id":{"type":"string","format":"uuid","description":"The entity that is owed."},"creditor_name":{"type":"string"},"debtor_entity_id":{"type":"string","format":"uuid","description":"The entity that owes."},"debtor_name":{"type":"string"},"balance":{"type":"string","description":"What the debtor owes the creditor, net of both intercompany accounts. Always positive.","example":"1234.50"}},"required":["creditor_entity_id","creditor_name","debtor_entity_id","debtor_name","balance"]},"IcAgingRowV1Dto":{"type":"object","properties":{"from_entity_id":{"type":"string","format":"uuid"},"from_entity_name":{"type":"string"},"to_entity_id":{"type":"string","format":"uuid"},"to_entity_name":{"type":"string"},"bucket_0_30":{"type":"string"},"bucket_31_60":{"type":"string"},"bucket_61_90":{"type":"string"},"bucket_90_plus":{"type":"string"},"total_open":{"type":"string"}},"required":["from_entity_id","from_entity_name","to_entity_id","to_entity_name","bucket_0_30","bucket_31_60","bucket_61_90","bucket_90_plus","total_open"]},"ContractTypeRefV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string"},"name":{"type":"string"}},"required":["id","code","name"]},"ContractLocationV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The space when the contract names one, the property otherwise."},"code":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["property","space"],"description":"Which record `id` names. The same two values `search_documents.kind` uses (D13)."},"property_id":{"type":"string","format":"uuid","description":"The property this location belongs to — equal to `id` when `kind` is `property`, and the ROOT property when `kind` is `space`. A space has no page of its own, so a client routes a space link through this."},"role":{"type":"string","description":"primary = linked by the client; related/billing_target = legacy manual roles."}},"required":["id","code","name","kind","property_id","role"]},"ContractListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"contract_type":{"$ref":"#/components/schemas/ContractTypeRefV1Dto"},"status":{"type":"string"},"title":{"type":"string"},"external_ref":{"type":"string","nullable":true},"legal_entity_id":{"type":"string","format":"uuid"},"counterparty_party_id":{"type":"string","nullable":true,"format":"uuid"},"counterparty_legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"counterparty_name":{"type":"string","nullable":true},"effective_date":{"type":"string","nullable":true},"start_date":{"type":"string","nullable":true},"end_date":{"type":"string","nullable":true},"billing_frequency":{"type":"string","enum":["weekly","biweekly","monthly","quarterly","semiannual","yearly"]},"billing_anchor_day":{"type":"number","nullable":true,"minimum":1,"maximum":31},"proration_method":{"type":"string","enum":["actual_days","thirty_day","three_sixty_five"],"nullable":true},"prorate_start":{"type":"boolean"},"prorate_end":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"locations":{"description":"The properties and spaces this contract sits on. Same shape on list and detail responses.","type":"array","items":{"$ref":"#/components/schemas/ContractLocationV1Dto"}},"rentable_sqft":{"type":"number","nullable":true,"description":"The lease’s own negotiated rentable area — `lease_terms.rentable_sqft`, the figure every square-footage recovery share resolves against. NULL for a contract with no lease terms (a service agreement has none) and for a lease whose area is genuinely not applicable or not yet measured: a ground lease priced per acre, a parking or antenna licence, a suite let before as-built measurement. It is NOT zero-filled, because a zero would silently shrink every other participant’s denominator. Present on the list so a caller can tell, before offering a square-footage basis, which leases can support one.","example":4200}},"required":["id","org_id","contract_type","status","title","external_ref","legal_entity_id","counterparty_party_id","counterparty_legal_entity_id","counterparty_name","effective_date","start_date","end_date","billing_frequency","created_at","locations","rentable_sqft"]},"LeaseOverlapV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"contract_title":{"type":"string","description":"The existing lease's title."},"counterparty_name":{"type":"string","nullable":true,"description":"The tenant on the existing lease. Null when the contract names no counterparty party."},"start_date":{"type":"string","format":"date","description":"The existing lease's first covered day."},"end_date":{"type":"string","format":"date","nullable":true,"description":"The date the existing lease stops covering the location — `LEAST(end_date, termination_date)`, because a terminated lease keeps the `end_date` it was signed with. Null means open-ended."}},"required":["contract_id","contract_title","counterparty_name","start_date","end_date"]},"ContractTermTypeRefV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string"},"name":{"type":"string"}},"required":["id","code","name"]},"ContractTermV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"term_type":{"$ref":"#/components/schemas/ContractTermTypeRefV1Dto"},"period_id":{"type":"string","nullable":true,"format":"uuid"},"effective_start":{"type":"string","nullable":true},"effective_end":{"type":"string","nullable":true},"term":{"type":"object","additionalProperties":true,"description":"Term payload (jsonb). Its shape is defined by the term type, so it is deliberately unconstrained here."},"introduced_by_amendment_id":{"type":"string","nullable":true,"format":"uuid","description":"The amendment that introduced this term. Null for an original-lease term."},"superseded_by_amendment_id":{"type":"string","nullable":true,"format":"uuid","description":"The amendment that retired this term. Null means the term is currently in force — a non-null value here does not depend on `?as_of=`; supersession is a fact about the row, not the query date."}},"required":["id","term_type","period_id","effective_start","effective_end","term","introduced_by_amendment_id","superseded_by_amendment_id"]},"ContractPeriodV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["initial","option"]},"label":{"type":"string"},"start_date":{"type":"string"},"end_date":{"type":"string","nullable":true},"notice_date":{"type":"string","nullable":true},"status":{"type":"string"},"sort_order":{"type":"number"},"exercised_at":{"type":"string","nullable":true,"format":"date-time"}},"required":["id","kind","label","start_date","end_date","notice_date","status","sort_order","exercised_at"]},"ContractLeaseTermsV1Dto":{"type":"object","properties":{"lease_subtype":{"type":"string","enum":["gross","net","double_net","triple_net","modified_gross","percentage"],"nullable":true},"possession_date":{"type":"string","nullable":true,"format":"date"},"rent_commencement_date":{"type":"string","nullable":true,"format":"date"},"rentable_sqft":{"type":"number","nullable":true},"security_deposit":{"type":"string","nullable":true,"example":"1234.50"},"notes":{"type":"string","nullable":true}},"required":["lease_subtype","possession_date","rent_commencement_date","rentable_sqft","notes"]},"ContractV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"contract_type":{"$ref":"#/components/schemas/ContractTypeRefV1Dto"},"status":{"type":"string"},"title":{"type":"string"},"external_ref":{"type":"string","nullable":true},"legal_entity_id":{"type":"string","format":"uuid"},"counterparty_party_id":{"type":"string","nullable":true,"format":"uuid"},"counterparty_legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"counterparty_name":{"type":"string","nullable":true},"effective_date":{"type":"string","nullable":true},"start_date":{"type":"string","nullable":true},"end_date":{"type":"string","nullable":true},"billing_frequency":{"type":"string","enum":["weekly","biweekly","monthly","quarterly","semiannual","yearly"]},"billing_anchor_day":{"type":"number","nullable":true,"minimum":1,"maximum":31},"proration_method":{"type":"string","enum":["actual_days","thirty_day","three_sixty_five"],"nullable":true},"prorate_start":{"type":"boolean"},"prorate_end":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"locations":{"description":"The properties and spaces this contract sits on. Same shape on list and detail responses.","type":"array","items":{"$ref":"#/components/schemas/ContractLocationV1Dto"}},"rentable_sqft":{"type":"number","nullable":true,"description":"The lease’s own negotiated rentable area — `lease_terms.rentable_sqft`, the figure every square-footage recovery share resolves against. NULL for a contract with no lease terms (a service agreement has none) and for a lease whose area is genuinely not applicable or not yet measured: a ground lease priced per acre, a parking or antenna licence, a suite let before as-built measurement. It is NOT zero-filled, because a zero would silently shrink every other participant’s denominator. Present on the list so a caller can tell, before offering a square-footage basis, which leases can support one.","example":4200},"version":{"type":"number","description":"Optimistic-lock counter (D-09). The same value the ETag carries, in the body so a client editing this contract can hold it in form state and send it back as If-Match on PATCH."},"legal_entity_name":{"type":"string","nullable":true},"straight_line_rent_enabled":{"type":"boolean","description":"When true, GAAP straight-line rent recognition is enabled for this lease."},"billing_start_date":{"type":"string","format":"date","nullable":true,"description":"Migration cutoff. Nothing is billed or posted for a service period that begins before this date. Null bills from the lease start."},"opening_straight_line_balance":{"type":"string","nullable":true,"description":"Accrued straight-line rent receivable at billing_start_date, from the prior books. Stored only; never posted.","example":"1234.50"},"summary":{"type":"string","nullable":true},"due_date_type":{"type":"string","enum":["days_after_invoice","day_of_month","last_day_of_month"]},"due_date_value":{"type":"number","nullable":true},"late_fee_type":{"type":"string","enum":["percentage","fixed"],"nullable":true},"late_fee_amount":{"type":"string","nullable":true,"example":"1234.50"},"late_fee_basis":{"type":"string","enum":["overdue_balance","invoice_total"],"nullable":true},"late_fee_grace_days":{"type":"number","nullable":true},"late_fee_cadence":{"type":"string","enum":["once","monthly","per_billing_period"],"nullable":true},"late_fee_item_id":{"type":"string","format":"uuid","nullable":true,"description":"Overrides the org's default late-fee item for this contract. Null means the org default (the item carrying system_role 'late_fee') is used."},"termination_date":{"type":"string","nullable":true,"format":"date"},"termination_proration":{"type":"string","enum":["full","prorated"],"nullable":true},"termination_reason":{"type":"string","nullable":true},"terminated_at":{"type":"string","nullable":true},"terms":{"type":"array","items":{"$ref":"#/components/schemas/ContractTermV1Dto"}},"periods":{"description":"Initial period plus any renewal options, ordered by start date.","type":"array","items":{"$ref":"#/components/schemas/ContractPeriodV1Dto"}},"lease_terms":{"nullable":true,"description":"RE-specific lease extension. Null for non-lease contracts.","type":"object","allOf":[{"$ref":"#/components/schemas/ContractLeaseTermsV1Dto"}]}},"required":["id","org_id","contract_type","status","title","external_ref","legal_entity_id","counterparty_party_id","counterparty_legal_entity_id","counterparty_name","effective_date","start_date","end_date","billing_frequency","created_at","locations","rentable_sqft","version","legal_entity_name","straight_line_rent_enabled","billing_start_date","opening_straight_line_balance","summary","due_date_type","due_date_value","late_fee_type","late_fee_amount","late_fee_basis","late_fee_grace_days","late_fee_cadence","late_fee_item_id","termination_date","termination_proration","termination_reason","terminated_at","terms","periods","lease_terms"]},"ContractRentScheduleWindowV1Dto":{"type":"object","properties":{"start":{"type":"string","format":"date","nullable":true,"description":"Billing window start. Null when the lease resolves none."},"end":{"type":"string","format":"date","nullable":true,"description":"Billing window end. Null for an open-ended lease."}},"required":["start","end"]},"ContractRentScheduleEntryV1Dto":{"type":"object","properties":{"date":{"type":"string","format":"date","description":"Invoice/anchor date for this period — the same date the billing engine stamps on `financial_events.event_date`."},"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"stub_start":{"type":"string","format":"date","nullable":true,"description":"Set when this entry is a partial period; null for a full one."},"stub_end":{"type":"string","format":"date","nullable":true},"proration_factor":{"type":"number","description":"1 for a full period; less for a prorated stub."},"fixed_base_amount":{"type":"string","description":"Fixed base rent billed for this period, prorated. Sums only BILLABLE fixed base-rent terms — percentage rent and percentage fees are excluded, exactly as the billing engine excludes them.","example":"1234.50"},"straight_line_basis_amount":{"type":"string","description":"The ASC 842 guaranteed-minimum basis for this period, prorated by the same factor as `fixed_base_amount`. Equal to `fixed_base_amount` for every entry whose `index_status` is `none`, which is every fixed and stepped lease. NOT what is billed: for an index-linked term this is the clause floor measured at commencement and never remeasured by an actual reading (U7-D1), so accepting a reset moves `fixed_base_amount` and moves this not at all.","example":"1234.50"},"index_status":{"type":"string","enum":["none","settled","provisional"],"description":"Whether this period’s `fixed_base_amount` is settled. `none` when no index-linked fixed base-rent term is in force. `settled` when every such term is decided, or no reset has come due yet. `provisional` when at least one is holding over past an undecided reset — the amount is the clause’s holdover rent, not an agreed one. NOT the event status `awaiting_index`: most provisional periods are future ones with no event at all."}},"required":["date","period_start","period_end","stub_start","stub_end","proration_factor","fixed_base_amount","straight_line_basis_amount","index_status"]},"ContractRentScheduleV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"window":{"description":"The billing window this series covers. `end` is null for an open-ended lease.","allOf":[{"$ref":"#/components/schemas/ContractRentScheduleWindowV1Dto"}]},"capped_end":{"type":"string","format":"date","nullable":true,"description":"`window.end` after the termination cap — earlier than `window.end` when a termination is scheduled."},"entries":{"type":"array","items":{"$ref":"#/components/schemas/ContractRentScheduleEntryV1Dto"}}},"required":["contract_id","window","capped_end","entries"]},"LifecycleRedeliveryV1Dto":{"type":"object","properties":{"delivery_id":{"type":"string","format":"uuid","description":"The delivery sent again."},"status":{"type":"string","enum":["pending"],"description":"Always `pending`: the delivery is queued and runs within a minute. Read the work item or the close readiness to see it land."}},"required":["delivery_id","status"]},"ContractPeriodInputV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["initial","option"]},"label":{"type":"string"},"start_date":{"type":"string"},"end_date":{"type":"string","nullable":true},"notice_date":{"type":"string","nullable":true},"sort_order":{"type":"number"}},"required":["kind","start_date"]},"ContractLeaseTermsInputV1Dto":{"type":"object","properties":{"lease_subtype":{"type":"string","enum":["gross","net","double_net","triple_net","modified_gross","percentage"],"nullable":true},"possession_date":{"type":"string","nullable":true},"rent_commencement_date":{"type":"string","nullable":true},"rentable_sqft":{"type":"number","nullable":true},"security_deposit":{"type":"string","nullable":true,"example":"1234.50"},"notes":{"type":"string","nullable":true,"maxLength":2000}}},"CreateContractTermV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The id of an existing term on this contract to update in place. Send back the id from GET /v1/contracts/{id} for terms you are editing; OMIT it for terms you are adding. A term already on the contract whose id is absent from the payload is DELETED. Ignored on create."},"term_type_id":{"type":"string","format":"uuid"},"term_type_code":{"type":"string"},"effective_start":{"type":"string"},"effective_end":{"type":"string"},"term":{"type":"object","additionalProperties":true,"description":"Term payload (jsonb). Its shape is defined by the term type, so it is deliberately unconstrained here."},"period_ref":{"type":"number","minimum":0,"description":"Index into the request's periods[] array this term belongs to. Omit to default to the initial period."},"period_id":{"type":"string","format":"uuid"}},"required":["term"]},"CreateContractV1Dto":{"type":"object","properties":{"contract_type_id":{"type":"string","format":"uuid"},"contract_type_code":{"type":"string","maxLength":64},"title":{"type":"string","maxLength":500},"legal_entity_id":{"type":"string","format":"uuid"},"counterparty_party_id":{"type":"string","format":"uuid"},"counterparty_legal_entity_id":{"type":"string","format":"uuid"},"location_ids":{"description":"Locations to link. Each id names a property, or a space within one — a space link records its property automatically, so the response no longer repeats every level of the parent chain.","type":"array","items":{"type":"string","format":"uuid"}},"effective_date":{"type":"string","description":"Optional at create so wizard/partial drafts can be created dateless. Activation readiness (not POST validation) enforces dates."},"start_date":{"type":"string","description":"Optional at create. When present (and periods[] is omitted) the initial period is synthesized from it; when absent NO period is created and the draft is dateless."},"end_date":{"type":"string","description":"Optional at create. Omit with start_date present for an open-ended initial period. Requires start_date (or periods[])."},"billing_frequency":{"type":"string","enum":["weekly","biweekly","monthly","quarterly","semiannual","yearly"],"default":"monthly"},"billing_anchor_day":{"type":"number","minimum":1,"maximum":31,"description":"Calendar day invoices bill on. Null = anchor to start date (no proration). Clamped to month-end for short months."},"proration_method":{"type":"string","enum":["actual_days","thirty_day","three_sixty_five"]},"prorate_start":{"type":"boolean","default":false,"description":"Bill the partial first period at the daily rate."},"prorate_end":{"type":"boolean","default":false,"description":"Bill the partial last period at the daily rate."},"straight_line_rent_enabled":{"type":"boolean","description":"Enable GAAP straight-line rent recognition for this lease (lessor income). Default false.","default":false},"billing_start_date":{"type":"string","format":"date","nullable":true,"description":"Migration cutoff: nothing is billed or posted for a service period that begins before this date. Must fall within start_date..end_date. Draft only."},"opening_straight_line_balance":{"type":"string","nullable":true,"description":"Accrued straight-line rent receivable at billing_start_date, from the prior books (may be negative). Requires billing_start_date. Stored only; never posted.","example":"1234.50"},"summary":{"type":"string","maxLength":2000},"external_ref":{"type":"string","maxLength":200},"due_date_type":{"type":"string","enum":["days_after_invoice","day_of_month","last_day_of_month"],"default":"days_after_invoice"},"due_date_value":{"type":"number","description":"Meaning depends on due_date_type: day-of-month (1-31) for 'day_of_month', days after invoice date for 'days_after_invoice'. Must be omitted for 'last_day_of_month'."},"late_fee_type":{"type":"string","enum":["percentage","fixed"],"nullable":true,"description":"Late-fee policy. percentage: late_fee_amount is a rate (5 = 5%) applied to late_fee_basis. fixed: late_fee_amount is a flat charge. Null/omitted: late fees disabled."},"late_fee_amount":{"type":"string","nullable":true,"description":"Rate (percentage) or flat amount (fixed). Must be > 0 when late_fee_type is set.","example":"1234.50"},"late_fee_basis":{"type":"string","enum":["overdue_balance","invoice_total"],"nullable":true,"description":"What a percentage fee applies to. Required for percentage, forbidden for fixed."},"late_fee_grace_days":{"type":"number","nullable":true,"description":"Days past the due date before a fee is assessed. Null = 0 (late the day after due date)."},"late_fee_cadence":{"type":"string","enum":["once","monthly","per_billing_period"],"nullable":true,"description":"How often the fee re-applies while an invoice stays overdue. 'once': assessed a single time. 'monthly': re-assessed every month overdue. 'per_billing_period': re-assessed each billing period overdue. Defaults to 'once' when late_fee_type is set and this is omitted."},"late_fee_item_id":{"type":"string","format":"uuid","nullable":true,"description":"Overrides the org's default late-fee item. Omit or null to use the org default."},"periods":{"description":"Initial period plus any renewal options. Omit to synthesize a single initial period from start_date/end_date (back-compat).","type":"array","items":{"$ref":"#/components/schemas/ContractPeriodInputV1Dto"}},"lease_terms":{"$ref":"#/components/schemas/ContractLeaseTermsInputV1Dto"},"terms":{"type":"array","items":{"$ref":"#/components/schemas/CreateContractTermV1Dto"}}},"required":["title","legal_entity_id","terms"]},"UpdateContractV1Dto":{"type":"object","properties":{"title":{"type":"string","maxLength":500},"legal_entity_id":{"type":"string","format":"uuid"},"counterparty_party_id":{"type":"string","format":"uuid"},"counterparty_legal_entity_id":{"type":"string","format":"uuid","nullable":true,"description":"The other entity of the org a management (`fee_based`) contract bills; null clears it, an omitted key keeps it. Any other contract may not name one, and no contract may name its own legal_entity_id (422 CONTRACT_COUNTERPARTY_LEGAL_ENTITY_NOT_ALLOWED)."},"location_ids":{"description":"Locations to link. Each id names a property, or a space within one — a space link records its property automatically, so the response no longer repeats every level of the parent chain.","type":"array","items":{"type":"string","format":"uuid"}},"effective_date":{"type":"string"},"start_date":{"type":"string"},"end_date":{"type":"string"},"billing_frequency":{"type":"string","enum":["weekly","biweekly","monthly","quarterly","semiannual","yearly"]},"billing_anchor_day":{"type":"number","minimum":1,"maximum":31,"description":"Calendar day invoices bill on. Null = anchor to start date (no proration). Clamped to month-end for short months."},"proration_method":{"type":"string","enum":["actual_days","thirty_day","three_sixty_five"]},"prorate_start":{"type":"boolean","default":false,"description":"Bill the partial first period at the daily rate."},"prorate_end":{"type":"boolean","default":false,"description":"Bill the partial last period at the daily rate."},"straight_line_rent_enabled":{"type":"boolean","description":"Enable/disable GAAP straight-line rent recognition for this lease."},"billing_start_date":{"type":"string","format":"date","nullable":true,"description":"Migration cutoff: nothing is billed or posted for a service period that begins before this date. Must fall within start_date..end_date. Draft only."},"opening_straight_line_balance":{"type":"string","nullable":true,"description":"Accrued straight-line rent receivable at billing_start_date, from the prior books (may be negative). Requires billing_start_date. Stored only; never posted.","example":"1234.50"},"summary":{"type":"string","maxLength":2000},"external_ref":{"type":"string","maxLength":200},"due_date_type":{"type":"string","enum":["days_after_invoice","day_of_month","last_day_of_month"]},"due_date_value":{"type":"number","description":"Meaning depends on due_date_type: day-of-month (1-31) for 'day_of_month', days after invoice date for 'days_after_invoice'. Must be omitted for 'last_day_of_month'."},"late_fee_type":{"type":"string","enum":["percentage","fixed"],"nullable":true,"description":"Late-fee policy. percentage: late_fee_amount is a rate (5 = 5%) applied to late_fee_basis. fixed: late_fee_amount is a flat charge. Null/omitted: late fees disabled."},"late_fee_amount":{"type":"string","nullable":true,"description":"Rate (percentage) or flat amount (fixed). Must be > 0 when late_fee_type is set.","example":"1234.50"},"late_fee_basis":{"type":"string","enum":["overdue_balance","invoice_total"],"nullable":true,"description":"What a percentage fee applies to. Required for percentage, forbidden for fixed."},"late_fee_grace_days":{"type":"number","nullable":true,"description":"Days past the due date before a fee is assessed. Null = 0 (late the day after due date)."},"late_fee_cadence":{"type":"string","enum":["once","monthly","per_billing_period"],"nullable":true,"description":"How often the fee re-applies while an invoice stays overdue. 'once': assessed a single time. 'monthly': re-assessed every month overdue. 'per_billing_period': re-assessed each billing period overdue. Defaults to 'once' when late_fee_type is set and this is omitted."},"late_fee_item_id":{"type":"string","format":"uuid","nullable":true,"description":"Overrides the org's default late-fee item. Omit or null to use the org default."},"lease_terms":{"$ref":"#/components/schemas/ContractLeaseTermsInputV1Dto"},"terms":{"type":"array","items":{"$ref":"#/components/schemas/CreateContractTermV1Dto"}}}},"AmendmentPeriodChangeV1Dto":{"type":"object","properties":{"period_id":{"type":"string","format":"uuid"},"change_kind":{"type":"string","enum":["dates","added","removed","waived","exercised"],"description":"dates moves the window; added has no before (old dates NULL); removed, waived and exercised are status acts whose old dates equal the new ones."},"period_label":{"type":"string","description":"The period's current label, e.g. 'Option 1'."},"old_start_date":{"type":"string","format":"date","nullable":true,"description":"NULL when the amendment added the period: it had no window."},"old_end_date":{"type":"string","format":"date","nullable":true,"description":"NULL when the period was open-ended before the amendment."},"new_start_date":{"type":"string","format":"date"},"new_end_date":{"type":"string","format":"date","nullable":true,"description":"NULL when the amendment made the period open-ended."}},"required":["period_id","change_kind","period_label","old_start_date","old_end_date","new_start_date","new_end_date"]},"AmendmentRentableSqftChangeV1Dto":{"type":"object","properties":{"from":{"type":"number","nullable":true,"description":"The area before the amendment; NULL when it was unset."},"to":{"type":"number","nullable":true,"description":"The area the amendment set; NULL when it cleared it."}},"required":["from","to"]},"AmendmentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"sequence_no":{"type":"number","description":"1-based, gapless per contract. Ordered oldest first."},"amendment_type":{"type":"string","enum":["rent_change","other","option_exercise","term_extension","term_reduction","option_addition","option_removal","option_waiver"]},"executed_on":{"type":"string","format":"date","description":"When the parties signed."},"effective_on":{"type":"string","format":"date","description":"When the change takes economic effect."},"recorded_at":{"type":"string","format":"date-time","description":"Decision time — when the system learned of this amendment. May be later than effective_on for a change recorded after the fact."},"reason":{"type":"string","nullable":true},"document_file_id":{"type":"string","nullable":true,"format":"uuid"},"created_by":{"type":"string","format":"uuid"},"period_changes":{"description":"Periods this amendment acted on — dates moved, or an option added, removed, waived or exercised — with each window before and after. Always present; empty when the amendment touched no period.","type":"array","items":{"$ref":"#/components/schemas/AmendmentPeriodChangeV1Dto"}},"rentable_sqft_change":{"nullable":true,"description":"The lease's rentable area before and after this amendment. NULL when the amendment did not change the area.","type":"object","allOf":[{"$ref":"#/components/schemas/AmendmentRentableSqftChangeV1Dto"}]}},"required":["id","sequence_no","amendment_type","executed_on","effective_on","recorded_at","reason","document_file_id","created_by","period_changes","rentable_sqft_change"]},"AmendmentTermInputV1Dto":{"type":"object","properties":{"term_type_id":{"type":"string","format":"uuid"},"term_type_code":{"type":"string"},"effective_start":{"type":"string","format":"date"},"effective_end":{"type":"string","format":"date"},"term":{"type":"object","additionalProperties":true,"description":"Term payload (jsonb). Its shape is defined by the term type, so it is deliberately unconstrained here."},"period_id":{"type":"string","format":"uuid","description":"The existing contract period this term attaches to. Send this or new_period_index, exactly one."},"new_period_index":{"type":"integer","minimum":0,"description":"Zero-based index into this amendment's add_periods: the new option this term attaches to. option_addition only. Send this or period_id, exactly one."}},"required":["term"]},"AmendmentPeriodChangeInputV1Dto":{"type":"object","properties":{"period_id":{"type":"string","format":"uuid","description":"The period to move. Must belong to this amendment's contract."},"start_date":{"type":"string","format":"date","description":"New start date. Omit to leave the period's start unchanged."},"end_date":{"type":"string","format":"date","nullable":true,"description":"New end date. Omit to leave it unchanged; null makes the period open-ended. An open-ended period cannot carry a stepped term."}},"required":["period_id"]},"AmendmentLeaseTermsChangesV1Dto":{"type":"object","properties":{"rentable_sqft":{"type":"number","nullable":true,"minimum":0,"description":"The lease's new rentable square footage; null clears it. An expansion, contraction or remeasure of a live lease."}},"required":["rentable_sqft"]},"AmendmentAddPeriodInputV1Dto":{"type":"object","properties":{"label":{"type":"string","description":"Display label, e.g. \"Option 2\"."},"start_date":{"type":"string","format":"date"},"end_date":{"type":"string","format":"date","nullable":true,"description":"null makes the option open-ended."},"notice_date":{"type":"string","format":"date","nullable":true,"description":"Last day the tenant may give notice to exercise this option. Drives the renewal scan's notice reminder and expires the option once it passes unexercised. Omit or null for no notice deadline."}},"required":["label","start_date","end_date"]},"CreateAmendmentDto":{"type":"object","properties":{"amendment_type":{"type":"string","enum":["rent_change","other","term_extension","term_reduction","option_addition","option_removal"],"description":"What kind of change this amendment records. Narrower than the type on the response: system-written types such as option_exercise are recorded by the route that performs the change, not requested here."},"executed_on":{"type":"string","format":"date","description":"When the parties signed."},"effective_on":{"type":"string","format":"date","description":"When the change takes economic effect. Must not precede the contract's start date, and must fall in an open accounting period."},"reason":{"type":"string","nullable":true},"document_file_id":{"type":"string","nullable":true,"format":"uuid"},"supersede_term_ids":{"description":"Terms this amendment retires. Every id must name an in-force term of this contract; the whole amendment is rejected otherwise.","type":"array","items":{"type":"string","format":"uuid"}},"introduce_terms":{"description":"Terms this amendment introduces, in force from effective_on.","type":"array","items":{"$ref":"#/components/schemas/AmendmentTermInputV1Dto"}},"period_changes":{"description":"Periods whose dates this amendment moves. Only term_extension and term_reduction may carry these, and the type must match the direction of the net change in the lease length.","type":"array","items":{"$ref":"#/components/schemas/AmendmentPeriodChangeInputV1Dto"}},"lease_terms_changes":{"description":"Lease facts this amendment changes beside its terms. Use amendment_type other for an area change alone.","allOf":[{"$ref":"#/components/schemas/AmendmentLeaseTermsChangesV1Dto"}]},"add_periods":{"description":"Options this amendment adds, as available periods after the existing ones. option_addition only, and it must carry at least one. Its introduce_terms may name these by new_period_index and no other period.","type":"array","items":{"$ref":"#/components/schemas/AmendmentAddPeriodInputV1Dto"}},"remove_period_ids":{"description":"Available options of this contract this amendment removes. option_removal only, and it must carry at least one; it may not supersede or introduce terms. A removed option keeps its row and terms with status removed; its terms are retired and their escalation clauses deleted, refused if a reset on them was already decided.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["amendment_type","executed_on","effective_on","supersede_term_ids","introduce_terms"]},"AmendmentPreviewMonthV1Dto":{"type":"object","properties":{"month":{"type":"string","format":"date","description":"The invoice event date."},"billed":{"type":"string","description":"What the month was invoiced.","example":"1234.50"},"should":{"type":"string","description":"What the month should bill after the change.","example":"1234.50"},"difference":{"type":"string","description":"What the adjustment posts (should − billed); 0.00 for rebill and needs_manual.","example":"1234.50"},"outcome":{"type":"string","enum":["adjustment","already_pending","give_back","rebill","needs_manual"],"description":"adjustment: an adjustment document will post `difference`. already_pending: an open adjustment for this month already exists and recomputes the whole gap, so it posts `difference` too (an open adjustment for a month before the amendment's effective month is unaffected by it and is not listed). give_back: a month no longer billed is credited back. rebill: the month's invoice is still pending or blocked; its re-bill carries the change. needs_manual: blocked — edited by hand, unknown proration, or the target invoice is not posted."}},"required":["month","billed","should","difference","outcome"]},"AmendmentPreviewCatchUpV1Dto":{"type":"object","properties":{"months":{"description":"Invoiced months on or after the effective date that billing would act on, oldest first. Months it posts nothing for are omitted.","type":"array","items":{"$ref":"#/components/schemas/AmendmentPreviewMonthV1Dto"}},"total":{"type":"string","description":"Sum of `difference` over adjustment, already_pending and give_back months.","example":"1234.50"}},"required":["months","total"]},"AmendmentPreviewPeriodV1Dto":{"type":"object","properties":{"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"}},"required":["period_start","period_end"]},"AmendmentPreviewNextInvoiceV1Dto":{"type":"object","properties":{"date":{"type":"string","format":"date","description":"The first billing date after today."},"before_total":{"type":"string","description":"What that invoice bills without the change.","example":"1234.50"},"after_total":{"type":"string","description":"What that invoice bills with the change.","example":"1234.50"}},"required":["date","before_total","after_total"]},"AmendmentPreviewV1Dto":{"type":"object","properties":{"catch_up":{"$ref":"#/components/schemas/AmendmentPreviewCatchUpV1Dto"},"posts_in":{"nullable":true,"description":"The accounting period the catch-up adjustments post in; null when nothing posts, or when no period is open to post into yet (the adjustments still count in the total and post as soon as a period opens).","type":"object","allOf":[{"$ref":"#/components/schemas/AmendmentPreviewPeriodV1Dto"}]},"next_invoice":{"nullable":true,"description":"The next invoice before and after the change, on the first date the lease bills after the change; `before_total` is what the lease billed on that same date before it. Fixed-amount charges only: a charge with no fixed amount (percentage rent) is billed from what is reported later and is not included. Null when none is scheduled.","type":"object","allOf":[{"$ref":"#/components/schemas/AmendmentPreviewNextInvoiceV1Dto"}]},"recovery_rebill_warning":{"type":"boolean","description":"Expense recovery has already billed past effective_on, so its charges may need re-billing by hand."}},"required":["catch_up","posts_in","next_invoice","recovery_rebill_warning"]},"AddContractPeriodV1Dto":{"type":"object","properties":{"label":{"type":"string"},"start_date":{"type":"string"},"end_date":{"type":"string","nullable":true},"notice_date":{"type":"string","nullable":true},"sort_order":{"type":"number"}},"required":["start_date"]},"UpdateContractPeriodV1Dto":{"type":"object","properties":{"label":{"type":"string"},"start_date":{"type":"string"},"end_date":{"type":"string","nullable":true},"notice_date":{"type":"string","nullable":true}}},"WaivePeriodV1Dto":{"type":"object","properties":{"executed_on":{"type":"string","format":"date","description":"When the waiver was decided. Defaults to today in the org's time zone. The amendment's effective_on is the same date."},"document_file_id":{"type":"string","format":"uuid","description":"A contract file that records the waiver, e.g. the notice."},"reason":{"type":"string","maxLength":1000}}},"TerminateContractV1Dto":{"type":"object","properties":{"termination_date":{"type":"string","format":"date","description":"Effective termination date (YYYY-MM-DD). Must be today or later. Billing stops at this boundary; status flips on this date."},"proration":{"type":"string","enum":["full","prorated"],"description":"Final-period handling: 'prorated' bills a stub through the termination date using the contract's proration method; 'full' bills the entire cycle containing the date."},"reason":{"type":"string","maxLength":2000}},"required":["termination_date","proration"]},"ContractTypeV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"code":{"type":"string"},"name":{"type":"string"},"is_active":{"type":"boolean"},"billing_model":{"type":"string","enum":["item_based","fee_based","none"]},"supports_straight_line":{"type":"boolean"},"is_system":{"type":"boolean","description":"Seed taxonomy rows are marked is_system=true; billing_model is frozen and they cannot be deleted."},"created_at":{"type":"string","format":"date-time"}},"required":["id","org_id","code","name","is_active","billing_model","supports_straight_line","is_system","created_at"]},"CreateContractTypeV1Dto":{"type":"object","properties":{"code":{"type":"string","maxLength":64},"name":{"type":"string","maxLength":200},"is_active":{"type":"boolean","default":true},"billing_model":{"type":"string","enum":["item_based","fee_based","none"],"default":"item_based"},"supports_straight_line":{"type":"boolean","default":false}},"required":["code","name"]},"UpdateContractTypeV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":200},"is_active":{"type":"boolean"},"billing_model":{"type":"string","enum":["item_based","fee_based","none"]},"supports_straight_line":{"type":"boolean"}}},"TermTypeV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"code":{"type":"string"},"name":{"type":"string"},"category":{"type":"string","enum":["billable","option","informational","adjustment"]},"is_billable":{"type":"boolean"},"is_recoverable":{"type":"boolean","description":"Whether a term of this type funds a recovery cycle (CAM, real estate tax, insurance). Seeded from the system vocabulary and not editable — only a recoverable type may carry a recoveryGroupId."},"is_active":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}},"required":["id","org_id","code","name","category","is_billable","is_recoverable","is_active","created_at"]},"CreateTermTypeV1Dto":{"type":"object","properties":{"code":{"type":"string","maxLength":64},"name":{"type":"string","maxLength":200},"category":{"type":"string","enum":["billable","option","informational","adjustment"]},"is_billable":{"type":"boolean","default":true},"is_active":{"type":"boolean","default":true}},"required":["code","name","category"]},"UpdateTermTypeV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":200},"category":{"type":"string","enum":["billable","option","informational","adjustment"]},"is_billable":{"type":"boolean"},"is_active":{"type":"boolean"}}},"LoanListNextPaymentV1Dto":{"type":"object","properties":{"due_date":{"type":"string","format":"date"},"amount":{"type":"string","description":"Before the period is billed, the scheduled total; once billed, what is still owed.","example":"1234.50"},"principal":{"type":"string","example":"1234.50"},"interest_and_escrow":{"type":"string","description":"Interest and escrow as one figure: a billed period's bill balance cannot be split between them.","example":"1234.50"},"fees":{"type":"string","example":"1234.50"},"billed":{"type":"boolean"},"direction":{"type":"string","enum":["pay","receive"],"description":"`pay` for a borrower loan, `receive` for a lender loan."},"date_status":{"type":"string","enum":["upcoming","due_today","in_grace","late"],"description":"`late`: past due (past grace, money owed, billed). `in_grace`: past the due date, within grace. `due_today`: due on the org's today. `upcoming`: due later. A period whose due date passed with no bill is never the next payment; `attention.periods_not_billed` counts those."},"days_until":{"type":"number","description":"Due date minus the org's today, in days: positive when upcoming, 0 when due today, negative once the date has passed."},"days_past_due":{"type":"number","description":"Days since the due date when the period is past due, else 0."}},"required":["due_date","amount","principal","interest_and_escrow","fees","billed","direction","date_status","days_until","days_past_due"]},"LoanListPastDueV1Dto":{"type":"object","properties":{"count":{"type":"number"},"amount":{"type":"string","description":"Still owed across the past-due periods.","example":"1234.50"},"oldest_due_date":{"type":"string","format":"date"},"days_past_due":{"type":"number","description":"Days past due of the oldest past-due period."}},"required":["count","amount","oldest_due_date","days_past_due"]},"LoanListCurrentRateV1Dto":{"type":"object","properties":{"rate_type":{"type":"string","enum":["fixed","variable","step","hybrid"]},"all_in_rate":{"type":"string","nullable":true,"description":"The all-in rate in force: the stored effective rate, or the fixed rate. Decimal fraction, not a percent: 0.055 = 5.5%."},"fixed_rate":{"type":"string","nullable":true,"description":"Decimal fraction, not a percent: 0.055 = 5.5%."},"index_type":{"type":"string","enum":["sofr","prime","treasury","other"],"nullable":true},"index_variant":{"type":"string","enum":["term_1m","term_3m","term_6m","daily_simple","compounded_arrears","na"],"nullable":true},"spread":{"type":"string","nullable":true,"description":"Decimal fraction, not a percent: 0.055 = 5.5%."},"next_reset_date":{"type":"string","format":"date","nullable":true,"description":"The next rate reset of a floating loan; null otherwise."}},"required":["rate_type","all_in_rate","fixed_rate","index_type","index_variant","spread","next_reset_date"]},"LoanListAttentionV1Dto":{"type":"object","properties":{"in_default":{"type":"boolean","description":"An open (uncured) default window."},"periods_not_billed":{"type":"number","description":"How many of the loan's periods had their due date pass with no bill (0 when none). Those periods are never the next payment."},"no_collateral":{"type":"boolean","description":"A borrower loan tied to no property and not marked unsecured; activation is refused until one is set."},"escrow_shortfall":{"type":"string","nullable":true,"description":"How far the loan's escrows are short of their required balance; null when none is.","example":"1234.50"},"extension_notice_deadline":{"type":"string","format":"date","nullable":true,"description":"The notice deadline of an open extension option whose notice window has started."}},"required":["in_default","periods_not_billed","no_collateral","escrow_shortfall","extension_notice_deadline"]},"LoanListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"loan_number":{"type":"string"},"external_ref":{"type":"string","nullable":true,"description":"Another system's key for this record, unique in the org; set by an importer."},"name":{"type":"string"},"loan_side":{"type":"string","enum":["borrower","lender"]},"counterparty_name":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","active","matured","paid_off","defaulted","cancelled"]},"amortization_type":{"type":"string","enum":["level_payment","interest_only","io_then_amortizing","custom","balloon"]},"commitment_amount":{"type":"string","example":"1234.50"},"funded_amount":{"type":"string","example":"1234.50"},"current_balance":{"type":"string","nullable":true,"example":"1234.50"},"currency":{"type":"string","example":"USD"},"maturity_date":{"type":"string","format":"date"},"payment_frequency":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"]},"created_at":{"type":"string","format":"date-time"},"next_payment":{"nullable":true,"description":"The loan's earliest open period, whatever its date. Null for a loan with no schedule or nothing left to pay.","type":"object","allOf":[{"$ref":"#/components/schemas/LoanListNextPaymentV1Dto"}]},"past_due":{"nullable":true,"description":"Every past-due period of the loan; null when none is.","type":"object","allOf":[{"$ref":"#/components/schemas/LoanListPastDueV1Dto"}]},"current_rate":{"nullable":true,"description":"The rate term in force on the org's today; null when none is.","type":"object","allOf":[{"$ref":"#/components/schemas/LoanListCurrentRateV1Dto"}]},"attention":{"$ref":"#/components/schemas/LoanListAttentionV1Dto"}},"required":["id","loan_number","external_ref","name","loan_side","counterparty_name","status","amortization_type","commitment_amount","funded_amount","current_balance","currency","maturity_date","payment_frequency","created_at","next_payment","past_due","current_rate","attention"]},"LoansSummaryCashWindowV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"Sum of the periods, each priced as next_payment.amount.","example":"1234.50"},"count":{"type":"number","description":"Number of periods (not loans)."},"next_date":{"type":"string","format":"date","nullable":true,"description":"The earliest due date among them; null when none."}},"required":["amount","count","next_date"]},"LoansSummaryPastDueV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"Still owed across every past-due period.","example":"1234.50"},"count":{"type":"number","description":"Past-due periods."},"loan_count":{"type":"number","description":"Loans with a past-due period."},"oldest_days":{"type":"number","description":"Days past due of the oldest past-due period; 0 when none."}},"required":["amount","count","loan_count","oldest_days"]},"LoansSummarySoonestMaturityV1Dto":{"type":"object","properties":{"loan_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"maturity_date":{"type":"string","format":"date"}},"required":["loan_id","name","maturity_date"]},"LoansSummaryMaturingV1Dto":{"type":"object","properties":{"principal":{"type":"string","description":"Outstanding principal of the loans maturing within 12 months (unresolvable balances left out).","example":"1234.50"},"loan_count":{"type":"number"},"soonest":{"nullable":true,"description":"The loan that matures first; null when none matures.","type":"object","allOf":[{"$ref":"#/components/schemas/LoansSummarySoonestMaturityV1Dto"}]}},"required":["principal","loan_count","soonest"]},"LoansSummaryOutstandingV1Dto":{"type":"object","properties":{"total":{"type":"string","description":"owed + owed_to_you.","example":"1234.50"},"owed":{"type":"string","description":"Outstanding principal of borrower loans.","example":"1234.50"},"owed_to_you":{"type":"string","description":"Outstanding principal of lender loans.","example":"1234.50"},"unresolved_count":{"type":"number","description":"Loans whose principal balance cannot be resolved (no loan dimension or principal account); left out of the sums."}},"required":["total","owed","owed_to_you","unresolved_count"]},"LoansSummaryV1Dto":{"type":"object","properties":{"to_pay_30d":{"description":"Borrower loans: every open period due on or before the org's today + 30 that is not past due (periods in grace or not billed included).","allOf":[{"$ref":"#/components/schemas/LoansSummaryCashWindowV1Dto"}]},"to_receive_30d":{"description":"As to_pay_30d, for lender loans.","allOf":[{"$ref":"#/components/schemas/LoansSummaryCashWindowV1Dto"}]},"past_due":{"$ref":"#/components/schemas/LoansSummaryPastDueV1Dto"},"maturing_12m":{"description":"Loans in the maturing_12m view.","allOf":[{"$ref":"#/components/schemas/LoansSummaryMaturingV1Dto"}]},"outstanding":{"$ref":"#/components/schemas/LoansSummaryOutstandingV1Dto"}},"required":["to_pay_30d","to_receive_30d","past_due","maturing_12m","outstanding"]},"LoanRateTermV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"rate_type":{"type":"string","enum":["fixed","variable","step","hybrid"]},"fixed_rate":{"type":"string","nullable":true,"example":"0.0525","description":"Decimal fraction, not a percent: 0.055 = 5.5%."},"index_type":{"type":"string","enum":["sofr","prime","treasury","other"],"nullable":true},"index_variant":{"type":"string","enum":["term_1m","term_3m","term_6m","daily_simple","compounded_arrears","na"],"nullable":true},"spread":{"type":"string","nullable":true,"example":"0.0250","description":"Decimal fraction, not a percent: 0.055 = 5.5%."},"rate_floor":{"type":"string","nullable":true,"description":"Decimal fraction, not a percent: 0.055 = 5.5%."},"rate_cap":{"type":"string","nullable":true,"description":"Decimal fraction, not a percent: 0.055 = 5.5%."},"floor_applies_to":{"type":"string","enum":["index","all_in"],"nullable":true},"lookback_days":{"type":"number","nullable":true},"lookback_method":{"type":"string","enum":["observation_shift","lookback"],"description":"How an in-arrears index (daily_simple, compounded_arrears) weighs its readings, from the agreement or confirmation. observation_shift: each reading weighs the calendar days it covers in the window shifted back lookback_days publication days, and the day count is that window. lookback: each calendar day of the interest period weighs 1 on the reading lookback_days publication days before it; a weekend or holiday takes the reading of the publication day before it, so Friday to Sunday share one. The day count is the period. Ignored by in-advance variants. Default observation_shift."},"reset_frequency":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"],"nullable":true},"day_count_convention":{"type":"string","enum":["actual_360","actual_365","30_360"]},"compounding":{"type":"string","enum":["simple","monthly","daily"]},"effective_rate":{"type":"string","nullable":true,"description":"Decimal fraction, not a percent: 0.055 = 5.5%."},"effective_from":{"type":"string","format":"date"},"effective_to":{"type":"string","format":"date","nullable":true}},"required":["id","rate_type","fixed_rate","index_type","index_variant","spread","rate_floor","rate_cap","floor_applies_to","lookback_days","lookback_method","reset_frequency","day_count_convention","compounding","effective_rate","effective_from","effective_to"]},"LoanPrepaymentTermV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"provision_type":{"type":"string","enum":["lockout","defeasance","yield_maintenance","step_down","open"]},"start_date":{"type":"string","format":"date","description":"First day the window applies (inclusive)."},"end_date":{"type":"string","format":"date","description":"Last day the window applies (inclusive)."},"penalty_pct":{"type":"string","nullable":true,"example":"2.00000","description":"A PERCENT, not a decimal rate: 2.0 = 2% of the principal prepaid (unlike the loan's interest rates, which are decimals). Required for step_down; the minimum floor for yield_maintenance (absent = no floor); must be absent for lockout and open; ignored for defeasance."},"description":{"type":"string","nullable":true}},"required":["id","provision_type","start_date","end_date","penalty_pct","description"]},"LoanDefaultStatusV1Dto":{"type":"object","properties":{"in_default":{"type":"boolean","description":"True while a default window is open."},"declared_on":{"type":"string","format":"date","nullable":true,"description":"The latest window's first day in default; null when never in default."},"cured_on":{"type":"string","format":"date","nullable":true,"description":"The latest window's cure date (exclusive end); null while open or when never in default."},"rate_uplift":{"type":"string","nullable":true,"example":"0.05000","description":"The window's uplift on the annual rate (0.05 = +5 points), fixed at declaration from the delinquency terms."},"reason":{"type":"string","nullable":true}},"required":["in_default","declared_on","cured_on","rate_uplift","reason"]},"LoanCoBorrowerV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"share_pct":{"type":"string","example":"60.0000","description":"This entity's share of the loan, a percent at four decimals. The co-borrowers' shares sum to 100."},"is_paying_borrower":{"type":"boolean","description":"True for the borrower that pays the lender (the loan’s legal_entity_id)."},"outstanding_principal":{"type":"string","nullable":true,"description":"The co-borrower's outstanding principal on its own books: credit minus debit on its principal account over the lines tagged with this loan, so it ties to that entity’s balance sheet. Null when its principal account cannot be resolved.","example":"1234.50"}},"required":["legal_entity_id","legal_entity_name","share_pct","is_paying_borrower","outstanding_principal"]},"LoanDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"loan_number":{"type":"string"},"name":{"type":"string"},"loan_side":{"type":"string","enum":["borrower","lender"]},"counterparty_id":{"type":"string","format":"uuid"},"counterparty_name":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","active","matured","paid_off","defaulted","cancelled"]},"amortization_type":{"type":"string","enum":["level_payment","interest_only","io_then_amortizing","custom","balloon"]},"io_end_date":{"type":"string","format":"date","nullable":true},"balloon_amortization_months":{"type":"number","nullable":true},"commitment_amount":{"type":"string","example":"1234.50"},"funded_amount":{"type":"string","example":"1234.50"},"current_balance":{"type":"string","nullable":true,"example":"1234.50"},"hedged_all_in_rate":{"type":"string","nullable":true,"example":"0.06333","description":"The balance-weighted all-in rate after the loan's active hedges, for the current period (spec §7): swap-covered notional at fixed_rate − floating_spread + the loan spread, cap-covered at the floating all-in rate less the cap payout max(0, index − strike), the rest at the floating all-in rate; covered notional is capped at the balance, swaps first. Computed on read from ONE index reading for every leg: the one the rate generation in force was reset from, or, for a generation no reset wrote, the latest reading on or before the org's today (the floating rate then recomputed from it). Null for a fixed-rate loan, a loan with no active hedge, or a zero balance. Shown beside the note rate, not instead of it. Decimal fraction, not a percent: 0.055 = 5.5%."},"currency":{"type":"string","example":"USD"},"origination_date":{"type":"string","format":"date"},"maturity_date":{"type":"string","format":"date"},"funding_status":{"type":"string","enum":["unfunded","partially_funded","fully_funded"]},"loan_account_id":{"type":"string","format":"uuid","nullable":true},"interest_account_id":{"type":"string","format":"uuid","nullable":true},"accrued_interest_account_id":{"type":"string","format":"uuid","nullable":true,"description":"The accrued-interest account override (null = the side’s role default). With loan_account_id and interest_account_id, never an escrow movement’s offset."},"payment_frequency":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"]},"payment_day":{"type":"number"},"notes":{"type":"string","nullable":true},"external_ref":{"type":"string","nullable":true,"description":"Another system's key for this record, unique in the org; set by an importer."},"is_unsecured":{"type":"boolean","description":"True when the loan is deliberately tied to no property; its cost stays on the borrower, unsplit."},"hedge_required":{"type":"boolean","description":"The lender requires an interest-rate cap or swap on this loan."},"collateral_locked_through":{"type":"string","format":"date","nullable":true,"description":"The latest due date whose collateral split is already spent: a billed due date, or the due date of the bill that will relieve interest already accrued past the last bill. A collateral row live on it cannot end before it, and a new collateral window must start after it (PUT /v1/loans/{id}/participants refuses otherwise with LOAN_COLLATERAL_BILLED_HISTORY). Null when nothing has been billed or accrued."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"rate_terms":{"type":"array","items":{"$ref":"#/components/schemas/LoanRateTermV1Dto"}},"prepayment_terms":{"description":"The prepayment windows, ordered by start_date (as GET /v1/loans/{id}/prepayment-terms).","type":"array","items":{"$ref":"#/components/schemas/LoanPrepaymentTermV1Dto"}},"default_status":{"nullable":true,"description":"The loan's latest default window: in default now, or the last one cured. Null when the loan was never declared in default.","type":"object","allOf":[{"$ref":"#/components/schemas/LoanDefaultStatusV1Dto"}]},"co_borrowers":{"description":"The loan's co-borrowers, the paying borrower first. Empty for a single-borrower loan.","type":"array","items":{"$ref":"#/components/schemas/LoanCoBorrowerV1Dto"}}},"required":["id","org_id","legal_entity_id","loan_number","name","loan_side","counterparty_id","counterparty_name","status","amortization_type","io_end_date","balloon_amortization_months","commitment_amount","funded_amount","current_balance","hedged_all_in_rate","currency","origination_date","maturity_date","funding_status","loan_account_id","interest_account_id","accrued_interest_account_id","payment_frequency","payment_day","notes","external_ref","is_unsecured","hedge_required","collateral_locked_through","created_at","updated_at","rate_terms","prepayment_terms","default_status","co_borrowers"]},"LoanIdV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]},"CreateLoanRateTermsV1Dto":{"type":"object","properties":{"rate_type":{"type":"string","enum":["fixed","variable","step","hybrid"]},"fixed_rate":{"type":"number","example":0.055,"minimum":0,"maximum":1,"description":"Fixed annual rate. Decimal fraction, not a percent: 0.055 = 5.5%."},"index_type":{"type":"string","enum":["sofr","prime","treasury","other"]},"index_variant":{"type":"string","enum":["term_1m","term_3m","term_6m","daily_simple","compounded_arrears","na"]},"spread":{"type":"number","example":0.025,"minimum":-1,"maximum":1,"description":"Margin over the index. Decimal fraction, not a percent: 0.055 = 5.5%."},"rate_floor":{"type":"number","example":0.055,"minimum":0,"maximum":1,"description":"Floor on the index or the all-in rate (see floor_applies_to). Decimal fraction, not a percent: 0.055 = 5.5%."},"rate_cap":{"type":"number","example":0.055,"minimum":0,"maximum":1,"description":"Cap on the all-in rate. Decimal fraction, not a percent: 0.055 = 5.5%."},"floor_applies_to":{"type":"string","enum":["index","all_in"]},"lookback_days":{"type":"number","minimum":0},"lookback_method":{"type":"string","enum":["observation_shift","lookback"],"default":"observation_shift","description":"How an in-arrears index (daily_simple, compounded_arrears) weighs its readings, from the agreement or confirmation. observation_shift: each reading weighs the calendar days it covers in the window shifted back lookback_days publication days, and the day count is that window. lookback: each calendar day of the interest period weighs 1 on the reading lookback_days publication days before it; a weekend or holiday takes the reading of the publication day before it, so Friday to Sunday share one. The day count is the period. Ignored by in-advance variants. Default observation_shift."},"reset_frequency":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"]},"day_count_convention":{"type":"string","enum":["actual_360","actual_365","30_360"]},"compounding":{"type":"string","enum":["simple","monthly","daily"],"default":"simple"},"effective_rate":{"type":"number","example":0.055,"minimum":0,"maximum":1,"description":"The starting rate: the all-in rate in force on effective_from. Leave it out on a variable loan and it is worked out from the index reading (on or before effective_from minus lookback_days, or today for a future start) plus the spread, within the floor and cap; a 422 VALIDATION_FAILED names rate_terms.effective_rate when no recent reading exists. A fixed loan uses fixed_rate. Decimal fraction, not a percent: 0.055 = 5.5%."},"effective_from":{"type":"string","format":"date"},"effective_to":{"type":"string","format":"date"}},"required":["rate_type","day_count_convention","effective_from"]},"CreateLoanCollateralPropertyV1Dto":{"type":"object","properties":{"property_id":{"type":"string","format":"uuid","description":"A property owned by the loan’s borrower (or by no legal entity)."},"share_pct":{"type":"string","example":"60.0000","description":"This property’s share of the loan, as a decimal string with up to four places, never a JSON number. The shares must total exactly 100."},"allocated_loan_amount":{"type":"string","nullable":true,"description":"The loan amount booked against this property for the collateral register. Independent of `share_pct`.","example":"400000.00"}},"required":["property_id","share_pct"]},"CreateLoanCollateralV1Dto":{"type":"object","properties":{"properties":{"description":"The properties securing the loan, each effective from the origination date with no end date. Send this or `unsecured: true`, not both.","type":"array","items":{"$ref":"#/components/schemas/CreateLoanCollateralPropertyV1Dto"}},"unsecured":{"type":"boolean","description":"True for a loan deliberately tied to no property (a corporate facility): its cost stays on the borrower, unsplit."}}},"CreateLoanCoBorrowerV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid","description":"A legal entity of this organization that carries a share of the loan."},"share_pct":{"type":"string","example":"60.0000","description":"This co-borrower’s share of the loan, as a decimal string with up to four places, never a JSON number. Above 0, at most 100, and the co-borrower shares must total exactly 100."}},"required":["legal_entity_id","share_pct"]},"CreateLoanV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"loan_side":{"type":"string","enum":["borrower","lender"]},"counterparty_id":{"type":"string","format":"uuid"},"amortization_type":{"type":"string","enum":["level_payment","interest_only","io_then_amortizing","custom","balloon"]},"io_end_date":{"type":"string","format":"date"},"balloon_amortization_months":{"type":"number","minimum":1,"description":"Balloon only: the amortization period in months the payment is sized on. Required when amortization_type is \"balloon\"."},"commitment_amount":{"type":"string","example":"1234.50"},"funded_amount":{"type":"string","example":"1234.50"},"currency":{"type":"string","default":"USD"},"origination_date":{"type":"string","format":"date"},"maturity_date":{"type":"string","format":"date"},"loan_account_id":{"type":"string","format":"uuid"},"interest_account_id":{"type":"string","format":"uuid"},"accrued_interest_account_id":{"type":"string","format":"uuid"},"payment_frequency":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"]},"payment_day":{"type":"number","minimum":1,"maximum":31},"notes":{"type":"string"},"external_ref":{"type":"string","nullable":true,"minLength":1,"maxLength":200,"description":"Another system's key for this record, unique in the org; set by an importer."},"rate_terms":{"$ref":"#/components/schemas/CreateLoanRateTermsV1Dto"},"collateral":{"nullable":true,"description":"What secures the loan: a list of properties, or `unsecured: true`. Required for a borrower loan (400 `LOAN_COLLATERAL_REQUIRED` without it); refused on a lender loan (`LOAN_COLLATERAL_LENDER_SIDE`). The loan and its collateral are saved together. `null` is read as absent.","type":"object","allOf":[{"$ref":"#/components/schemas/CreateLoanCollateralV1Dto"}]},"co_borrowers":{"description":"The legal entities that share this loan, each with its share. Omit for a loan carried by its borrower alone. When sent, the list must include the borrower (`legal_entity_id`) and the shares must total exactly 100. Saved together with the loan and its collateral; refused on a lender loan (`LOAN_CO_BORROWERS_LENDER_SIDE`).","type":"array","items":{"$ref":"#/components/schemas/CreateLoanCoBorrowerV1Dto"}},"hedge_required":{"type":"boolean","default":false,"description":"The lender requires an interest-rate cap or swap on this loan (loan hedges spec §7)."}},"required":["legal_entity_id","name","loan_side","counterparty_id","amortization_type","commitment_amount","origination_date","maturity_date","payment_frequency","payment_day","rate_terms"]},"UpdateLoanV1Dto":{"type":"object","properties":{"name":{"type":"string"},"loan_side":{"type":"string","enum":["borrower","lender"]},"counterparty_id":{"type":"string","format":"uuid"},"amortization_type":{"type":"string","enum":["level_payment","interest_only","io_then_amortizing","custom","balloon"]},"io_end_date":{"type":"string","format":"date"},"balloon_amortization_months":{"type":"number","minimum":1,"description":"Balloon only: the amortization period in months the payment is sized on. Required when amortization_type is \"balloon\"."},"commitment_amount":{"type":"string","example":"1234.50"},"funded_amount":{"type":"string","example":"1234.50"},"currency":{"type":"string"},"origination_date":{"type":"string","format":"date"},"maturity_date":{"type":"string","format":"date"},"loan_account_id":{"type":"string","format":"uuid"},"interest_account_id":{"type":"string","format":"uuid"},"accrued_interest_account_id":{"type":"string","format":"uuid"},"payment_frequency":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"]},"payment_day":{"type":"number","minimum":1,"maximum":31},"notes":{"type":"string"},"external_ref":{"type":"string","nullable":true,"minLength":1,"maxLength":200,"description":"Another system's key for this record, unique in the org; set by an importer."},"hedge_required":{"type":"boolean","description":"The lender requires an interest-rate cap or swap on this loan. Editable in any status."}}},"LoanScheduleCountV1Dto":{"type":"object","properties":{"schedule_entries_count":{"type":"number"}},"required":["schedule_entries_count"]},"LoanDrawdownResultV1Dto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid"},"funded_amount":{"type":"string","example":"1234.50"},"funding_status":{"type":"string","enum":["unfunded","partially_funded","fully_funded"]}},"required":["document_id","funded_amount","funding_status"]},"DrawdownLoanV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"Drawdown amount (must be positive; ≤ remaining commitment)","example":"1234.50"},"drawdown_date":{"type":"string","format":"date"}},"required":["amount","drawdown_date"]},"LoanPayoffResultV1Dto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid"},"remaining_principal":{"type":"string","example":"1234.50"},"accrued_interest":{"type":"string","example":"1234.50"},"penalty_amount":{"type":"string","example":"1234.50"},"total":{"type":"string","description":"principal + accrued interest + penalty","example":"1234.50"}},"required":["document_id","remaining_principal","accrued_interest","penalty_amount","total"]},"PayoffLoanV1Dto":{"type":"object","properties":{"payoff_date":{"type":"string","format":"date","description":"On or before the org's today and on or after the loan's accrued-through date."},"treasury_yield":{"type":"string","example":"0.04250","description":"Treasury yield for a yield-maintenance window, between 0 and 1 with at most 5 decimals. Decimal fraction, not a percent: 0.055 = 5.5%."},"defeasance_cost":{"type":"string","description":"Defeasance cost for a defeasance window (computed, never executed).","example":"1234.50"},"lockout_override_reason":{"type":"string","maxLength":2000,"description":"Required, and stored (trimmed), when the payoff date is inside a lockout window."}},"required":["payoff_date"]},"LoanAccrualRunResultV1Dto":{"type":"object","properties":{"loans_scanned":{"type":"number"},"events_created":{"type":"number"}},"required":["loans_scanned","events_created"]},"LoanParticipantFrozenByV1Dto":{"type":"object","properties":{"loan_event_id":{"type":"string","format":"uuid","description":"The spine event whose posted allocation froze this row."},"period_number":{"type":"number","nullable":true,"description":"The period number, or null when the spine row does not carry one."},"due_date":{"type":"string","format":"date","nullable":true,"description":"The period's due date. `loan_events.due_date` is NOT NULL and the FK from `loan_event_shares` guarantees the joined row exists, so in practice this is never null; nullable here only to defensively mirror `FrozenLoanPeriodRef`."}},"required":["loan_event_id","period_number","due_date"]},"LoanParticipantV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"participant_type":{"type":"string","enum":["property","legal_entity"]},"property_id":{"type":"string","format":"uuid","nullable":true},"legal_entity_id":{"type":"string","format":"uuid","nullable":true},"share_pct":{"type":"string","example":"60.0000","description":"The share as `numeric(7, 4)` renders it — a decimal string at four places, never a JSON number."},"allocation_basis":{"type":"string","nullable":true},"method":{"type":"string","enum":["allocated","intercompany"]},"allocated_loan_amount":{"type":"string","nullable":true,"example":"400000.00"},"release_status":{"type":"string","enum":["held","released"]},"effective_from":{"type":"string","format":"date"},"effective_to":{"type":"string","format":"date","nullable":true,"description":"Inclusive last day, or null for open-ended."},"frozen_by":{"nullable":true,"description":"The posted period that froze this row, or null when none has. When non-null the row cannot be removed and its `share_pct`, `effective_from` and participant reference cannot be re-stated — close its window with `effective_to` instead. Read-only: it is not a key of `LoanParticipantInputV1Dto` and is rejected on write.","type":"object","allOf":[{"$ref":"#/components/schemas/LoanParticipantFrozenByV1Dto"}]}},"required":["id","participant_type","property_id","legal_entity_id","share_pct","allocation_basis","method","allocated_loan_amount","release_status","effective_from","effective_to","frozen_by"]},"LoanParticipantInputV1Dto":{"type":"object","properties":{"participant_type":{"type":"string","enum":["property","legal_entity"],"description":"What bears this share. `property` is collateral: the loan is secured by that property, which must be owned by one of the loan’s borrowers (the paying borrower `legal_entity_id` or any co-borrower) or by no legal entity. `legal_entity` is a co-borrower: that entity carries this share of the loan, and the co-borrower rows must include the paying borrower and total exactly 100 among themselves, apart from the property rows."},"property_id":{"type":"string","format":"uuid","nullable":true,"description":"The collateral property. Required for `property` rows; null or absent on `legal_entity` rows."},"legal_entity_id":{"type":"string","format":"uuid","nullable":true,"description":"The co-borrower legal entity. Required for `legal_entity` rows; null or absent on `property` rows."},"share_pct":{"type":"string","example":"60.0000","description":"This participant’s share of the loan, as a decimal string with up to four places — `numeric(7, 4)`, never a JSON number. Must be above 0 and at most 100, and the live shares must total exactly 100 at every point in time where any participant is live, which is checked across the whole set rather than per row."},"allocation_basis":{"type":"string","nullable":true,"description":"Free text recording how the share was derived — “by appraised value, 2026 appraisal”. A note for humans; nothing computes from it."},"method":{"type":"string","enum":["allocated","intercompany"],"description":"How the share is expressed downstream. On `property` rows it must be `allocated` (the default when omitted): the journal lines are tagged with the property dimension. On co-borrower (`legal_entity`) rows it is ignored and always stored as `intercompany`: the co-borrower’s share moves into its own books through intercompany allocation entries. Need not be sent on either."},"allocated_loan_amount":{"type":"string","nullable":true,"description":"The loan amount booked against this participant for the collateral register — what a partial release is priced from. Independent of `share_pct`, which is what the debt service is split by.","example":"400000.00"},"release_status":{"type":"string","enum":["held","released"],"default":"held","description":"Whether the collateral is still held. `released` is a record, not an end date: ending participation is what `effective_to` is for, and the share resolver reads the window, never this field."},"effective_from":{"type":"string","format":"date","example":"2026-01-01","description":"First day this participant bears the loan. Required for `property` rows. Ignored for co-borrower (`legal_entity`) rows, which always start on the loan’s origination date and have no end."},"effective_to":{"type":"string","format":"date","nullable":true,"example":"2026-06-30","description":"Last day this participant bears the loan, INCLUSIVE — a window ending on a date is still live that day. Null means open-ended."}},"required":["participant_type","share_pct"]},"PutLoanParticipantsV1Dto":{"type":"object","properties":{"participants":{"description":"The complete participant set for this loan. A row left out of the payload is removed only if nothing has frozen it; a row a posted period was split by is refused instead — close its window with effective_to to end its participation. Once every document of such a period is voided, the row can be re-stated in any column, and one left out is archived (kept for the voided record, hidden everywhere).","type":"array","items":{"$ref":"#/components/schemas/LoanParticipantInputV1Dto"}},"is_unsecured":{"type":"boolean","description":"Marks the loan unsecured (tied to no property) or clears that mark. Absent leaves it unchanged. Removing all collateral from a borrower loan that is no longer pending needs `true` in the same request, and an unsecured loan cannot keep a collateral row with no end date."}},"required":["participants"]},"LoanPrepaymentTermInputV1Dto":{"type":"object","properties":{"provision_type":{"type":"string","enum":["lockout","defeasance","yield_maintenance","step_down","open"]},"start_date":{"type":"string","format":"date","description":"First day the window applies (inclusive)."},"end_date":{"type":"string","format":"date","description":"Last day the window applies (inclusive)."},"penalty_pct":{"type":"string","nullable":true,"example":"2.0","description":"A PERCENT, not a decimal rate: 2.0 = 2% of the principal prepaid (unlike the loan's interest rates, which are decimals). Required for step_down; the minimum floor for yield_maintenance (absent = no floor); must be absent for lockout and open; ignored for defeasance."},"description":{"type":"string","nullable":true,"maxLength":500}},"required":["provision_type","start_date","end_date"]},"PutLoanPrepaymentTermsV1Dto":{"type":"object","properties":{"terms":{"maxItems":50,"description":"The WHOLE set; it replaces what the loan has. An empty array clears it.","type":"array","items":{"$ref":"#/components/schemas/LoanPrepaymentTermInputV1Dto"}}},"required":["terms"]},"LoanPrepaymentPenaltyBasisV1Dto":{"type":"object","properties":{"terms_id":{"type":"string","format":"uuid","nullable":true},"provision_type":{"type":"string","enum":["lockout","defeasance","yield_maintenance","step_down","open"],"nullable":true},"penalty_pct":{"type":"string","nullable":true,"description":"A PERCENT, not a decimal rate: 2.0 = 2% of the principal prepaid (unlike the loan's interest rates, which are decimals). Required for step_down; the minimum floor for yield_maintenance (absent = no floor); must be absent for lockout and open; ignored for defeasance."},"treasury_yield":{"type":"string","nullable":true,"description":"Decimal fraction, not a percent: 0.055 = 5.5%."},"defeasance_cost":{"type":"string","nullable":true,"example":"1234.50"},"remaining_months":{"type":"number","nullable":true}},"required":["terms_id","provision_type","penalty_pct","treasury_yield","defeasance_cost","remaining_months"]},"LoanPrepaymentEscrowBalanceV1Dto":{"type":"object","properties":{"escrow_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"escrow_type":{"type":"string","enum":["tax","insurance","replacement_reserve","ti_lc_reserve","other"]},"balance":{"type":"string","example":"1234.50"}},"required":["escrow_id","name","escrow_type","balance"]},"LoanPrepaymentQuoteResultV1Dto":{"type":"object","properties":{"outstanding_principal":{"type":"string","example":"1234.50"},"principal_amount":{"type":"string","example":"1234.50"},"accrued_interest":{"type":"string","description":"Curtailment: the catch-up accrual through the date (billed on the next statement, S2-3). Payoff: the interest the payoff pays.","example":"1234.50"},"penalty_amount":{"type":"string","example":"1234.50"},"penalty_basis":{"$ref":"#/components/schemas/LoanPrepaymentPenaltyBasisV1Dto"},"locked_out":{"type":"boolean","description":"The date is inside a lockout window: the write needs lockout_override_reason."},"cash_total":{"type":"string","description":"Cash moving on the date: principal + penalty (+ accrued interest for a payoff).","example":"1234.50"},"new_payment_amount":{"type":"string","nullable":true,"example":"1234.50"},"new_final_due_date":{"type":"string","format":"date","nullable":true},"interest_saved":{"type":"string","nullable":true,"example":"1234.50"},"escrow_balances":{"description":"Payoff only (empty for a curtailment): each active or non-zero escrow and its balance. Information — the payoff does NOT refund escrow; record the lender's refund separately.","type":"array","items":{"$ref":"#/components/schemas/LoanPrepaymentEscrowBalanceV1Dto"}}},"required":["outstanding_principal","principal_amount","accrued_interest","penalty_amount","penalty_basis","locked_out","cash_total","new_payment_amount","new_final_due_date","interest_saved","escrow_balances"]},"LoanPrepaymentQuoteV1Dto":{"type":"object","properties":{"effective_date":{"type":"string","format":"date"},"kind":{"type":"string","enum":["curtailment","payoff"]},"principal_amount":{"type":"string","description":"Required for a curtailment; a payoff prices the outstanding principal.","example":"1234.50"},"schedule_mode":{"type":"string","enum":["reduce_term","reamortize"],"description":"Curtailment only; default reduce_term. Ignored for an interest-only loan or phase."},"treasury_yield":{"type":"string","example":"0.04250","description":"Treasury yield for a yield-maintenance window, between 0 and 1 with at most 5 decimals. Decimal fraction, not a percent: 0.055 = 5.5%."},"defeasance_cost":{"type":"string","description":"Defeasance cost for a defeasance window (computed, never executed).","example":"1234.50"}},"required":["effective_date","kind"]},"LoanPrepaymentResultV1Dto":{"type":"object","properties":{"prepayment_id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"principal_amount":{"type":"string","example":"1234.50"},"penalty_amount":{"type":"string","example":"1234.50"},"cash_total":{"type":"string","description":"Cash moving on the date: principal + penalty.","example":"1234.50"},"interest_saved":{"type":"string","nullable":true,"description":"Interest the regenerated schedule saves against the one it replaced.","example":"1234.50"},"schedule_version":{"type":"number"}},"required":["prepayment_id","document_id","principal_amount","penalty_amount","cash_total","interest_saved","schedule_version"]},"CreateLoanPrepaymentV1Dto":{"type":"object","properties":{"effective_date":{"type":"string","format":"date","description":"Cash value date; on or before the org's today and on or after the loan's accrued-through date."},"principal_amount":{"type":"string","description":"Principal prepaid; strictly less than the outstanding principal (all of it is a payoff).","example":"1234.50"},"schedule_mode":{"type":"string","enum":["reduce_term","reamortize"],"default":"reduce_term","description":"reduce_term keeps the payment and ends the loan earlier; reamortize keeps the maturity and lowers the payment. Ignored for an interest-only loan or phase."},"treasury_yield":{"type":"string","example":"0.04250","description":"Treasury yield for a yield-maintenance window, between 0 and 1 with at most 5 decimals. Decimal fraction, not a percent: 0.055 = 5.5%."},"defeasance_cost":{"type":"string","description":"Defeasance cost for a defeasance window (computed, never executed).","example":"1234.50"},"lockout_override_reason":{"type":"string","maxLength":2000,"description":"Required, and stored (trimmed), when the date is inside a lockout window."},"memo":{"type":"string","maxLength":2000}},"required":["effective_date","principal_amount"]},"LoanAmendmentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"loan_id":{"type":"string","format":"uuid"},"amendment_number":{"type":"number","description":"1, 2, 3… per loan."},"amendment_type":{"type":"string","enum":["rate_change","maturity_extension","principal_increase","payment_change","restructure","covenant_waiver","other"]},"effective_date":{"type":"string","format":"date"},"description":{"type":"string","description":"The reason the terms changed."},"changed_fields":{"type":"object","additionalProperties":true,"description":"Map of changed field → {from, to}; `rate_term` holds the previous and new rate terms. Empty for a record-only amendment."},"document_id":{"type":"string","format":"uuid","nullable":true},"created_by":{"type":"string","format":"uuid","nullable":true},"created_at":{"type":"string","format":"date-time"}},"required":["id","loan_id","amendment_number","amendment_type","effective_date","description","changed_fields","document_id","created_by","created_at"]},"LoanAmendmentRegenerationV1Dto":{"type":"object","properties":{"schedule_version":{"type":"number"},"new_payment_amount":{"type":"string","nullable":true,"example":"1234.50"},"new_final_due_date":{"type":"string","format":"date","nullable":true}},"required":["schedule_version","new_payment_amount","new_final_due_date"]},"LoanAmendmentResultV1Dto":{"type":"object","properties":{"amendment":{"$ref":"#/components/schemas/LoanAmendmentV1Dto"},"regeneration":{"nullable":true,"description":"The schedule rebuild; null only for a record-only amendment (covenant_waiver, other).","type":"object","allOf":[{"$ref":"#/components/schemas/LoanAmendmentRegenerationV1Dto"}]}},"required":["amendment","regeneration"]},"AmendmentTermsV1Dto":{"type":"object","properties":{"maturity_date":{"type":"string","format":"date"},"amortization_type":{"type":"string","enum":["level_payment","interest_only","io_then_amortizing","custom","balloon"],"description":"custom is refused (422 LOAN_AMENDMENT_TERMS_INVALID)."},"io_end_date":{"type":"string","format":"date","nullable":true},"balloon_amortization_months":{"type":"number","nullable":true,"minimum":1},"payment_frequency":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"]},"payment_day":{"type":"number","minimum":1,"maximum":31},"commitment_amount":{"type":"string","example":"1234.50"}}},"AmendmentRateTermV1Dto":{"type":"object","properties":{"rate_type":{"type":"string","enum":["fixed","variable","step","hybrid"]},"fixed_rate":{"type":"number","example":0.055,"minimum":0,"maximum":1,"description":"Fixed annual rate. Decimal fraction, not a percent: 0.055 = 5.5%."},"index_type":{"type":"string","enum":["sofr","prime","treasury","other"]},"index_variant":{"type":"string","enum":["term_1m","term_3m","term_6m","daily_simple","compounded_arrears","na"]},"spread":{"type":"number","example":0.025,"minimum":-1,"maximum":1,"description":"Margin over the index. Decimal fraction, not a percent: 0.055 = 5.5%."},"rate_floor":{"type":"number","example":0.055,"minimum":0,"maximum":1,"description":"Floor on the index or the all-in rate (see floor_applies_to). Decimal fraction, not a percent: 0.055 = 5.5%."},"rate_cap":{"type":"number","example":0.055,"minimum":0,"maximum":1,"description":"Cap on the all-in rate. Decimal fraction, not a percent: 0.055 = 5.5%."},"floor_applies_to":{"type":"string","enum":["index","all_in"]},"lookback_days":{"type":"number","minimum":0},"reset_frequency":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"]},"day_count_convention":{"type":"string","enum":["actual_360","actual_365","30_360"]},"compounding":{"type":"string","enum":["simple","monthly","daily"],"default":"simple"},"effective_rate":{"type":"number","example":0.055,"minimum":0,"maximum":1,"description":"The starting rate: the all-in rate in force on effective_from. Leave it out on a variable loan and it is worked out from the index reading (on or before effective_from minus lookback_days, or today for a future start) plus the spread, within the floor and cap; a 422 VALIDATION_FAILED names rate_terms.effective_rate when no recent reading exists. A fixed loan uses fixed_rate. Decimal fraction, not a percent: 0.055 = 5.5%."},"lookback_method":{"type":"string","enum":["observation_shift","lookback"],"default":"observation_shift","description":"How an in-arrears index (daily_simple, compounded_arrears) weighs its readings, from the agreement or confirmation. observation_shift: each reading weighs the calendar days it covers in the window shifted back lookback_days publication days, and the day count is that window. lookback: each calendar day of the interest period weighs 1 on the reading lookback_days publication days before it; a weekend or holiday takes the reading of the publication day before it, so Friday to Sunday share one. The day count is the period. Ignored by in-advance variants. Default observation_shift. The amendment replaces the rate term whole: an omitted lookback_method resets to observation_shift, like every other omitted term, so send the loan's current value to keep it."}},"required":["rate_type","day_count_convention"]},"CreateLoanAmendmentV1Dto":{"type":"object","properties":{"amendment_type":{"type":"string","enum":["rate_change","maturity_extension","principal_increase","payment_change","restructure","covenant_waiver","other"]},"effective_date":{"type":"string","format":"date","description":"On or before the org's today and after origination_date. A rate change may not be before interest is accrued through."},"description":{"type":"string","description":"Why the terms changed (the reason). Required."},"document_id":{"type":"string","format":"uuid","nullable":true,"description":"The signed amendment document, if any."},"terms":{"$ref":"#/components/schemas/AmendmentTermsV1Dto"},"rate_term":{"description":"The full rate terms from effective_date (replaces the generation in force). effective_rate is required unless rate_type is fixed.","allOf":[{"$ref":"#/components/schemas/AmendmentRateTermV1Dto"}]}},"required":["amendment_type","effective_date","description"]},"LoanRateHistoryV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"period_start":{"type":"string","format":"date","description":"First day of the interest period this reset priced."},"period_end":{"type":"string","format":"date","description":"The period's end: the next due date (exclusive)."},"fix_date":{"type":"string","format":"date","nullable":true,"description":"Date of the published reading the reset was fixed from; null when the row names no reading."},"index_type":{"type":"string","nullable":true,"example":"sofr_1m","description":"The series actually read (e.g. `sofr_1m`, or `sofr` for an overnight proxy); null when the row names no reading."},"index_rate":{"type":"string","example":"0.04300","description":"Decimal fraction, not a percent: 0.055 = 5.5%."},"spread":{"type":"string","example":"0.02500","description":"Decimal fraction, not a percent: 0.055 = 5.5%."},"all_in_rate":{"type":"string","example":"0.06800","description":"Index plus spread, after floor and cap. Decimal fraction, not a percent: 0.055 = 5.5%."},"basis":{"type":"string","enum":["fixed","projected","overnight_proxy"],"description":"`fixed`: a reading on or before the fix date, final. `projected`: an in-arrears period priced from the latest overnight reading held flat, re-evaluated once the period closes. `overnight_proxy`: a term-rate loan priced from overnight SOFR because no tenor reading was usable; repriced when one is recorded."},"created_at":{"type":"string","format":"date-time"}},"required":["id","period_start","period_end","fix_date","index_type","index_rate","spread","all_in_rate","basis","created_at"]},"LoanExtensionOptionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"option_number":{"type":"number"},"extended_maturity_date":{"type":"string","format":"date"},"notice_window_start_days":{"type":"number","nullable":true},"notice_deadline_days":{"type":"number"},"fee_rate":{"type":"string","nullable":true,"description":"A decimal rate, 0.0025 = 0.25%; informational — not posted."},"conditions":{"type":"string","nullable":true},"state":{"type":"string","enum":["available","exercised","waived","lapsed"],"description":"available, exercised, waived, or lapsed (live and past its notice deadline, still exercisable)."},"is_live":{"type":"boolean","description":"True for the one option that can be exercised or waived now."},"notice_deadline":{"type":"string","format":"date","nullable":true,"description":"Null once exercised or waived."},"notice_window_start":{"type":"string","format":"date","nullable":true,"description":"Null once exercised or waived."},"exercised_amendment_id":{"type":"string","format":"uuid","nullable":true},"waived_at":{"type":"string","format":"date-time","nullable":true},"waived_reason":{"type":"string","nullable":true}},"required":["id","option_number","extended_maturity_date","notice_window_start_days","notice_deadline_days","fee_rate","conditions","state","is_live","notice_deadline","notice_window_start","exercised_amendment_id","waived_at","waived_reason"]},"PutLoanExtensionOptionInputV1Dto":{"type":"object","properties":{"option_number":{"type":"number","minimum":1,"maximum":10,"description":"1, 2, 3… in the order they can be exercised."},"extended_maturity_date":{"type":"string","format":"date","description":"The maturity the loan gets if this option is exercised."},"notice_window_start_days":{"type":"number","nullable":true,"minimum":1,"maximum":3650,"description":"Days before maturity the notice window opens; must exceed notice_deadline_days. Null = 30 days before the deadline."},"notice_deadline_days":{"type":"number","minimum":1,"maximum":3650,"description":"Days before maturity by which notice must be given."},"fee_rate":{"type":"string","nullable":true,"example":"0.0025","description":"A decimal rate, 0.0025 = 0.25%; informational — not posted."},"conditions":{"type":"string","nullable":true,"description":"Free-text conditions of the option."}},"required":["option_number","extended_maturity_date","notice_deadline_days"]},"PutLoanExtensionOptionsV1Dto":{"type":"object","properties":{"options":{"maxItems":10,"description":"The WHOLE set; it replaces what the loan has. Exercised and waived options must be re-sent unchanged.","type":"array","items":{"$ref":"#/components/schemas/PutLoanExtensionOptionInputV1Dto"}}},"required":["options"]},"LoanExtensionOptionExerciseResultV1Dto":{"type":"object","properties":{"option":{"$ref":"#/components/schemas/LoanExtensionOptionV1Dto"},"amendment":{"$ref":"#/components/schemas/LoanAmendmentV1Dto"},"regeneration":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/LoanAmendmentRegenerationV1Dto"}]}},"required":["option","amendment","regeneration"]},"ExerciseLoanExtensionOptionV1Dto":{"type":"object","properties":{"effective_date":{"type":"string","format":"date","description":"On or before the org's today (the amendment's effective date)."},"description":{"type":"string","description":"Why the option is being exercised (the reason). Required."},"document_id":{"type":"string","format":"uuid","nullable":true,"description":"The signed extension document, if any."}},"required":["effective_date","description"]},"WaiveLoanExtensionOptionV1Dto":{"type":"object","properties":{"reason":{"type":"string","description":"Why the option is being waived. Required."}},"required":["reason"]},"LoanDelinquencyTermsV1Dto":{"type":"object","properties":{"grace_days":{"type":"number","minimum":0,"maximum":365,"example":10,"description":"Days after the due date before an unpaid period is past due. 0 = past due the day after."},"payment_waterfall":{"type":"array","minItems":3,"maxItems":3,"example":["fees","interest","principal"],"description":"The order a payment is applied in: fees, interest and principal, each exactly once.","items":{"type":"string","enum":["fees","interest","principal"]}},"late_fee_basis":{"type":"string","enum":["none","pct_scheduled_payment","pct_past_due_amount","flat"],"example":"pct_past_due_amount","description":"What the late fee is computed on: none (no fee), pct_scheduled_payment (late_fee_value × the period's scheduled payment), pct_past_due_amount (late_fee_value × what the period still owes, fees excluded, on the fee date), or flat (late_fee_value is the fee)."},"late_fee_value":{"type":"string","nullable":true,"example":"0.05","description":"A decimal fraction for the pct_* bases (0.05 = 5%), money for flat. Null when the basis is none."},"late_fee_cadence":{"type":"string","enum":["once","monthly","per_billing_period"],"example":"monthly","description":"How often the fee is charged while the period stays unpaid: once; monthly (again each month after the first fee); per_billing_period (again each time a later due date passes). Each repeat is priced on the day it is charged. Must be once when late_fee_basis is none."},"default_rate_uplift":{"type":"string","nullable":true,"example":"0.05","description":"Added to the interest rate while the loan is in default (0.05 = +5 percentage points). Null = the note has none, and default cannot be declared."}},"required":["grace_days","payment_waterfall","late_fee_basis","late_fee_cadence"]},"LoanScheduleEntryV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The spine event id."},"period_number":{"type":"number","description":"Null only for point events, which this view never returns; kept nullable so the vocabulary and the DTO agree.","nullable":true},"due_date":{"type":"string","format":"date"},"segment":{"type":"string","description":"Which side of the organization’s today this row falls on. `actual` — due before today, so a real document should have filled it. `projection` — due today or later. The boundary is the org’s calendar day, not the database session’s.","enum":["actual","projection"]},"expected_principal":{"type":"string","example":"1234.50"},"expected_interest":{"type":"string","example":"1234.50"},"expected_escrow":{"type":"string","example":"1234.50"},"expected_fees":{"type":"string","example":"1234.50"},"expected_hedge":{"type":"string","description":"A hedge settlement's signed amount (+ we pay the bank, − the bank pays us). Non-zero only on a `swap_settlement` row (source_instrument_type `hedge`), where the other four components are 0.00; 0.00 on every other row.","example":"1234.50"},"expected_total":{"type":"string","description":"The exact sum of the five components above.","example":"1234.50"},"beginning_balance":{"type":"string","nullable":true,"description":"PROJECTION ONLY. The balance the projection assumed going into this period; it carries no meaning on a row a real document has filled. The settled balance is derived from the books, never stored.","example":"1234.50"},"ending_balance":{"type":"string","nullable":true,"description":"PROJECTION ONLY, on the same terms as `beginning_balance`.","example":"1234.50"},"amount_basis":{"type":"string","description":"Whether the expected amounts are settled (`fixed`), derived from a forward curve (`projected`), or a placeholder (`estimated`).","enum":["fixed","projected","estimated"]},"source_instrument_type":{"type":"string","description":"What wrote the row: `hedge` for a hedge's settlement (source_instrument_id is the hedge, GET /v1/loans/{id}/hedges); null for the loan's own rows.","enum":["hedge"],"nullable":true},"source_instrument_id":{"type":"string","description":"The hedge a `hedge` row belongs to; null otherwise.","format":"uuid","nullable":true},"schedule_version":{"type":"number","description":"Which generation of the schedule this row belongs to. Version 1 is the origination-day contractual schedule and is kept forever."},"superseded_at":{"type":"string","description":"When a later schedule version replaced this row. Null while it is live. Superseded rows are excluded unless `include_superseded` is set.","format":"date-time","nullable":true},"state":{"type":"string","description":"Where the slot stands, derived at read time and stored nowhere. `superseded` — replaced by a later schedule version. `moot` — all its documents were voided. `paid` — posted documents fill it and `outstanding` is 0. `billed` — posted documents fill it and nothing is settled yet. `partial` — posted documents fill it and part of `owed` is settled. `missed` — the due date plus the loan’s grace days has passed and nothing filled it. `scheduled` — anything else, including everything still in the future.","enum":["superseded","moot","paid","billed","partial","missed","scheduled"]},"actual_document_id":{"type":"string","description":"The live actual filling this slot, when one exists.","format":"uuid","nullable":true},"actual_date":{"type":"string","format":"date","nullable":true},"actual_total":{"type":"string","nullable":true,"description":"The period’s `owed` once a live document fills it (the bill plus the scheduled principal); null before.","example":"1234.50"},"actual_settled":{"type":"string","nullable":true,"description":"The period’s `settled` once a live document fills it: the paid part of its bills plus the principal its payments moved; null before.","example":"1234.50"},"variance_total":{"type":"string","nullable":true,"description":"`actual_total` less `expected_total`: interest that differed from the schedule (and late fees, once they exist). Null when no live document fills the slot.","example":"1234.50"},"financial_event_id":{"type":"string","description":"The execution-queue row that materialized this slot, when one exists.","format":"uuid","nullable":true},"owed":{"type":"string","description":"What the period owes: the interest, escrow and fees billed (the bill’s total) plus the scheduled principal. Before the period is billed it is the scheduled principal alone.","example":"1234.50"},"settled":{"type":"string","description":"What the period’s posted documents have settled: the paid part of its bills plus the principal its payments moved.","example":"1234.50"},"outstanding":{"type":"string","description":"`owed` less `settled`.","example":"1234.50"},"is_past_due":{"type":"boolean","description":"True once the due date plus the loan’s grace days has passed and the period still owes money — counted only for a period that was billed (a posted document holds it) or that the nightly run recorded as having nothing to bill. A due period with neither is not past due; it raises a `loans.period_not_billed` work item instead. Not a `state`: a billed or partial period can be past due."},"days_past_due":{"type":"number","description":"Days since the due date (not since grace ended) while `is_past_due`; 0 otherwise."}},"required":["id","due_date","segment","expected_principal","expected_interest","expected_escrow","expected_fees","expected_hedge","expected_total","amount_basis","source_instrument_type","source_instrument_id","schedule_version","state","owed","settled","outstanding","is_past_due","days_past_due"]},"LoanEventV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"loan_id":{"type":"string","format":"uuid"},"event_type":{"type":"string","description":"What kind of obligation this slot represents. Phase A writes only `scheduled_payment`; the rest of the vocabulary is reserved.","enum":["scheduled_payment","swap_settlement","escrow_deposit","accrual","fee","rate_reset","maturity","balloon"]},"due_date":{"type":"string","format":"date"},"period_number":{"type":"number","description":"Null for point events (maturity, rate reset); set for payment-type events.","nullable":true},"expected_principal":{"type":"string","example":"1234.50"},"expected_interest":{"type":"string","example":"1234.50"},"expected_escrow":{"type":"string","example":"1234.50"},"expected_fees":{"type":"string","example":"1234.50"},"expected_hedge":{"type":"string","description":"A hedge settlement's signed amount (+ we pay the bank, − the bank pays us). Non-zero only on a `swap_settlement` row (source_instrument_type `hedge`), where the other four components are 0.00; 0.00 on every other row.","example":"1234.50"},"expected_total":{"type":"string","description":"The exact sum of the five components above.","example":"1234.50"},"beginning_balance":{"type":"string","nullable":true},"ending_balance":{"type":"string","nullable":true},"amount_basis":{"type":"string","description":"Whether the expected amounts are settled (`fixed`), derived from a forward curve (`projected`), or a placeholder (`estimated`).","enum":["fixed","projected","estimated"]},"source_instrument_type":{"type":"string","description":"What wrote the row: `hedge` for a hedge's settlement (source_instrument_id is the hedge, GET /v1/loans/{id}/hedges); null for the loan's own rows.","enum":["hedge"],"nullable":true},"source_instrument_id":{"type":"string","description":"The hedge a `hedge` row belongs to; null otherwise.","format":"uuid","nullable":true},"schedule_version":{"type":"number","description":"Which generation of the schedule this row belongs to. A regeneration supersedes rather than deletes, so older versions stay readable."},"superseded_at":{"type":"string","description":"When a later schedule version replaced this row. Null while it is live.","format":"date-time","nullable":true},"financial_event_id":{"type":"string","description":"The execution-queue row that materialized this slot, when one exists.","format":"uuid","nullable":true},"state":{"type":"string","description":"Where the slot stands, derived at read time and stored nowhere. `superseded` — replaced by a later schedule version. `moot` — its only actual was voided. `paid` — a posted document filled it and owes nothing. `billed` — a posted document filled it and is unpaid. `partial` — a posted document filled it and is part-paid. `missed` — the due date has passed and nothing filled it. `scheduled` — anything else, including everything still in the future.","enum":["superseded","moot","paid","billed","partial","missed","scheduled"]}},"required":["id","loan_id","event_type","due_date","expected_principal","expected_interest","expected_escrow","expected_fees","expected_hedge","expected_total","amount_basis","source_instrument_type","source_instrument_id","schedule_version","state"]},"LoanDocumentLinkV1Dto":{"type":"object","properties":{"loan_id":{"type":"string","format":"uuid"},"loan_name":{"type":"string"},"document_role":{"type":"string","description":"The document's role on the loan — the same value as `document_role` on `GET /v1/loans/{loanId}/documents`."},"allocates_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The source document a co_borrower_allocation document allocates; null for every other role."},"allocates_document_number":{"type":"string","nullable":true,"description":"The source document's document_number; null when allocates_document_id is null."},"allocates_document_type":{"type":"string","nullable":true,"description":"The source document's document_type (e.g. `loan_drawdown`); null when allocates_document_id is null."}},"required":["loan_id","loan_name","document_role","allocates_document_id","allocates_document_number","allocates_document_type"]},"LoanDocumentV1Dto":{"type":"object","properties":{"loan_id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"document_role":{"type":"string"},"allocates_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The source document a co_borrower_allocation row allocates; null on every other row."},"document_type":{"type":"string","nullable":true},"document_number":{"type":"string","nullable":true},"document_date":{"type":"string","format":"date","nullable":true},"total_amount":{"type":"string","nullable":true,"example":"1234.50"},"status":{"type":"string","nullable":true}},"required":["loan_id","document_id","document_role","allocates_document_id","document_type","document_number","document_date","total_amount","status"]},"LoanPeriodEscrowLineV1Dto":{"type":"object","properties":{"escrow_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"escrow_type":{"type":"string","enum":["tax","insurance","replacement_reserve","ti_lc_reserve","other"]},"expected":{"type":"string","description":"The deposit letter in force on the due date.","example":"1234.50"},"billed":{"type":"string","nullable":true,"description":"What the period's live bill carried for this escrow; null when no bill holds the period.","example":"1234.50"}},"required":["escrow_id","name","escrow_type","expected","billed"]},"LoanPeriodActualV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The `loan_event_actuals` row id."},"status":{"type":"string","description":"This actual’s own lifecycle — `active` holds the period’s slot (the bill, or the first payment of a principal-only period); `linked` belongs to the period without holding the slot (a payment, or a late fee — a fee never holds the slot); `voided` was live and its document was voided; `superseded` is legacy history (a bill that handed the slot to its payment before debt-v2 step 3) and is no longer written.","enum":["active","linked","superseded","voided"]},"document_id":{"type":"string","format":"uuid"},"document_type":{"type":"string","description":"e.g. `debt_service_bill`, `debt_service_payment`. A late fee is a `debt_service_bill` too — `document_role` tells it from the bill."},"document_role":{"type":"string","nullable":true,"enum":["scheduled_bill","late_fee","scheduled_payment"],"description":"Which kind of period document: the period’s bill, a late fee (also a debt_service_bill), or a payment."},"document_status":{"type":"string","description":"The document’s own status — independent of this row’s `status` above. A `status: active` row on a `document_status: voided` document is exactly the inconsistency `slot_integrity_ok` flags."},"document_date":{"type":"string","format":"date"},"total_amount":{"type":"string","description":"The document’s total, in full.","example":"1234.50"},"balance_amount":{"type":"string","description":"A bill: what is still owed. A payment: unapplied cash (its principal leg), never debt still owed — see `periodMoneySql` in `loan-event-state.ts`.","example":"1234.50"},"late_fee_window":{"type":"string","nullable":true,"description":"A late fee only: its assessment window — `once`, `m<k>` (the k-th month after the first fee date) or `p0` / `p:<due date>` (a later billing period). Null on any other document."},"waived_at":{"type":"string","format":"date-time","nullable":true,"description":"A late fee only: when it was waived (its document is then voided and its window stays closed). Null when charged, and on any other document."}},"required":["id","status","document_id","document_type","document_role","document_status","document_date","total_amount","balance_amount","late_fee_window","waived_at"]},"LoanPeriodShareV1Dto":{"type":"object","properties":{"participant_id":{"type":"string","format":"uuid","description":"The `loan_participants` row this snapshot was built from."},"participant_type":{"type":"string","enum":["property","legal_entity"]},"property_id":{"type":"string","format":"uuid","nullable":true},"legal_entity_id":{"type":"string","format":"uuid","nullable":true},"share_pct":{"type":"string","description":"FROZEN at the moment this actual was built — what the money was ACTUALLY split by, not today’s participant configuration. Percent, numeric(7,4) as a decimal string.","example":"60.0000"},"method":{"type":"string","enum":["allocated","intercompany"]},"interest_amount":{"type":"string","example":"1234.50"},"principal_amount":{"type":"string","example":"1234.50"},"escrow_amount":{"type":"string","example":"1234.50"},"fees_amount":{"type":"string","example":"1234.50"}},"required":["participant_id","participant_type","share_pct","method","interest_amount","principal_amount","escrow_amount","fees_amount"]},"LoanPeriodAccrualV1Dto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid"},"accounting_period_id":{"type":"string","format":"uuid","description":"The accounting period this interest BELONGS to — not necessarily the period the accrual document posted in (A6)."},"amount":{"type":"string","example":"1234.50"},"status":{"type":"string"},"document_date":{"type":"string","format":"date"}},"required":["document_id","accounting_period_id","amount","status","document_date"]},"LoanPeriodAttentionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","description":"e.g. `loans.payment_not_seen`."},"severity":{"type":"string","enum":["info","warning","critical"]},"state":{"type":"string","enum":["open","snoozed","resolved"]},"payload":{"type":"object","additionalProperties":true,"description":"Caller-defined; shape varies by `type`."},"created_at":{"type":"string","format":"date-time"}},"required":["id","type","severity","state","payload","created_at"]},"LoanPeriodV1Dto":{"type":"object","properties":{"event_id":{"type":"string","format":"uuid","description":"The spine `loan_events` row id."},"loan_id":{"type":"string","format":"uuid"},"due_date":{"type":"string","format":"date"},"period_number":{"type":"number","nullable":true},"state":{"type":"string","description":"Where the slot stands, derived at read time — see `LoanScheduleEntryV1Dto.state`.","enum":["superseded","moot","paid","billed","partial","missed","scheduled"]},"expected_principal":{"type":"string","example":"1234.50"},"expected_interest":{"type":"string","example":"1234.50"},"interest_to_bill":{"type":"string","description":"Interest a statement for this period should show: what has accrued for the period (default interest included), not the schedule's estimate. Prefill for Record statement.","example":"1234.50"},"expected_escrow":{"type":"string","example":"1234.50"},"expected_fees":{"type":"string","example":"1234.50"},"expected_total":{"type":"string","description":"The exact sum of the four components above.","example":"1234.50"},"escrow_lines":{"description":"Per escrow: expected deposit vs what the bill carried (debt-v2 4). Empty when the loan has no escrow.","type":"array","items":{"$ref":"#/components/schemas/LoanPeriodEscrowLineV1Dto"}},"actuals":{"description":"Every document this period has held, live or not — the bill holding the slot and the payments linked to it, each with its own status.","type":"array","items":{"$ref":"#/components/schemas/LoanPeriodActualV1Dto"}},"shares":{"description":"The FROZEN participant split for whichever actual currently holds the slot (`loan_event_shares`) — not the live `loan_participants` configuration, which may have changed since.","type":"array","items":{"$ref":"#/components/schemas/LoanPeriodShareV1Dto"}},"owed":{"type":"string","description":"What the period owes: the interest, escrow and fees billed (the bill’s total), plus its live late fees (`fees_owed`), plus the scheduled principal. Before the period is billed it is the scheduled principal and any late fees.","example":"1234.50"},"settled":{"type":"string","description":"What the period’s posted documents have settled: the paid part of its bills and late fees plus the principal its payments moved.","example":"1234.50"},"outstanding":{"type":"string","description":"`owed` less `settled`.","example":"1234.50"},"fees_owed":{"type":"string","description":"Σ total of the period’s live late fees (included in `owed`).","example":"1234.50"},"fees_outstanding":{"type":"string","description":"What the period’s live late fees still owe (included in `outstanding`).","example":"1234.50"},"late_fee_exempt":{"type":"boolean","description":"True when later late-fee windows are stopped for this period (an admin exemption, or a waive with `stop_future`). Fees already charged stay; removing the exemption resumes from the next window."},"is_past_due":{"type":"boolean","description":"True once the due date plus the loan’s grace days has passed and the period still owes money — counted only for a period that was billed (a posted document holds it) or that the nightly run recorded as having nothing to bill. A due period with neither is not past due; it raises a `loans.period_not_billed` work item instead. Not a `state`: a billed or partial period can be past due."},"days_past_due":{"type":"number","description":"Days since the due date (not since grace ended) while `is_past_due`; 0 otherwise."},"variance_total":{"type":"string","nullable":true,"description":"`owed` less `expected_total`: interest that differed from the schedule, plus late fees. Null when the period has no live document (a late fee alone is not one).","example":"1234.50"},"variance_basis":{"type":"string","enum":["total","non_principal"],"description":"Always `total` since debt-v2 step 3; kept for compatibility — deprecated. `variance_total` is measured against `expected_total`."},"accrual":{"nullable":true,"description":"Accrued interest for this period, read by (loan_id, accrual_period_id) — spec A7. Never a spine row: an accrual is a recomputed quantity and does not fill a `loan_events` slot.","type":"object","allOf":[{"$ref":"#/components/schemas/LoanPeriodAccrualV1Dto"}]},"attention":{"description":"This loan’s open/snoozed `loans.*` work items.","type":"array","items":{"$ref":"#/components/schemas/LoanPeriodAttentionV1Dto"}},"slot_integrity_ok":{"type":"boolean","description":"`false` when some actual is `active` while its document is `voided` (spec gap G1) — a banking unmatch bypasses the void orchestrator’s slot release. The workspace surfaces this; it does not repair it."}},"required":["event_id","loan_id","due_date","state","expected_principal","expected_interest","interest_to_bill","expected_escrow","expected_fees","expected_total","escrow_lines","actuals","shares","owed","settled","outstanding","fees_owed","fees_outstanding","late_fee_exempt","is_past_due","days_past_due","variance_basis","attention","slot_integrity_ok"]},"RecordLoanStatementEscrowV1Dto":{"type":"object","properties":{"escrow_id":{"type":"string","format":"uuid"},"amount":{"type":"string","description":"The statement's deposit for this escrow; 0 or more.","example":"1234.50"}},"required":["escrow_id","amount"]},"RecordLoanStatementV1Dto":{"type":"object","properties":{"interest":{"type":"string","description":"The lender statement's interest for the period. Fees arrive with step 5.","example":"1234.50"},"escrow":{"description":"The statement's escrow, per escrow. An escrow left out bills its deposit letter; an escrow not active on the loan for this period is refused (422 LOAN_ESCROW_STATEMENT_UNKNOWN_ESCROW). The period variance shows any difference.","type":"array","items":{"$ref":"#/components/schemas/RecordLoanStatementEscrowV1Dto"}}},"required":["interest"]},"VoidLoanActualV1Dto":{"type":"object","properties":{"memo":{"type":"string","maxLength":2000}},"required":["memo"]},"LoanPaymentResultV1Dto":{"type":"object","properties":{"payment_document_ids":{"description":"One debt_service_payment per period touched, oldest first.","type":"array","items":{"type":"string","format":"uuid"}},"periods":{"description":"Each period the payment touched, reloaded.","type":"array","items":{"$ref":"#/components/schemas/LoanPeriodV1Dto"}}},"required":["payment_document_ids","periods"]},"LoanPaymentSplitV1Dto":{"type":"object","properties":{"due_date":{"type":"string","format":"date","description":"The period, by due date."},"fees":{"type":"string","description":"Late fees settled. Always 0.00 until late fees ship (3b).","example":"1234.50"},"interest":{"type":"string","description":"Applied to the period's bill (interest, escrow and fees billed).","example":"1234.50"},"principal":{"type":"string","description":"Principal the payment moves.","example":"1234.50"}},"required":["due_date","fees","interest","principal"]},"RecordLoanPaymentV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"The whole remittance. Spread oldest first over the periods due on or before today, each filled in the loan's payment-waterfall order. More than those periods owe is refused (LOAN_PAYMENT_EXCEEDS_OUTSTANDING): record extra principal as a prepayment.","example":"1234.50"},"payment_date":{"type":"string","format":"date","description":"Cash value date: on or after the loan's origination date and on or before the org's today. It may be before a due date (cash paid early): the periods filled are those due on or before the org's today, and interest is corrected to this date."},"splits":{"minItems":1,"maxItems":120,"description":"A lender's own split; replaces the computed allocation entirely. Each bucket at most what it owes, rows summing to amount, and a later period only once every earlier open period is filled (LOAN_PAYMENT_SPLIT_INVALID otherwise).","type":"array","items":{"$ref":"#/components/schemas/LoanPaymentSplitV1Dto"}}},"required":["amount","payment_date"]},"LoanPaymentPreviewV1Dto":{"type":"object","properties":{"outstanding":{"type":"string","description":"What the periods due on or before today still owe. A due period with no bill yet counts its scheduled interest (expected_interest); recording the payment bills it at the interest that accrued, so the two can differ by the interest variance of that period.","example":"1234.50"},"splits":{"description":"The allocation recording this amount would post, oldest first.","type":"array","items":{"$ref":"#/components/schemas/LoanPaymentSplitV1Dto"}}},"required":["outstanding","splits"]},"RecordLoanLateFeeV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"The lender's late fee for the period's current window. Must be greater than 0.","example":"1234.50"},"memo":{"type":"string","maxLength":500}},"required":["amount"]},"WaiveLoanLateFeeV1Dto":{"type":"object","properties":{"note":{"type":"string","maxLength":500,"description":"Why the fee is waived; recorded on the void memo."},"stop_future":{"type":"boolean","description":"Also stop every later late-fee window for this period (the exemption)."}}},"CreateLoanLateFeeExemptionV1Dto":{"type":"object","properties":{"note":{"type":"string","maxLength":500}}},"DeclareLoanDefaultV1Dto":{"type":"object","properties":{"declared_on":{"type":"string","format":"date","description":"The first day in default. May be in the past (the uplift for days already accrued is posted at once); not after the org's today, not before origination, not before the loan's latest cure."},"reason":{"type":"string","minLength":1,"maxLength":500,"example":"Notice of default dated 2026-09-01"}},"required":["declared_on","reason"]},"CureLoanDefaultV1Dto":{"type":"object","properties":{"cured_on":{"type":"string","format":"date","description":"The first day no longer in default (the window is [declared_on, cured_on)). May be in the past (the uplift already accrued for the days from it is taken back); not after the org's today, not before declared_on. Equal to declared_on withdraws the default."}},"required":["cured_on"]},"LoanEscrowDepositV1Dto":{"type":"object","properties":{"effective_date":{"type":"string","format":"date"},"amount":{"type":"string","example":"1234.50"}},"required":["effective_date","amount"]},"LoanEscrowV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"loan_id":{"type":"string","format":"uuid"},"escrow_type":{"type":"string","enum":["tax","insurance","replacement_reserve","ti_lc_reserve","other"]},"name":{"type":"string"},"required_balance":{"type":"string","description":"The lender's minimum balance; 0.00 = none.","example":"1234.50"},"account_id":{"type":"string","format":"uuid","nullable":true,"description":"GL account overriding the role account (loan_escrow_asset / loan_escrow_liability) for this escrow."},"status":{"type":"string","enum":["active","closed"]},"closed_at":{"type":"string","format":"date","nullable":true},"current_deposit":{"type":"string","description":"The monthly deposit in force on the org's today (0.00 before the first letter or once closed).","example":"1234.50"},"deposit_history":{"description":"Every letter, effective date ascending.","type":"array","items":{"$ref":"#/components/schemas/LoanEscrowDepositV1Dto"}},"balance":{"type":"string","description":"From the GL: the posted lines tagged with this escrow on the escrow's account. Positive = held.","example":"1234.50"},"funded_balance":{"type":"string","description":"The GL balance less deposits on bills that still have a balance due. Drives the shortfall check. Negative when money was paid out of deposits the borrower has not yet paid.","example":"1234.50"},"billed_unpaid":{"type":"string","description":"Deposits billed on bills that still have a balance due; owed to the escrow but not yet funded.","example":"1234.50"},"shortfall":{"type":"boolean","description":"Active and its funded_balance is below required_balance (a Work Center item is raised)."},"has_movements":{"type":"boolean","description":"A journal line carries this escrow; account_id can then no longer change."}},"required":["id","loan_id","escrow_type","name","required_balance","account_id","status","closed_at","current_deposit","deposit_history","balance","funded_balance","billed_unpaid","shortfall","has_movements"]},"LoanEscrowChangeV1Dto":{"type":"object","properties":{"escrow":{"$ref":"#/components/schemas/LoanEscrowV1Dto"},"repriced_periods":{"type":"number","description":"How many unbilled periods had their expected escrow changed by this write."}},"required":["escrow","repriced_periods"]},"LoanEscrowDepositInputV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"The monthly deposit from the lender's escrow-analysis letter; 0 or more.","example":"1234.50"},"effective_date":{"type":"string","format":"date","description":"Prices every period due on or after this date. May not precede the latest billed due date."}},"required":["amount","effective_date"]},"CreateLoanEscrowV1Dto":{"type":"object","properties":{"escrow_type":{"type":"string","enum":["tax","insurance","replacement_reserve","ti_lc_reserve","other"]},"name":{"type":"string","maxLength":120,"description":"Unique on the loan."},"required_balance":{"type":"string","description":"The lender's minimum balance; 0.00 = none.","example":"1234.50"},"account_id":{"type":"string","format":"uuid","description":"Overrides the role account for this escrow; must be usable by the loan's legal entity."},"deposit":{"$ref":"#/components/schemas/LoanEscrowDepositInputV1Dto"}},"required":["escrow_type","name","required_balance","deposit"]},"UpdateLoanEscrowV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"required_balance":{"type":"string","description":"The lender's minimum balance; 0.00 = none.","example":"1234.50"},"account_id":{"type":"string","format":"uuid","nullable":true,"description":"Only while no journal line carries the escrow; null returns to the role account."}}},"AddLoanEscrowDepositV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"The monthly deposit from the lender's escrow-analysis letter; 0 or more.","example":"1234.50"},"effective_date":{"type":"string","format":"date","description":"Prices every period due on or after this date. May not precede the latest billed due date."}},"required":["amount","effective_date"]},"CloseLoanEscrowV1Dto":{"type":"object","properties":{"closed_at":{"type":"string","format":"date","description":"On or before the org's today. No deposit is priced from this date."}},"required":["closed_at"]},"LoanEscrowMovementResultV1Dto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid","description":"The movement document (the payment_out or journal_entry)."},"kind":{"type":"string","enum":["disbursement","draw","refund","interest","opening_balance","adjustment"]},"escrow":{"description":"The escrow after the write, balance from the GL.","allOf":[{"$ref":"#/components/schemas/LoanEscrowV1Dto"}]}},"required":["document_id","kind","escrow"]},"CreateLoanEscrowDisbursementV1Dto":{"type":"object","properties":{"date":{"type":"string","format":"date","description":"The movement's date: on or before the org's today, in an open period (or with period_override_reason)."},"amount":{"type":"string","description":"Greater than 0.","example":"1234.50"},"memo":{"type":"string","maxLength":500},"period_override_reason":{"type":"string","maxLength":500,"description":"Post into a closed period; needs the accounting:periods_override scope."},"bill_document_id":{"type":"string","format":"uuid","description":"The AP bill the lender paid from escrow (posted, open, the loan's entity and currency). Exactly one of bill_document_id / expense_account_id."},"expense_account_id":{"type":"string","format":"uuid","description":"With no bill in the books: the expense account the disbursement is recognised on."}},"required":["date","amount"]},"CreateLoanEscrowMovementV1Dto":{"type":"object","properties":{"date":{"type":"string","format":"date","description":"The movement's date: on or before the org's today, in an open period (or with period_override_reason)."},"amount":{"type":"string","description":"Greater than 0.","example":"1234.50"},"memo":{"type":"string","maxLength":500},"period_override_reason":{"type":"string","maxLength":500,"description":"Post into a closed period; needs the accounting:periods_override scope."},"kind":{"type":"string","enum":["disbursement","draw","refund","interest","opening_balance","adjustment"],"description":"disbursement is lender-only here (a borrower uses …/disbursements)."},"offset_account_id":{"type":"string","format":"uuid","description":"The other side of the entry. With bank_transaction_id it may be omitted (the bank cash account is used) or must equal it."},"bank_transaction_id":{"type":"string","format":"uuid","description":"draw / refund / lender disbursement: the bank line the cash moved on. Required when the offset is a bank cash account; the line is matched by the same act."},"direction":{"type":"string","enum":["increase","decrease"],"description":"adjustment only, and required for it."}},"required":["date","amount","kind"]},"VoidLoanEscrowMovementV1Dto":{"type":"object","properties":{"memo":{"type":"string","maxLength":500,"description":"Why — kept on the reversing entry."}},"required":["memo"]},"LoanEscrowMovementV1Dto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid"},"document_number":{"type":"string","nullable":true},"document_type":{"type":"string","description":"payment_out, journal_entry, or debt_service_bill for a deposit."},"kind":{"type":"string","enum":["deposit","disbursement","draw","refund","interest","opening_balance","adjustment","other"]},"date":{"type":"string","format":"date"},"amount":{"type":"string","description":"Signed: positive into the escrow, negative out of it. A voided movement keeps its original amount.","example":"1234.50"},"running_balance":{"type":"string","description":"The escrow balance after this movement, oldest first, voided movements counting zero.","example":"1234.50"},"status":{"type":"string","enum":["posted","voided"]},"voidable":{"type":"boolean","description":"A recorded movement (not a deposit) still posted: POST …/void accepts it."},"memo":{"type":"string","nullable":true}},"required":["document_id","document_number","document_type","kind","date","amount","running_balance","status","voidable","memo"]},"LoanEscrowPayableBillV1Dto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid"},"document_number":{"type":"string","nullable":true},"document_date":{"type":"string","format":"date"},"due_date":{"type":"string","format":"date","nullable":true},"party_name":{"type":"string","nullable":true},"total_amount":{"type":"string","example":"1234.50"},"balance_amount":{"type":"string","example":"1234.50"},"source_hint":{"type":"string","enum":["property_tax","property_insurance"],"nullable":true,"description":"The module that raised the bill."},"collateral":{"type":"boolean","description":"Tagged with one of the loan's collateral properties (listed first)."}},"required":["document_id","document_number","document_date","due_date","party_name","total_amount","balance_amount","source_hint","collateral"]},"LoanHedgeLatestMarkV1Dto":{"type":"object","properties":{"as_of_date":{"type":"string","format":"date"},"fair_value":{"type":"string","description":"Signed: + an asset to us, − a liability.","example":"1234.50"}},"required":["as_of_date","fair_value"]},"LoanHedgeV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"loan_id":{"type":"string","format":"uuid"},"instrument_type":{"type":"string","enum":["swap","cap"]},"counterparty_id":{"type":"string","format":"uuid","description":"The bank on the other side of the hedge (a party)."},"reference":{"type":"string","nullable":true,"description":"The bank's trade or confirmation reference."},"notional_amount":{"type":"string","example":"1234.50"},"index_type":{"type":"string","enum":["sofr","prime","treasury","other"]},"index_variant":{"type":"string","enum":["term_1m","term_3m","term_6m","daily_simple","compounded_arrears","na"]},"fixed_rate":{"type":"string","nullable":true,"example":"0.04000","description":"Swap only: the fixed rate we pay. Decimal fraction, not a percent: 0.055 = 5.5%."},"floating_spread":{"type":"string","example":"0.00000","description":"Swap only: the spread over the index on the floating leg we receive. Decimal fraction, not a percent: 0.055 = 5.5%."},"strike_rate":{"type":"string","nullable":true,"example":"0.05000","description":"Cap only: the strike the cap pays above. Decimal fraction, not a percent: 0.055 = 5.5%."},"premium_amount":{"type":"string","nullable":true,"description":"Cap only: the premium paid.","example":"1234.50"},"premium_paid_date":{"type":"string","format":"date","nullable":true},"tracking_start_date":{"type":"string","format":"date","description":"Settlement periods ending on or before this date are not tracked here (settled before the ERP took over)."},"opening_premium_balance":{"type":"string","nullable":true,"description":"Cap only: the unamortized premium on tracking_start_date, for a hedge onboarded mid-life.","example":"1234.50"},"opening_premium_offset_account_id":{"type":"string","format":"uuid","nullable":true,"description":"Cap only: the account the opening premium balance is credited to when the premium posts (the asset side is the cap premium asset)."},"lookback_days":{"type":"number","description":"Counted in SOFR publication days: weekdays less SIFMA US full closes and every Good Friday (weekdays only after 2030). Fixed in advance (term_1m, term_3m, term_6m, na): publication days before a period start the index is read. In arrears (daily_simple, compounded_arrears): how far back the readings are taken, weighed per lookback_method — observation_shift moves the window back this many publication days, lookback has each day of the period read this many publication days earlier."},"lookback_method":{"type":"string","enum":["observation_shift","lookback"],"description":"How an in-arrears index (daily_simple, compounded_arrears) weighs its readings, from the agreement or confirmation. observation_shift: each reading weighs the calendar days it covers in the window shifted back lookback_days publication days, and the day count is that window. lookback: each calendar day of the interest period weighs 1 on the reading lookback_days publication days before it; a weekend or holiday takes the reading of the publication day before it, so Friday to Sunday share one. The day count is the period. Ignored by in-advance variants. Default observation_shift."},"day_count_convention":{"type":"string","enum":["actual_360","actual_365","30_360"]},"settlement_frequency":{"type":"string","enum":["monthly","quarterly","semi_annual"]},"settlement_day":{"type":"number","minimum":1,"maximum":31,"description":"Day of month a period settles; clamped to the month end."},"effective_date":{"type":"string","format":"date"},"maturity_date":{"type":"string","format":"date","description":"The term is [effective_date, maturity_date)."},"status":{"type":"string","enum":["active","terminated","expired"]},"terminated_on":{"type":"string","format":"date","nullable":true},"termination_amount":{"type":"string","nullable":true,"example":"1234.50"},"notes":{"type":"string","nullable":true},"cancellation_style":{"type":"string","enum":["none","european","bermudan"],"description":"Spec §12.2, swap only (a cap is always 'none'). 'none': not cancellable; 'european': one call date (first_call_date); 'bermudan': a call date every call_frequency from first_call_date, exercised at most once. Exercising a call = terminating the hedge on the call date."},"cancellation_holder":{"type":"string","enum":["borrower","counterparty"],"nullable":true,"description":"Who may cancel: 'borrower' (we decide) or 'counterparty' (the bank may cancel). Required unless cancellation_style is 'none'."},"first_call_date":{"type":"string","format":"date","nullable":true,"description":"The first (european: the only) call date; after effective_date and before maturity_date. Required unless cancellation_style is 'none'."},"call_frequency":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"],"nullable":true,"description":"Bermudan only (required there, absent otherwise): call dates step from first_call_date on its day of month, clamped to month end, while before maturity_date."},"notice_business_days":{"type":"number","minimum":1,"maximum":90,"nullable":true,"description":"SOFR publication days of notice before a call date (1–90). Required unless cancellation_style is 'none'."},"next_call_date":{"type":"string","format":"date","nullable":true,"readOnly":true,"description":"Derived: the first call date whose notice deadline is the org's today or later; null when none remain, the hedge is not cancellable, or it is not active."},"next_notice_deadline":{"type":"string","format":"date","nullable":true,"readOnly":true,"description":"Derived: next_call_date minus notice_business_days, the last day to give notice. Counted in SOFR publication days: weekdays less SIFMA US full closes and every Good Friday (weekdays only after 2030). A bank holiday calendar can differ, so check the confirmation. Null with next_call_date."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"latest_mark":{"nullable":true,"description":"The mark with the latest as_of_date; null before the first.","type":"object","allOf":[{"$ref":"#/components/schemas/LoanHedgeLatestMarkV1Dto"}]}},"required":["id","loan_id","instrument_type","counterparty_id","reference","notional_amount","index_type","index_variant","fixed_rate","floating_spread","strike_rate","premium_amount","premium_paid_date","tracking_start_date","opening_premium_balance","opening_premium_offset_account_id","lookback_days","lookback_method","day_count_convention","settlement_frequency","settlement_day","effective_date","maturity_date","status","terminated_on","termination_amount","notes","cancellation_style","cancellation_holder","first_call_date","call_frequency","notice_business_days","next_call_date","next_notice_deadline","created_at","updated_at","latest_mark"]},"CreateLoanHedgeV1Dto":{"type":"object","properties":{"instrument_type":{"type":"string","enum":["swap","cap"]},"counterparty_id":{"type":"string","format":"uuid","description":"A party of this org."},"reference":{"type":"string","maxLength":120},"notional_amount":{"type":"string","description":"More than 0.","example":"1234.50"},"index_type":{"type":"string","enum":["sofr","prime","treasury","other"]},"index_variant":{"type":"string","enum":["term_1m","term_3m","term_6m","daily_simple","compounded_arrears","na"],"description":"term_1m, term_3m, term_6m or na: fixed in advance, on any index_type. daily_simple or compounded_arrears: SOFR in arrears, accepted for index_type sofr only (422 LOAN_HEDGE_NOT_SUPPORTED otherwise)."},"fixed_rate":{"type":"string","example":"0.04000","description":"Swap: required. Cap: must be absent. Decimal fraction, not a percent: 0.055 = 5.5%."},"floating_spread":{"type":"string","example":"0.00000","default":"0","description":"Swap only. Decimal fraction, not a percent: 0.055 = 5.5%."},"strike_rate":{"type":"string","example":"0.05000","description":"Cap: required. Swap: must be absent. Decimal fraction, not a percent: 0.055 = 5.5%."},"premium_amount":{"type":"string","description":"Cap: required (0 or more).","example":"1234.50"},"premium_paid_date":{"type":"string","format":"date","description":"Cap: required when premium_amount is above 0."},"tracking_start_date":{"type":"string","format":"date","description":"Default: effective_date when its accounting period is open, else the first day of the loan's legal entity's earliest open period after it."},"opening_premium_balance":{"type":"string","description":"Cap only: the unamortized premium on tracking_start_date (0 or more).","example":"1234.50"},"opening_premium_offset_account_id":{"type":"string","format":"uuid","description":"Cap only: the account the opening premium balance is credited to (an account of this organization, org-wide or of the loan's legal entity). Required when opening_premium_balance is above 0 and the premium was paid before tracking_start_date."},"lookback_days":{"type":"number","default":2,"minimum":0,"maximum":30,"description":"Counted in SOFR publication days: weekdays less SIFMA US full closes and every Good Friday (weekdays only after 2030). Fixed in advance (term_1m, term_3m, term_6m, na): publication days before a period start the index is read. In arrears (daily_simple, compounded_arrears): how far back the readings are taken, weighed per lookback_method — observation_shift moves the window back this many publication days, lookback has each day of the period read this many publication days earlier."},"lookback_method":{"type":"string","enum":["observation_shift","lookback"],"default":"observation_shift","description":"How an in-arrears index (daily_simple, compounded_arrears) weighs its readings, from the agreement or confirmation. observation_shift: each reading weighs the calendar days it covers in the window shifted back lookback_days publication days, and the day count is that window. lookback: each calendar day of the interest period weighs 1 on the reading lookback_days publication days before it; a weekend or holiday takes the reading of the publication day before it, so Friday to Sunday share one. The day count is the period. Ignored by in-advance variants. Default observation_shift."},"day_count_convention":{"type":"string","enum":["actual_360","actual_365","30_360"],"default":"actual_360"},"settlement_frequency":{"type":"string","enum":["monthly","quarterly","semi_annual"]},"settlement_day":{"type":"number","minimum":1,"maximum":31,"description":"Default: the loan's payment day."},"effective_date":{"type":"string","format":"date"},"maturity_date":{"type":"string","format":"date","description":"After effective_date."},"notes":{"type":"string"},"cancellation_style":{"type":"string","enum":["none","european","bermudan"],"default":"none","description":"Spec §12.2, swap only (a cap is always 'none'). 'none': not cancellable; 'european': one call date (first_call_date); 'bermudan': a call date every call_frequency from first_call_date, exercised at most once. Exercising a call = terminating the hedge on the call date."},"cancellation_holder":{"type":"string","enum":["borrower","counterparty"],"description":"Who may cancel: 'borrower' (we decide) or 'counterparty' (the bank may cancel). Required unless cancellation_style is 'none'."},"first_call_date":{"type":"string","format":"date","description":"The first (european: the only) call date; after effective_date and before maturity_date. Required unless cancellation_style is 'none'."},"call_frequency":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"],"description":"Bermudan only (required there, absent otherwise): call dates step from first_call_date on its day of month, clamped to month end, while before maturity_date."},"notice_business_days":{"type":"number","minimum":1,"maximum":90,"description":"SOFR publication days of notice before a call date (1–90). Required unless cancellation_style is 'none'. Counted in SOFR publication days: weekdays less SIFMA US full closes and every Good Friday (weekdays only after 2030). A bank holiday calendar can differ, so check the confirmation."}},"required":["instrument_type","counterparty_id","notional_amount","index_type","index_variant","settlement_frequency","effective_date","maturity_date"]},"UpdateLoanHedgeV1Dto":{"type":"object","properties":{"instrument_type":{"type":"string","enum":["swap","cap"]},"counterparty_id":{"type":"string","format":"uuid"},"reference":{"type":"string","maxLength":120,"nullable":true},"notional_amount":{"type":"string","example":"1234.50"},"index_type":{"type":"string","enum":["sofr","prime","treasury","other"]},"index_variant":{"type":"string","enum":["term_1m","term_3m","term_6m","daily_simple","compounded_arrears","na"]},"fixed_rate":{"type":"string","nullable":true,"description":"Decimal fraction, not a percent: 0.055 = 5.5%."},"floating_spread":{"type":"string","description":"Decimal fraction, not a percent: 0.055 = 5.5%."},"strike_rate":{"type":"string","nullable":true,"description":"Decimal fraction, not a percent: 0.055 = 5.5%."},"premium_amount":{"type":"string","nullable":true,"example":"1234.50"},"premium_paid_date":{"type":"string","format":"date","nullable":true},"tracking_start_date":{"type":"string","format":"date"},"opening_premium_balance":{"type":"string","nullable":true,"example":"1234.50"},"opening_premium_offset_account_id":{"type":"string","format":"uuid","nullable":true,"description":"Cap only: the account the opening premium balance is credited to. Changing it re-posts the premium."},"lookback_days":{"type":"number","minimum":0,"maximum":30,"description":"Counted in SOFR publication days: weekdays less SIFMA US full closes and every Good Friday (weekdays only after 2030). Fixed in advance (term_1m, term_3m, term_6m, na): publication days before a period start the index is read. In arrears (daily_simple, compounded_arrears): how far back the readings are taken, weighed per lookback_method — observation_shift moves the window back this many publication days, lookback has each day of the period read this many publication days earlier."},"lookback_method":{"type":"string","enum":["observation_shift","lookback"],"description":"How an in-arrears index (daily_simple, compounded_arrears) weighs its readings, from the agreement or confirmation. observation_shift: each reading weighs the calendar days it covers in the window shifted back lookback_days publication days, and the day count is that window. lookback: each calendar day of the interest period weighs 1 on the reading lookback_days publication days before it; a weekend or holiday takes the reading of the publication day before it, so Friday to Sunday share one. The day count is the period. Ignored by in-advance variants. Default observation_shift. Locked once any period is fixed (fixed rows are final), and like every other economic term once a settlement is recorded."},"day_count_convention":{"type":"string","enum":["actual_360","actual_365","30_360"]},"settlement_frequency":{"type":"string","enum":["monthly","quarterly","semi_annual"]},"settlement_day":{"type":"number","minimum":1,"maximum":31},"effective_date":{"type":"string","format":"date"},"maturity_date":{"type":"string","format":"date"},"notes":{"type":"string","nullable":true},"cancellation_style":{"type":"string","enum":["none","european","bermudan"],"description":"Spec §12.2, swap only (a cap is always 'none'). 'none': not cancellable; 'european': one call date (first_call_date); 'bermudan': a call date every call_frequency from first_call_date, exercised at most once. Exercising a call = terminating the hedge on the call date. Setting 'none' clears the four other cancellation fields (no need to send them). Switching to 'european' does not clear call_frequency; send call_frequency: null with it."},"cancellation_holder":{"type":"string","enum":["borrower","counterparty"],"nullable":true,"description":"Who may cancel: 'borrower' (we decide) or 'counterparty' (the bank may cancel). Required unless cancellation_style is 'none'."},"first_call_date":{"type":"string","format":"date","nullable":true,"description":"The first (european: the only) call date; after effective_date and before maturity_date. Required unless cancellation_style is 'none'."},"call_frequency":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"],"nullable":true,"description":"Bermudan only (required there, absent otherwise): call dates step from first_call_date on its day of month, clamped to month end, while before maturity_date."},"notice_business_days":{"type":"number","minimum":1,"maximum":90,"nullable":true,"description":"SOFR publication days of notice before a call date (1–90). Required unless cancellation_style is 'none'. Counted in SOFR publication days: weekdays less SIFMA US full closes and every Good Friday (weekdays only after 2030). A bank holiday calendar can differ, so check the confirmation."}}},"MoveLoanHedgeV1Dto":{"type":"object","properties":{"loan_id":{"type":"string","format":"uuid","description":"The active floating borrower loan, of the same legal entity, the hedge moves to."},"effective_on":{"type":"string","format":"date","description":"Unfilled settlement rows due after this date leave the old loan and are regenerated on the new one; recorded settlements stay where they were booked."}},"required":["loan_id","effective_on"]},"LoanHedgeSettlementV1Dto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid","description":"The posted `hedge_settlement` document."},"loan_event_id":{"type":"string","format":"uuid"},"amount":{"type":"string","description":"Signed: + we paid, − we received.","example":"1234.50"},"expected_amount":{"type":"string","description":"The period's expected settlement (signed).","example":"1234.50"},"variance":{"type":"string","description":"amount − expected_amount.","example":"1234.50"}},"required":["document_id","loan_event_id","amount","expected_amount","variance"]},"RecordLoanHedgeSettlementV1Dto":{"type":"object","properties":{"loan_event_id":{"type":"string","format":"uuid","description":"The hedge's live settlement period (a `swap_settlement` row of this hedge on the loan's schedule)."},"amount":{"type":"string","description":"Signed, as the advice states it: + we pay the bank, − we receive. Never 0.00 (a cap below strike simply leaves the period's expected 0.00 unrecorded).","example":"1234.50"},"date":{"type":"string","format":"date","description":"The settlement date; default the period's due_date."}},"required":["loan_event_id","amount"]},"TerminateLoanHedgeV1Dto":{"type":"object","properties":{"terminated_on":{"type":"string","format":"date","description":"On or after the tracking start date and before maturity. Unfilled settlement rows due after it are superseded; recorded ones stay."},"termination_amount":{"type":"string","description":"Signed: + we pay the bank to unwind, − we receive. 0.00 when the hedge simply ends.","example":"1234.50"}},"required":["terminated_on","termination_amount"]},"LoanHedgeMarkV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"hedge_id":{"type":"string","format":"uuid"},"as_of_date":{"type":"string","format":"date"},"fair_value":{"type":"string","description":"Signed: + an asset to us, − a liability.","example":"1234.50"},"source":{"type":"string","enum":["manual","import"]},"note":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","hedge_id","as_of_date","fair_value","source","note","created_at","updated_at"]},"UpsertLoanHedgeMarkV1Dto":{"type":"object","properties":{"as_of_date":{"type":"string","format":"date","description":"One mark per date: a second POST for a date replaces it."},"fair_value":{"type":"string","description":"Signed: + an asset to us, − a liability.","example":"1234.50"},"source":{"type":"string","enum":["manual","import"],"default":"manual"},"note":{"type":"string"}},"required":["as_of_date","fair_value"]},"ReferenceRateV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"index_type":{"type":"string","enum":["sofr","sofr_1m","sofr_3m","sofr_6m","prime","treasury","cpi","other"]},"rate_date":{"type":"string","format":"date"},"rate_value":{"type":"string","example":"0.0533"},"source":{"type":"string","enum":["ny_fed","cme","manual","bls"]},"fetched_at":{"type":"string","format":"date-time"}},"required":["id","index_type","rate_date","rate_value","source","fetched_at"]},"ReferenceRateIdV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]},"CreateReferenceRateV1Dto":{"type":"object","properties":{"index_type":{"type":"string","enum":["sofr","sofr_1m","sofr_3m","sofr_6m","prime","treasury","cpi","other"]},"rate_date":{"type":"string","format":"date"},"rate_value":{"type":"number","description":"A rate series (`sofr`, `sofr_1m`, `sofr_3m`, `sofr_6m`, `prime`, `treasury`, `other`) takes a DECIMAL in [0, 1] — 0.0533 is 5.33% — and refuses anything outside with 400 REFERENCE_RATE_OUT_OF_RANGE. `cpi` takes the published index level (e.g. 310.1), unbounded."},"source":{"type":"string","enum":["ny_fed","cme","manual","bls"]}},"required":["index_type","rate_date","rate_value","source"]},"ReferenceRateSeriesV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The catalog row id. THIS is what an escalation clause stores in its `series_id` field — not the publisher string below."},"index_type":{"type":"string","description":"The index family: 'cpi' for lease escalation, 'sofr'/'prime'/'treasury' for floating-rate debt. Unique across the catalog, so there is at most one series per family today."},"series_id":{"type":"string","nullable":true,"description":"The PUBLISHER's series code, e.g. 'CUUR0000SA0' for CPI-U. A display and lookup value only. Never send this as a clause `series_id` — that field takes the UUID above."},"display_name":{"type":"string","description":"Human-readable name, e.g. \"CPI-U, All Items, U.S. City Average (NSA)\"."},"source":{"type":"string","enum":["ny_fed","cme","manual","bls"],"description":"Who publishes it: 'bls', 'ny_fed', 'cme', 'manual'."},"publication_cadence":{"type":"string","enum":["monthly","bimonthly","quarterly","semiannual"],"description":"How often it publishes: 'monthly', 'bimonthly', 'quarterly', 'semiannual'."},"publication_lag_days":{"type":"number","description":"Typical days between the period it measures and the day it is published. A clause lookback must clear this or it reads a month that does not exist yet."},"retired_at":{"type":"string","format":"date","nullable":true,"description":"Set when the publisher discontinued this series. Retired series are STILL LISTED, so a clause already pointing at one can render; a client should not offer a retired series for a NEW selection."},"successor_series_id":{"type":"string","format":"uuid","nullable":true,"description":"The series that replaced this one. Non-null whenever `retired_at` is set — a database CHECK guarantees the pair."}},"required":["id","index_type","series_id","display_name","source","publication_cadence","publication_lag_days","retired_at","successor_series_id"]},"BudgetCurrentVersionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"version_no":{"type":"number","example":1},"status":{"type":"string","enum":["draft","submitted","approved","active","superseded","archived"]}},"required":["id","version_no","status"]},"BudgetV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"first_fiscal_year":{"type":"number","example":2027},"num_years":{"type":"number","example":1,"minimum":1,"maximum":10},"created_by":{"type":"string","nullable":true,"format":"uuid"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"current_version":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/BudgetCurrentVersionV1Dto"}]},"is_active":{"type":"boolean"}},"required":["id","legal_entity_id","name","first_fiscal_year","num_years","created_by","created_at","updated_at","current_version","is_active"]},"CreateBudgetV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":128,"example":"2027 Operating Budget"},"first_fiscal_year":{"type":"number","example":2027,"description":"First fiscal year the budget covers."},"num_years":{"type":"number","minimum":1,"maximum":10,"example":1,"description":"Number of consecutive fiscal years the budget spans, starting at first_fiscal_year (DB check: 1..10)."}},"required":["legal_entity_id","name","first_fiscal_year","num_years"]},"BudgetVersionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"budget_id":{"type":"string","format":"uuid"},"version_no":{"type":"number","example":1},"kind":{"type":"string","enum":["original","reforecast"]},"label":{"type":"string"},"status":{"type":"string","enum":["draft","submitted","approved","active","superseded","archived"]},"reforecast_start_month":{"type":"string","nullable":true,"format":"date"},"notes":{"type":"string","nullable":true},"created_by":{"type":"string","nullable":true,"format":"uuid"},"approved_by":{"type":"string","nullable":true,"format":"uuid"},"approved_at":{"type":"string","nullable":true,"format":"date-time"},"activated_by":{"type":"string","nullable":true,"format":"uuid"},"activated_at":{"type":"string","nullable":true,"format":"date-time"},"superseded_at":{"type":"string","nullable":true,"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","budget_id","version_no","kind","label","status","reforecast_start_month","notes","created_by","approved_by","approved_at","activated_by","activated_at","superseded_at","created_at","updated_at"]},"BudgetDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"first_fiscal_year":{"type":"number","example":2027},"num_years":{"type":"number","example":1,"minimum":1,"maximum":10},"created_by":{"type":"string","nullable":true,"format":"uuid"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"current_version":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/BudgetCurrentVersionV1Dto"}]},"is_active":{"type":"boolean"},"versions":{"type":"array","items":{"$ref":"#/components/schemas/BudgetVersionV1Dto"}}},"required":["id","legal_entity_id","name","first_fiscal_year","num_years","created_by","created_at","updated_at","current_version","is_active","versions"]},"CreateBudgetVersionV1Dto":{"type":"object","properties":{"mode":{"type":"string","enum":["blank","copy_from"]},"copy_from_version_id":{"type":"string","format":"uuid","description":"Required when mode is 'copy_from'."},"label":{"type":"string","maxLength":128,"example":"Q2 Reforecast"}},"required":["mode","label"]},"DerivationMethodV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"property_id":{"type":"string","nullable":true,"format":"uuid","description":"Null for the entity-level (no-property) cell."},"method":{"type":"string","enum":["prior_year_plus_pct","annual_total_spread","flat_monthly","active_leases"]},"params":{"type":"object","additionalProperties":true,"description":"Method-specific parameters — see `method`'s enum values."}},"required":["id","account_id","property_id","method","params"]},"BudgetGridRowV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"account_name":{"type":"string"},"parent_account_id":{"type":"string","nullable":true,"format":"uuid"},"parent_account_name":{"type":"string","nullable":true,"description":"Display name of the row's parent_account_id; null when there is no parent."},"account_type_code":{"type":"string","description":"The row account's account_type_code ('income' or 'expense' for P&L accounts), for sectioning the grid."},"report_order":{"type":"number","description":"The account's report_order (nulls last)."},"months":{"type":"object","additionalProperties":{"type":"string"},"description":"Keyed by 'YYYY-MM'. Value is the summed decimal amount for that month, as a string. A month absent from this object has no budget line.","example":{"2027-01":"12500.00","2027-02":"12500.00"}},"method":{"nullable":true,"description":"The account's derivation-method config for THIS grid read's scope (the requested property_id, or the entity-level cell when omitted) — null when the account has no method configured in that scope. Always null for the all-properties rollup, where a single per-row method would be ambiguous across properties.","type":"object","allOf":[{"$ref":"#/components/schemas/DerivationMethodV1Dto"}]},"cell_sources":{"type":"object","additionalProperties":{"type":"string"},"description":"per-cell effective source: derived|override|manual|seed; absent for the all-properties rollup"}},"required":["account_id","account_name","parent_account_id","parent_account_name","account_type_code","report_order","months"]},"BudgetGridV1Dto":{"type":"object","properties":{"budget_version_id":{"type":"string","format":"uuid"},"fiscal_year":{"type":"number","example":2027},"fiscal_year_start_month":{"type":"number","example":1,"description":"The org's configured fiscal-year start month (1-12) the grid's months were windowed against — 1 is the calendar year. Lets the FE label/order month columns without a second lookup."},"rows":{"type":"array","items":{"$ref":"#/components/schemas/BudgetGridRowV1Dto"}}},"required":["budget_version_id","fiscal_year","fiscal_year_start_month","rows"]},"BudgetLineCellV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"property_id":{"type":"string","nullable":true,"format":"uuid","description":"null = unassigned (no property)."},"period_month":{"type":"string","format":"date","example":"2027-01-01","description":"Must be the first of the month, within the budget span."},"amount":{"type":"string","nullable":true,"example":"12500.00","description":"Decimal string. null clears the cell."}},"required":["account_id","property_id","period_month","amount"]},"PatchBudgetLinesV1Dto":{"type":"object","properties":{"cells":{"maxItems":5000,"type":"array","items":{"$ref":"#/components/schemas/BudgetLineCellV1Dto"}}},"required":["cells"]},"SeedBudgetVersionV1Dto":{"type":"object","properties":{"from_fiscal_year":{"type":"number","example":2026,"description":"Prior fiscal year to project P&L actuals from."},"adjustment_pct":{"type":"string","example":"0.03","description":"Fractional adjustment applied to every projected amount (e.g. \"0.03\" = +3%, \"-0.05\" = -5%)."},"property_id":{"type":"string","nullable":true,"format":"uuid","description":"When set, bulk-applies only within this property; null/omitted = entity-level."}},"required":["from_fiscal_year","adjustment_pct"]},"PutDerivationMethodV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"property_id":{"type":"string","nullable":true,"format":"uuid","description":"Property to scope this method to. Omit or pass null for the entity-level (no-property) cell."},"method":{"type":"string","enum":["prior_year_plus_pct","annual_total_spread","flat_monthly","active_leases"],"description":"'prior_year_plus_pct' grows last year's actuals by a %; 'annual_total_spread' distributes a total across the 12 fiscal months (evenly, or by optional weights); 'flat_monthly' repeats one amount every month; 'active_leases' sums this property's active leases' escalated fixed rent mapped to this income account; params: {}."},"params":{"type":"object","additionalProperties":true,"description":"Method-specific parameters — shape depends on `method`. 'prior_year_plus_pct': { from_fiscal_year: int, growth_pct: decimal string }. 'annual_total_spread': { annual_total: decimal string, weights?: int[12] }. 'flat_monthly': { monthly_amount: decimal string }. Validated server-side by `validateMethodParams` against `method`, not by this schema.","example":{"from_fiscal_year":2026,"growth_pct":"0.03"}}},"required":["account_id","method","params"]},"DeriveVersionV1Dto":{"type":"object","properties":{"property_id":{"type":"string","nullable":true,"format":"uuid","description":"Recompute only configs scoped to this property (null = entity-level). Omit to recompute every config in the version."},"all":{"type":"boolean","description":"Explicitly recompute every config in the version, regardless of property_id."}}},"EntityFileDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"parent_id":{"type":"string","format":"uuid"},"file_name":{"type":"string"},"content_type":{"type":"string","enum":["application/pdf","image/png","image/jpeg","image/webp","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation","text/csv","text/plain"]},"file_size_bytes":{"type":"number"},"file_sha256":{"type":"string","description":"SHA-256 of the stored bytes, lower-case hex."},"uploaded_at":{"type":"string","format":"date-time"},"uploaded_by":{"type":"string","nullable":true,"format":"uuid"},"folder_id":{"type":"string","nullable":true,"format":"uuid","description":"Id of the org folder this file lives in (see GET /v1/org-folders), or null when at the root."},"folder_name":{"type":"string","nullable":true,"description":"Name of folder_id. Present on rolled-up rows so the client can show the child's folder path."},"owner_name":{"type":"string","nullable":true,"description":"Display name of the property or space this file hangs on. Present only on rolled-up (descendant) rows, where the caller named an ancestor rather than this owner."},"source_kind":{"type":"string","enum":["party","legal_entity","property","contract","consolidation_group"],"nullable":true,"description":"Which kind of entity owns this file. Present only on rolled-up rows (party contracts, property/space descendants, legal-entity hierarchy, or a consolidation group and its member roll-up)."},"source_label":{"type":"string","nullable":true,"description":"Display name of the owning entity (property / contract / legal entity). Present only on rolled-up rows."},"group_id":{"type":"string","nullable":true,"format":"uuid","description":"On legal-entity hierarchy roll-ups: id of the top-level property this row nests under, so the client can render a property → record tree. Null when the row belongs to no property (renders flat). A contract linked to several properties is returned once per property. On a consolidation-group hierarchy roll-up: id of the member legal entity this row belongs to (the group's own rows have no group_id)."},"group_label":{"type":"string","nullable":true,"description":"Display name of group_id (the property this row nests under)."}},"required":["id","parent_id","file_name","content_type","file_size_bytes","file_sha256","uploaded_at"]},"EntityFileDownloadUrlDto":{"type":"object","properties":{"url":{"type":"string"},"expires_at":{"type":"string","format":"date-time"}},"required":["url","expires_at"]},"MoveEntityFileDto":{"type":"object","properties":{"folder_id":{"type":"string","nullable":true,"format":"uuid","description":"Target folder id (see GET /v1/org-folders), or null to move the file to the root. Omit to leave the current folder unchanged."},"file_name":{"type":"string","minLength":1,"maxLength":255,"description":"New display name for the file (rename). Trimmed server-side; storage_path and content_type never change. The extension is immutable — the new name must keep the current extension (changing it returns VALIDATION_FAILED). Omit to leave the current name unchanged. An explicit null is rejected — omit the field instead."}}},"OrgFolderDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"parent_kind":{"type":"string","enum":["party","legal_entity","property","contract","consolidation_group"]},"name":{"type":"string"},"parent_folder_id":{"type":"string","nullable":true,"format":"uuid","description":"Parent folder id, or null for a root folder."},"is_template":{"type":"boolean","description":"True for system-seeded template folders; false for org-created folders."},"created_at":{"type":"string","format":"date-time"}},"required":["id","parent_kind","name","is_template","created_at"]},"CreateOrgFolderDto":{"type":"object","properties":{"parent_kind":{"type":"string","enum":["party","legal_entity","property","contract","consolidation_group"],"description":"Entity type the folder belongs to."},"name":{"type":"string","maxLength":60},"parent_folder_id":{"type":"string","format":"uuid","description":"Optional parent folder id to create a subfolder. Only one level of nesting is allowed."}},"required":["parent_kind","name"]},"RenameOrgFolderDto":{"type":"object","properties":{"name":{"type":"string","maxLength":60}},"required":["name"]},"DeleteOrgFolderResultDto":{"type":"object","properties":{"unfiled_count":{"type":"number","description":"Files moved to the root by this delete (across all records of the type)."}},"required":["unfiled_count"]},"BankAccountV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"cash_account_id":{"type":"string","nullable":true,"format":"uuid"},"name":{"type":"string"},"account_type":{"type":"string","enum":["checking","savings","credit_card","trust","other"]},"currency_code":{"type":"string"},"institution_name":{"type":"string","nullable":true},"account_holder_name":{"type":"string","nullable":true},"last4":{"type":"string","nullable":true},"routing_number_last4":{"type":"string","nullable":true},"external_provider":{"type":"string","nullable":true},"external_account_id":{"type":"string","nullable":true},"external_item_id":{"type":"string","nullable":true},"plaid_item_id":{"type":"string","nullable":true,"format":"uuid","description":"Local plaid_items.id when this account has a live feed. Null for a manual account."},"connection_id":{"type":"string","nullable":true,"format":"uuid","description":"The connection feeding this account (`bank_connections.id`), whatever the provider. Null for a manual account. THIS is the test for \"is this account already connected to a feed\" — `plaid_account_id` answers only \"is PLAID feeding it\", which a CashPro account leaves null while being fully connected."},"plaid_account_id":{"type":"string","nullable":true,"description":"Plaid's account id, present only on a Plaid-fed account. NOT a test for whether the account is connected — use `connection_id` for that. This property's description claimed otherwise until 2026-10-14, and both the account detail page and the Plaid-conversion guard read it that way, so a CashPro account was shown as unconnected and offered a second, conflicting feed."},"mask":{"type":"string","nullable":true},"feed_start_date":{"type":"string","nullable":true,"format":"date","description":"Plaid transactions dated before this are not imported. Set when a manual account is converted, so the backfill does not duplicate statement history already on the account. Null means no filter."},"account_number":{"type":"string","nullable":true,"deprecated":true,"description":"Deprecated — always null; use account_number_last4. The full account number is encrypted at rest and never returned by the API."},"account_number_last4":{"type":"string","nullable":true},"ach_company_name":{"type":"string","nullable":true},"ach_company_id":{"type":"string","nullable":true},"ach_originating_routing_number":{"type":"string","nullable":true},"ach_sec_code":{"type":"string","nullable":true},"ach_company_entry_description":{"type":"string","nullable":true},"external_ref":{"type":"string","nullable":true,"description":"Another system's key for this record, unique in the org; set by an importer."},"is_active":{"type":"boolean"},"created_at":{"type":"string","nullable":true,"format":"date-time"},"legal_entity_name":{"type":"string","nullable":true},"cash_account_code":{"type":"string","nullable":true},"cash_balance":{"type":"string","description":"Live cash balance computed from posted journal entries. Null when no GL cash account is linked.","nullable":true,"example":"12500.00"}},"required":["id","org_id","legal_entity_id","cash_account_id","name","account_type","currency_code","institution_name","account_holder_name","last4","routing_number_last4","external_provider","external_account_id","external_item_id","plaid_item_id","connection_id","plaid_account_id","mask","feed_start_date","account_number","account_number_last4","ach_company_name","ach_company_id","ach_originating_routing_number","ach_sec_code","ach_company_entry_description","external_ref","is_active","created_at","legal_entity_name","cash_account_code","cash_balance"]},"BankCashTopAccountV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"legal_entity_name":{"type":"string","nullable":true},"cash_balance":{"type":"string","description":"GL cash balance, a decimal string.","example":"1234.50"}},"required":["id","name","legal_entity_name","cash_balance"]},"BankCashCurrencyTotalV1Dto":{"type":"object","properties":{"currency_code":{"type":"string","example":"USD","description":"ISO 4217 code shared by every account in this total."},"account_count":{"type":"number","description":"Active bank accounts in scope in this currency, including those with no cash GL account."},"total_cash_balance":{"type":"string","description":"Sum of the GL cash balances of the active accounts in scope in this currency, in this currency; an account with no cash GL account adds nothing.","example":"1234.50"},"top_accounts":{"description":"Up to 5 active accounts in this currency with the highest cash balance, ties broken by id. Accounts with no cash GL account are not ranked.","type":"array","items":{"$ref":"#/components/schemas/BankCashTopAccountV1Dto"}}},"required":["currency_code","account_count","total_cash_balance","top_accounts"]},"BankCashSummaryV1Dto":{"type":"object","properties":{"account_count":{"type":"number","description":"Active bank accounts in scope, every currency, including those with no cash GL account."},"totals":{"description":"One total per currency with an active account in scope, most accounts first (ties by `currency_code`). Balances are never added across currencies. Empty when there are no active accounts.","type":"array","items":{"$ref":"#/components/schemas/BankCashCurrencyTotalV1Dto"}}},"required":["account_count","totals"]},"BankAccountDailyBalanceV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bank_account_id":{"type":"string","format":"uuid"},"as_of_date":{"type":"string","format":"date","description":"The bank's stated date for this row — always a previous-day figure, never a live balance (spec §3.1)."},"opening_ledger":{"type":"string","nullable":true,"description":"BAI 010 — the signed opening ledger balance. Null on an activity-only row.","example":"1234.50"},"closing_ledger":{"type":"string","nullable":true,"description":"BAI 015 — the signed closing ledger balance. Null on an activity-only row.","example":"1234.50"},"closing_available":{"type":"string","nullable":true,"description":"BAI 045 — closing available balance, excluding uncleared funds. Never a reconciliation figure. Null on an activity-only row.","example":"1234.50"},"total_credits":{"type":"string","nullable":true,"description":"BAI 100 — the day's total credits from the transaction feed. Null on a balance-only row.","example":"1234.50"},"total_credit_count":{"type":"number","nullable":true,"description":"Count of credit transactions behind `total_credits`."},"total_debits":{"type":"string","nullable":true,"description":"BAI 400 — the day's total debits from the transaction feed. Null on a balance-only row.","example":"1234.50"},"total_debit_count":{"type":"number","nullable":true,"description":"Count of debit transactions behind `total_debits`."},"currency_code":{"type":"string","nullable":true,"example":"USD","description":"As the bank states it — the bank is authoritative about its own account. Null when neither source has reported a currency for this row."},"source":{"type":"string","enum":["balance_inquiry","transaction_sync"],"description":"Which capture source wrote the BALANCE figures currently on this row (not the activity figures) — `balance_inquiry` or `transaction_sync`."}},"required":["id","bank_account_id","as_of_date","currency_code","source"]},"BankAccountDailyBalancesMetaV1Dto":{"type":"object","properties":{"next_cursor":{"type":"string","nullable":true,"description":"Opaque cursor for the next page, or null when this is the last page. Pass it back as `?cursor=`. Always present; do not parse it.","example":"eyJpZCI6ICJhYmMifQ=="},"limit":{"type":"number","description":"Page size used for this response."},"window_from":{"type":"string","format":"date","description":"The first date actually covered by `data` across every page of this query, after resolving the default window and any `MAX_BALANCE_WINDOW_DAYS` cap — not necessarily the requested `from_date` (spec §3.4)."},"window_to":{"type":"string","format":"date","description":"The last date actually covered by `data` across every page."},"request_id":{"type":"string","example":"018f0b3d-2b1e-7c8a-9d4b-1a2b3c4d5e6f"},"api_version":{"type":"string","example":"2026-04-23"}},"required":["next_cursor","limit","window_from","window_to","request_id","api_version"]},"CreateBankAccountV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"cash_account_id":{"type":"string","format":"uuid","description":"Parent GL account. When provided, a child cash account is created with the next available code under the parent."},"name":{"type":"string","maxLength":500},"account_type":{"type":"string","enum":["checking","savings","credit_card","trust","other"],"default":"checking"},"currency_code":{"type":"string","pattern":"^[A-Z]{3}$","example":"USD","description":"ISO 4217 code. Must equal the legal entity's default_currency (one currency per entity). Defaults to the legal entity's default_currency."},"institution_name":{"type":"string","maxLength":200},"account_holder_name":{"type":"string","maxLength":200},"last4":{"type":"string","maxLength":10},"routing_number_last4":{"type":"string","maxLength":10},"external_provider":{"type":"string","maxLength":64},"external_account_id":{"type":"string","maxLength":256},"external_item_id":{"type":"string","maxLength":256},"account_number":{"type":"string","maxLength":64},"ach_company_name":{"type":"string"},"ach_company_id":{"type":"string"},"ach_originating_routing_number":{"type":"string","description":"9-digit ABA routing of the ODFI"},"ach_sec_code":{"type":"string","enum":["CCD","PPD"]},"ach_company_entry_description":{"type":"string"},"external_ref":{"type":"string","nullable":true,"minLength":1,"maxLength":200,"description":"Another system's key for this record, unique in the org; set by an importer."},"is_active":{"type":"boolean","default":true}},"required":["legal_entity_id","name"]},"UpdateBankAccountV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"cash_account_id":{"type":"string","nullable":true,"format":"uuid"},"name":{"type":"string","maxLength":500},"account_type":{"type":"string","enum":["checking","savings","credit_card","trust","other"]},"currency_code":{"type":"string","pattern":"^[A-Z]{3}$","example":"USD","description":"ISO 4217 code. Must equal the legal entity's default_currency (one currency per entity)."},"institution_name":{"type":"string","nullable":true,"maxLength":200},"account_holder_name":{"type":"string","nullable":true,"maxLength":200},"last4":{"type":"string","nullable":true,"maxLength":10},"routing_number_last4":{"type":"string","nullable":true,"maxLength":10},"external_provider":{"type":"string","nullable":true,"maxLength":64},"external_account_id":{"type":"string","nullable":true,"maxLength":256},"external_item_id":{"type":"string","nullable":true,"maxLength":256},"account_number":{"type":"string","nullable":true,"maxLength":64},"ach_company_name":{"type":"string","nullable":true},"ach_company_id":{"type":"string","nullable":true},"ach_originating_routing_number":{"type":"string","nullable":true,"description":"9-digit ABA routing of the ODFI"},"ach_sec_code":{"type":"string","nullable":true,"enum":["CCD","PPD"]},"ach_company_entry_description":{"type":"string","nullable":true},"external_ref":{"type":"string","nullable":true,"minLength":1,"maxLength":200,"description":"Another system's key for this record, unique in the org; set by an importer."},"is_active":{"type":"boolean"}}},"ConnectBankAccountPlaidV1Dto":{"type":"object","properties":{"plaid_item_id":{"type":"string","format":"uuid","description":"Local plaid_items.id."},"plaid_account_id":{"type":"string","description":"Plaid's account_id on that item."},"feed_start_date":{"type":"string","format":"date","example":"2026-07-01","description":"Do not import transactions dated before this. Omit to default to the day after the newest transaction already on the account."}},"required":["plaid_item_id","plaid_account_id"]},"ConnectBankAccountCashProV1Dto":{"type":"object","properties":{"account_number":{"type":"string","description":"The account number as the bank knows it. Encrypted at rest; never returned by any response."},"bank_id":{"type":"string","description":"The BIC or routing number (e.g. BOFAUS3N or 026009593) — CashPro accounts are addressed, not enumerated."},"connection_id":{"type":"string","format":"uuid","description":"Which CashPro connection to use. Required only when the org has more than one non-disabled CashPro connection."},"feed_start_date":{"type":"string","format":"date","example":"2026-07-01","description":"Do not import transactions dated before this. Omit to default to the day after the newest transaction already on the account."}},"required":["account_number","bank_id"]},"MergedCountsV1Dto":{"type":"object","properties":{"transactions":{"type":"number"},"reconciliations":{"type":"number"},"statement_imports":{"type":"number"},"payment_runs":{"type":"number"},"bank_rules":{"type":"number"}},"required":["transactions","reconciliations","statement_imports","payment_runs","bank_rules"]},"MergeBankAccountResponseV1Dto":{"type":"object","properties":{"bank_account":{"$ref":"#/components/schemas/BankAccountV1Dto"},"moved":{"$ref":"#/components/schemas/MergedCountsV1Dto"},"flagged_duplicates":{"type":"number","description":"Transactions that look like duplicates of ones already on the surviving account. Set to needs_review, never deleted."},"source_cash_account_deactivated":{"type":"boolean","description":"Whether the retired account's GL cash account was deactivated. False when it still carries journal lines, in which case it is left active and readable."}},"required":["bank_account","moved","flagged_duplicates","source_cash_account_deactivated"]},"MergeBankAccountV1Dto":{"type":"object","properties":{"source_bank_account_id":{"type":"string","format":"uuid","description":"The duplicate Plaid-connected account to fold in and retire. The path id is the manual account, which survives."}},"required":["source_bank_account_id"]},"BankAddressingFieldOptionV1Dto":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]},"BankAddressingFieldV1Dto":{"type":"object","properties":{"key":{"type":"string","description":"The key submitted in the account's `addressing` object."},"label":{"type":"string","description":"The label the form renders."},"kind":{"type":"string","enum":["text","uppercase","select"],"description":"The closed vocabulary of input shapes a generated form can render."},"min_length":{"type":"number","nullable":true},"max_length":{"type":"number","nullable":true},"pattern":{"type":"string","nullable":true,"description":"Anchored at both ends. A convenience for the person typing, re-applied server-side — never a trust boundary."},"help":{"type":"string","nullable":true,"description":"Help text rendered beside the field."},"options":{"nullable":true,"description":"Only present when `kind` is 'select'.","type":"array","items":{"$ref":"#/components/schemas/BankAddressingFieldOptionV1Dto"}}},"required":["key","label","kind"]},"BankCredentialFieldV1Dto":{"type":"object","properties":{"key":{"type":"string","description":"The key submitted in the `credentials` object."},"label":{"type":"string","description":"The label the form renders."},"kind":{"type":"string","enum":["text","uppercase"],"description":"The closed vocabulary of input shapes a generated credential form can render. Narrower than an addressing field's: a credential is a value the bank issued, so there is no enumerable set for a `select` to offer and no `options` list on this shape to render one from."},"min_length":{"type":"number","nullable":true},"max_length":{"type":"number","nullable":true},"pattern":{"type":"string","nullable":true,"description":"Anchored at both ends. Re-applied server-side — never a trust boundary."},"help":{"type":"string","nullable":true,"description":"Help text rendered beside the field."},"secret":{"type":"boolean","nullable":true,"description":"Write-only. The value is encrypted at rest and never returned by any read endpoint, not even masked — so a form renders it as a password input and never pre-fills it on edit."}},"required":["key","label","kind"]},"BankConnectionMethodV1Dto":{"type":"object","properties":{"provider":{"type":"string","description":"The registry key — bank_connections.provider's vocabulary."},"display_name":{"type":"string"},"credential_owner":{"type":"string","enum":["spark","customer"],"description":"'spark' = Acreum's own credentials, self-serve. 'customer' = the customer's own bank relationship, administrator-provisioned."},"capabilities":{"type":"array","items":{"type":"string","enum":["data_in","money_out"]}},"tagline":{"type":"string","description":"One line the chooser renders verbatim."},"highlights":{"description":"Bullets the chooser renders verbatim, in order.","type":"array","items":{"type":"string"}},"available":{"type":"boolean","description":"Whether this org can use this method in this deployment right now."},"unavailable_reason":{"type":"string","nullable":true,"description":"A complete sentence the frontend renders verbatim when `available` is false — e.g. \"Plaid isn't set up in this environment yet.\" Null when available."},"connection_count":{"type":"number","description":"This org's existing connection count for this provider, so the UI can offer \"add another\" instead of \"connect\"."},"addressing":{"description":"What identifies an account with this provider, in declared order. Empty for a provider that discovers its own accounts (e.g. Plaid). The single source the entry form, the bulk CSV template header, and the row validator are all generated from.","type":"array","items":{"$ref":"#/components/schemas/BankAddressingFieldV1Dto"}},"credentials":{"description":"What this provider needs to authenticate, in declared order. Empty for a `credential_owner: 'spark'` provider — Acreum holds those and there is nothing for a customer to type. The credential form and its validation are generated from this, so adding a provider changes this list rather than a dialog.","type":"array","items":{"$ref":"#/components/schemas/BankCredentialFieldV1Dto"}}},"required":["provider","display_name","credential_owner","capabilities","tagline","highlights","available","unavailable_reason","connection_count","addressing","credentials"]},"BankConnectionSummaryV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"Informational only — records that credentials were issued to a specific entity. Does not scope the accounts; the account carries the entity (spec §3.5)."},"provider":{"type":"string","enum":["plaid","cashpro"]},"institution_id":{"type":"string","nullable":true},"institution_name":{"type":"string","nullable":true},"label":{"type":"string","nullable":true,"description":"A human's own name for this ONE connection, so an org with two CashPro relationships (both \"Bank of America\" in `institution_name`, since institution names collide by definition) can tell them apart. Set on create: the caller's value if supplied, else `institution_name`. Not unique — two connections may legitimately share a label."},"environment":{"type":"string","enum":["sandbox","production","unknown"]},"capabilities":{"type":"array","items":{"type":"string","enum":["data_in","money_out"]}},"status":{"type":"string","enum":["healthy","degraded","credentials_rejected","needs_reauth","disabled"]},"status_detail":{"type":"string","nullable":true,"description":"Our own wording plus at most a provider error code — never a provider response body."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"display_name":{"type":"string","description":"The registry's display name for `provider`."},"legal_entity_name":{"type":"string","nullable":true,"description":"Name of `legal_entity_id`, or null when there is none."},"account_count":{"type":"number","description":"`bank_accounts` rows fed by this connection."},"last_synced_at":{"type":"string","nullable":true,"format":"date-time","description":"The latest sync across this connection's accounts, or null when none has ever synced."},"last_sync_outcome":{"type":"string","nullable":true,"enum":["ok","partial","failed"],"description":"The most recently started sync run's outcome, or null when a run is still in flight or none has ever run."}},"required":["id","org_id","legal_entity_id","provider","institution_id","institution_name","label","environment","capabilities","status","status_detail","created_at","updated_at","display_name","legal_entity_name","account_count","last_synced_at","last_sync_outcome"]},"BankConnectionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"Informational only — records that credentials were issued to a specific entity. Does not scope the accounts; the account carries the entity (spec §3.5)."},"provider":{"type":"string","enum":["plaid","cashpro"]},"institution_id":{"type":"string","nullable":true},"institution_name":{"type":"string","nullable":true},"label":{"type":"string","nullable":true,"description":"A human's own name for this ONE connection, so an org with two CashPro relationships (both \"Bank of America\" in `institution_name`, since institution names collide by definition) can tell them apart. Set on create: the caller's value if supplied, else `institution_name`. Not unique — two connections may legitimately share a label."},"environment":{"type":"string","enum":["sandbox","production","unknown"]},"capabilities":{"type":"array","items":{"type":"string","enum":["data_in","money_out"]}},"status":{"type":"string","enum":["healthy","degraded","credentials_rejected","needs_reauth","disabled"]},"status_detail":{"type":"string","nullable":true,"description":"Our own wording plus at most a provider error code — never a provider response body."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","org_id","legal_entity_id","provider","institution_id","institution_name","label","environment","capabilities","status","status_detail","created_at","updated_at"]},"CreateBankConnectionV1Dto":{"type":"object","properties":{"provider":{"type":"string","enum":["plaid","cashpro"],"description":"The registry key. A 'spark'-owned provider is refused here."},"environment":{"type":"string","enum":["sandbox","production"]},"institution_id":{"type":"string","maxLength":200},"institution_name":{"type":"string","maxLength":200,"example":"Bank of America"},"label":{"type":"string","maxLength":200,"example":"Main operating connection","description":"A human's own name for this connection, so an org with several relationships at the same bank can tell them apart. Defaults to `institution_name` when omitted."},"legal_entity_id":{"type":"string","format":"uuid","description":"Informational only (spec §9.3) — one credential set spans legal entities."},"credentials":{"type":"object","additionalProperties":true,"description":"The provider's declared credential keys and their values. Shape is provider-defined; see GET /v1/banking/connection-methods' `credentials` declaration. Validated against that declaration server-side, so an unknown key or a missing required one is a 400. Write-only — never returned by any read."}},"required":["provider","environment","credentials"]},"RotateBankConnectionCredentialsV1Dto":{"type":"object","properties":{"credentials":{"type":"object","additionalProperties":true,"description":"The provider's declared credential keys and their values. Shape is provider-defined; see GET /v1/banking/connection-methods' `credentials` declaration. Validated against that declaration server-side, so an unknown key or a missing required one is a 400, never a silent drop. Write-only — never returned by any read."}},"required":["credentials"]},"AddCashProAccountV1Dto":{"type":"object","properties":{"account_number":{"type":"string","description":"The account number as the bank knows it. Encrypted at rest; never returned by any response."},"bank_id":{"type":"string","description":"The BIC or routing number (e.g. BOFAUS3N or 026009593) — CashPro accounts are addressed, not enumerated."},"name":{"type":"string","maxLength":200},"currency_code":{"type":"string","maxLength":10,"default":"USD"},"legal_entity_id":{"type":"string","format":"uuid"},"cash_parent_account_id":{"type":"string","format":"uuid","description":"Parent (header) cash GL account under which a child sub-account is auto-minted for this bank, scoped to `legal_entity_id`. Mutually exclusive with `cash_account_id`; exactly one of the two is required."},"cash_account_id":{"type":"string","format":"uuid","description":"An existing cash GL account to reuse. Must already be scoped to `legal_entity_id` — an org-wide account is refused, because an account every entity can spend from cannot be one entity’s bank cash. Must also not already back another bank account (`bank_accounts_cash_account_id_uk`). Mutually exclusive with `cash_parent_account_id`."},"cash_account_name_override":{"type":"string","maxLength":120,"description":"Overrides the auto-minted child account name. Only meaningful with `cash_parent_account_id`; ignored otherwise. Defaults to \"${name} ••${last 4 of account_number}\"."}},"required":["account_number","bank_id","name","legal_entity_id"]},"BankBackfillWindowV1Dto":{"type":"object","properties":{"from_date":{"type":"string","format":"date","example":"2026-01-01"},"to_date":{"type":"string","format":"date","example":"2026-03-01"},"job_id":{"type":"string","format":"uuid","nullable":true,"description":"The queued job that will pull this window. For a window that collapsed onto a job already in flight (`deduped`), this is that job’s id. Null only if that job finished between the collision and the lookup."},"deduped":{"type":"boolean","description":"True when an identical window was already pending or running, so no second job was created. Dedup is scoped to the ACTIVE job: a re-submission after the windows finished enqueues fresh jobs and costs fresh calls to the bank (the data is unaffected — the writer is idempotent)."}},"required":["from_date","to_date","job_id","deduped"]},"BankConnectionBackfillV1Dto":{"type":"object","properties":{"window_count":{"type":"number","description":"How many bank-legal windows the span was split into, one job each.","example":6},"windows":{"description":"Every window that was enqueued, oldest first and contiguous: each starts the day after the previous one ends, and the last ends on `to_date`. Order of execution is immaterial — no watermark is written and the transaction writer is idempotent.","type":"array","items":{"$ref":"#/components/schemas/BankBackfillWindowV1Dto"}}},"required":["window_count","windows"]},"BackfillConnectionV1Dto":{"type":"object","properties":{"from_date":{"type":"string","format":"date","example":"2026-01-01","description":"First calendar day to pull, inclusive. Refused — never silently clamped — when it predates what the bank retains; the refusal names `earliest_available_from_date`, measured back from yesterday."},"to_date":{"type":"string","format":"date","example":"2026-11-06","description":"Last day, inclusive. Defaults to yesterday in the org's time zone. Today or later is refused: the window feeds the bank’s previous-day report, and today’s rows are provisional."},"account_ids":{"uniqueItems":true,"maxItems":200,"description":"Restrict the pull to these accounts on this connection. Omit for every account on it. An id that is not on the connection, or one the provider cannot address, is refused up front — a named account that silently produced no transactions would be a 202 with nothing behind it.","type":"array","items":{"type":"string","format":"uuid"}},"include_balances":{"type":"boolean","default":false,"description":"Also pull each day's closing balance over the window, one request per day. Off by default: a 60-day transaction backfill must not silently become 60 extra bank calls. A day the bank does not report — a weekend, a holiday — is left without a balance rather than failing the backfill. Inert on a provider that does not expose balances (Plaid today)."}},"required":["from_date"]},"BankRuleConditionV1Dto":{"type":"object","properties":{"description_contains":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"string"}},"amount_min":{"type":"string","example":"1234.50"},"amount_max":{"type":"string","example":"1234.50"}},"required":["description_contains"]},"BankRuleV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"priority":{"type":"number"},"scope_bank_account_id":{"type":"string","nullable":true,"format":"uuid"},"scope_bank_account_name":{"type":"string","nullable":true,"description":"Name of `scope_bank_account_id`; null when the rule has no scope account."},"to_bank_account_name":{"type":"string","nullable":true,"description":"Name of the destination bank account of a `transfer` action (`action.to_bank_account_id`); null for any other action."},"direction":{"type":"string","nullable":true,"enum":["in","out"]},"condition":{"$ref":"#/components/schemas/BankRuleConditionV1Dto"},"action":{"description":"Discriminated by `type`. One of categorize/transfer/exclude.","oneOf":[{"$ref":"#/components/schemas/BankRuleActionCategorizeV1Dto"},{"$ref":"#/components/schemas/BankRuleActionTransferV1Dto"},{"$ref":"#/components/schemas/BankRuleActionExcludeV1Dto"}]},"mode":{"type":"string","enum":["suggest","auto_post"]},"is_active":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"modified_at":{"type":"string","nullable":true,"format":"date-time"}},"required":["id","org_id","name","priority","scope_bank_account_id","scope_bank_account_name","to_bank_account_name","direction","condition","action","mode","is_active","created_at","modified_at"]},"ReorderBankRulesV1Dto":{"type":"object","properties":{"ordered_ids":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["ordered_ids"]},"CreateBankRuleV1Dto":{"type":"object","properties":{"name":{"type":"string"},"priority":{"type":"number"},"scope_bank_account_id":{"type":"string","nullable":true,"format":"uuid"},"direction":{"type":"string","nullable":true,"enum":["in","out"]},"condition":{"$ref":"#/components/schemas/BankRuleConditionV1Dto"},"action":{"description":"Discriminated by `type`. One of categorize/transfer/exclude.","oneOf":[{"$ref":"#/components/schemas/BankRuleActionCategorizeV1Dto"},{"$ref":"#/components/schemas/BankRuleActionTransferV1Dto"},{"$ref":"#/components/schemas/BankRuleActionExcludeV1Dto"}]},"mode":{"type":"string","enum":["suggest","auto_post"]}},"required":["name","condition","action","mode"]},"MoveBankRuleV1Dto":{"type":"object","properties":{"before_rule_id":{"type":"string","format":"uuid","description":"Place the rule immediately before this rule. Send exactly one of `before_rule_id` and `after_rule_id`."},"after_rule_id":{"type":"string","format":"uuid","description":"Place the rule immediately after this rule. Send exactly one of `before_rule_id` and `after_rule_id`."}}},"UpdateBankRuleV1Dto":{"type":"object","properties":{"name":{"type":"string"},"scope_bank_account_id":{"type":"string","nullable":true,"format":"uuid"},"direction":{"type":"string","nullable":true,"enum":["in","out"]},"condition":{"$ref":"#/components/schemas/BankRuleConditionV1Dto"},"action":{"description":"Discriminated by `type`. One of categorize/transfer/exclude.","oneOf":[{"$ref":"#/components/schemas/BankRuleActionCategorizeV1Dto"},{"$ref":"#/components/schemas/BankRuleActionTransferV1Dto"},{"$ref":"#/components/schemas/BankRuleActionExcludeV1Dto"}]},"mode":{"type":"string","enum":["suggest","auto_post"]},"is_active":{"type":"boolean"}}},"BankRuleTestResultV1Dto":{"type":"object","properties":{"would_match_transaction_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"count":{"type":"number"}},"required":["would_match_transaction_ids","count"]},"BankRuleApplicationV1Dto":{"type":"object","properties":{"bank_transaction_id":{"type":"string","format":"uuid"},"outcome":{"type":"string"}},"required":["bank_transaction_id","outcome"]},"BankRuleApplyResultV1Dto":{"type":"object","properties":{"applications":{"type":"array","items":{"$ref":"#/components/schemas/BankRuleApplicationV1Dto"}},"suggested_count":{"type":"number","description":"Count of pending tx that received a suggestion (mode=suggest or mode=auto_post with org gate off)."},"auto_posted_count":{"type":"number","description":"Count of pending tx that were auto-posted."}},"required":["applications","suggested_count","auto_posted_count"]},"CounterpartyMappingPartyV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"is_active":{"type":"boolean","description":"False when the party was deactivated. A mapping to an inactive party keeps its state but never resolves a line."}},"required":["id","name","is_active"]},"CounterpartyMappingV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"signal_kind":{"type":"string","enum":["ach_originator_id","plaid_counterparty","ach_originator_name","descriptor"],"description":"Which bank signal the mapping keys on, strongest first: `ach_originator_id` (ACH `ppd_id`), `plaid_counterparty` (Plaid counterparty `entity_id`), `ach_originator_name` (ACH payer name), `descriptor` (the cleaned line description)."},"signal_value":{"type":"string","description":"The signal value, normalized the way bank lines are."},"state":{"type":"string","enum":["suggested","learned","confirmed","ambiguous","retired"],"description":"`suggested` — matched to one party once since the last reset, or it keeps its party with no counted match since then (for example right after \"Turn back on\"); a suggested mapping never drives auto-matching. `learned` — at least twice, to that party only; `confirmed` — a person set the party; `ambiguous` — matched to two or more parties (resolves to the list), or it has no counted match and no party; `retired` — a person stopped it, never resolves a line."},"party":{"nullable":true,"description":"The mapped party. Null while ambiguous (see `ambiguous_parties`) and for a mapping retired while ambiguous.","type":"object","allOf":[{"$ref":"#/components/schemas/CounterpartyMappingPartyV1Dto"}]},"ambiguous_parties":{"description":"The parties an ambiguous mapping resolves to: its counted parties in the current window (at most six, by party id) plus the party it was confirmed to, if any; empty in every other state.","type":"array","items":{"$ref":"#/components/schemas/CounterpartyMappingPartyV1Dto"}},"counted_matches":{"type":"integer","description":"Matches since the last reset that were not reverted — the ones the state counts. For a caller limited to some legal entities, this and the three counts below include only matches whose entity (the generated document's, else the line's bank account's — the `legal_entity` Why? shows) is one of them."},"total_matches":{"type":"integer","description":"Every match ever recorded, reverted or not."},"auto_matches":{"type":"integer","description":"Matches made by a bank rule auto-post, ever."},"reverted_auto_matches":{"type":"integer","description":"Auto-post matches that were later reverted, ever."},"saturated_at":{"type":"string","format":"date-time","nullable":true,"description":"When the mapping saw 5 different parties in its window. A saturated mapping neither learns nor resolves a bank line until a person confirms it to a party, or stops it and turns it back on. Null when not saturated."},"last_seen_at":{"type":"string","format":"date-time","nullable":true,"description":"When a line last carried this signal while being settled. Null for a mapping added by hand that no line has matched yet."},"created_at":{"type":"string","format":"date-time"}},"required":["id","signal_kind","signal_value","state","party","ambiguous_parties","counted_matches","total_matches","auto_matches","reverted_auto_matches","saturated_at","last_seen_at","created_at"]},"CounterpartyEvidenceLineV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"description":{"type":"string","nullable":true},"amount":{"type":"string","example":"1234.50"},"transaction_date":{"type":"string","format":"date"}},"required":["id","description","amount","transaction_date"]},"CounterpartyEvidenceEntityV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true}},"required":["id","name"]},"CounterpartyEvidenceDocumentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_number":{"type":"string","nullable":true}},"required":["id","document_number"]},"CounterpartyEvidenceV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time","description":"When the match was made."},"counted":{"type":"boolean","description":"Whether this match counts toward the state: made since the last reset and not reverted."},"line":{"$ref":"#/components/schemas/CounterpartyEvidenceLineV1Dto"},"legal_entity":{"nullable":true,"description":"The generated document's legal entity, else the line's bank account's.","type":"object","allOf":[{"$ref":"#/components/schemas/CounterpartyEvidenceEntityV1Dto"}]},"party":{"$ref":"#/components/schemas/CounterpartyMappingPartyV1Dto"},"generated_document":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/CounterpartyEvidenceDocumentV1Dto"}]},"source":{"type":"string","enum":["manual","rule_auto"],"description":"`rule_auto` when a bank rule auto-posted the line; `manual` otherwise (bulk accept included)."},"actor_principal_id":{"type":"string","format":"uuid","description":"The principal that settled the line."},"reverted_at":{"type":"string","format":"date-time","nullable":true,"description":"When the match was undone; null while it stands."}},"required":["id","created_at","counted","line","legal_entity","party","generated_document","source","actor_principal_id","reverted_at"]},"CounterpartyMappingDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"signal_kind":{"type":"string","enum":["ach_originator_id","plaid_counterparty","ach_originator_name","descriptor"],"description":"Which bank signal the mapping keys on, strongest first: `ach_originator_id` (ACH `ppd_id`), `plaid_counterparty` (Plaid counterparty `entity_id`), `ach_originator_name` (ACH payer name), `descriptor` (the cleaned line description)."},"signal_value":{"type":"string","description":"The signal value, normalized the way bank lines are."},"state":{"type":"string","enum":["suggested","learned","confirmed","ambiguous","retired"],"description":"`suggested` — matched to one party once since the last reset, or it keeps its party with no counted match since then (for example right after \"Turn back on\"); a suggested mapping never drives auto-matching. `learned` — at least twice, to that party only; `confirmed` — a person set the party; `ambiguous` — matched to two or more parties (resolves to the list), or it has no counted match and no party; `retired` — a person stopped it, never resolves a line."},"party":{"nullable":true,"description":"The mapped party. Null while ambiguous (see `ambiguous_parties`) and for a mapping retired while ambiguous.","type":"object","allOf":[{"$ref":"#/components/schemas/CounterpartyMappingPartyV1Dto"}]},"ambiguous_parties":{"description":"The parties an ambiguous mapping resolves to: its counted parties in the current window (at most six, by party id) plus the party it was confirmed to, if any; empty in every other state.","type":"array","items":{"$ref":"#/components/schemas/CounterpartyMappingPartyV1Dto"}},"counted_matches":{"type":"integer","description":"Matches since the last reset that were not reverted — the ones the state counts. For a caller limited to some legal entities, this and the three counts below include only matches whose entity (the generated document's, else the line's bank account's — the `legal_entity` Why? shows) is one of them."},"total_matches":{"type":"integer","description":"Every match ever recorded, reverted or not."},"auto_matches":{"type":"integer","description":"Matches made by a bank rule auto-post, ever."},"reverted_auto_matches":{"type":"integer","description":"Auto-post matches that were later reverted, ever."},"saturated_at":{"type":"string","format":"date-time","nullable":true,"description":"When the mapping saw 5 different parties in its window. A saturated mapping neither learns nor resolves a bank line until a person confirms it to a party, or stops it and turns it back on. Null when not saturated."},"last_seen_at":{"type":"string","format":"date-time","nullable":true,"description":"When a line last carried this signal while being settled. Null for a mapping added by hand that no line has matched yet."},"created_at":{"type":"string","format":"date-time"},"evidence":{"description":"Why?: the matches behind the mapping, newest first, one page (`meta.next_cursor`). For a caller limited to some legal entities, only the matches whose entity (the generated document's, else the line's bank account's — the `legal_entity` Why? shows) is one of them.","type":"array","items":{"$ref":"#/components/schemas/CounterpartyEvidenceV1Dto"}}},"required":["id","signal_kind","signal_value","state","party","ambiguous_parties","counted_matches","total_matches","auto_matches","reverted_auto_matches","saturated_at","last_seen_at","created_at","evidence"]},"CreateCounterpartyMappingV1Dto":{"type":"object","properties":{"signal_kind":{"type":"string","enum":["ach_originator_id","plaid_counterparty","ach_originator_name","descriptor"],"description":"Which bank signal the mapping keys on, strongest first: `ach_originator_id` (ACH `ppd_id`), `plaid_counterparty` (Plaid counterparty `entity_id`), `ach_originator_name` (ACH payer name), `descriptor` (the cleaned line description)."},"signal_value":{"type":"string","minLength":1,"maxLength":500,"description":"Stored normalized the way bank lines are, so it matches the lines it came from."},"party_id":{"type":"string","format":"uuid","description":"An active party of this org."}},"required":["signal_kind","signal_value","party_id"]},"UpdateCounterpartyMappingV1Dto":{"type":"object","properties":{"party_id":{"type":"string","format":"uuid","description":"Change party: the mapping becomes confirmed for this active party and its count restarts. Also settles an ambiguous mapping, and on a retired mapping it turns it back on. Not nullable: `null` is a 400."},"state":{"type":"string","enum":["retired","active"],"description":"`retired` — stop using it (a no-op on a mapping already retired); `active` — turn it back on, its count restarts (a no-op on a mapping that is not retired). Not nullable: `null` is a 400."}}},"BankTransactionMatchV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"document_type":{"type":"string","description":"document_type of the matched document (e.g. \"payment_in\", \"expense\", \"transfer\", \"intercompany_settlement\")."},"document_number":{"type":"string","nullable":true},"kind":{"type":"string","enum":["created","linked"],"description":"`created`: this match booked the document, and an unmatch voids it. `linked`: the document existed before the match (a payment entered by hand); an unmatch only releases the line."},"role":{"type":"string","enum":["primary","residual"],"description":"`primary`: the document the line backs. `residual`: the write-off document of a partial match."},"matched_at":{"type":"string","format":"date-time"},"matched_by":{"type":"string","nullable":true,"format":"uuid","description":"The user who matched. Null = the system (a bank rule, Plaid)."},"unmatched_at":{"type":"string","nullable":true,"format":"date-time","description":"When the match ended. Null while it is live."},"unmatched_by":{"type":"string","nullable":true,"format":"uuid"}},"required":["id","document_id","document_type","document_number","kind","role","matched_at","matched_by","unmatched_at","unmatched_by"]},"MatchApplicationV1Dto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid"},"document_label":{"type":"string","nullable":true},"applied_amount":{"type":"string","description":"Amount this match would apply against the doc.","example":"1234.50"}},"required":["document_id","document_label","applied_amount"]},"MatchAlternateV1Dto":{"type":"object","properties":{"applications":{"type":"array","items":{"$ref":"#/components/schemas/MatchApplicationV1Dto"}},"total_applied":{"type":"string","description":"Sum of applied_amount across applications.","example":"1234.50"},"party_id":{"type":"string","nullable":true,"format":"uuid"},"party_name":{"type":"string","nullable":true}},"required":["applications","total_applied","party_id","party_name"]},"IcTransferPairMatchedDocV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_number":{"type":"string","nullable":true},"document_date":{"type":"string","example":"2026-04-15","description":"ISO date (YYYY-MM-DD)"},"remaining_balance":{"type":"string","description":"The doc's balance_amount at query time, before this hypothetical settlement.","example":"1234.50"},"applied_amount":{"type":"string","description":"Amount this suggestion would apply against the doc.","example":"1234.50"}},"required":["id","document_number","document_date","remaining_balance","applied_amount"]},"TransactionSuggestionV1Dto":{"type":"object","properties":{"kind":{"type":"string","description":"Discriminated by `kind`. `reconcile` links the line to a payment already recorded (GL-neutral): it carries the `match` fields with exactly one application, the payment at its total, and is accepted through `PUT /v1/banking/transactions/{id}/process` with `mode: 'match'` and `match_document_id`.","enum":["match","reconcile","categorize_hint","transfer","ic_transfer_pair"]},"applications":{"description":"Doc applications for the top pick when kind=match. Length 1 for single-doc match; length N for subset match.","type":"array","items":{"$ref":"#/components/schemas/MatchApplicationV1Dto"}},"total_applied":{"type":"string","description":"Sum of applied_amount across applications (kind=match).","example":"1234.50"},"alternates":{"type":"array","items":{"$ref":"#/components/schemas/MatchAlternateV1Dto"}},"total_candidates_count":{"type":"number","description":"Total number of candidate subsets ranked behind the top pick (1 means just the top; >1 means alternates exist)."},"party_name":{"type":"string","nullable":true},"account_id":{"type":"string","format":"uuid"},"account_label":{"type":"string"},"party_id":{"type":"string","nullable":true,"format":"uuid"},"source_count":{"type":"number"},"to_bank_account_id":{"type":"string","format":"uuid"},"to_bank_account_name":{"type":"string"},"paired_transaction_id":{"type":"string","format":"uuid"},"to_entity_id":{"type":"string","format":"uuid","description":"Counterparty LE id (for kind=ic_transfer_pair)."},"matched_ic_documents":{"description":"FIFO pre-match against open intercompany_transaction docs. Empty array means no open docs to apply against.","type":"array","items":{"$ref":"#/components/schemas/IcTransferPairMatchedDocV1Dto"}},"fifo_total_applied":{"type":"string","description":"Sum of applied_amount across matched_ic_documents.","example":"1234.50"},"fully_settles":{"type":"boolean","description":"True when matched_ic_documents fully cover the bank-tx amount (within $0.005)."}},"required":["kind"]},"CandidateShortPayV1Dto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid","description":"The document the payment only partly settles."},"document_label":{"type":"string","nullable":true,"description":"Live document number on the candidates route; as stored at compute time on the transaction row."},"applied":{"type":"string","description":"The part of the line applied to that document.","example":"1234.50"},"remaining":{"type":"string","description":"What would stay open on that document once applied.","example":"1234.50"}},"required":["document_id","document_label","applied","remaining"]},"AppliedCategorizeLineV1Dto":{"type":"object","properties":{"account_code":{"type":"string","nullable":true},"account_name":{"type":"string","nullable":true},"amount":{"type":"string","example":"1234.50"}},"required":["account_code","account_name","amount"]},"AppliedSettledDocV1Dto":{"type":"object","properties":{"document_id":{"type":"string","nullable":true,"format":"uuid","description":"Document id, for navigating to the settled document."},"document_number":{"type":"string","nullable":true},"document_type":{"type":"string"},"applied_amount":{"type":"string","example":"1234.50"}},"required":["document_id","document_number","document_type","applied_amount"]},"AppliedDetailV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["categorize","match","transfer","ic_settle"],"description":"Which processing flow produced the linked document."},"economic_document_type":{"type":"string","nullable":true,"description":"Categorize only: 'expense' | 'sales_receipt' | 'deposit'. Null otherwise."},"party_name":{"type":"string","nullable":true},"lines":{"nullable":true,"description":"Categorize only: the GL account line(s) the tx was posted to.","type":"array","items":{"$ref":"#/components/schemas/AppliedCategorizeLineV1Dto"}},"settled_documents":{"nullable":true,"description":"Match only: the invoice/bill(s) settled by the generated payment.","type":"array","items":{"$ref":"#/components/schemas/AppliedSettledDocV1Dto"}},"destination_account_name":{"type":"string","nullable":true},"destination_account_last4":{"type":"string","nullable":true},"counterparty_entity_name":{"type":"string","nullable":true},"ic_applications":{"nullable":true,"description":"IC settle only: the intercompany documents settled.","type":"array","items":{"$ref":"#/components/schemas/AppliedSettledDocV1Dto"}}},"required":["kind","economic_document_type","party_name","lines","settled_documents","destination_account_name","destination_account_last4","counterparty_entity_name","ic_applications"]},"BankTransactionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bank_account_id":{"type":"string","format":"uuid"},"bank_account_name":{"type":"string","nullable":true},"bank_account_last4":{"type":"string","nullable":true},"bank_account_legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"bank_account_legal_entity_name":{"type":"string","nullable":true},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"party_id":{"type":"string","nullable":true,"format":"uuid"},"legal_entity_name":{"type":"string","nullable":true},"party_name":{"type":"string","nullable":true},"external_id":{"type":"string","nullable":true},"transaction_date":{"type":"string","format":"date"},"direction":{"type":"string","enum":["in","out"]},"amount":{"type":"string","example":"1234.50"},"currency":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["imported","accounted","excluded","needs_review"],"description":"`accounted` when the line has a live primary match (derived from `matches`); otherwise the stored review status: `imported`, `excluded` or `needs_review`."},"category_type":{"type":"string","enum":["uncategorized","sales_receipt","expense","excluded","needs_review","transfer","ic_settlement","payment_in","payment_out","refund_payment","deposit"]},"matched_document_id":{"type":"string","nullable":true,"format":"uuid","description":"The document the live primary match names. Null when the line is not matched."},"generated_document_type":{"type":"string","nullable":true,"description":"document_type of the live primary match's document (e.g. \"payment_in\", \"expense\", \"sales_receipt\", \"transfer\", \"intercompany_settlement\"). Null when the line is not matched."},"generated_document_number":{"type":"string","nullable":true,"description":"Human-readable document number of the live primary match's document, when available."},"matches":{"description":"The line's match record. The list endpoint returns the live rows only (a primary, and a residual when a partial match booked one); the detail endpoint returns the full history, ended rows included, oldest first.","type":"array","items":{"$ref":"#/components/schemas/BankTransactionMatchV1Dto"}},"pending":{"type":"boolean","description":"Plaid pending flag. Pending transactions are hidden from the default list and cannot be matched until they post."},"removed_by_provider":{"type":"boolean","description":"The bank feed (Plaid) removed this transaction upstream after it had been matched. It is kept as a record of that match and can never be matched again (409 `BANK_LINE_REMOVED_BY_PROVIDER`)."},"created_at":{"type":"string","nullable":true,"format":"date-time"},"suggestion":{"nullable":true,"description":"Precomputed suggestion (Phase 2). Null when none.","type":"object","allOf":[{"$ref":"#/components/schemas/TransactionSuggestionV1Dto"}]},"suggestion_source":{"type":"string","nullable":true,"description":"Source of the suggestion (existing_payment | rule:<uuid> | party_settlement | transfer_pair | history_hint | ic_transfer_pair). Rows computed before step 3b may still read open_document_match."},"suggestion_score":{"type":"integer","minimum":0,"maximum":100,"nullable":true,"description":"The rank-1 match candidate's score (0-100). Null when the line has no candidates or the top one is a categorize hint."},"suggestion_band":{"type":"string","enum":["high","medium","needs_you"],"nullable":true,"description":"The rank-1 match candidate's confidence band. Null when the line has no candidates or the top one is a categorize hint."},"suggestion_short_pay":{"nullable":true,"description":"The rank-1 candidate's short pay, when it only partly settles a document; the document label is as stored when the suggestion was computed. Null otherwise.","type":"object","allOf":[{"$ref":"#/components/schemas/CandidateShortPayV1Dto"}]},"applied":{"nullable":true,"description":"Detail-endpoint only: read-only summary of the applied decision for an accounted transaction. Null on the list endpoint and for non-accounted rows.","type":"object","allOf":[{"$ref":"#/components/schemas/AppliedDetailV1Dto"}]}},"required":["id","bank_account_id","bank_account_name","bank_account_last4","bank_account_legal_entity_id","bank_account_legal_entity_name","legal_entity_id","party_id","legal_entity_name","party_name","external_id","transaction_date","direction","amount","currency","description","status","category_type","matched_document_id","matches","pending","removed_by_provider","created_at","suggestion_score","suggestion_band","suggestion_short_pay"]},"BankTransactionCountsV1Dto":{"type":"object","properties":{"imported":{"type":"number","description":"Lines whose status is `imported` (not matched, not excluded)."},"needs_review":{"type":"number","description":"Lines flagged `needs_review` and not matched."},"accounted":{"type":"number","description":"Lines with a live primary match."},"excluded":{"type":"number","description":"Lines whose status is `excluded`."}},"required":["imported","needs_review","accounted","excluded"]},"BankTransactionStatsV1Dto":{"type":"object","properties":{"pending":{"type":"number","description":"Count of transactions in `imported` status (visible in Pending tab)."},"high_confidence":{"type":"number","description":"Count of pending transactions with at least one exact-amount match (≤0.01 tolerance) against an open invoice/bill."},"ic_tagged":{"type":"number","description":"Count of pending transactions with a non-null legal_entity_id (IC-tagged)."},"transfers":{"type":"number","description":"Phase 1: always 0. Phase 2 will populate from transfer-pair detection."}},"required":["pending","high_confidence","ic_tagged","transfers"]},"MetaBankAccountV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]},"MetaProcessingOptionLegalEntityV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]},"MetaProcessingOptionPartyV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"Set when this party represents one of the org's own legal entities (its system-managed party), as on `PartyV1Dto.legal_entity_id`; null for an outside party. Deposit and categorize refuse such a party with `BANK_TX_PARTY_IS_LEGAL_ENTITY`: cash between group entities goes through IC settle. Match accepts it."}},"required":["id","name","legal_entity_id"]},"MetaProcessingOptionAccountV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string"},"name":{"type":"string"}},"required":["id","code","name"]},"MetaProcessingOptionLocationV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"kind":{"type":"string","enum":["property","space"],"description":"Which record `id` names. The same two values `search_documents.kind` uses (D13)."},"parent_id":{"type":"string","nullable":true,"format":"uuid","description":"What this hangs under: null for a property, the property for a top-level space, the parent space for a nested one. Renamed from `parentTrackableId`."}},"required":["id","name","kind","parent_id"]},"MetaProcessingOptionDocumentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"document_number":{"type":"string","nullable":true},"balance_amount":{"type":"string","example":"1234.50"},"party_name":{"type":"string","nullable":true},"document_date":{"type":"string","format":"date"}},"required":["id","document_type","document_number","balance_amount","party_name","document_date"]},"MetaProcessingOptionsV1Dto":{"type":"object","properties":{"legal_entities":{"type":"array","items":{"$ref":"#/components/schemas/MetaProcessingOptionLegalEntityV1Dto"}},"parties":{"type":"array","items":{"$ref":"#/components/schemas/MetaProcessingOptionPartyV1Dto"}},"accounts":{"type":"array","items":{"$ref":"#/components/schemas/MetaProcessingOptionAccountV1Dto"}},"locations":{"description":"Every active property and space in the org, one flat list ordered by name.","type":"array","items":{"$ref":"#/components/schemas/MetaProcessingOptionLocationV1Dto"}},"open_documents":{"type":"array","items":{"$ref":"#/components/schemas/MetaProcessingOptionDocumentV1Dto"}}},"required":["legal_entities","parties","accounts","locations","open_documents"]},"CategorizationHistoryItemDto":{"type":"object","properties":{"bank_transaction_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"account_name":{"type":"string"},"party_id":{"type":"string","format":"uuid","nullable":true},"party_name":{"type":"string","nullable":true},"amount":{"type":"string","description":"Categorized line amount, as numeric string"},"categorized_at":{"type":"string","format":"date-time","description":"When the current categorization was written: the creation time of the generated document's current journal entry (`documents.posted_journal_entry_id`). An edit points the document at a new entry, so a re-categorization moves it. RFC 3339, UTC."}},"required":["bank_transaction_id","account_id","account_name","party_id","party_name","amount","categorized_at"]},"CategorizationHistoryResponseDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CategorizationHistoryItemDto"}}},"required":["items"]},"CandidateCounterpartyV1Dto":{"type":"object","properties":{"state":{"type":"string","enum":["confirmed","learned","suggested","ambiguous"],"description":"How firmly the payer is tied to a party."},"party_id":{"type":"string","format":"uuid","nullable":true,"description":"The party the payer maps to; null when ambiguous."},"party_name":{"type":"string","nullable":true,"description":"The mapping's party name while it still names party_id, else the proposal's stored name for that party; null when ambiguous or neither names it."},"signal_kind":{"type":"string","enum":["ach_originator_id","plaid_counterparty","ach_originator_name","descriptor"],"nullable":true,"description":"Kind of the line signal that identified the payer; null when the mapping is gone or now points at another party."},"signal_value":{"type":"string","nullable":true,"description":"Value of that signal (e.g. the bank descriptor); null when the mapping is gone or now points at another party."},"match_count":{"type":"integer","nullable":true,"description":"Matches counted behind the mapping, limited to the caller legal entities; null when the mapping is gone or now points at another party."},"party_count":{"type":"integer","description":"How many parties the payer could be (above 1 when ambiguous)."}},"required":["state","party_id","party_name","signal_kind","signal_value","match_count","party_count"]},"CandidateApplicationV1Dto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid","description":"The open document to settle."},"document_label":{"type":"string","nullable":true,"description":"Human label of the document: its current number, or the label stored when computed if the document is gone."},"due_date":{"type":"string","format":"date","nullable":true,"description":"Due date of the document as it stands now; null when the document is gone."},"applied_amount":{"type":"string","description":"The amount of the line this candidate applies.","example":"1234.50"},"open_amount":{"type":"string","nullable":true,"description":"The document open balance as it stands now; null when the document is gone.","example":"1234.50"},"left_open":{"type":"string","nullable":true,"description":"The balance left on the document after applying `applied_amount` to its current balance; negative when the balance has since dropped below it. Null when the document is gone.","example":"1234.50"},"partial":{"type":"boolean","description":"True when the application leaves part of the document open."}},"required":["document_id","document_label","due_date","applied_amount","open_amount","left_open","partial"]},"MatchCandidateV1Dto":{"type":"object","properties":{"rank":{"type":"integer","description":"Position in the ranking, 1 = best."},"generator":{"type":"string","enum":["existing_payment","rule","party_settlement","transfer_pair","history_hint","open_document_combination"],"description":"The generator that produced this candidate (`open_document_combination` only on rows stored before step 3b)."},"kind":{"type":"string","enum":["match","reconcile","categorize","transfer","ic_transfer_pair","exclude"],"description":"`match` settles documents; `categorize` is an account hint; `transfer`, `ic_transfer_pair` and `exclude` are the other stored kinds."},"score":{"type":"integer","minimum":0,"maximum":100,"nullable":true,"description":"Confidence score 0-100; null when the candidate is unscored."},"band":{"type":"string","enum":["high","medium","needs_you"],"nullable":true,"description":"How much to trust the score; null when unscored."},"reasons":{"description":"Reason codes behind the score, as the engine emitted them.","type":"array","items":{"type":"string"}},"structures":{"description":"Settlement structure codes (e.g. short_pay) describing how documents combine.","type":"array","items":{"type":"string"}},"pool":{"type":"string","enum":["counterparty","entity_scan"],"nullable":true,"description":"Where the documents came from: the payer own documents, or a scan of the entity."},"oldest_days_past_due":{"type":"integer","nullable":true,"description":"Days past due of the oldest document applied, when known."},"party_id":{"type":"string","format":"uuid","nullable":true,"description":"The party the documents belong to; null for a hint."},"party_name":{"type":"string","nullable":true,"description":"Name of that party, as stored when computed."},"total_applied":{"type":"string","nullable":true,"description":"Total applied across the documents; null for a hint.","example":"1234.50"},"short_pay":{"nullable":true,"description":"The partly settled document, when the structure is a short pay.","type":"object","allOf":[{"$ref":"#/components/schemas/CandidateShortPayV1Dto"}]},"applications":{"description":"The documents to settle; empty for a categorize hint.","type":"array","items":{"$ref":"#/components/schemas/CandidateApplicationV1Dto"}},"stale":{"type":"boolean","description":"True when the documents changed since the candidates were computed (gone, not posted, or paid below the applied amount)."}},"required":["rank","generator","kind","score","band","reasons","structures","pool","oldest_days_past_due","party_id","party_name","total_applied","short_pay","applications","stale"]},"BankTransactionCandidatesV1Dto":{"type":"object","properties":{"computed_at":{"type":"string","format":"date-time","nullable":true,"description":"When the newest candidate was computed; null when none exist."},"counterparty":{"nullable":true,"description":"The payer identification behind the top candidate, if any.","type":"object","allOf":[{"$ref":"#/components/schemas/CandidateCounterpartyV1Dto"}]},"candidates":{"description":"The stored candidates, best first.","type":"array","items":{"$ref":"#/components/schemas/MatchCandidateV1Dto"}}},"required":["computed_at","counterparty","candidates"]},"MatchSuggestionSettlementV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_type":{"type":"string","enum":["invoice","bill","refund","owner_distribution","investment_in_subsidiary","distribution_receipt","distribution_refund","distribution_refund_payable"]},"document_number":{"type":"string","nullable":true},"document_date":{"type":"string","format":"date"},"due_date":{"type":"string","nullable":true},"party_id":{"type":"string","format":"uuid","nullable":true,"description":"Party the document belongs to. The client keeps a multi-select on a single party; mixing parties is rejected at settle time."},"party_name":{"type":"string","nullable":true},"total_amount":{"type":"string"},"balance_amount":{"type":"string"},"match_score":{"type":"number","minimum":0,"maximum":100}},"required":["id","document_type","document_date","total_amount","balance_amount","match_score"]},"MatchSuggestionReconcileV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"document_type":{"type":"string","enum":["payment_in","payment_out"]},"document_number":{"type":"string","nullable":true},"document_date":{"type":"string","format":"date"},"party_name":{"type":"string","nullable":true},"total_amount":{"type":"string"},"applied_to_document_number":{"type":"string","nullable":true},"match_score":{"type":"number","minimum":0,"maximum":100}},"required":["id","document_type","document_date","total_amount","match_score"]},"MatchSuggestionsResponseV1Dto":{"type":"object","properties":{"settlement_targets":{"type":"array","items":{"$ref":"#/components/schemas/MatchSuggestionSettlementV1Dto"}},"reconcile_targets":{"type":"array","items":{"$ref":"#/components/schemas/MatchSuggestionReconcileV1Dto"}}},"required":["settlement_targets","reconcile_targets"]},"CreateBankTransactionV1Dto":{"type":"object","properties":{"bank_account_id":{"type":"string","format":"uuid"},"external_id":{"type":"string","description":"External provider id (e.g. Plaid)"},"transaction_date":{"type":"string","example":"2026-02-25","format":"date"},"amount":{"type":"string","example":"2500.00"},"description":{"type":"string"},"legal_entity_id":{"type":"string","description":"IC counterparty (mutually exclusive with party_id). When set the txn must settle via IC settlement. Must be a different entity from the bank account's own — the owner is always the bank account's entity and is never sent here (422 BANK_TX_IC_TAG_IS_OWN_ENTITY).","format":"uuid"},"party_id":{"type":"string","description":"AR/AP counterparty (mutually exclusive with legal_entity_id). For standard match / categorize.","format":"uuid"}},"required":["bank_account_id","transaction_date","amount"]},"UpdateBankTransactionClassificationV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"IC counterparty tag (mutually exclusive with party_id); null clears it. Must be a different entity from the bank account's own (422 BANK_TX_IC_TAG_IS_OWN_ENTITY)."},"party_id":{"type":"string","nullable":true,"format":"uuid"}}},"ProcessBankTransactionResultV1Dto":{"type":"object","properties":{"transaction_id":{"type":"string","format":"uuid"},"payment_document_id":{"type":"string","nullable":true,"format":"uuid"},"economic_document_id":{"type":"string","nullable":true,"format":"uuid"},"matched_document_id":{"type":"string","nullable":true,"format":"uuid"},"payment_application_id":{"type":"string","nullable":true,"format":"uuid"},"document_id":{"type":"string","nullable":true,"format":"uuid"},"journal_entry_id":{"type":"string","nullable":true,"format":"uuid"},"status":{"type":"string","enum":["accounted"]}},"required":["transaction_id","payment_document_id","economic_document_id","matched_document_id","payment_application_id","document_id","journal_entry_id","status"]},"ProcessBankTransactionApplicationV1Dto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid"},"amount":{"type":"string","example":"500.00"}},"required":["document_id","amount"]},"ProcessBankTransactionLineV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"amount":{"type":"string","example":"1000.00"},"description":{"type":"string"},"dimensions":{"type":"object","description":"Dimension values keyed by dimensions.code (UUIDs for data_type=entity). Three states: omit the key = unanswered; key with null = explicit \"None\" answer (satisfies is_required); key with a string = a value. Entity-typed values are auto-completed server-side with the row's parent chain; caller-supplied values (including explicit None) are never overwritten. Line level.","additionalProperties":{"type":"string","nullable":true}}},"required":["account_id","amount"]},"ProcessBankTransactionV1Dto":{"type":"object","properties":{"mode":{"type":"string","enum":["categorize","match","transfer","deposit"]},"economic_document_type":{"type":"string","enum":["expense","sales_receipt"]},"legal_entity_id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"},"match_document_id":{"type":"string","format":"uuid"},"applied_amount":{"type":"string","example":"2500.00"},"applications":{"type":"array","items":{"$ref":"#/components/schemas/ProcessBankTransactionApplicationV1Dto"}},"lines":{"type":"array","items":{"$ref":"#/components/schemas/ProcessBankTransactionLineV1Dto"}},"residual_lines":{"description":"Resolve-difference lines for Match mode. Use when applied_amount differs from |bank tx amount|: each line allocates the difference to an account (e.g. bank fees, discount given/taken, overpayment income). Sum of residual amounts must equal |applied_amount - tx_amount|. Without residual_lines the applied amount must equal the bank amount, with one exception: an inflow (direction in) larger than what is applied to invoices creates the payment_in for the full bank amount and leaves the excess unapplied on it as customer credit.","type":"array","items":{"$ref":"#/components/schemas/ProcessBankTransactionLineV1Dto"}},"to_bank_account_id":{"type":"string","format":"uuid","description":"Required when mode=transfer. Destination bank account id."},"paired_transaction_id":{"type":"string","format":"uuid","description":"Optional when mode=transfer. Pairs the source tx with a sibling tx on the destination account; both lines get a live primary match to the one transfer document."},"memo":{"type":"string"}},"required":["mode"]},"BulkProcessItemErrorV1Dto":{"type":"object","properties":{"code":{"type":"string","description":"The error code for this item. It is one of the codes `BankTransactions.process` can return, for example `DOCUMENT_NOT_FOUND`, `DOCUMENT_STATUS_FORBIDS_ACTION` or `LEGAL_ENTITY_NOT_IN_SCOPE`."},"message":{"type":"string"}},"required":["code","message"]},"BulkProcessItemResultV1Dto":{"type":"object","properties":{"transaction_id":{"type":"string","format":"uuid"},"ok":{"type":"boolean"},"result":{"$ref":"#/components/schemas/ProcessBankTransactionResultV1Dto"},"error":{"$ref":"#/components/schemas/BulkProcessItemErrorV1Dto"}},"required":["transaction_id","ok"]},"BulkProcessBankTransactionsResultV1Dto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/BulkProcessItemResultV1Dto"}}},"required":["items"]},"BulkProcessItemV1Dto":{"type":"object","properties":{"transaction_id":{"type":"string","format":"uuid"},"payload":{"description":"Same shape as PUT /:id/process body.","allOf":[{"$ref":"#/components/schemas/ProcessBankTransactionV1Dto"}]}},"required":["transaction_id","payload"]},"BulkProcessBankTransactionsV1Dto":{"type":"object","properties":{"items":{"minItems":1,"maxItems":100,"type":"array","items":{"$ref":"#/components/schemas/BulkProcessItemV1Dto"}}},"required":["items"]},"RevertBankTransactionResultV1Dto":{"type":"object","properties":{"transaction_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["imported","accounted","excluded","needs_review"]}},"required":["transaction_id","status"]},"IcSettlementResultV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string"},"journal_entry_id":{"type":"string","format":"uuid"},"total_amount":{"type":"string"},"from_entity_id":{"type":"string","format":"uuid"},"to_entity_id":{"type":"string","format":"uuid"},"applications_count":{"type":"number"}},"required":["id","status","total_amount","from_entity_id","to_entity_id","applications_count"]},"ManualIcApplicationV1Dto":{"type":"object","properties":{"source_document_id":{"type":"string","format":"uuid"},"applied_amount":{"type":"string","example":"100000.00"}},"required":["source_document_id","applied_amount"]},"CategorizeAsIcSettlementV1Dto":{"type":"object","properties":{"to_entity_id":{"type":"string","description":"The counterparty legal entity — the other side of the wire from this bank account's entity (an `ic_transfer_pair` suggestion's `to_entity_id`). The transaction's sign sets the direction: an outflow settles bank entity → counterparty, an inflow settles counterparty → bank entity.","format":"uuid"},"application_method":{"type":"string","enum":["fifo","manual"]},"manual_applications":{"type":"array","items":{"$ref":"#/components/schemas/ManualIcApplicationV1Dto"}},"memo":{"type":"string"},"paired_transaction_id":{"type":"string","format":"uuid","description":"Optional. The other side of the same wire: the counterpart bank transaction on the other party's bank (the `paired_transaction_id` of an `ic_transfer_pair` suggestion). Both lines become `accounted` and point at the new settlement. Requires `bank_transaction_id` (on the banking route, the transaction in the URL). Refused with IC_SETTLEMENT_PAIRED_TRANSACTION_INVALID unless it is in this organization, is not the first line, is not pending, is on a bank of the settlement party that does not own the first line's bank, has the first line's amount with the opposite sign (so the payer's bank shows the outflow and the payee's the inflow, and its absolute amount is the settlement total), is on a bank in the settlement's currency, and that bank has a cash account configured — the payee's or payer's cash leg posts to it; refused with IC_SETTLEMENT_BANK_TRANSACTION_ALREADY_PROCESSED if it is already categorized or linked. A refusal writes nothing."}},"required":["to_entity_id","application_method"]},"ReconciliationBookedAfterDocumentV1Dto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid"},"document_number":{"type":"string","nullable":true},"bank_date":{"type":"string","format":"date","description":"When the bank took it: on or before the statement date."},"book_date":{"type":"string","format":"date","description":"When the books dated it: after the statement date."},"amount":{"type":"string","description":"The cash line's amount, shown positive.","example":"1234.50"}},"required":["document_id","document_number","bank_date","book_date","amount"]},"ReconciliationBlockingReasonV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["unprocessed_bank_lines","confirm_beginning_balance","booked_after_statement_date","unexplained_difference"],"description":"unprocessed_bank_lines: bank lines up to the statement date with no entry in the books (count + total). confirm_beginning_balance: first period, confirm it through Edit info. booked_after_statement_date: the bank took it by the statement date but the books dated it after (documents). unexplained_difference: none of the above explains the difference (amount = the difference)."},"count":{"type":"number","nullable":true},"amount":{"type":"string","nullable":true,"example":"1234.50"},"documents":{"description":"Only filled for booked_after_statement_date.","type":"array","items":{"$ref":"#/components/schemas/ReconciliationBookedAfterDocumentV1Dto"}}},"required":["kind","count","amount","documents"]},"ReconciliationStatementImportV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string"},"file_name":{"type":"string"},"extracted_statement_date":{"type":"string","nullable":true,"format":"date"},"extracted_ending_balance":{"type":"string","nullable":true}},"required":["id","status","file_name","extracted_statement_date","extracted_ending_balance"]},"ReconciliationLineV1Dto":{"type":"object","properties":{"journal_line_id":{"type":"string","format":"uuid"},"journal_entry_id":{"type":"string","format":"uuid"},"entry_date":{"type":"string","format":"date"},"cleared_date":{"type":"string","nullable":true},"document_id":{"type":"string","nullable":true,"format":"uuid","description":"The line's source document, to link to; null for a manual entry."},"document_type":{"type":"string","nullable":true},"document_number":{"type":"string","nullable":true},"memo":{"type":"string","nullable":true},"payment":{"type":"string","description":"Outflow on this line, shown positive; '0.00' when the line is an inflow.","example":"1234.50"},"deposit":{"type":"string","description":"Inflow on this line; '0.00' when the line is an outflow.","example":"1234.50"},"cleared":{"type":"boolean"},"feed_cleared":{"type":"boolean","description":"True when this account's bank cleared the line on or before the statement date, so it clears automatically (spec 2026-10-26 R3.1)."},"bank_date":{"type":"string","nullable":true,"format":"date","description":"The date this account's bank cleared the line (its earliest live-matched bank line), even when after the statement date; null when the bank has not cleared it."},"party_name":{"type":"string","nullable":true,"description":"The party on the line's document, if any."},"clear_source":{"type":"string","nullable":true,"enum":["auto","manual"],"description":"How the line was cleared: automatically from a bank match, or by hand. Null when not cleared."}},"required":["journal_line_id","journal_entry_id","entry_date","cleared_date","document_id","document_type","document_number","memo","payment","deposit","cleared","feed_cleared","bank_date","party_name","clear_source"]},"ReconciliationSessionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bank_account_id":{"type":"string","format":"uuid"},"bank_account_name":{"type":"string"},"bank_account_last4":{"type":"string","nullable":true},"legal_entity_name":{"type":"string","nullable":true},"statement_ending_date":{"type":"string","format":"date"},"statement_ending_balance":{"type":"string","example":"1234.50"},"beginning_balance":{"type":"string","example":"1234.50"},"status":{"type":"string","enum":["in_progress","completed","discarded"]},"start_mode":{"type":"string","enum":["auto","manual"],"description":"auto: opened by an uploaded statement. manual: started from the Reconcile dialog."},"completion_mode":{"type":"string","nullable":true,"enum":["auto","manual"],"description":"How it was completed; null while not completed. A completion from before this field existed reads manual."},"completed_by":{"type":"string","nullable":true,"format":"uuid","description":"Who completed it; null while not completed or when it completed automatically."},"completed_at":{"type":"string","nullable":true,"format":"date-time"},"blocking_reasons":{"description":"Why it cannot complete by itself (spec 2026-10-26 R5). Always empty unless in progress.","type":"array","items":{"$ref":"#/components/schemas/ReconciliationBlockingReasonV1Dto"}},"human_changes":{"type":"boolean","description":"Started or changed by hand, so a person finishes it. Informational: it does not block Finish. Always false unless in progress."},"cleared_balance":{"type":"string","example":"1234.50"},"cleared_deposits_total":{"type":"string","example":"1234.50"},"cleared_payments_total":{"type":"string","example":"1234.50"},"cleared_count":{"type":"number"},"difference":{"type":"string","example":"1234.50"},"is_balanced":{"type":"boolean"},"adjustment_journal_entry_id":{"type":"string","nullable":true,"format":"uuid"},"statement_import":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/ReconciliationStatementImportV1Dto"}]},"lines":{"type":"array","items":{"$ref":"#/components/schemas/ReconciliationLineV1Dto"}}},"required":["id","bank_account_id","bank_account_name","bank_account_last4","legal_entity_name","statement_ending_date","statement_ending_balance","beginning_balance","status","start_mode","completion_mode","completed_by","completed_at","blocking_reasons","human_changes","cleared_balance","cleared_deposits_total","cleared_payments_total","cleared_count","difference","is_balanced","adjustment_journal_entry_id","statement_import","lines"]},"StartReconciliationV1Dto":{"type":"object","properties":{"bank_account_id":{"type":"string","format":"uuid"},"statement_ending_date":{"type":"string","example":"2026-01-31","format":"date"},"statement_ending_balance":{"type":"string","example":"11839.51"},"beginning_balance":{"type":"string","description":"Only honored on the first reconciliation for the account (no prior to carry from). Defaults to 0.","example":"0.00"}},"required":["bank_account_id","statement_ending_date","statement_ending_balance"]},"ReconciliationSummaryV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bank_account_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","nullable":true},"bank_account_name":{"type":"string","nullable":true},"statement_ending_date":{"type":"string","format":"date"},"statement_ending_balance":{"type":"string","example":"1234.50"},"beginning_balance":{"type":"string","example":"1234.50"},"status":{"type":"string","enum":["in_progress","completed","discarded"]},"completed_at":{"type":"string","nullable":true},"completion_mode":{"type":"string","nullable":true,"enum":["auto","manual"],"description":"How it was completed: auto when it closed by itself from its statement, manual when a person finished it. Null unless completed; a completion from before this field existed reads manual."}},"required":["id","bank_account_id","legal_entity_id","legal_entity_name","bank_account_name","statement_ending_date","statement_ending_balance","beginning_balance","status","completed_at","completion_mode"]},"ReconciliationAccountLatestV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"statement_ending_date":{"type":"string","format":"date"},"status":{"type":"string","enum":["in_progress","completed"]},"start_mode":{"type":"string","enum":["auto","manual"]},"completion_mode":{"type":"string","enum":["auto","manual"],"nullable":true},"completed_by":{"type":"string","format":"uuid","nullable":true},"completed_at":{"type":"string","nullable":true,"format":"date-time"},"blocking_count":{"type":"number","description":"Number of items to resolve keeping an in-progress reconciliation from closing (one per document for lines booked after the statement date); 0 otherwise."}},"required":["id","statement_ending_date","status","start_mode","completion_mode","completed_by","completed_at","blocking_count"]},"ReconciliationAccountV1Dto":{"type":"object","properties":{"bank_account_id":{"type":"string","format":"uuid"},"bank_account_name":{"type":"string"},"bank_account_last4":{"type":"string","nullable":true},"account_type":{"type":"string","enum":["checking","savings","credit_card","trust","other"]},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"reconcilable":{"type":"boolean","description":"False when the account has no cash account in the books."},"reconciled_through":{"type":"string","format":"date","nullable":true},"latest":{"nullable":true,"description":"The latest non-discarded reconciliation, if any.","type":"object","allOf":[{"$ref":"#/components/schemas/ReconciliationAccountLatestV1Dto"}]},"state":{"type":"string","enum":["needs_attention","in_progress","completed_auto","completed","waiting_for_statement","never_reconciled","not_reconcilable"]}},"required":["bank_account_id","bank_account_name","bank_account_last4","account_type","legal_entity_id","legal_entity_name","reconcilable","reconciled_through","latest","state"]},"EditReconciliationInfoV1Dto":{"type":"object","properties":{"statement_ending_date":{"type":"string","format":"date"},"statement_ending_balance":{"type":"string","example":"1234.50"},"beginning_balance":{"type":"string","description":"Only accepted while the bank account has no completed reconciliation (a first period); otherwise refused with RECONCILIATION_BEGINNING_BALANCE_LOCKED.","example":"250.00"}}},"ToggleItemV1Dto":{"type":"object","properties":{"journal_line_id":{"type":"string","format":"uuid"},"cleared":{"type":"boolean","description":"true = clear, false = unclear"}},"required":["journal_line_id","cleared"]},"ToggleItemsV1Dto":{"type":"object","properties":{"items":{"description":"At least one item; an empty list is refused (VALIDATION_FAILED).","type":"array","items":{"$ref":"#/components/schemas/ToggleItemV1Dto"}}},"required":["items"]},"CompleteReconciliationAdjustV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid","description":"GL account to book the difference against (e.g. Reconciliation Discrepancy)."},"memo":{"type":"string"}},"required":["account_id"]},"CompleteReconciliationV1Dto":{"type":"object","properties":{"adjust":{"description":"When omitted, completion requires difference == 0. When present, posts a balancing JE and forces completion.","allOf":[{"$ref":"#/components/schemas/CompleteReconciliationAdjustV1Dto"}]}}},"StatementImportV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bank_account_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"purpose":{"type":"string","enum":["feed","reconciliation"]},"status":{"type":"string","enum":["parsing","parsed","failed","committed","discarded"]},"file_name":{"type":"string"},"content_type":{"type":"string"},"parse_model":{"type":"string","nullable":true},"parse_error":{"type":"string","nullable":true},"reconciliation_id":{"type":"string","nullable":true,"format":"uuid"},"extracted_statement_date":{"type":"string","nullable":true,"format":"date"},"extracted_ending_balance":{"type":"string","nullable":true},"needs_period_confirmation":{"type":"boolean","description":"True when the period end was only guessed from the CSV and a person must confirm it before a reconciliation can start on its own."},"period_end_confirmed_at":{"type":"string","nullable":true,"format":"date-time"},"auto_reconcile_note":{"type":"string","nullable":true,"enum":["not_reconcilable","not_depository","not_after_last_reconciliation","reconciliation_in_progress","no_ending_balance","awaiting_period_confirmation"],"description":"Why automatic reconciliation did not start for this import."},"created_at":{"type":"string","format":"date-time"}},"required":["id","bank_account_id","legal_entity_id","purpose","status","file_name","content_type","parse_model","parse_error","reconciliation_id","extracted_statement_date","extracted_ending_balance","needs_period_confirmation","period_end_confirmed_at","auto_reconcile_note","created_at"]},"LinkTokenV1Dto":{"type":"object","properties":{"link_token":{"type":"string","description":"Plaid Link token. Single-use, expires in 4h (30min in update mode)."},"expiration":{"type":"string","description":"ISO 8601 expiration timestamp."},"request_id":{"type":"string","description":"Plaid request_id for support traceability."}},"required":["link_token","expiration","request_id"]},"CreateLinkTokenV1Dto":{"type":"object","properties":{"mode":{"type":"string","enum":["create","update"],"description":"create: issue a token to connect a new institution. update: re-issue for an existing item that needs the user to re-authenticate (ITEM_LOGIN_REQUIRED, PENDING_DISCONNECT)."},"plaid_item_id":{"type":"string","description":"Required when mode=update. The local plaid_items.id whose access_token should be reused for the Link update flow."}},"required":["mode"]},"PlaidItemV1Dto":{"type":"object","properties":{"id":{"type":"string"},"plaid_item_id":{"type":"string"},"institution_id":{"type":"string","nullable":true},"institution_name":{"type":"string","nullable":true},"status":{"type":"string"},"webhook_url":{"type":"string","nullable":true},"last_synced_at":{"type":"string","nullable":true},"error_code":{"type":"string","nullable":true},"error_message":{"type":"string","nullable":true},"created_at":{"type":"string"},"account_count":{"type":"number"}},"required":["id","plaid_item_id","institution_id","institution_name","status","webhook_url","last_synced_at","error_code","error_message","created_at","account_count"]},"PlaidAccountV1Dto":{"type":"object","properties":{"plaid_account_id":{"type":"string"},"name":{"type":"string"},"official_name":{"type":"string","nullable":true},"mask":{"type":"string","nullable":true},"type":{"type":"string"},"subtype":{"type":"string","nullable":true},"currency_code":{"type":"string","nullable":true},"verification_status":{"type":"string","nullable":true},"ignored":{"type":"boolean","description":"True when the user has already seen this account and chose not to import it. Only ever true on the discoverable-accounts response with include_ignored=true; the default response omits these accounts entirely."}},"required":["plaid_account_id","name","official_name","mask","type","subtype","currency_code","verification_status"]},"ExchangePublicTokenResponseV1Dto":{"type":"object","properties":{"item":{"$ref":"#/components/schemas/PlaidItemV1Dto"},"plaid_accounts":{"type":"array","items":{"$ref":"#/components/schemas/PlaidAccountV1Dto"}}},"required":["item","plaid_accounts"]},"ExchangePublicTokenV1Dto":{"type":"object","properties":{"public_token":{"type":"string","description":"Plaid public_token from Link onSuccess."},"institution_id":{"type":"string","description":"Plaid institution_id from Link metadata."},"institution_name":{"type":"string","description":"Plaid institution display name from Link metadata."}},"required":["public_token"]},"AssignPlaidAccountsResponseV1Dto":{"type":"object","properties":{"accounts":{"type":"array","items":{"$ref":"#/components/schemas/BankAccountV1Dto"}}},"required":["accounts"]},"PlaidAccountAssignmentInputDto":{"type":"object","properties":{"plaid_account_id":{"type":"string"},"skip":{"type":"boolean","description":"When true, skip — no bank_accounts row created."},"legal_entity_id":{"type":"string","description":"Required when skip=false."},"cash_parent_account_id":{"type":"string","description":"Parent (header) cash GL account under which a child sub-account will be auto-minted for this bank, mirroring QuickBooks-style \"Add new account\" flow. Mutually exclusive with cash_account_id; exactly one of the two MUST be set when skip=false."},"cash_account_id":{"type":"string","description":"Existing cash GL account override. Use when re-attaching a Plaid feed to a pre-existing account (e.g. customer migration with historical activity). Mutually exclusive with cash_parent_account_id."},"cash_account_name_override":{"type":"string","description":"Optional override for the auto-minted child account name. Only meaningful when cash_parent_account_id is set; ignored otherwise. Defaults to \"${plaid name} ••${mask}\"."}},"required":["plaid_account_id","skip"]},"AssignPlaidAccountsV1Dto":{"type":"object","properties":{"accounts":{"type":"array","items":{"$ref":"#/components/schemas/PlaidAccountAssignmentInputDto"}}},"required":["accounts"]},"PlaidItemDetailV1Dto":{"type":"object","properties":{"item":{"$ref":"#/components/schemas/PlaidItemV1Dto"},"accounts":{"type":"array","items":{"$ref":"#/components/schemas/BankAccountV1Dto"}}},"required":["item","accounts"]},"DiscoverableAccountsV1Dto":{"type":"object","properties":{"accounts":{"type":"array","items":{"$ref":"#/components/schemas/PlaidAccountV1Dto"}}},"required":["accounts"]},"PlaidSyncInlineResultV1Dto":{"type":"object","properties":{"added":{"type":"number"},"modified":{"type":"number"},"removed":{"type":"number"},"skipped":{"type":"boolean","description":"true when the sync was skipped (e.g. item already syncing)."}},"required":["added","modified","removed","skipped"]},"TriggerPlaidSyncResponseV1Dto":{"type":"object","properties":{"job_id":{"type":"string","description":"BullMQ job id (`sync-item:${plaid_item_id}`). Duplicate triggers collapse onto the same id."},"queued":{"type":"boolean","description":"true when the job was enqueued. false when the plaid-sync queue is not yet registered (queue disabled)."},"inline_result":{"description":"Result of the synchronous fallback run. Always present — the orchestrator runs inline so support tools / serverless deployments get a deterministic answer instead of trusting a worker that may not exist.","allOf":[{"$ref":"#/components/schemas/PlaidSyncInlineResultV1Dto"}]}},"required":["job_id","queued"]},"PlaidItemReconnectCheckResponseV1Dto":{"type":"object","properties":{"status":{"type":"string","description":"The item's status as Plaid reports it right now, after a live /item/get. 'active' means the connection is healthy and any reconnect banner should clear.","enum":["active","error","login_required","pending_disconnect","disconnected"]},"error_code":{"type":"string","description":"Plaid error code behind a non-active status, or null when the item is healthy.","nullable":true}},"required":["status","error_code"]},"PlaidWebhookErrorV1Dto":{"type":"object","properties":{"error_code":{"type":"string"},"error_message":{"type":"string"}}},"PlaidWebhookV1Dto":{"type":"object","properties":{"webhook_type":{"type":"string"},"webhook_code":{"type":"string"},"item_id":{"type":"string","description":"Plaid item_id (external)."},"environment":{"type":"string","description":"Plaid environment that generated the webhook (sandbox / production)."},"error":{"description":"Optional Plaid error envelope.","allOf":[{"$ref":"#/components/schemas/PlaidWebhookErrorV1Dto"}]}},"required":["webhook_type","webhook_code"]},"StatementImportListRowV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bank_account_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"purpose":{"type":"string","enum":["feed","reconciliation"]},"status":{"type":"string","enum":["parsing","parsed","failed","committed","discarded"]},"file_name":{"type":"string"},"content_type":{"type":"string"},"parse_model":{"type":"string","nullable":true},"parse_error":{"type":"string","nullable":true},"reconciliation_id":{"type":"string","nullable":true,"format":"uuid"},"extracted_statement_date":{"type":"string","nullable":true,"format":"date"},"extracted_ending_balance":{"type":"string","nullable":true},"needs_period_confirmation":{"type":"boolean","description":"True when the period end was only guessed from the CSV and a person must confirm it before a reconciliation can start on its own."},"period_end_confirmed_at":{"type":"string","nullable":true,"format":"date-time"},"auto_reconcile_note":{"type":"string","nullable":true,"enum":["not_reconcilable","not_depository","not_after_last_reconciliation","reconciliation_in_progress","no_ending_balance","awaiting_period_confirmation"],"description":"Why automatic reconciliation did not start for this import."},"created_at":{"type":"string","format":"date-time"},"bank_account_name":{"type":"string","nullable":true},"legal_entity_name":{"type":"string","nullable":true}},"required":["id","bank_account_id","legal_entity_id","purpose","status","file_name","content_type","parse_model","parse_error","reconciliation_id","extracted_statement_date","extracted_ending_balance","needs_period_confirmation","period_end_confirmed_at","auto_reconcile_note","created_at","bank_account_name","legal_entity_name"]},"StatementLineV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"line_index":{"type":"number"},"transaction_date":{"type":"string","format":"date"},"amount":{"type":"string"},"description":{"type":"string","nullable":true},"is_duplicate":{"type":"boolean"},"duplicate_of_transaction_id":{"type":"string","nullable":true,"format":"uuid"},"included":{"type":"boolean"},"generated_transaction_id":{"type":"string","nullable":true,"format":"uuid"}},"required":["id","line_index","transaction_date","amount","description","is_duplicate","duplicate_of_transaction_id","included","generated_transaction_id"]},"StatementImportDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bank_account_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"purpose":{"type":"string","enum":["feed","reconciliation"]},"status":{"type":"string","enum":["parsing","parsed","failed","committed","discarded"]},"file_name":{"type":"string"},"content_type":{"type":"string"},"parse_model":{"type":"string","nullable":true},"parse_error":{"type":"string","nullable":true},"reconciliation_id":{"type":"string","nullable":true,"format":"uuid"},"extracted_statement_date":{"type":"string","nullable":true,"format":"date"},"extracted_ending_balance":{"type":"string","nullable":true},"needs_period_confirmation":{"type":"boolean","description":"True when the period end was only guessed from the CSV and a person must confirm it before a reconciliation can start on its own."},"period_end_confirmed_at":{"type":"string","nullable":true,"format":"date-time"},"auto_reconcile_note":{"type":"string","nullable":true,"enum":["not_reconcilable","not_depository","not_after_last_reconciliation","reconciliation_in_progress","no_ending_balance","awaiting_period_confirmation"],"description":"Why automatic reconciliation did not start for this import."},"created_at":{"type":"string","format":"date-time"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/StatementLineV1Dto"}}},"required":["id","bank_account_id","legal_entity_id","purpose","status","file_name","content_type","parse_model","parse_error","reconciliation_id","extracted_statement_date","extracted_ending_balance","needs_period_confirmation","period_end_confirmed_at","auto_reconcile_note","created_at","lines"]},"PatchStatementLineV1Dto":{"type":"object","properties":{"line_id":{"type":"string","format":"uuid"},"included":{"type":"boolean"},"amount":{"type":"string","description":"Signed decimal string, e.g. \"-42.50\"."},"description":{"type":"string","nullable":true},"transaction_date":{"type":"string","format":"date"}},"required":["line_id"]},"CommitStatementImportResultV1Dto":{"type":"object","properties":{"committed":{"type":"number","description":"Number of bank transactions created."}},"required":["committed"]},"ConfirmStatementPeriodEndV1Dto":{"type":"object","properties":{"statement_ending_date":{"type":"string","example":"2026-03-31","format":"date"}},"required":["statement_ending_date"]},"AccountImportV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"connection_id":{"type":"string","format":"uuid"},"file_name":{"type":"string"},"file_sha256":{"type":"string","description":"sha256 of the parsed file bytes, hex-encoded."},"row_count":{"type":"number"},"rows_accepted":{"type":"number"},"rows_rejected":{"type":"number"},"status":{"type":"string","enum":["pending","validating","verifying","completed","failed","discarded"],"description":"`pending`/`validating` never reach the wire today (structural work happens synchronously in the upload request); `verifying` while the background job checks rows against the bank; `completed`/`failed` once it's done; `discarded` if the import was abandoned."},"error":{"type":"string","nullable":true,"description":"Our own wording, classified — never a provider response body."},"created_by":{"type":"string","nullable":true,"format":"uuid"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"completed_at":{"type":"string","nullable":true,"format":"date-time"}},"required":["id","connection_id","file_name","file_sha256","row_count","rows_accepted","rows_rejected","status","error","created_by","created_at","updated_at","completed_at"]},"AccountImportRejectedRowV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"row_number":{"type":"number","description":"1-based, matching the physical line in the uploaded file — \"row 174\" here is the row the operator's own spreadsheet also calls 174."},"addressing":{"type":"object","additionalProperties":true,"description":"The provider's declared addressing keys, as submitted (normalised per field kind — e.g. `bankId` upper-cased), with every account-number field MASKED to its last four digits (`••3456`). Enough to recognise the row in the operator's own spreadsheet, which is what a rejection list is for; re-reading the full number is not. Shape is provider-defined; see GET /v1/banking/connection-methods' `addressing` declaration."},"legal_entity_code":{"type":"string","nullable":true,"description":"As written in the file's `legal_entity` column (a code or an exact name) — never what it failed to resolve to."},"cash_account_code":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"rejection_reason":{"type":"string","description":"A complete sentence naming the problem, in our own wording."}},"required":["id","row_number","addressing","legal_entity_code","cash_account_code","name","rejection_reason"]},"AccountImportListMetaV1Dto":{"type":"object","properties":{"next_cursor":{"type":"string","description":"Opaque cursor for the next page, or null when this is the last page. Pass it back as `?cursor=`. Always present; do not parse it.","nullable":true,"example":"eyJpZCI6ICJhYmMifQ=="},"limit":{"type":"number","description":"Page size used for this response.","example":50},"request_id":{"type":"string","example":"018f0b3d-2b1e-7c8a-9d4b-1a2b3c4d5e6f"},"api_version":{"type":"string","example":"2026-04-23"},"import":{"$ref":"#/components/schemas/AccountImportV1Dto"}},"required":["next_cursor","limit","request_id","api_version","import"]},"AccountImportCommitResultV1Dto":{"type":"object","properties":{"import_id":{"type":"string","format":"uuid"},"accounts_created":{"type":"number","description":"bank_accounts rows created by THIS commit call — never a running total across every commit of this import."},"already_committed":{"type":"number","description":"Accepted rows this call did not need to write: a row already committed by an earlier call, and a row whose account already existed on this connection (linked rather than duplicated). Not an error — \"0 created, 287 already committed\" on a second commit is the correct, idempotent answer."},"rows_rejected":{"type":"number","description":"Accepted rows this call rejected instead of committing: the account they address already exists under a different legal entity, so linking them would have reported success while leaving the account where it was. Poll the import to see the per-row reason."}},"required":["import_id","accounts_created","already_committed","rows_rejected"]},"CommitAccountImportV1Dto":{"type":"object","properties":{"cash_parent_account_id":{"type":"string","format":"uuid","description":"Cash header to mint each accepted row’s child cash GL account under. Required unless every accepted row already resolved a `cash_account_code`. The minted child is scoped to its own row’s legal entity, never to the header’s — a header is routinely shared across entities."}}},"PropertyV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"code":{"type":"string","maxLength":64,"description":"Unique per org (spec D4)."},"name":{"type":"string"},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"The legal entity that owns this property. NULL means org-wide / unassigned. A SPACE has no legal entity of its own — it inherits this one through `spaces.property_id`."},"legal_entity_ownership_kind":{"type":"string","nullable":true,"enum":["owned","managed"],"description":"The owning legal entity's ownership_kind — 'managed' marks an externally-owned, fee-managed property. Null when legal_entity_id is null."},"managing_legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"Internal manager: one of the org's OWNED legal entities that operates this property. Null when self-managed or externally managed. Spec 2026-09-19 D1."},"managing_party_id":{"type":"string","nullable":true,"format":"uuid","description":"External manager: an outside management company (a party). Recorded for reporting; its fee arrives through AP. Mutually exclusive with managing_legal_entity_id."},"effective_managing_legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"managing_legal_entity_id, or — for a property under a MANAGED legal entity — that entity's managing_legal_entity_id. Activating a management contract on this property writes this value as the contract's issuer (spec 2026-09-19 D4); when it is null, activation is refused with management_manager_required."},"address":{"type":"string","nullable":true,"description":"First address line. Promoted out of the old `attributes` blob into a column by fix 7 — `attributes.address_line1` is no longer where this lives."},"address_line2":{"type":"string","nullable":true,"description":"Second address line. A COLUMN since migration `0257`; it was `attributes.address_line2` before, a key nothing in the product read."},"city":{"type":"string","nullable":true},"county":{"type":"string","nullable":true,"description":"The county the property sits in — GEOGRAPHY, part of the same address as `city`/`state`/`zip`. A COLUMN since migration `0257`. This is NOT `parcels.jurisdiction`, which names WHO ASSESSES a parcel across a city/township/county/school/special_assessment vocabulary; a property can span several parcels, so the two are not the same field and must not be consolidated."},"country":{"type":"string","nullable":true,"description":"Country. Two-letter ISO by convention, not enforced. A COLUMN since migration `0257`."},"state":{"type":"string","nullable":true},"zip":{"type":"string","nullable":true},"date_sold":{"type":"string","nullable":true,"format":"date"},"purchase_price":{"type":"string","nullable":true,"description":"Historical purchase price. numeric(14,2), serialized as a string to preserve precision.","example":"1250000.00"},"purchase_date":{"type":"string","nullable":true,"format":"date"},"rentable_sqft":{"type":"string","nullable":true,"description":"Rentable square feet for the property AS A WHOLE — the area a lease that names no space covers. numeric(14,2), serialized as a string to preserve precision. A COLUMN since migration `0232`; it was `attributes.rentable_sqft` before, which is why only one repository in the product could read it. NULL means not measured, which is a real state the sqft attention detector reports on — it is not zero.","example":"12500.00"},"is_leasable":{"type":"boolean","description":"True when the PROPERTY is the rentable location — it has no leasable space beneath it. Fix 7's D5 invariant is at most one leasable node per root-to-leaf path, so a property and a space under it are never both leasable. Defaults true because a property with no spaces is rentable whole; it is set false by an explicit write, never inferred from spacelessness at read time.","example":true},"property_type":{"type":"string","nullable":true,"enum":["office","retail","industrial","multifamily","land","mixed_use","other"],"description":"Asset class. A COLUMN since migration `0244`; before that it was the unread `attributes.type` key, which the deal funnel writes on every promoted deal and requires for a deal to be complete. NULL means unclassified -- distinct from `other`, which is a positive classification a human chose."},"status":{"type":"string","enum":["active","inactive","archived"],"description":"LIFECYCLE, not occupancy. `properties.status` and `spaces.status` are both lifecycle; occupancy is DERIVED from live leases, is never stored, and is reported by the contract counts below (queryable on spaces with `?occupancy=`). Migration `0198` promoted an occupancy key into the space column by copying this property branch of the mirror trigger, and `0199` corrected it — the two concepts share the name `status` and must not be conflated, which is why P9 deleted the stored representation of occupancy entirely."},"attributes":{"type":"object","additionalProperties":true,"description":"Caller-defined attributes (jsonb). Shape is caller-defined. Writes are validated against the built-in property schema (address/address_line2/city/county/state/postal_code/country/date_sold) with `additionalProperties: true`, so undeclared keys are accepted but are not filterable via `attribute_filters`. Every declared key is now a COLUMN, so `attribute_filters` on one is routed to that column rather than to this blob."},"created_at":{"type":"string","nullable":true,"format":"date-time"},"updated_at":{"type":"string","nullable":true,"format":"date-time"},"active_contract_count":{"type":"number","description":"Contracts currently in `active` status naming this property. Counted from `contract_properties`, whose `property_id` is NOT NULL even for a space-level lease (spec D8) — so a lease on any space in this property counts here.","example":1},"active_contract_ids":{"description":"IDs of the contracts counted by `active_contract_count`.","type":"array","items":{"type":"string","format":"uuid"}},"space_count":{"type":"number","description":"Spaces belonging to this property at ANY nesting depth — `spaces.property_id` names the root property at every level, so this is not just direct children.","example":4},"subtree_leaf_count":{"type":"number","description":"Leasable leaves in this property's space tree. A leaf is a space with no child space; a property with NO spaces counts as one leaf (itself), so this is always ≥ 1. Denominator for rolled-up occupancy.","example":4},"subtree_occupied_leaf_count":{"type":"number","description":"Subset of `subtree_leaf_count` that a live lease names DIRECTLY. A lease held on a parent space, or on the whole property, does not mark its child leaves occupied — spec D8 puts that occupancy at the level the lease names. Verified against the pre-fix-7 numbers with zero drift.","example":3},"has_spaces":{"type":"boolean","description":"True iff any space names this property. Lets a client decide whether a row is expandable without a second roundtrip.","example":true}},"required":["id","org_id","code","name","legal_entity_id","legal_entity_ownership_kind","managing_legal_entity_id","managing_party_id","effective_managing_legal_entity_id","address","address_line2","city","county","country","state","zip","date_sold","purchase_price","purchase_date","rentable_sqft","is_leasable","property_type","status","attributes","created_at","updated_at","active_contract_count","active_contract_ids","space_count","subtree_leaf_count","subtree_occupied_leaf_count","has_spaces"]},"CreatePropertyV1Dto":{"type":"object","properties":{"code":{"type":"string","maxLength":64,"description":"Unique per org (spec D4)."},"name":{"type":"string","maxLength":200},"legal_entity_id":{"type":"string","format":"uuid"},"managing_legal_entity_id":{"type":"string","format":"uuid","description":"Internal manager (an OWNED legal entity) — who operates this property, as distinct from `legal_entity_id`, who owns it. Mutually exclusive with managing_party_id. On POST /v1/properties/managed this same field additionally selects mode A: the new MANAGED legal entity is created under this manager, and it becomes the property's manager (spec 2026-09-19 D2)."},"managing_party_id":{"type":"string","format":"uuid","description":"External manager (a party in this org). Mutually exclusive with managing_legal_entity_id."},"status":{"type":"string","enum":["active","inactive","archived"],"description":"Lifecycle status. Defaults to `active`."},"property_type":{"type":"string","enum":["office","retail","industrial","multifamily","land","mixed_use","other"],"description":"Asset class. May also be sent as `type` inside `attributes` -- the write path promotes and strips it either way. Defaults to null (unclassified)."},"purchase_price":{"type":"string","description":"Numeric string with up to 2 decimal places (e.g. \"1250000.00\")."},"purchase_date":{"type":"string","format":"date"},"address":{"type":"string","maxLength":200,"description":"Street address."},"address_line2":{"type":"string","maxLength":200,"description":"Second address line."},"city":{"type":"string","maxLength":100},"county":{"type":"string","maxLength":100,"description":"County — geography, not tax. See `PropertyV1Dto.county`; this is not `parcels.jurisdiction`."},"country":{"type":"string","maxLength":3,"description":"Country, ISO-ish."},"state":{"type":"string","maxLength":100},"zip":{"type":"string","maxLength":20,"description":"Postal code."},"date_sold":{"type":"string","format":"date"},"attributes":{"type":"object","additionalProperties":true,"description":"Caller-defined attributes (jsonb) for anything the columns above do not name. Shape is caller-defined. The promoted fields (`address`, `address_line2`, `city`, `county`, `country`, `state`, `zip`, `date_sold`, `rentable_sqft`, `property_type`) are NOT read from here — pass them as fields; keys of those names in this blob are ignored and stripped. `address_line1`/`postal_code`/`sqft`/`type` are accepted alias spellings and are stripped too."},"rentable_sqft":{"type":"string","description":"Rentable square feet for the whole property. numeric(14,2) as a string. May also be sent inside `attributes` — the write path promotes and strips it either way.","example":"12500.00"},"is_leasable":{"type":"boolean","description":"Whether the property itself is the rentable location. Defaults to true — a property is created with no spaces, so at that moment it is rentable whole."}},"required":["code","name"]},"CreateManagedPropertyV1Dto":{"type":"object","properties":{"code":{"type":"string","maxLength":64,"description":"Unique per org (spec D4)."},"name":{"type":"string","maxLength":200},"legal_entity_id":{"type":"string","format":"uuid"},"managing_legal_entity_id":{"type":"string","format":"uuid","description":"Internal manager (an OWNED legal entity) — who operates this property, as distinct from `legal_entity_id`, who owns it. Mutually exclusive with managing_party_id. On POST /v1/properties/managed this same field additionally selects mode A: the new MANAGED legal entity is created under this manager, and it becomes the property's manager (spec 2026-09-19 D2)."},"managing_party_id":{"type":"string","format":"uuid","description":"External manager (a party in this org). Mutually exclusive with managing_legal_entity_id."},"status":{"type":"string","enum":["active","inactive","archived"],"description":"Lifecycle status. Defaults to `active`."},"property_type":{"type":"string","enum":["office","retail","industrial","multifamily","land","mixed_use","other"],"description":"Asset class. May also be sent as `type` inside `attributes` -- the write path promotes and strips it either way. Defaults to null (unclassified)."},"purchase_price":{"type":"string","description":"Numeric string with up to 2 decimal places (e.g. \"1250000.00\")."},"purchase_date":{"type":"string","format":"date"},"address":{"type":"string","maxLength":200,"description":"Street address."},"address_line2":{"type":"string","maxLength":200,"description":"Second address line."},"city":{"type":"string","maxLength":100},"county":{"type":"string","maxLength":100,"description":"County — geography, not tax. See `PropertyV1Dto.county`; this is not `parcels.jurisdiction`."},"country":{"type":"string","maxLength":3,"description":"Country, ISO-ish."},"state":{"type":"string","maxLength":100},"zip":{"type":"string","maxLength":20,"description":"Postal code."},"date_sold":{"type":"string","format":"date"},"attributes":{"type":"object","additionalProperties":true,"description":"Caller-defined attributes (jsonb) for anything the columns above do not name. Shape is caller-defined. The promoted fields (`address`, `address_line2`, `city`, `county`, `country`, `state`, `zip`, `date_sold`, `rentable_sqft`, `property_type`) are NOT read from here — pass them as fields; keys of those names in this blob are ignored and stripped. `address_line1`/`postal_code`/`sqft`/`type` are accepted alias spellings and are stripped too."},"rentable_sqft":{"type":"string","description":"Rentable square feet for the whole property. numeric(14,2) as a string. May also be sent inside `attributes` — the write path promotes and strips it either way.","example":"12500.00"},"is_leasable":{"type":"boolean","description":"Whether the property itself is the rentable location. Defaults to true — a property is created with no spaces, so at that moment it is rentable whole."},"legal_entity_name":{"type":"string","maxLength":200,"description":"Mode A only: name for the new managed legal entity. Defaults to the property name."}},"required":["code","name"]},"UpdatePropertyV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":200},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"managing_legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"Internal manager (an OWNED legal entity). Send null to clear."},"managing_party_id":{"type":"string","nullable":true,"format":"uuid","description":"External manager (a party in this org). Send null to clear."},"status":{"type":"string","enum":["active","inactive","archived"]},"property_type":{"type":"string","nullable":true,"enum":["office","retail","industrial","multifamily","land","mixed_use","other"],"description":"Asset class, or null to clear."},"purchase_price":{"type":"string","nullable":true,"description":"Numeric string with up to 2 decimal places, or null to clear."},"purchase_date":{"type":"string","nullable":true,"format":"date"},"address":{"type":"string","nullable":true,"maxLength":200},"address_line2":{"type":"string","nullable":true,"maxLength":200},"city":{"type":"string","nullable":true,"maxLength":100},"county":{"type":"string","nullable":true,"maxLength":100},"country":{"type":"string","nullable":true,"maxLength":3},"state":{"type":"string","nullable":true,"maxLength":100},"zip":{"type":"string","nullable":true,"maxLength":20},"date_sold":{"type":"string","nullable":true,"format":"date"},"attributes":{"type":"object","additionalProperties":true,"description":"Caller-defined attributes (jsonb) for anything the columns above do not name. Replaces the whole blob. The promoted fields are NOT read from here — pass them as fields."},"rentable_sqft":{"type":"string","nullable":true,"description":"Rentable square feet for the whole property, or null to clear. numeric(14,2) as a string."},"is_leasable":{"type":"boolean","description":"Whether the property itself is the rentable location. Fix 7's D5 invariant allows at most one leasable node per root-to-leaf path, so this and a leasable space beneath it must never both be true. **That invariant is not yet enforced at this write path** — the refusal arrives with spec P4. Until then, setting this true on a property that has a leasable space creates a violation the `leasing.leasable_path_conflict` detector will report."}}},"SpaceV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid","description":"The ROOT property, at every nesting depth — for a nested space this is still the property, not the parent space. Never null."},"parent_space_id":{"type":"string","nullable":true,"format":"uuid","description":"The containing space, or null for a top-level space. Null/non-null is what the old model expressed as the `space` vs `unit` trackable types."},"designation":{"type":"string","description":"What a person calls it — \"2D\", \"Suite 200\". Unique per parent (spec D4). Derived from the old trackable `code`, not `name`: measured, `name` collided within a parent 10 times in real data and `code` never did."},"name":{"type":"string","nullable":true},"external_code":{"type":"string","nullable":true,"description":"A code an OUTSIDE system uses for this space. Set it on create or update; it is null when nobody claims it, and any number of spaces may leave it null. Unique per ORG, so an importer can use it as the lookup key that is its whole purpose — a duplicate is 409 SPACE_EXTERNAL_CODE_TAKEN. It is NOT derived from any other field: the create path used to copy `designation` into it, which made designations org-unique by accident until `0278`. Read `designation` for what a PERSON calls the space."},"space_type":{"type":"string","nullable":true,"enum":["office","retail","industrial","multifamily","land","mixed_use","other"],"description":"The ASSET CLASS — office, retail, industrial and so on. Same vocabulary and same CHECK as `properties.property_type`, so a report can group properties and spaces on one axis. NULL means unclassified, which 659 of 799 spaces are: they never recorded an asset class, and the column only looked populated before the split because it was holding an ownership kind instead."},"ownership_kind":{"type":"string","nullable":true,"enum":["owned","common_area","rea"],"description":"Who owns this space and whether it is rentable area at all: `owned` is yours to let, `common_area` is shared, `rea` is a Reciprocal Easement Agreement parcel — typically an anchor that owns its own box while sharing access and parking. Split out of `space_type`, which used to carry both this and the asset class. NULL means not recorded. This is the DEFAULT source for `is_leasable`, not a rule: a `common_area` may be declared leasable."},"rentable_sqft":{"type":"string","nullable":true,"description":"Rentable square feet. numeric(14,2), serialized as a string to preserve precision. A COLUMN, not an attribute key. This is the authoritative square-footage source of the three the audit found.","example":"2500.00"},"is_leasable":{"type":"boolean","description":"Declared, never inferred from childlessness — inferring it is why subdividing a suite used to change what occupancy meant."},"status":{"type":"string","enum":["active","inactive","archived"],"description":"LIFECYCLE, not occupancy. Occupancy is DERIVED from live leases, is not settable, and is queryable with `?occupancy=vacant|occupied`; the contract counts below report it too. Migration `0198` promoted an occupancy key into this column by copying the property branch of the mirror trigger, and `0199` corrected it — the two concepts share the name `status` and must not be conflated, which is why occupancy has no stored representation at all."},"attributes":{"type":"object","additionalProperties":true,"description":"Caller-defined attributes (jsonb). Shape is caller-defined and this blob carries NO occupancy: `space_type` and `rentable_sqft` are columns, and the three occupancy spellings that used to live here (`space_status`, `unit_status`, `status`) were deleted by P9 because occupancy is derived from live leases and never stored. Query it with `?occupancy=` instead."},"created_at":{"type":"string","nullable":true,"format":"date-time"},"updated_at":{"type":"string","nullable":true,"format":"date-time"},"property_code":{"type":"string","description":"The parent property's code. Denormalised so a list render does not need one lookup per row."},"property_name":{"type":"string","description":"The parent property's name."},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"The owning legal entity, taken from the PROPERTY — a space does not carry one of its own (House Style). Reading it off the space is what made the LE-scoped occupancy KPI return zero for every property-owning entity before `be#538`."},"active_contract_count":{"type":"number","description":"Contracts in `active` status reaching this space: named on it directly, or named on one of its nested spaces. The roll-up is a faithful port — `contract_trackables` auto-added an ancestor row so a nested lease already counted toward its parent, and `contract_properties` has no ancestor rows. Verified against the old numbers with zero drift (164 = 164 across 791 spaces).","example":1},"active_contract_ids":{"description":"IDs of the contracts counted by `active_contract_count`.","type":"array","items":{"type":"string","format":"uuid"}},"has_children":{"type":"boolean","description":"True iff another space names this one as its parent.","example":false},"subtree_leaf_count":{"type":"number","description":"Leasable leaves at or below this space. A space with no child counts as one leaf — itself — so this is always ≥ 1, preserving the pre-fix-7 semantics. Denominator for a per-space occupancy bar.","example":4},"subtree_occupied_leaf_count":{"type":"number","description":"Subset of `subtree_leaf_count` that a live lease names DIRECTLY. A lease on this space does not mark its child leaves occupied — spec D8 puts occupancy at the level the lease names. Verified against the pre-fix-7 numbers with zero drift (816 = 816 leaves, 159 = 159 occupied across 791 spaces).","example":3}},"required":["id","org_id","property_id","parent_space_id","designation","name","external_code","space_type","ownership_kind","rentable_sqft","is_leasable","status","attributes","created_at","updated_at","property_code","property_name","legal_entity_id","active_contract_count","active_contract_ids","has_children","subtree_leaf_count","subtree_occupied_leaf_count"]},"CreateSpaceV1Dto":{"type":"object","properties":{"property_id":{"type":"string","format":"uuid","description":"The property this space belongs to. Required."},"parent_space_id":{"type":"string","format":"uuid","description":"The containing space, for a nested space. Must belong to `property_id`. Omit for a top-level space."},"designation":{"type":"string","maxLength":64,"description":"Unique per parent (spec D4)."},"external_code":{"type":"string","maxLength":64,"description":"A code an OUTSIDE system uses for this space, for an importer to find the row again on a later sync. Unique per ORG, so it can serve as that lookup key; omit it and it stays null, and any number of spaces may leave it null. It is never derived from another field — `designation` is what a PERSON calls the space, and the two are different facts."},"name":{"type":"string","maxLength":200},"space_type":{"type":"string","enum":["office","retail","industrial","multifamily","land","mixed_use","other"]},"ownership_kind":{"type":"string","enum":["owned","common_area","rea"]},"rentable_sqft":{"type":"string","description":"Numeric string with up to 2 decimal places."},"is_leasable":{"type":"boolean","description":"Declared, not inferred. Omitted on CREATE, it defaults from `ownership_kind`: `common_area` and `rea` are not rentable space, anything else is. That default is not a rule — a `common_area` may be declared leasable and an `owned` space declared unleasable. Whichever value results is what spec D5 is checked against, so a declared `true` under a leasable property or parent space is refused with LEASABLE_PATH_CONFLICT."},"status":{"type":"string","enum":["active","inactive","archived"]},"attributes":{"type":"object","additionalProperties":true,"description":"Caller-defined attributes (jsonb). Shape is caller-defined."}},"required":["property_id","designation"]},"UpdateSpaceV1Dto":{"type":"object","properties":{"designation":{"type":"string","maxLength":64},"external_code":{"type":"string","maxLength":64,"nullable":true,"description":"A code an OUTSIDE system uses for this space, for an importer to find the row again on a later sync. Unique per ORG, so it can serve as that lookup key; omit it and it stays null, and any number of spaces may leave it null. It is never derived from another field — `designation` is what a PERSON calls the space, and the two are different facts. Send null to release the code so another space can claim it."},"name":{"type":"string","maxLength":200,"nullable":true},"parent_space_id":{"type":"string","nullable":true,"format":"uuid","description":"Re-parent within the same property. Spec D5 refuses subdividing a space that carries a live lease."},"space_type":{"type":"string","nullable":true,"enum":["office","retail","industrial","multifamily","land","mixed_use","other"]},"ownership_kind":{"type":"string","nullable":true,"enum":["owned","common_area","rea"]},"rentable_sqft":{"type":"string","nullable":true},"is_leasable":{"type":"boolean","description":"Declared, not inferred. **Omit it and the stored value stands, always.** No other field changes it: reclassifying a space's `space_type` or its `ownership_kind` leaves its leasability exactly as declared. Refused with LEASABLE_PATH_CONFLICT when turning this space leasable while a leasable ancestor or descendant already exists (spec D5); a leasable SIBLING is on a different path and is allowed."},"status":{"type":"string","enum":["active","inactive","archived"]},"attributes":{"type":"object","additionalProperties":true,"description":"Caller-defined attributes (jsonb). Replaces the whole blob."}}},"DealStageV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string"},"label":{"type":"string"},"sort_order":{"type":"integer"},"terminal_outcome":{"type":"string","enum":["closed","dead"],"nullable":true,"description":"Set on terminal stages (closed / dead); null otherwise."},"color":{"type":"string","enum":["secondary","info","warning","success","destructive","muted"],"description":"Badge colour token the stage is drawn with."}},"required":["id","code","label","sort_order","terminal_outcome","color"]},"DealLostReasonRefV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string"},"label":{"type":"string"}},"required":["id","code","label"]},"DealPartyV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"deal_id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"},"deal_role":{"type":"string","description":"A code from the org's deal role catalog; each role carries a side (buyer, seller or neutral). Every org is seeded with: seller, seller_attorney, seller_broker, current_lender, broker, current_owner, buyer_attorney, buyer_broker, lender, equity_partner, title_escrow, surveyor, environmental, inspector, insurer, appraiser, other."},"side":{"type":"string","enum":["buyer","seller","neutral"]},"created_by":{"type":"string","nullable":true,"format":"uuid"},"created_at":{"type":"string","nullable":true,"format":"date-time"}},"required":["id","deal_id","party_id","deal_role","side"]},"DealTenantV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"deal_id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","nullable":true,"format":"date-time"}},"required":["id","deal_id","party_id"]},"CriticalDateRuleV1Dto":{"type":"object","properties":{"anchor_critical_date_id":{"type":"string","format":"uuid","description":"Another critical date on the same deal that this one follows."},"offset_days":{"type":"number","minimum":-3650,"maximum":3650,"description":"Signed offset from the anchor date, in `offset_unit`."},"offset_unit":{"type":"string","enum":["calendar_days","business_days"]},"roll":{"type":"string","enum":["forward","backward"],"default":"forward","description":"Direction to move a result that lands on a weekend or holiday. Defaults to forward."}},"required":["anchor_critical_date_id","offset_days","offset_unit"]},"DealCriticalDateV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"deal_id":{"type":"string","format":"uuid"},"kind":{"type":"string","description":"Standard milestone key, or 'custom'."},"label":{"type":"string"},"event_date":{"type":"string","nullable":true,"format":"date","description":"Business date YYYY-MM-DD, or null when not yet set."},"status":{"type":"string","enum":["pending","done","na"]},"is_standard":{"type":"boolean","description":"True for seeded standard milestones."},"sort_order":{"type":"number","description":"Display order."},"rule":{"nullable":true,"description":"The rule that computes this date from an anchor, or null for a by-hand date.","type":"object","allOf":[{"$ref":"#/components/schemas/CriticalDateRuleV1Dto"}]},"is_locked":{"type":"boolean","description":"A locked date is never recomputed by a cascade and may be typed even when it has a rule."},"created_at":{"type":"string","nullable":true,"format":"date-time"},"updated_at":{"type":"string","nullable":true,"format":"date-time"}},"required":["id","deal_id","kind","label","status","is_standard","sort_order","rule","is_locked"]},"DealRequirementV1Dto":{"type":"object","properties":{"key":{"type":"string","enum":["property_details","admin_entity","owners","seller","has_document","purchase","tenants"]},"ok":{"type":"boolean","description":"True when this requirement is currently satisfied."},"gating":{"type":"boolean","description":"True when this requirement blocks promote (property_details, admin_entity, owners, seller, has_document). purchase/tenants are informational only."},"message":{"type":"string"}},"required":["key","ok","gating","message"]},"DealCompletenessV1Dto":{"type":"object","properties":{"requirements":{"type":"array","items":{"$ref":"#/components/schemas/DealRequirementV1Dto"}},"complete":{"type":"number","description":"Number of GATING requirements currently satisfied."},"total":{"type":"number","description":"Total number of GATING requirements: 5 on an acquisition, 0 on any other kind."},"can_promote":{"type":"boolean","description":"True iff every gating requirement is satisfied (complete === total). Always false for a deal that is not an acquisition."}},"description":"The onboarding checklist that gates promote. Evaluated for acquisitions only: on a disposition or internal transfer it is empty (no requirements, complete 0, total 0, can_promote false), since promote applies to acquisitions alone.","required":["requirements","complete","total","can_promote"]},"DealV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["in_progress","promoted","dropped"]},"code":{"type":"string","nullable":true},"name":{"type":"string"},"kind":{"type":"string","enum":["acquisition","disposition","internal_transfer"]},"stage":{"$ref":"#/components/schemas/DealStageV1Dto"},"contracting_legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"The org's legal entity that signs the contract. Its `entity_ownerships` cap table (GET /v1/entity-ownerships?parent_entity_id=...) IS the deal's owners — see the `owners` completeness requirement. Accepted on acquisition, internal_transfer deals; any other kind answers 422 DEAL_SIDE_NOT_ALLOWED_FOR_KIND."},"contract_price":{"type":"string","nullable":true,"description":"Numeric string with up to 2 decimal places (e.g. \"1250000.00\")."},"indicative_price":{"type":"string","nullable":true,"description":"The price discussed before a contract exists (numeric string, 2 decimals); null when not set.","example":"1234.50"},"stage_entered_at":{"type":"string","format":"date-time","description":"When the deal entered its current stage (\"days in stage\")."},"buyer_legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"The org's own legal entity on the buying side. Accepted on acquisition, internal_transfer deals; any other kind answers 422 DEAL_SIDE_NOT_ALLOWED_FOR_KIND."},"seller_legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"The org's own legal entity on the selling side. Accepted on disposition, internal_transfer deals; any other kind answers 422 DEAL_SIDE_NOT_ALLOWED_FOR_KIND."},"buyer_party_id":{"type":"string","nullable":true,"format":"uuid","description":"The external buyer (a party in the org). Accepted on disposition deals; any other kind answers 422 DEAL_SIDE_NOT_ALLOWED_FOR_KIND."},"client_party_id":{"type":"string","nullable":true,"format":"uuid","description":"The client the deal is run for (a party in the org). Accepted on acquisition, disposition, internal_transfer deals; any other kind answers 422 DEAL_SIDE_NOT_ALLOWED_FOR_KIND."},"admin_legal_entity_id":{"type":"string","nullable":true,"format":"uuid","deprecated":true,"description":"Deprecated alias of contracting_legal_entity_id (removed one release after Deal Center phase 0)."},"purchase_price":{"type":"string","nullable":true,"deprecated":true,"description":"Deprecated alias of contract_price (removed one release after Deal Center phase 0)."},"purchase_date":{"type":"string","nullable":true,"format":"date"},"currency":{"type":"string","nullable":true},"attributes":{"type":"object","additionalProperties":true,"description":"Free-form jsonb bag. Canonical keys: address_line1, address_line2, city, state, postal_code, country, county, category, store_type, type, sqft."},"property_id":{"type":"string","nullable":true,"format":"uuid","description":"The promoted property, set once the deal is promoted. Renamed from `trackable_id` in fix 7 unit 7 — a promoted deal always becomes a whole property, never a space (property/space spec D8)."},"promoted_at":{"type":"string","nullable":true,"format":"date-time"},"property_removed_at":{"type":"string","nullable":true,"format":"date-time","description":"Set when the promoted property was later deleted; `property_id` is nulled at the same time."},"drop_reason":{"type":"string","nullable":true},"lost_reason":{"nullable":true,"description":"The lost reason chosen when the deal was dropped; null when none was chosen or the deal is not dropped.","type":"object","allOf":[{"$ref":"#/components/schemas/DealLostReasonRefV1Dto"}]},"dropped_at":{"type":"string","nullable":true,"format":"date-time"},"created_by":{"type":"string","nullable":true,"format":"uuid"},"created_at":{"type":"string","nullable":true,"format":"date-time"},"updated_at":{"type":"string","nullable":true,"format":"date-time"},"parties":{"type":"array","items":{"$ref":"#/components/schemas/DealPartyV1Dto"}},"tenants":{"type":"array","items":{"$ref":"#/components/schemas/DealTenantV1Dto"}},"critical_dates":{"type":"array","items":{"$ref":"#/components/schemas/DealCriticalDateV1Dto"}},"completeness":{"$ref":"#/components/schemas/DealCompletenessV1Dto"}},"required":["id","org_id","status","name","kind","stage","indicative_price","stage_entered_at","attributes","lost_reason","parties","tenants","critical_dates","completeness"]},"DealBoardStageV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string"},"label":{"type":"string"},"sort_order":{"type":"integer"},"color":{"type":"string","enum":["secondary","info","warning","success","destructive","muted"],"description":"Badge colour token the stage is drawn with."}},"required":["id","code","label","sort_order","color"]},"DealBoardNextCriticalDateV1Dto":{"type":"object","properties":{"kind":{"type":"string"},"label":{"type":"string"},"event_date":{"type":"string","format":"date"}},"required":["kind","label","event_date"]},"DealBoardCardV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"code":{"type":"string","nullable":true},"contract_price":{"type":"string","nullable":true,"example":"1234.50"},"indicative_price":{"type":"string","nullable":true,"example":"1234.50"},"stage_entered_at":{"type":"string","format":"date-time"},"next_critical_date":{"nullable":true,"description":"The earliest pending critical date on or after the org's today, custom dates included; null when none.","type":"object","allOf":[{"$ref":"#/components/schemas/DealBoardNextCriticalDateV1Dto"}]}},"required":["id","name","code","contract_price","indicative_price","stage_entered_at","next_critical_date"]},"DealBoardColumnV1Dto":{"type":"object","properties":{"stage":{"$ref":"#/components/schemas/DealBoardStageV1Dto"},"count":{"type":"integer","description":"The stage's true deal count (cards are capped at 100)."},"cards":{"type":"array","items":{"$ref":"#/components/schemas/DealBoardCardV1Dto"}}},"required":["stage","count","cards"]},"DealBoardV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["acquisition","disposition","internal_transfer"]},"columns":{"type":"array","items":{"$ref":"#/components/schemas/DealBoardColumnV1Dto"}}},"required":["kind","columns"]},"CreateDealV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":200},"code":{"type":"string","maxLength":64,"description":"Case code (e.g. legacy \"494\")."},"kind":{"type":"string","enum":["acquisition","disposition","internal_transfer"],"description":"Defaults to `acquisition`. Immutable once created."},"contracting_legal_entity_id":{"type":"string","format":"uuid","description":"The org's legal entity that signs the contract. Its `entity_ownerships` cap table (GET /v1/entity-ownerships?parent_entity_id=...) IS the deal's owners — see the `owners` completeness requirement. Accepted on acquisition, internal_transfer deals; any other kind answers 422 DEAL_SIDE_NOT_ALLOWED_FOR_KIND."},"contract_price":{"type":"string","description":"Numeric string with up to 2 decimal places (e.g. \"1250000.00\")."},"indicative_price":{"type":"string","description":"The price discussed before a contract exists. Numeric string with up to 2 decimal places.","example":"1234.50"},"buyer_legal_entity_id":{"type":"string","format":"uuid","description":"The org's own legal entity on the buying side. Accepted on acquisition, internal_transfer deals; any other kind answers 422 DEAL_SIDE_NOT_ALLOWED_FOR_KIND."},"seller_legal_entity_id":{"type":"string","format":"uuid","description":"The org's own legal entity on the selling side. Accepted on disposition, internal_transfer deals; any other kind answers 422 DEAL_SIDE_NOT_ALLOWED_FOR_KIND."},"buyer_party_id":{"type":"string","format":"uuid","description":"The external buyer (a party in the org). Accepted on disposition deals; any other kind answers 422 DEAL_SIDE_NOT_ALLOWED_FOR_KIND."},"client_party_id":{"type":"string","format":"uuid","description":"The client the deal is run for (a party in the org). Accepted on acquisition, disposition, internal_transfer deals; any other kind answers 422 DEAL_SIDE_NOT_ALLOWED_FOR_KIND."},"admin_legal_entity_id":{"type":"string","format":"uuid","deprecated":true,"description":"Deprecated alias of contracting_legal_entity_id (removed one release after Deal Center phase 0)."},"purchase_price":{"type":"string","deprecated":true,"description":"Deprecated alias of contract_price (removed one release after Deal Center phase 0)."},"purchase_date":{"type":"string","format":"date"},"currency":{"type":"string","maxLength":8},"attributes":{"type":"object","additionalProperties":true,"description":"Free-form jsonb bag. Canonical keys: address_line1, address_line2, city, state, postal_code, country, county, category, store_type, type, sqft."}},"required":["name"]},"UpdateDealV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":200},"code":{"type":"string","nullable":true,"maxLength":64},"contracting_legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"The org's legal entity that signs the contract. Its `entity_ownerships` cap table (GET /v1/entity-ownerships?parent_entity_id=...) IS the deal's owners — see the `owners` completeness requirement. Accepted on acquisition, internal_transfer deals; any other kind answers 422 DEAL_SIDE_NOT_ALLOWED_FOR_KIND."},"contract_price":{"type":"string","nullable":true,"description":"Numeric string with up to 2 decimal places, or null to clear."},"indicative_price":{"type":"string","nullable":true,"description":"The price discussed before a contract exists. Numeric string with up to 2 decimal places, or null to clear.","example":"1234.50"},"buyer_legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"The org's own legal entity on the buying side. Accepted on acquisition, internal_transfer deals; any other kind answers 422 DEAL_SIDE_NOT_ALLOWED_FOR_KIND."},"seller_legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"The org's own legal entity on the selling side. Accepted on disposition, internal_transfer deals; any other kind answers 422 DEAL_SIDE_NOT_ALLOWED_FOR_KIND."},"buyer_party_id":{"type":"string","nullable":true,"format":"uuid","description":"The external buyer (a party in the org). Accepted on disposition deals; any other kind answers 422 DEAL_SIDE_NOT_ALLOWED_FOR_KIND."},"client_party_id":{"type":"string","nullable":true,"format":"uuid","description":"The client the deal is run for (a party in the org). Accepted on acquisition, disposition, internal_transfer deals; any other kind answers 422 DEAL_SIDE_NOT_ALLOWED_FOR_KIND."},"admin_legal_entity_id":{"type":"string","nullable":true,"format":"uuid","deprecated":true,"description":"Deprecated alias of contracting_legal_entity_id (removed one release after Deal Center phase 0)."},"purchase_price":{"type":"string","nullable":true,"deprecated":true,"description":"Deprecated alias of contract_price (removed one release after Deal Center phase 0)."},"purchase_date":{"type":"string","nullable":true,"format":"date"},"currency":{"type":"string","nullable":true,"maxLength":8},"attributes":{"type":"object","additionalProperties":true,"description":"Whole-object REPLACE, not a merge: when present, the deal's attributes are set to exactly this object (omit the field to leave them unchanged). Send the full attribute set on every update."}}},"DropDealV1Dto":{"type":"object","properties":{"reason":{"type":"string","maxLength":500,"description":"Optional free-text reason recorded on the deal."},"lost_reason_id":{"type":"string","format":"uuid","description":"An active lost reason of the org (GET /v1/deal-lost-reasons); otherwise 422 DEAL_LOST_REASON_UNKNOWN and nothing is written."}}},"MoveDealStageV1Dto":{"type":"object","properties":{"stage_id":{"type":"string","format":"uuid","description":"The non-terminal stage to move to: an active stage of the deal kind, other than the current one."},"note":{"type":"string","maxLength":500,"description":"Optional note written on the stage history row."},"expected_stage_id":{"type":"string","format":"uuid","description":"The stage the caller saw the deal on. When it is no longer the deal stage the move answers 409 DEAL_STAGE_CONFLICT."}},"required":["stage_id"]},"DealStageRequirementV1Dto":{"type":"object","properties":{"key":{"type":"string","description":"Requirement key, e.g. principal_entity, indicative_price, psa_effective_date, closing_date."},"ok":{"type":"boolean","description":"True when the deal currently meets it."},"message":{"type":"string","description":"What to do when it is not met."}},"required":["key","ok","message"]},"DealStagePathV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string"},"label":{"type":"string"},"sort_order":{"type":"integer"},"terminal_outcome":{"type":"string","enum":["closed","dead"],"nullable":true,"description":"Set on terminal stages (closed / dead); null otherwise."},"color":{"type":"string","enum":["secondary","info","warning","success","destructive","muted"],"description":"Badge colour token the stage is drawn with."},"is_current":{"type":"boolean","description":"True for the deal's current stage."},"requirements":{"description":"The stage's own requirement set, judged against the deal now (keys that do not apply to the deal kind are omitted).","type":"array","items":{"$ref":"#/components/schemas/DealStageRequirementV1Dto"}},"can_enter":{"type":"boolean","description":"Whether a move to this stage would pass now: cumulative checks for a forward move, true for a backward one, false for terminal stages, the current stage and a deal that is not in progress."}},"required":["id","code","label","sort_order","terminal_outcome","color","is_current","requirements","can_enter"]},"AddDealPartyV1Dto":{"type":"object","properties":{"party_id":{"type":"string","format":"uuid"},"deal_role":{"type":"string","maxLength":64,"description":"A code from the org's deal role catalog; each role carries a side (buyer, seller or neutral). Every org is seeded with: seller, seller_attorney, seller_broker, current_lender, broker, current_owner, buyer_attorney, buyer_broker, lender, equity_partner, title_escrow, surveyor, environmental, inspector, insurer, appraiser, other. One required 'seller' party gates promote; the rest are informational. A disposition or internal transfer refuses seller and current_owner with DEAL_ROLE_NOT_ALLOWED_FOR_KIND: there the org's own entity is the seller."}},"required":["party_id","deal_role"]},"AddDealTenantV1Dto":{"type":"object","properties":{"party_id":{"type":"string","format":"uuid"}},"required":["party_id"]},"AddDealCriticalDateV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["effective_date","earnest_money","dd_expiration","financing_contingency","title_survey","inspection","closing","buyer_deposit","inspection_end","buyer_financing","consent"],"nullable":true,"description":"Restore a removed standard milestone by kind (its standard label and order are used; `label` is ignored; `event_date` and `status` are kept, defaulting to undated and pending). Omit to add a custom milestone."},"label":{"type":"string","description":"Label for the custom milestone (required without `kind`)."},"event_date":{"type":"string","nullable":true,"format":"date","description":"A real day from 1900-01-01 to 2199-12-31."},"status":{"type":"string","enum":["pending","done","na"]},"rule":{"description":"Compute the date from an anchor. Cannot be combined with `event_date`.","allOf":[{"$ref":"#/components/schemas/CriticalDateRuleV1Dto"}]}}},"UpdateDealCriticalDateV1Dto":{"type":"object","properties":{"event_date":{"type":"string","nullable":true,"format":"date","description":"Set/clear the date. null clears it. A real day from 1900-01-01 to 2199-12-31."},"status":{"type":"string","enum":["pending","done","na"]},"label":{"type":"string","description":"Rename — allowed for custom entries only."},"rule":{"nullable":true,"description":"Object sets or changes the rule (the date is recomputed at once unless locked); null clears it and keeps the current date.","type":"object","allOf":[{"$ref":"#/components/schemas/CriticalDateRuleV1Dto"}]},"is_locked":{"type":"boolean","description":"Lock keeps the value and stops cascades; unlock recomputes a ruled date from its anchor."}}},"DealCriticalDateChangeV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"critical_date_id":{"type":"string","format":"uuid"},"old_date":{"type":"string","nullable":true,"format":"date"},"new_date":{"type":"string","nullable":true,"format":"date"},"cause":{"type":"string","enum":["manual","rule","cascade","unlock","restore","recompute"]},"source_critical_date_id":{"type":"string","nullable":true,"format":"uuid","description":"The date whose change triggered this one (cascade, recompute)."},"actor_id":{"type":"string","nullable":true,"format":"uuid"},"created_at":{"type":"string","format":"date-time"}},"required":["id","critical_date_id","old_date","new_date","cause","source_critical_date_id","actor_id","created_at"]},"DistributionDeclarationListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","nullable":true,"description":"Display name of the declaring legal entity."},"cascade":{"type":"string","enum":["direct","ultimate"]},"declaration_date":{"type":"string","format":"date"},"distribution_type":{"type":"string","enum":["operating_income","capital_event","distribution_in_kind","tax_distribution"]},"total_amount":{"type":"string"},"memo":{"type":"string","nullable":true},"external_ref":{"type":"string","nullable":true,"description":"Another system's key for this record, unique in the org; set by an importer."},"period_start":{"type":"string","nullable":true,"format":"date"},"period_end":{"type":"string","nullable":true,"format":"date"},"status":{"type":"string","enum":["active","undone"]},"source":{"type":"string","enum":["manual","scheduled"],"description":"`scheduled` when the declaration was executed from a scheduled distribution, `manual` when declared by hand."},"scheduled_distribution_id":{"type":"string","nullable":true,"format":"uuid","description":"The scheduled distribution this declaration executed; null for a manual declaration."},"document_count":{"type":"number"},"created_at":{"type":"string"},"split_basis":{"type":"string","enum":["pro_rata","waterfall","directed"],"description":"How the total was split: the cap table (`pro_rata`), the entity's waterfall (`waterfall`), or the amounts named per holder in `owner_amounts` (`directed`, E4)."},"return_of_capital":{"type":"boolean","description":"A return of capital (E4): every holder's capital event is in the `capital` bucket and an in-group holder's receipt credits its investment."}},"required":["id","legal_entity_id","cascade","declaration_date","distribution_type","total_amount","external_ref","status","source","scheduled_distribution_id","document_count","created_at","split_basis","return_of_capital"]},"CascadePreviewRowV1Dto":{"type":"object","properties":{"tier":{"type":"number"},"owner_party_id":{"type":"string","format":"uuid"},"owner_party_name":{"type":"string","nullable":true},"owner_party_type":{"type":"string","enum":["legal_entity","party"]},"owner_legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"ownership_percentage":{"type":"string","description":"Ownership percentage with exactly 15 decimals, e.g. \"60.000000000000000\"."},"allocated_amount":{"type":"string","description":"Allocated amount as decimal string."},"parent_legal_entity_id":{"type":"string","format":"uuid","description":"The LE whose cap-table produced this row. Tier 1 = root LE; tier N = LE-party owner from the tier-(N-1) row whose allocation this row split."},"tier_seq":{"type":"number","nullable":true,"description":"The waterfall tier's sequence when the parent entity split through its waterfall; null for a cap-table row."},"bucket":{"type":"string","nullable":true,"enum":["capital","pref","profit","promote"],"description":"The capital bucket the line pays; null for a cap-table row."},"settlement":{"type":"string","nullable":true,"enum":["distribution","incentive_fee"],"description":"How the line settles; null for a cap-table row."},"held_amount":{"type":"string","nullable":true,"description":"The part held in escrow, decimal string; always 0.00 until vesting exists. Null for a cap-table row."},"class_id":{"type":"string","nullable":true,"format":"uuid"},"position_id":{"type":"string","nullable":true,"format":"uuid"}},"required":["tier","owner_party_id","owner_party_type","ownership_percentage","allocated_amount","parent_legal_entity_id"]},"CascadePreviewV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"cascade":{"type":"string","enum":["direct","ultimate"]},"total_amount":{"type":"string"},"max_tier":{"type":"number","description":"Deepest tier in the response."},"total_owners":{"type":"number","description":"Number of allocation rows returned."},"total_allocated":{"type":"string","description":"Sum of tier-1 rows; sanity check — should equal total_amount."},"rows":{"type":"array","items":{"$ref":"#/components/schemas/CascadePreviewRowV1Dto"}}},"required":["legal_entity_id","cascade","total_amount","max_tier","total_owners","total_allocated","rows"]},"DistributablePreviewPeriodV1Dto":{"type":"object","properties":{"from_date":{"type":"string","format":"date"},"to_date":{"type":"string","format":"date"}},"required":["from_date","to_date"]},"DistributablePreviewV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"period":{"$ref":"#/components/schemas/DistributablePreviewPeriodV1Dto"},"period_net_income":{"type":"string","description":"Net income for the LE across the period, signed (income positive). Decimal string."},"prior_distributions_in_period":{"type":"string","description":"What this LE has already distributed for the period. Counts every active declaration rooted at the LE whose covered period (period_start..period_end) overlaps the requested range, whatever day it was declared on; a declaration with no covered period counts when its declaration_date falls inside the range. Also counts the tier-2-or-deeper owner_distribution documents booked on this LE by an active cascade (what a holdco passed through to its own owners), by document date, which is the date the holdco books the matching dividend income. The covered period is what the operator states a declaration distributes: a holdco that declares its own distribution for the quarter the income of a propco covers, rather than the quarter it booked the dividend in, has it counted against that stated quarter. Decimal string."},"distributable_amount":{"type":"string","description":"max(0, period_net_income - prior_distributions_in_period). The system uses this as the auto-fill in \"By Period\" mode."},"lifetime_net_income":{"type":"string"},"lifetime_distributions":{"type":"string","description":"Everything this LE has distributed, on the same two sources as prior_distributions_in_period without the date filter. Decimal string."},"retained_earnings":{"type":"string"},"cash_balance":{"type":"string","nullable":true,"description":"Available cash for the LE as of to_date: summed balances of its operating cash GL accounts (LE-scoped cash_operating + bank-linked cash accounts, trust excluded). Decimal string, or null when the LE has no operating cash accounts (cash position unknown). The FE compares the operator-entered total against this to warn on a shortfall before submit; when null, no cash warning is shown."},"period_fully_distributed":{"type":"boolean","description":"True when period_net_income > 0 AND prior_distributions_in_period >= period_net_income. FE shows a double-distribute warning banner and requires acknowledgement when true."}},"required":["legal_entity_id","period","period_net_income","prior_distributions_in_period","distributable_amount","lifetime_net_income","lifetime_distributions","retained_earnings","period_fully_distributed"]},"DistributionDeclarationDocumentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"},"party_name":{"type":"string","nullable":true,"description":"Display name of the owner party for this per-tier document."},"legal_entity_id":{"type":"string","format":"uuid","description":"The LE this tier's document was posted under."},"legal_entity_name":{"type":"string","nullable":true,"description":"Display name of the LE this tier's document was posted under."},"total_amount":{"type":"string","description":"Per-owner share, dollars.cents string."},"balance_amount":{"type":"string","description":"Remaining unpaid balance, dollars.cents string. Equals total_amount on creation; decrements as payment_out applications hit the doc."},"document_number":{"type":"string","nullable":true},"status":{"type":"string"},"distribution_tier":{"type":"number","description":"1 = direct owner of the declaring LE; 2 = direct owner of a tier-1 LE-as-party (e.g. Holdco); … Cascade stops at non-LE parties."},"holder_external_ref":{"type":"string","nullable":true,"description":"An in-group holder's receipt: the loader's reference for it (E4), from `owner_amounts` or `holder_refs`. Null on every other document, and on a receipt declared without one."}},"required":["id","party_id","legal_entity_id","total_amount","balance_amount","status","distribution_tier","holder_external_ref"]},"DistributionDeclarationV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","nullable":true,"description":"Display name of the declaring legal entity."},"cascade":{"type":"string","enum":["direct","ultimate"]},"declaration_date":{"type":"string","format":"date"},"distribution_type":{"type":"string","enum":["operating_income","capital_event","distribution_in_kind","tax_distribution"]},"total_amount":{"type":"string"},"memo":{"type":"string","nullable":true},"external_ref":{"type":"string","nullable":true,"description":"Another system's key for this record, unique in the org; set by an importer."},"period_start":{"type":"string","nullable":true,"format":"date"},"period_end":{"type":"string","nullable":true,"format":"date"},"status":{"type":"string","enum":["active","undone"]},"source":{"type":"string","enum":["manual","scheduled"],"description":"`scheduled` when the declaration was executed from a scheduled distribution, `manual` when declared by hand."},"scheduled_distribution_id":{"type":"string","nullable":true,"format":"uuid","description":"The scheduled distribution this declaration executed; null for a manual declaration."},"undone_at":{"type":"string","nullable":true},"undone_by":{"type":"string","nullable":true,"format":"uuid"},"undo_reason":{"type":"string","nullable":true},"created_by":{"type":"string","format":"uuid"},"created_at":{"type":"string"},"split_basis":{"type":"string","enum":["pro_rata","waterfall","directed"],"description":"How the total was split: the cap table (`pro_rata`), the entity's waterfall (`waterfall`), or the amounts named per holder in `owner_amounts` (`directed`, E4)."},"return_of_capital":{"type":"boolean","description":"A return of capital (E4): every holder's capital event is in the `capital` bucket and an in-group holder's receipt credits its investment."},"documents":{"type":"array","items":{"$ref":"#/components/schemas/DistributionDeclarationDocumentV1Dto"}}},"required":["id","org_id","legal_entity_id","cascade","declaration_date","distribution_type","total_amount","external_ref","status","source","scheduled_distribution_id","created_by","created_at","split_basis","return_of_capital","documents"]},"DistributionDeclarationCreatedDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"cascade":{"type":"string","enum":["direct","ultimate"]},"split_basis":{"type":"string","enum":["pro_rata","waterfall","directed"]},"return_of_capital":{"type":"boolean"},"documents":{"type":"array","items":{"$ref":"#/components/schemas/DistributionDeclarationDocumentV1Dto"}}},"required":["id","cascade","split_basis","return_of_capital","documents"]},"DirectedOwnerAmountV1Dto":{"type":"object","properties":{"party_id":{"type":"string","format":"uuid","description":"The holder paid."},"amount":{"type":"string","description":"What this holder is paid. Greater than zero.","example":"1234.50"},"holder_side":{"type":"boolean","description":"In-group holder only: record the holder's own side (its receipt). Default true; false when the holder has no counterpart in its books."},"holder_date":{"type":"string","format":"date","description":"In-group holder only: the receipt's date on the holder's books. Defaults to `declaration_date`."},"holder_external_ref":{"type":"string","minLength":1,"maxLength":200,"description":"In-group holder only: the loader's reference for the holder's receipt, unique per org."}},"required":["party_id","amount"]},"HolderRefV1Dto":{"type":"object","properties":{"party_id":{"type":"string","format":"uuid","description":"An in-group holder (one of the org's entities) this declaration pays."},"holder_external_ref":{"type":"string","minLength":1,"maxLength":200,"description":"The loader's reference for that holder's receipt, unique per org like `external_ref`."}},"required":["party_id","holder_external_ref"]},"CreateDistributionDeclarationV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid","description":"Declaring legal entity. The orchestrator walks entity_ownerships for this LE on declaration_date and creates one owner_distribution document per direct owner. With cascade=ultimate, recurses through nested LEs."},"cascade":{"type":"string","enum":["direct","ultimate"],"description":"Cascade behavior. 'direct' creates one document per direct entity_ownerships row of the declaring LE and stops. 'ultimate' (default) recurses through nested LEs (e.g. SPE → Holdco → individuals), emitting per-tier documents. The cascade STOPS at parties that are not legal entities.","default":"ultimate"},"declaration_date":{"type":"string","format":"date","description":"Declaration date (YYYY-MM-DD). Must be inside an open accounting period for the declaring LE."},"distribution_type":{"type":"string","enum":["operating_income","capital_event","distribution_in_kind","tax_distribution"],"description":"Classifies the distribution for downstream reporting."},"total_amount":{"type":"string","description":"Total distribution amount (the declaring LE's tier-1 amount). The orchestrator splits it across that LE's direct owners by ownership_percentage with the rounding residual going to the largest-pct member.","example":"1234.50"},"memo":{"type":"string","maxLength":2000},"external_ref":{"type":"string","nullable":true,"minLength":1,"maxLength":200,"description":"Another system's key for this record, unique in the org; set by an importer."},"return_of_capital":{"type":"boolean","default":false,"description":"A return of capital (E4): every holder's capital event lands in the `capital` bucket whatever its class policy, and an in-group holder's receipt credits its investment. Ownership percentages never change."},"owner_amounts":{"description":"A directed split (E4): each holder's amount, summing exactly to `total_amount`, instead of the cap table. Requires `cascade: 'direct'`; each holder holds an active position in the entity or is on its cap table on the date. Refused on an entity whose waterfall applies.","type":"array","items":{"$ref":"#/components/schemas/DirectedOwnerAmountV1Dto"}},"holder_refs":{"description":"E4: in-group holders' own references for a split that is not directed (pro-rata, or a waterfall root's holders): each named holder must be paid exactly one receipt by this declaration, which stores the reference. Not with `owner_amounts`, whose lines carry their own.","type":"array","items":{"$ref":"#/components/schemas/HolderRefV1Dto"}},"period_start":{"type":"string","format":"date","description":"Optional period the distribution covers (inclusive). If provided, period_end must also be provided. Audit metadata only; does not affect posting or the per-owner split."},"period_end":{"type":"string","format":"date","description":"Optional period the distribution covers (inclusive). If provided, period_start must also be provided and period_start <= period_end. The orchestrator additionally enforces declaration_date >= period_end."},"acknowledge_cash_shortfall":{"type":"boolean","description":"Set true to declare a distribution whose total_amount exceeds the declaring LE's available ledger cash. When false/omitted and the amount exceeds available cash, the request is rejected with CASH_SHORTFALL. Use only when distributing against expected near-term receipts.","default":false},"basis":{"type":"string","enum":["accrual","cash"],"description":"Reporting basis the amount was computed on, recorded on the declaration. Omitted: not recorded."}},"required":["legal_entity_id","declaration_date","distribution_type","total_amount"]},"DistributionDeclarationUndoneDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["undone"]},"voided_document_count":{"type":"number","description":"Number of linked per-tier documents that were voided."}},"required":["id","status","voided_document_count"]},"UndoDistributionDeclarationV1Dto":{"type":"object","properties":{"reason":{"type":"string","description":"Required audit reason for the cascade undo.","maxLength":2000}},"required":["reason"]},"DistributionPolicyTemplateRefV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]},"DistributionPolicyAdjustmentV1Dto":{"type":"object","properties":{"seq":{"type":"integer","description":"1-based order among the policy's OWN lines; assigned server-side."},"direction":{"type":"string","enum":["add","subtract"]},"measure":{"type":"string","enum":["decrease_in_balance","increase_in_balance","ending_balance"]},"account_id":{"type":"string","nullable":true,"format":"uuid"},"system_role":{"type":"string","nullable":true,"enum":["accounts_receivable","accounts_payable","customer_refunds_payable","cash_operating","cash_trust","intercompany_due_from","intercompany_due_to","deferred_revenue","retained_earnings","opening_balance_equity","undeposited_funds","ic_rounding_adjustment","distributions_payable","distributions_held","incentive_fee_payable","incentive_fee_expense","owner_distributions_equity","distributions_receivable","contributed_capital","contributions_receivable","contributions_payable","investment_in_subsidiary","dividend_income","accrued_rent_receivable","cam_recovery_income","percentage_rent_income","administrative_fee_income","late_fee_income","loan_clearing","notes_payable","notes_receivable","interest_expense","interest_income","accrued_interest_payable","accrued_interest_receivable","property_tax_expense","insurance_expense","fixed_assets","accumulated_depreciation","depreciation_expense","construction_in_progress","gain_loss_on_disposal","impairment_loss","asset_disposal_clearing","debt_service_payable","prepayment_penalty_expense","prepayment_fee_income","loan_late_fee_expense","loan_late_fee_income","loan_escrow_asset","loan_escrow_liability","hedge_settlement_expense","hedge_premium_asset","hedge_termination_gain_loss","fixed_asset_transfer_clearing"]},"label":{"type":"string"}},"required":["seq","direction","measure","account_id","system_role","label"]},"EffectivePolicyLineV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The line's id: on a `template` line, what `excluded_template_line_ids` names to exclude it."},"seq":{"type":"integer","description":"1-based order within the line's ORIGIN: template lines and the policy's own lines each number from 1, so two lines can share a seq. Key on (origin, seq) or the array index, never on seq alone."},"origin":{"type":"string","enum":["template","entity"],"description":"`template`: one of the template's lines; `entity`: the policy's own."},"template_id":{"type":"string","nullable":true,"format":"uuid","description":"The template on a `template` line; null on an `entity` line."},"direction":{"type":"string","enum":["add","subtract"]},"measure":{"type":"string","enum":["decrease_in_balance","increase_in_balance","ending_balance"]},"account_id":{"type":"string","nullable":true,"format":"uuid"},"system_role":{"type":"string","nullable":true,"enum":["accounts_receivable","accounts_payable","customer_refunds_payable","cash_operating","cash_trust","intercompany_due_from","intercompany_due_to","deferred_revenue","retained_earnings","opening_balance_equity","undeposited_funds","ic_rounding_adjustment","distributions_payable","distributions_held","incentive_fee_payable","incentive_fee_expense","owner_distributions_equity","distributions_receivable","contributed_capital","contributions_receivable","contributions_payable","investment_in_subsidiary","dividend_income","accrued_rent_receivable","cam_recovery_income","percentage_rent_income","administrative_fee_income","late_fee_income","loan_clearing","notes_payable","notes_receivable","interest_expense","interest_income","accrued_interest_payable","accrued_interest_receivable","property_tax_expense","insurance_expense","fixed_assets","accumulated_depreciation","depreciation_expense","construction_in_progress","gain_loss_on_disposal","impairment_loss","asset_disposal_clearing","debt_service_payable","prepayment_penalty_expense","prepayment_fee_income","loan_late_fee_expense","loan_late_fee_income","loan_escrow_asset","loan_escrow_liability","hedge_settlement_expense","hedge_premium_asset","hedge_termination_gain_loss","fixed_asset_transfer_clearing"]},"label":{"type":"string"}},"required":["id","seq","origin","template_id","direction","measure","account_id","system_role","label"]},"EffectivePolicyExcludedLineV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The template line's id — what `excluded_template_line_ids` names."},"seq":{"type":"integer","description":"The line's 1-based order in its TEMPLATE. Not unique across `lines` and `excluded_lines`: key on the id or the array index, never on seq alone."},"template_id":{"type":"string","format":"uuid"},"direction":{"type":"string","enum":["add","subtract"]},"measure":{"type":"string","enum":["decrease_in_balance","increase_in_balance","ending_balance"]},"account_id":{"type":"string","nullable":true,"format":"uuid"},"system_role":{"type":"string","nullable":true,"enum":["accounts_receivable","accounts_payable","customer_refunds_payable","cash_operating","cash_trust","intercompany_due_from","intercompany_due_to","deferred_revenue","retained_earnings","opening_balance_equity","undeposited_funds","ic_rounding_adjustment","distributions_payable","distributions_held","incentive_fee_payable","incentive_fee_expense","owner_distributions_equity","distributions_receivable","contributed_capital","contributions_receivable","contributions_payable","investment_in_subsidiary","dividend_income","accrued_rent_receivable","cam_recovery_income","percentage_rent_income","administrative_fee_income","late_fee_income","loan_clearing","notes_payable","notes_receivable","interest_expense","interest_income","accrued_interest_payable","accrued_interest_receivable","property_tax_expense","insurance_expense","fixed_assets","accumulated_depreciation","depreciation_expense","construction_in_progress","gain_loss_on_disposal","impairment_loss","asset_disposal_clearing","debt_service_payable","prepayment_penalty_expense","prepayment_fee_income","loan_late_fee_expense","loan_late_fee_income","loan_escrow_asset","loan_escrow_liability","hedge_settlement_expense","hedge_premium_asset","hedge_termination_gain_loss","fixed_asset_transfer_clearing"]},"label":{"type":"string"}},"required":["id","seq","template_id","direction","measure","account_id","system_role","label"]},"EffectivePolicyOriginsV1Dto":{"type":"object","properties":{"cadence":{"type":"string","enum":["inherited","own"]},"due_day":{"type":"string","enum":["inherited","own"]},"period_lag":{"type":"string","enum":["inherited","own"]},"horizon_months":{"type":"string","enum":["inherited","own"]},"on_skip":{"type":"string","enum":["inherited","own"]},"basis":{"type":"string","enum":["inherited","own"]},"distribution_type":{"type":"string","enum":["inherited","own"]},"base":{"type":"string","enum":["inherited","own"]},"upstream_basis":{"type":"string","enum":["inherited","own"]},"cash_guard":{"type":"string","enum":["inherited","own"]},"holdback_amount":{"type":"string","enum":["inherited","own"]},"cash_floor":{"type":"string","enum":["inherited","own"]},"min_amount":{"type":"string","enum":["inherited","own"]}},"required":["cadence","due_day","period_lag","horizon_months","on_skip","basis","distribution_type","base","upstream_basis","cash_guard","holdback_amount","cash_floor","min_amount"]},"EffectivePolicyV1Dto":{"type":"object","properties":{"cadence":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"]},"due_day":{"type":"integer"},"period_lag":{"type":"integer"},"horizon_months":{"type":"integer"},"on_skip":{"type":"string","enum":["carry_forward","forfeit"]},"basis":{"type":"string","nullable":true,"enum":["accrual","cash"],"description":"Null means the org's default_reporting_basis."},"distribution_type":{"type":"string","enum":["operating_income","capital_event","distribution_in_kind","tax_distribution"]},"base":{"type":"string","enum":["net_income_ex_receipts","available_cash","zero"]},"upstream_basis":{"type":"string","enum":["declared","received"]},"cash_guard":{"type":"string","enum":["cap","flag","off"]},"holdback_amount":{"type":"string","nullable":true,"description":"Null means none.","example":"1234.50"},"cash_floor":{"type":"string","nullable":true,"description":"Null means none.","example":"1234.50"},"min_amount":{"type":"string","nullable":true,"description":"Null means none.","example":"1234.50"},"lines":{"description":"Compute order: the template's non-excluded lines, then the policy's own.","type":"array","items":{"$ref":"#/components/schemas/EffectivePolicyLineV1Dto"}},"excluded_lines":{"type":"array","items":{"$ref":"#/components/schemas/EffectivePolicyExcludedLineV1Dto"}},"origins":{"$ref":"#/components/schemas/EffectivePolicyOriginsV1Dto"}},"required":["cadence","due_day","period_lag","horizon_months","on_skip","basis","distribution_type","base","upstream_basis","cash_guard","holdback_amount","cash_floor","min_amount","lines","excluded_lines","origins"]},"DistributionPolicyV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["active","paused","archived"]},"template":{"nullable":true,"description":"The template a template-based policy reads its formula from; null on a custom policy.","type":"object","allOf":[{"$ref":"#/components/schemas/DistributionPolicyTemplateRefV1Dto"}]},"cadence":{"type":"string","nullable":true,"enum":["monthly","quarterly","semi_annual","annual"]},"due_day":{"type":"integer","nullable":true},"period_lag":{"type":"integer","nullable":true},"horizon_months":{"type":"integer","nullable":true},"baseline_date":{"type":"string","format":"date"},"opening_undistributed":{"type":"string","example":"1234.50"},"on_skip":{"type":"string","nullable":true,"enum":["carry_forward","forfeit"]},"basis":{"type":"string","nullable":true,"enum":["accrual","cash"]},"distribution_type":{"type":"string","nullable":true,"enum":["operating_income","capital_event","distribution_in_kind","tax_distribution"]},"base":{"type":"string","nullable":true,"enum":["net_income_ex_receipts","available_cash","zero"]},"upstream_basis":{"type":"string","nullable":true,"enum":["declared","received"]},"holdback_amount":{"type":"string","nullable":true,"example":"1234.50"},"cash_floor":{"type":"string","nullable":true,"example":"1234.50"},"min_amount":{"type":"string","nullable":true,"example":"1234.50"},"cash_guard":{"type":"string","nullable":true,"enum":["cap","flag","off"]},"adjustments":{"description":"The policy's OWN lines. A template-based policy also computes with its template's lines — see `effective.lines`.","type":"array","items":{"$ref":"#/components/schemas/DistributionPolicyAdjustmentV1Dto"}},"effective":{"$ref":"#/components/schemas/EffectivePolicyV1Dto"},"created_by":{"type":"string","nullable":true,"format":"uuid","description":"The user who created the policy; null when a non-user principal (an API key) created it — the audit log keeps the full principal."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","legal_entity_id","status","template","cadence","due_day","period_lag","horizon_months","baseline_date","opening_undistributed","on_skip","basis","distribution_type","base","upstream_basis","holdback_amount","cash_floor","min_amount","cash_guard","adjustments","effective","created_by","created_at","updated_at"]},"PositionWindowsV1Dto":{"type":"object","properties":{"earned_to":{"type":"string","format":"date"},"receipts_to":{"type":"string","format":"date"},"paid_to_exclusive":{"type":"string","format":"date"},"cash_as_of":{"type":"string","format":"date"}},"required":["earned_to","receipts_to","paid_to_exclusive","cash_as_of"]},"StatementTemplateV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]},"StatementBaseV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["net_income_ex_receipts","available_cash","zero"]},"net_income":{"type":"string","example":"1234.50"},"dividend_income_excluded":{"type":"string","example":"1234.50"},"available_cash":{"type":"string","nullable":true,"example":"1234.50"},"amount":{"type":"string","example":"1234.50"}},"required":["kind","net_income","dividend_income_excluded","available_cash","amount"]},"PendingDownstreamV1Dto":{"type":"object","properties":{"scheduled_distribution_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"adjusted_amount":{"type":"string","example":"1234.50"},"ownership_percentage":{"type":"string","description":"Ownership percentage with exactly 15 decimals, e.g. \"60.000000000000000\"."},"share":{"type":"string","example":"1234.50"}},"required":["scheduled_distribution_id","legal_entity_id","adjusted_amount","ownership_percentage","share"]},"StatementUpstreamV1Dto":{"type":"object","properties":{"receipts":{"type":"string","example":"1234.50"},"pending_downstream":{"type":"array","items":{"$ref":"#/components/schemas/PendingDownstreamV1Dto"}},"total":{"type":"string","example":"1234.50"}},"required":["receipts","pending_downstream","total"]},"StatementAdjustmentV1Dto":{"type":"object","properties":{"seq":{"type":"integer","description":"1-based order within the line's ORIGIN: template lines and the policy's own lines each number from 1, so a statement can carry two lines with the same seq. Key on (origin, seq) or the array index, never on seq alone."},"label":{"type":"string"},"direction":{"type":"string","enum":["add","subtract"]},"measure":{"type":"string","enum":["decrease_in_balance","increase_in_balance","ending_balance"]},"account_id":{"type":"string","format":"uuid"},"system_role":{"type":"string","nullable":true,"enum":["accounts_receivable","accounts_payable","customer_refunds_payable","cash_operating","cash_trust","intercompany_due_from","intercompany_due_to","deferred_revenue","retained_earnings","opening_balance_equity","undeposited_funds","ic_rounding_adjustment","distributions_payable","distributions_held","incentive_fee_payable","incentive_fee_expense","owner_distributions_equity","distributions_receivable","contributed_capital","contributions_receivable","contributions_payable","investment_in_subsidiary","dividend_income","accrued_rent_receivable","cam_recovery_income","percentage_rent_income","administrative_fee_income","late_fee_income","loan_clearing","notes_payable","notes_receivable","interest_expense","interest_income","accrued_interest_payable","accrued_interest_receivable","property_tax_expense","insurance_expense","fixed_assets","accumulated_depreciation","depreciation_expense","construction_in_progress","gain_loss_on_disposal","impairment_loss","asset_disposal_clearing","debt_service_payable","prepayment_penalty_expense","prepayment_fee_income","loan_late_fee_expense","loan_late_fee_income","loan_escrow_asset","loan_escrow_liability","hedge_settlement_expense","hedge_premium_asset","hedge_termination_gain_loss","fixed_asset_transfer_clearing"]},"opening_balance":{"type":"string","example":"1234.50"},"closing_balance":{"type":"string","example":"1234.50"},"amount":{"type":"string","example":"1234.50"},"origin":{"type":"string","enum":["template","entity"],"description":"Spec §6.0: `template` — one of the policy's template's lines; `entity` — the policy's own line."},"template_id":{"type":"string","nullable":true,"format":"uuid","description":"The template on a `template` line; null on an `entity` line."}},"required":["seq","label","direction","measure","account_id","system_role","opening_balance","closing_balance","amount","origin","template_id"]},"StatementExcludedAdjustmentV1Dto":{"type":"object","properties":{"seq":{"type":"integer","description":"The line's 1-based order in its TEMPLATE — it can repeat a seq in `adjustments`. Key on the array index, never on seq alone."},"label":{"type":"string"},"direction":{"type":"string","enum":["add","subtract"]},"measure":{"type":"string","enum":["decrease_in_balance","increase_in_balance","ending_balance"]},"account_id":{"type":"string","nullable":true,"format":"uuid","description":"The line's own account; null on a role line."},"system_role":{"type":"string","nullable":true,"enum":["accounts_receivable","accounts_payable","customer_refunds_payable","cash_operating","cash_trust","intercompany_due_from","intercompany_due_to","deferred_revenue","retained_earnings","opening_balance_equity","undeposited_funds","ic_rounding_adjustment","distributions_payable","distributions_held","incentive_fee_payable","incentive_fee_expense","owner_distributions_equity","distributions_receivable","contributed_capital","contributions_receivable","contributions_payable","investment_in_subsidiary","dividend_income","accrued_rent_receivable","cam_recovery_income","percentage_rent_income","administrative_fee_income","late_fee_income","loan_clearing","notes_payable","notes_receivable","interest_expense","interest_income","accrued_interest_payable","accrued_interest_receivable","property_tax_expense","insurance_expense","fixed_assets","accumulated_depreciation","depreciation_expense","construction_in_progress","gain_loss_on_disposal","impairment_loss","asset_disposal_clearing","debt_service_payable","prepayment_penalty_expense","prepayment_fee_income","loan_late_fee_expense","loan_late_fee_income","loan_escrow_asset","loan_escrow_liability","hedge_settlement_expense","hedge_premium_asset","hedge_termination_gain_loss","fixed_asset_transfer_clearing"]}},"required":["seq","label","direction","measure","account_id","system_role"]},"StatementPaidV1Dto":{"type":"object","properties":{"declarations":{"type":"string","example":"1234.50"},"cascaded_documents":{"type":"string","example":"1234.50"},"approved_items":{"type":"string","example":"1234.50"},"total":{"type":"string","example":"1234.50"}},"required":["declarations","cascaded_documents","approved_items","total"]},"StatementV1Dto":{"type":"object","properties":{"template":{"nullable":true,"description":"The template a template-based policy computed from; null on a custom policy.","type":"object","allOf":[{"$ref":"#/components/schemas/StatementTemplateV1Dto"}]},"origins":{"description":"Where each formula field and overridable amount came from: `inherited` from the template, `own` set on the policy — the same shape as a policy's `effective.origins`. On a custom policy every field is `own`; on a template-based one `holdback_amount`, `cash_floor` and `min_amount` are `own` exactly when the policy overrides them (`0.00` included), so a stored statement records which overrides produced its number.","allOf":[{"$ref":"#/components/schemas/EffectivePolicyOriginsV1Dto"}]},"distribution_type":{"type":"string","enum":["operating_income","capital_event","distribution_in_kind","tax_distribution"],"description":"The effective distribution type this statement was computed under. On a scheduled item's frozen `computation` it is what a batch declares, so a policy edited after approval does not change it. Absent on items computed before it was recorded."},"cash_guard":{"type":"string","enum":["cap","flag","off"],"description":"The effective cash guard this statement was computed under. On a scheduled item's frozen `computation`, `off` lets the batch declare past a cash shortfall. Absent on items computed before it was recorded."},"base":{"$ref":"#/components/schemas/StatementBaseV1Dto"},"upstream":{"$ref":"#/components/schemas/StatementUpstreamV1Dto"},"adjustments":{"description":"Computed lines in compute order: the template's non-excluded lines, then the policy's own (spec D31).","type":"array","items":{"$ref":"#/components/schemas/StatementAdjustmentV1Dto"}},"excluded_adjustments":{"description":"Template lines this entity excluded, with no amount; empty on a custom policy.","type":"array","items":{"$ref":"#/components/schemas/StatementExcludedAdjustmentV1Dto"}},"opening_undistributed":{"type":"string","example":"1234.50"},"entitlement":{"type":"string","example":"1234.50"},"paid":{"$ref":"#/components/schemas/StatementPaidV1Dto"},"position":{"type":"string","example":"1234.50"},"holdback":{"type":"string","example":"1234.50"},"income_lens":{"type":"string","example":"1234.50"},"cash_floor":{"type":"string","nullable":true,"description":"The policy's cash floor, subtracted from available cash for the headroom; null when unset.","example":"1234.50"},"headroom":{"type":"string","nullable":true,"example":"1234.50"},"recommendation":{"type":"string","example":"1234.50"},"bound_by":{"type":"string","enum":["income","cash"]},"min_amount":{"type":"string","nullable":true,"description":"The policy's minimum distribution — below it the item is nothing_to_distribute; null when unset.","example":"1234.50"},"computed_amount":{"type":"string","example":"1234.50"},"cash_shortfall":{"type":"string","nullable":true,"example":"1234.50"},"status":{"type":"string","enum":["staged","nothing_to_distribute"]},"flags":{"type":"array","items":{"type":"string","enum":["prior_period_open","cash_shortfall","period_open","no_cash_accounts","downstream_no_policy","upstream_pending","no_cap_table","period_already_declared"]}}},"required":["template","origins","base","upstream","adjustments","excluded_adjustments","opening_undistributed","entitlement","paid","position","holdback","income_lens","cash_floor","headroom","recommendation","bound_by","min_amount","computed_amount","cash_shortfall","status","flags"]},"DistributionPositionV1Dto":{"type":"object","properties":{"policy_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"as_of":{"type":"string","format":"date"},"basis":{"type":"string","enum":["accrual","cash"]},"baseline_date":{"type":"string","format":"date"},"windows":{"$ref":"#/components/schemas/PositionWindowsV1Dto"},"statement":{"$ref":"#/components/schemas/StatementV1Dto"}},"required":["policy_id","legal_entity_id","as_of","basis","baseline_date","windows","statement"]},"PolicyAdjustmentInputV1Dto":{"type":"object","properties":{"direction":{"type":"string","enum":["add","subtract"],"description":"Whether this line adds to or subtracts from the base."},"measure":{"type":"string","enum":["decrease_in_balance","increase_in_balance","ending_balance"],"description":"What is measured over the earned window: the balance change (increase/decrease) or the ending balance itself."},"account_id":{"type":"string","nullable":true,"format":"uuid","description":"An explicit account. Exactly one of account_id/system_role must be set."},"system_role":{"type":"string","nullable":true,"enum":["accounts_receivable","accounts_payable","customer_refunds_payable","cash_operating","cash_trust","intercompany_due_from","intercompany_due_to","deferred_revenue","retained_earnings","opening_balance_equity","undeposited_funds","ic_rounding_adjustment","distributions_payable","distributions_held","incentive_fee_payable","incentive_fee_expense","owner_distributions_equity","distributions_receivable","contributed_capital","contributions_receivable","contributions_payable","investment_in_subsidiary","dividend_income","accrued_rent_receivable","cam_recovery_income","percentage_rent_income","administrative_fee_income","late_fee_income","loan_clearing","notes_payable","notes_receivable","interest_expense","interest_income","accrued_interest_payable","accrued_interest_receivable","property_tax_expense","insurance_expense","fixed_assets","accumulated_depreciation","depreciation_expense","construction_in_progress","gain_loss_on_disposal","impairment_loss","asset_disposal_clearing","debt_service_payable","prepayment_penalty_expense","prepayment_fee_income","loan_late_fee_expense","loan_late_fee_income","loan_escrow_asset","loan_escrow_liability","hedge_settlement_expense","hedge_premium_asset","hedge_termination_gain_loss","fixed_asset_transfer_clearing"],"description":"A system role, resolved to an account for the policy legal entity at compute time. Exactly one of account_id/system_role must be set."},"label":{"type":"string","maxLength":120,"description":"Display label for this line."}},"required":["direction","measure","label"]},"CreateDistributionPolicyV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"template_id":{"type":"string","nullable":true,"format":"uuid","description":"The template to base the policy on (spec D29). Set: the formula comes from the template and every formula field must be omitted. Omitted or null: a custom policy."},"cadence":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"],"description":"Formula field — required on a custom policy."},"due_day":{"type":"integer","minimum":1,"maximum":28,"description":"Formula field — required on a custom policy. Day of month a due date falls on (never month-clamped)."},"period_lag":{"type":"integer","minimum":1,"maximum":12,"default":1,"description":"Periods back from the due date to the period the item covers; 1 = the prior period. At least 1: an item due inside the period it covers could never be declared (a declaration cannot be dated before its period ends)."},"horizon_months":{"type":"integer","minimum":1,"maximum":36,"default":12},"baseline_date":{"type":"string","format":"date","description":"Defaults to the covered period start computed from cadence/due_day/period_lag against the org today. YYYY-MM-DD only — a partial date (e.g. \"2026-09\") or a full datetime is rejected."},"opening_undistributed":{"type":"string","description":"Either sign. Defaults to 0.00.","example":"1234.50"},"on_skip":{"type":"string","enum":["carry_forward","forfeit"],"default":"carry_forward"},"basis":{"type":"string","nullable":true,"enum":["accrual","cash"],"description":"Null (default) means the org's default_reporting_basis."},"distribution_type":{"type":"string","enum":["operating_income","capital_event","distribution_in_kind","tax_distribution"],"default":"operating_income"},"base":{"type":"string","enum":["net_income_ex_receipts","zero"],"description":"Formula field — required on a custom policy. available_cash is not accepted in this release (its formula is a pending product decision)."},"upstream_basis":{"type":"string","enum":["declared","received"],"default":"declared"},"holdback_amount":{"type":"string","nullable":true,"description":"Held back, never negative. On a template-based policy an override: null or omitted inherits the template, 0.00 means none.","example":"1234.50"},"cash_floor":{"type":"string","nullable":true,"description":"Cash guard floor, never negative. On a template-based policy an override: null or omitted inherits the template, 0.00 means none.","example":"1234.50"},"min_amount":{"type":"string","nullable":true,"description":"Minimum distribution, never negative. On a template-based policy an override: null or omitted inherits the template, 0.00 means none.","example":"1234.50"},"cash_guard":{"type":"string","enum":["cap","flag","off"],"default":"cap"},"adjustments":{"default":[],"maxItems":100,"description":"Ordered add/subtract lines — the policy's OWN lines (on a template-based policy they compute after the template's). seq is assigned server-side from array order.","type":"array","items":{"$ref":"#/components/schemas/PolicyAdjustmentInputV1Dto"}}},"required":["legal_entity_id"]},"UpdateDistributionPolicyV1Dto":{"type":"object","properties":{"cadence":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"]},"due_day":{"type":"integer","minimum":1,"maximum":28},"period_lag":{"type":"integer","minimum":1,"maximum":12},"horizon_months":{"type":"integer","minimum":1,"maximum":36},"baseline_date":{"type":"string","format":"date","description":"YYYY-MM-DD only — a partial date (e.g. \"2026-09\") or a full datetime is rejected."},"opening_undistributed":{"type":"string","example":"1234.50"},"on_skip":{"type":"string","enum":["carry_forward","forfeit"]},"basis":{"type":"string","nullable":true,"enum":["accrual","cash"]},"distribution_type":{"type":"string","enum":["operating_income","capital_event","distribution_in_kind","tax_distribution"]},"base":{"type":"string","enum":["net_income_ex_receipts","zero"],"description":"available_cash is not accepted in this release (its formula is a pending product decision)."},"upstream_basis":{"type":"string","enum":["declared","received"]},"holdback_amount":{"type":"string","nullable":true,"example":"1234.50"},"cash_floor":{"type":"string","nullable":true,"example":"1234.50"},"min_amount":{"type":"string","nullable":true,"example":"1234.50"},"cash_guard":{"type":"string","enum":["cap","flag","off"]},"status":{"type":"string","enum":["active","paused","archived"],"description":"archived is terminal — a further PATCH is refused."},"adjustments":{"maxItems":100,"description":"Replaces every existing OWN line (a template-based policy's template lines are untouched); seq reassigned 1..n from array order.","type":"array","items":{"$ref":"#/components/schemas/PolicyAdjustmentInputV1Dto"}},"excluded_template_line_ids":{"description":"Template-based policies only: the ids of the template's lines this entity excludes, replaced whole (`[]` re-includes every line). Each id must be a line of the policy's current template (`effective.lines[].id` / `effective.excluded_lines[].id`), or 400 VALIDATION_FAILED naming it in `detail`. A custom policy refuses the field outright (400), even `[]` — omit it.","type":"array","items":{"type":"string","format":"uuid"}}}},"CopyDistributionPolicyAdjustmentsV1Dto":{"type":"object","properties":{"source_policy_id":{"type":"string","format":"uuid","description":"The source policy whose adjustment lines replace this policy's. Every line is re-validated against THIS policy's legal entity."}},"required":["source_policy_id"]},"DistributionPolicyTemplateLineV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The line's id — what a policy's `excluded_template_line_ids` names."},"seq":{"type":"integer","description":"1-based order among the template's lines."},"direction":{"type":"string","enum":["add","subtract"]},"measure":{"type":"string","enum":["decrease_in_balance","increase_in_balance","ending_balance"]},"account_id":{"type":"string","nullable":true,"format":"uuid","description":"An org-wide account; null on a role line."},"system_role":{"type":"string","nullable":true,"enum":["accounts_receivable","accounts_payable","customer_refunds_payable","cash_operating","cash_trust","intercompany_due_from","intercompany_due_to","deferred_revenue","retained_earnings","opening_balance_equity","undeposited_funds","ic_rounding_adjustment","distributions_payable","distributions_held","incentive_fee_payable","incentive_fee_expense","owner_distributions_equity","distributions_receivable","contributed_capital","contributions_receivable","contributions_payable","investment_in_subsidiary","dividend_income","accrued_rent_receivable","cam_recovery_income","percentage_rent_income","administrative_fee_income","late_fee_income","loan_clearing","notes_payable","notes_receivable","interest_expense","interest_income","accrued_interest_payable","accrued_interest_receivable","property_tax_expense","insurance_expense","fixed_assets","accumulated_depreciation","depreciation_expense","construction_in_progress","gain_loss_on_disposal","impairment_loss","asset_disposal_clearing","debt_service_payable","prepayment_penalty_expense","prepayment_fee_income","loan_late_fee_expense","loan_late_fee_income","loan_escrow_asset","loan_escrow_liability","hedge_settlement_expense","hedge_premium_asset","hedge_termination_gain_loss","fixed_asset_transfer_clearing"]},"label":{"type":"string"}},"required":["id","seq","direction","measure","account_id","system_role","label"]},"DistributionPolicyTemplateV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","archived"]},"starter_key":{"type":"string","nullable":true,"enum":["propco_quarterly","holdco_quarterly","propco_monthly","holdco_monthly"],"description":"Set on one of the four starter templates; null otherwise."},"cadence":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"]},"due_day":{"type":"integer"},"period_lag":{"type":"integer"},"horizon_months":{"type":"integer"},"on_skip":{"type":"string","enum":["carry_forward","forfeit"]},"basis":{"type":"string","nullable":true,"enum":["accrual","cash"],"description":"Null means each entity's org default_reporting_basis."},"distribution_type":{"type":"string","enum":["operating_income","capital_event","distribution_in_kind","tax_distribution"]},"base":{"type":"string","enum":["net_income_ex_receipts","available_cash","zero"]},"upstream_basis":{"type":"string","enum":["declared","received"]},"cash_guard":{"type":"string","enum":["cap","flag","off"]},"holdback_amount":{"type":"string","nullable":true,"description":"The default every assigned policy inherits unless it overrides it; null means none. Never negative.","example":"1234.50"},"cash_floor":{"type":"string","nullable":true,"description":"The default every assigned policy inherits unless it overrides it; null means none. Never negative.","example":"1234.50"},"min_amount":{"type":"string","nullable":true,"description":"The default every assigned policy inherits unless it overrides it; null means none. Never negative.","example":"1234.50"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/DistributionPolicyTemplateLineV1Dto"}},"assigned_count":{"type":"integer","description":"How many live (non-archived) policies are based on this template."},"created_by":{"type":"string","nullable":true,"format":"uuid","description":"The user who created the template; null when any non-user principal (an API key) created it, starter or not — the audit log keeps the full principal."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","description","status","starter_key","cadence","due_day","period_lag","horizon_months","on_skip","basis","distribution_type","base","upstream_basis","cash_guard","holdback_amount","cash_floor","min_amount","lines","assigned_count","created_by","created_at","updated_at"]},"DistributionPolicyTemplatesListMetaV1Dto":{"type":"object","properties":{"next_cursor":{"type":"string","nullable":true,"description":"Opaque cursor for the next page, or null when this is the last page. Pass it back as `?cursor=`. Always present; do not parse it.","example":"eyJpZCI6ICJhYmMifQ=="},"limit":{"type":"number","description":"Page size used for this response.","example":50},"starters_created":{"type":"boolean","description":"True once every one of the four starter templates has been created for this org (an archived starter counts) — then `POST /distribution-policy-templates/starters` creates nothing. False: call it to create the missing ones (spec D32)."},"request_id":{"type":"string","example":"018f0b3d-2b1e-7c8a-9d4b-1a2b3c4d5e6f"},"api_version":{"type":"string","example":"2026-04-23"}},"required":["next_cursor","limit","starters_created","request_id","api_version"]},"CreateDistributionPolicyTemplateV1Dto":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120,"description":"Unique among the org's live (non-archived) templates."},"description":{"type":"string","nullable":true,"maxLength":500},"cadence":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"]},"due_day":{"type":"integer","minimum":1,"maximum":28,"description":"Day of month a due date falls on (never month-clamped)."},"period_lag":{"type":"integer","minimum":1,"maximum":12,"default":1,"description":"Periods back from the due date to the period the item covers; 1 = the prior period."},"horizon_months":{"type":"integer","minimum":1,"maximum":36,"default":12},"on_skip":{"type":"string","enum":["carry_forward","forfeit"],"default":"carry_forward"},"basis":{"type":"string","nullable":true,"enum":["accrual","cash"],"description":"Null (default) means each entity's org default_reporting_basis."},"distribution_type":{"type":"string","enum":["operating_income","capital_event","distribution_in_kind","tax_distribution"],"default":"operating_income"},"base":{"type":"string","enum":["net_income_ex_receipts","zero"],"description":"available_cash is not accepted in this release (its formula is a pending product decision)."},"upstream_basis":{"type":"string","enum":["declared","received"],"default":"declared"},"cash_guard":{"type":"string","enum":["cap","flag","off"],"default":"cap"},"holdback_amount":{"type":"string","nullable":true,"description":"The default every assigned policy inherits unless it overrides it; null means none. Never negative.","example":"1234.50"},"cash_floor":{"type":"string","nullable":true,"description":"The default every assigned policy inherits unless it overrides it; null means none. Never negative.","example":"1234.50"},"min_amount":{"type":"string","nullable":true,"description":"The default every assigned policy inherits unless it overrides it; null means none. Never negative.","example":"1234.50"},"lines":{"default":[],"description":"Ordered add/subtract lines, replaced whole; seq is assigned server-side from array order. A template line names a system role (resolved per assigned entity) or an ORG-WIDE account — an entity's own account belongs on that entity's own lines (422 ACCOUNT_LEGAL_ENTITY_MISMATCH).","type":"array","items":{"$ref":"#/components/schemas/PolicyAdjustmentInputV1Dto"}}},"required":["name","cadence","due_day","base"]},"UpdateDistributionPolicyTemplateV1Dto":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","nullable":true,"maxLength":500},"status":{"type":"string","enum":["active","archived"],"description":"archived is terminal, and refused while live policies are assigned (move them first)."},"cadence":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"]},"due_day":{"type":"integer","minimum":1,"maximum":28},"period_lag":{"type":"integer","minimum":1,"maximum":12},"horizon_months":{"type":"integer","minimum":1,"maximum":36},"on_skip":{"type":"string","enum":["carry_forward","forfeit"]},"basis":{"type":"string","nullable":true,"enum":["accrual","cash"]},"distribution_type":{"type":"string","enum":["operating_income","capital_event","distribution_in_kind","tax_distribution"]},"base":{"type":"string","enum":["net_income_ex_receipts","zero"],"description":"available_cash is not accepted in this release (its formula is a pending product decision)."},"upstream_basis":{"type":"string","enum":["declared","received"]},"cash_guard":{"type":"string","enum":["cap","flag","off"]},"holdback_amount":{"type":"string","nullable":true,"description":"The default every assigned policy inherits unless it overrides it; null means none. Never negative.","example":"1234.50"},"cash_floor":{"type":"string","nullable":true,"description":"The default every assigned policy inherits unless it overrides it; null means none. Never negative.","example":"1234.50"},"min_amount":{"type":"string","nullable":true,"description":"The default every assigned policy inherits unless it overrides it; null means none. Never negative.","example":"1234.50"},"lines":{"description":"Ordered add/subtract lines, replaced whole; seq is assigned server-side from array order. A template line names a system role (resolved per assigned entity) or an ORG-WIDE account — an entity's own account belongs on that entity's own lines (422 ACCOUNT_LEGAL_ENTITY_MISMATCH). An unchanged line keeps its id (and the entities’ exclusions of it); so does a line whose only change is its label (it is renamed in place); a line changed in direction, measure or target is a new line. A new role line every assigned entity must resolve, or 422 MISSING_SYSTEM_ROLE_ACCOUNT names the entities that cannot.","type":"array","items":{"$ref":"#/components/schemas/PolicyAdjustmentInputV1Dto"}}}},"DistributionTemplateAssignmentResultV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"result":{"type":"string","enum":["created","moved","converted","unchanged","failed"],"description":"`created`: a template-based policy was created for an entity with none. `moved`: from another template (overrides and own lines kept, exclusions dropped). `converted`: a custom policy became template-based (baseline, opening undistributed, status, amounts and lines kept). `unchanged`: already on this template. `failed`: see `code`."},"policy_id":{"type":"string","nullable":true,"format":"uuid","description":"The entity's policy; null on a failed row."},"code":{"type":"string","nullable":true,"enum":["LEGAL_ENTITY_NOT_IN_SCOPE","NOT_FOUND","DISTRIBUTION_MANAGED_ENTITY_EXCLUDED","DISTRIBUTION_POLICY_ARCHIVED","MISSING_SYSTEM_ROLE_ACCOUNT","ACCOUNT_LEGAL_ENTITY_MISMATCH","LEDGER_ENTRY_REFUSED","POLICY_ALREADY_EXISTS_FOR_LE"],"description":"Why a failed row failed; null otherwise. Each code means what it means as an error response: the entity is outside the caller's scope, not in the org (NOT_FOUND), managed, has only an archived policy, cannot resolve one of the template's roles, a converted policy's own account line is no longer usable (ACCOUNT_LEGAL_ENTITY_MISMATCH / LEDGER_ENTRY_REFUSED), or lost a race with a concurrent policy create."},"detail":{"type":"string","nullable":true,"description":"A human-readable reason on a failed row; null otherwise."}},"required":["legal_entity_id","result","policy_id","code","detail"]},"AssignDistributionPolicyTemplateV1Dto":{"type":"object","properties":{"legal_entity_ids":{"minItems":1,"maxItems":500,"description":"The legal entities to assign the template to; duplicates are collapsed (one result per distinct id).","type":"array","items":{"type":"string","format":"uuid"}}},"required":["legal_entity_ids"]},"MoveDistributionPolicyTemplateEntitiesV1Dto":{"type":"object","properties":{"to_template_id":{"type":"string","format":"uuid","description":"The active template every live policy on this template moves to; it must be a different template."}},"required":["to_template_id"]},"ScheduledDistributionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"policy_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"due_date":{"type":"string","format":"date"},"covered_period_start":{"type":"string","format":"date","description":"First day covered. Inclusive."},"covered_period_end":{"type":"string","format":"date","description":"Last day covered. Inclusive."},"status":{"type":"string","enum":["scheduled","staged","nothing_to_distribute","approved","rejected","skipped","needs_review","queued","executed","failed","cancelled"]},"depth":{"type":"integer","nullable":true,"description":"How many ownership tiers sit below the entity (0: owns no entity with an item on that due date); null until the item is staged or when the graph has a cycle."},"basis":{"type":"string","nullable":true,"enum":["net_income_ex_receipts","available_cash","zero"],"description":"The basis the amount was computed on; null until staged."},"split_basis":{"type":"string","enum":["pro_rata","waterfall"],"description":"How the item splits among the entity's holders when it executes: `waterfall` when the entity has a waterfall for the item's distribution type in effect on the due date, else `pro_rata` (the cap table). Set when the item is computed; `pro_rata` until then."},"computed_amount":{"type":"string","nullable":true,"example":"1234.50"},"adjusted_amount":{"type":"string","nullable":true,"description":"The amount that will be distributed: the computed one unless an operator changed it.","example":"1234.50"},"position_before":{"type":"string","nullable":true,"example":"1234.50"},"modified":{"type":"boolean","description":"True when `adjusted_amount` differs from `computed_amount`."},"adjustment_reason":{"type":"string","nullable":true,"maxLength":200},"adjustment_note":{"type":"string","nullable":true,"maxLength":2000},"available_cash":{"type":"string","nullable":true,"example":"1234.50"},"cash_shortfall":{"type":"string","nullable":true,"example":"1234.50"},"cash_shortfall_acknowledged":{"type":"boolean"},"flags":{"type":"array","items":{"type":"string","enum":["prior_period_open","cash_shortfall","period_open","no_cash_accounts","downstream_no_policy","upstream_pending","no_cap_table","period_already_declared"]}},"batch_id":{"type":"string","nullable":true,"format":"uuid"},"declaration_id":{"type":"string","nullable":true,"format":"uuid"},"error_code":{"type":"string","nullable":true},"error_detail":{"type":"string","nullable":true},"staged_at":{"type":"string","nullable":true,"format":"date-time"},"decided_by":{"type":"string","nullable":true,"format":"uuid","description":"The user who took the item's last decision (approve, modify, reject, skip or reset); null when none was taken or a non-user principal (an API key) took it — the history keeps the actor kind. A recompute does not change it, so an item returned to review still names its approver."},"decided_at":{"type":"string","nullable":true,"format":"date-time"},"executed_at":{"type":"string","nullable":true,"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","policy_id","legal_entity_id","legal_entity_name","due_date","covered_period_start","covered_period_end","status","depth","basis","split_basis","computed_amount","adjusted_amount","position_before","modified","adjustment_reason","adjustment_note","available_cash","cash_shortfall","cash_shortfall_acknowledged","flags","batch_id","declaration_id","error_code","error_detail","staged_at","decided_by","decided_at","executed_at","created_at","updated_at"]},"ScheduledDistributionEventV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["staged","recomputed","returned_to_review","approved","modified","rejected","skipped","reset","cancelled","reactivated","batched","unbatched","queued","executed","failed","retried","undone"]},"from_status":{"type":"string","enum":["scheduled","staged","nothing_to_distribute","approved","rejected","skipped","needs_review","queued","executed","failed","cancelled"]},"to_status":{"type":"string","enum":["scheduled","staged","nothing_to_distribute","approved","rejected","skipped","needs_review","queued","executed","failed","cancelled"]},"computed_amount":{"type":"string","nullable":true,"example":"1234.50"},"adjusted_amount":{"type":"string","nullable":true,"example":"1234.50"},"reason":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"actor_user_id":{"type":"string","nullable":true,"format":"uuid"},"actor_kind":{"type":"string","enum":["user","api_key","system"]},"detail":{"type":"object","additionalProperties":true,"nullable":true,"description":"Free-form facts the transition recorded (for instance the previous and new baseline of a forfeit skip). Its keys are caller-defined by the event kind and carry no contract."},"created_at":{"type":"string","format":"date-time"}},"required":["kind","from_status","to_status","computed_amount","adjusted_amount","reason","note","actor_user_id","actor_kind","detail","created_at"]},"ScheduledDistributionOwnerSplitV1Dto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CascadePreviewRowV1Dto"}},"total_allocated":{"type":"string","description":"Sum of the direct owners' amounts; equals the item's adjusted amount.","example":"1234.50"}},"required":["rows","total_allocated"]},"WaterfallPreviewLineV1Dto":{"type":"object","properties":{"holder_id":{"type":"string","description":"The position id when the holder has one, else `<class_id>:<party_id>` (a cap-table owner with no position in the class)."},"party_id":{"type":"string","format":"uuid"},"position_id":{"type":"string","format":"uuid","nullable":true},"class_id":{"type":"string","format":"uuid"},"tier_key":{"type":"string","format":"uuid"},"tier_seq":{"type":"number"},"bucket":{"type":"string","enum":["capital","profit","promote"]},"settlement":{"type":"string","enum":["distribution"]},"amount":{"type":"string","example":"1234.50"},"vested_amount":{"type":"string","example":"1234.50"},"held_amount":{"type":"string","example":"1234.50"}},"required":["holder_id","party_id","position_id","class_id","tier_key","tier_seq","bucket","settlement","amount","vested_amount","held_amount"]},"WaterfallPreviewTierV1Dto":{"type":"object","properties":{"tier_key":{"type":"string","format":"uuid"},"seq":{"type":"number"},"kind":{"type":"string","enum":["priority_share","pro_rata"]},"available":{"type":"string","description":"What reached this tier.","example":"1234.50"},"paid_now":{"type":"string","description":"What this tier paid in this split.","example":"1234.50"},"entitled_to_date":{"type":"string","nullable":true,"example":"1234.50"},"paid_to_date":{"type":"string","nullable":true,"example":"1234.50"},"forfeited_to_date":{"type":"string","nullable":true,"example":"1234.50"},"carried":{"type":"string","nullable":true,"example":"1234.50"}},"required":["tier_key","seq","kind","available","paid_now","entitled_to_date","paid_to_date","forfeited_to_date","carried"]},"WaterfallPreviewWindowV1Dto":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"deal_year":{"type":"number"},"version_id":{"type":"string","format":"uuid"},"measure":{"type":"string","nullable":true},"rate":{"type":"string","nullable":true,"description":"The rate in force in the window, scale 9."},"loss_recovered":{"type":"string","nullable":true,"example":"1234.50"},"earned":{"type":"string","example":"1234.50"}},"required":["from","to","deal_year","version_id","measure","rate","loss_recovered","earned"]},"WaterfallPreviewWeightV1Dto":{"type":"object","properties":{"holder_id":{"type":"string"},"percentage":{"type":"string","description":"A percentage at scale 15."}},"required":["holder_id","percentage"]},"WaterfallPreviewTierTraceV1Dto":{"type":"object","properties":{"tier_key":{"type":"string","format":"uuid"},"windows":{"type":"array","items":{"$ref":"#/components/schemas/WaterfallPreviewWindowV1Dto"}},"weights":{"type":"array","items":{"$ref":"#/components/schemas/WaterfallPreviewWeightV1Dto"}}},"required":["tier_key","windows","weights"]},"WaterfallPreviewTraceV1Dto":{"type":"object","properties":{"as_of":{"type":"string","format":"date"},"amount":{"type":"string","example":"1234.50"},"version_id":{"type":"string","format":"uuid","description":"The version the split was computed under."},"tiers":{"type":"array","items":{"$ref":"#/components/schemas/WaterfallPreviewTierTraceV1Dto"}}},"required":["as_of","amount","version_id","tiers"]},"WaterfallPreviewV1Dto":{"type":"object","properties":{"waterfall_id":{"type":"string","format":"uuid"},"version_ids":{"description":"Every version the history was read from, oldest first.","type":"array","items":{"type":"string"}},"lines":{"type":"array","items":{"$ref":"#/components/schemas/WaterfallPreviewLineV1Dto"}},"tiers":{"type":"array","items":{"$ref":"#/components/schemas/WaterfallPreviewTierV1Dto"}},"trace":{"$ref":"#/components/schemas/WaterfallPreviewTraceV1Dto"}},"required":["waterfall_id","version_ids","lines","tiers","trace"]},"OwnedSameDayItemV1Dto":{"type":"object","properties":{"item":{"description":"The owned entity's item as it stands now.","allOf":[{"$ref":"#/components/schemas/ScheduledDistributionV1Dto"}]},"ownership_percentage":{"type":"string","description":"Percent at 15 decimals, e.g. \"60.000000000000000\": how much of that entity this item's entity owns on the due date."},"in_statement":{"type":"boolean","description":"Whether this item's frozen `computation` lists it in `upstream.pending_downstream` (only staged, approved and queued items are). One in review is not, until it is approved and this item is recomputed."},"share":{"type":"string","nullable":true,"description":"This item's entity's part of it, as the statement computed it; null when `in_statement` is false.","example":"1234.50"}},"required":["item","ownership_percentage","in_statement","share"]},"ScheduledDistributionDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"policy_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"due_date":{"type":"string","format":"date"},"covered_period_start":{"type":"string","format":"date","description":"First day covered. Inclusive."},"covered_period_end":{"type":"string","format":"date","description":"Last day covered. Inclusive."},"status":{"type":"string","enum":["scheduled","staged","nothing_to_distribute","approved","rejected","skipped","needs_review","queued","executed","failed","cancelled"]},"depth":{"type":"integer","nullable":true,"description":"How many ownership tiers sit below the entity (0: owns no entity with an item on that due date); null until the item is staged or when the graph has a cycle."},"basis":{"type":"string","nullable":true,"enum":["net_income_ex_receipts","available_cash","zero"],"description":"The basis the amount was computed on; null until staged."},"split_basis":{"type":"string","enum":["pro_rata","waterfall"],"description":"How the item splits among the entity's holders when it executes: `waterfall` when the entity has a waterfall for the item's distribution type in effect on the due date, else `pro_rata` (the cap table). Set when the item is computed; `pro_rata` until then."},"computed_amount":{"type":"string","nullable":true,"example":"1234.50"},"adjusted_amount":{"type":"string","nullable":true,"description":"The amount that will be distributed: the computed one unless an operator changed it.","example":"1234.50"},"position_before":{"type":"string","nullable":true,"example":"1234.50"},"modified":{"type":"boolean","description":"True when `adjusted_amount` differs from `computed_amount`."},"adjustment_reason":{"type":"string","nullable":true,"maxLength":200},"adjustment_note":{"type":"string","nullable":true,"maxLength":2000},"available_cash":{"type":"string","nullable":true,"example":"1234.50"},"cash_shortfall":{"type":"string","nullable":true,"example":"1234.50"},"cash_shortfall_acknowledged":{"type":"boolean"},"flags":{"type":"array","items":{"type":"string","enum":["prior_period_open","cash_shortfall","period_open","no_cash_accounts","downstream_no_policy","upstream_pending","no_cap_table","period_already_declared"]}},"batch_id":{"type":"string","nullable":true,"format":"uuid"},"declaration_id":{"type":"string","nullable":true,"format":"uuid"},"error_code":{"type":"string","nullable":true},"error_detail":{"type":"string","nullable":true},"staged_at":{"type":"string","nullable":true,"format":"date-time"},"decided_by":{"type":"string","nullable":true,"format":"uuid","description":"The user who took the item's last decision (approve, modify, reject, skip or reset); null when none was taken or a non-user principal (an API key) took it — the history keeps the actor kind. A recompute does not change it, so an item returned to review still names its approver."},"decided_at":{"type":"string","nullable":true,"format":"date-time"},"executed_at":{"type":"string","nullable":true,"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"computation":{"nullable":true,"description":"The statement frozen when the item was last computed; null while it is still `scheduled`.","type":"object","allOf":[{"$ref":"#/components/schemas/StatementV1Dto"}]},"history":{"description":"Oldest first.","type":"array","items":{"$ref":"#/components/schemas/ScheduledDistributionEventV1Dto"}},"owner_split":{"nullable":true,"description":"How the adjusted amount splits across the entity's direct owners on the due date; null while the item has no amount (not computed yet, or 0.00), when the entity has no cap table on that date, or when its waterfall cannot be computed on that date.","type":"object","allOf":[{"$ref":"#/components/schemas/ScheduledDistributionOwnerSplitV1Dto"}]},"split":{"nullable":true,"description":"The waterfall split of the adjusted amount on the due date, computed live (what `POST /v1/legal-entities/{id}/waterfall-preview` returns), so it follows the declarations made since the item was computed, until it executes; null once the item is `executed`, `rejected`, `skipped` or `cancelled` (the split an executed item paid is the frozen computation of its declaration), when no waterfall applies on the due date, the item has no amount, or the waterfall cannot be computed on that date (staging and execution report that error on the item). `split_basis` records what applied when the item was last computed.","type":"object","allOf":[{"$ref":"#/components/schemas/WaterfallPreviewV1Dto"}]},"owned_same_day":{"description":"The items due the same day of the legal entities this item's entity owns directly, any status but cancelled, by entity name. Read live, unlike `computation`. Entities outside a scoped caller's legal entities are left out. Empty for an entity that owns none.","type":"array","items":{"$ref":"#/components/schemas/OwnedSameDayItemV1Dto"}}},"required":["id","policy_id","legal_entity_id","legal_entity_name","due_date","covered_period_start","covered_period_end","status","depth","basis","split_basis","computed_amount","adjusted_amount","position_before","modified","adjustment_reason","adjustment_note","available_cash","cash_shortfall","cash_shortfall_acknowledged","flags","batch_id","declaration_id","error_code","error_detail","staged_at","decided_by","decided_at","executed_at","created_at","updated_at","computation","history","owner_split","split","owned_same_day"]},"BulkDecisionResultV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"result":{"type":"string","enum":["applied","skipped_flagged","failed"],"description":"`applied`: the decision was taken. `skipped_flagged`: the item carries a flag a bulk decision does not override (anything but `period_open` and `no_cash_accounts`) and was left alone. `failed`: see `code`."},"status":{"type":"string","nullable":true,"enum":["scheduled","staged","nothing_to_distribute","approved","rejected","skipped","needs_review","queued","executed","failed","cancelled"],"description":"The item status after an applied decision; null otherwise."},"flags":{"type":"array","description":"The flags that stopped a `skipped_flagged` row; else empty.","items":{"type":"string","enum":["prior_period_open","cash_shortfall","period_open","no_cash_accounts","downstream_no_policy","upstream_pending","no_cap_table","period_already_declared"]}},"code":{"type":"string","nullable":true,"description":"Why a failed row failed, with the meaning it has as an error response; null otherwise."},"detail":{"type":"string","nullable":true,"description":"A human-readable reason on a failed row; null otherwise."}},"required":["id","result","status","flags","code","detail"]},"BulkDecideScheduledDistributionsV1Dto":{"type":"object","properties":{"ids":{"minItems":1,"maxItems":500,"description":"The items to decide; each one is decided on its own and reported on its own row.","type":"array","items":{"type":"string","format":"uuid"}},"action":{"type":"string","enum":["approve","reject","skip","reset"],"description":"`modify` is not available in bulk: it needs an amount per item."}},"required":["ids","action"]},"DecideScheduledDistributionV1Dto":{"type":"object","properties":{"action":{"type":"string","enum":["approve","modify","reject","skip","reset"],"description":"`approve` approves the item; refused on `nothing_to_distribute` (modify it first). `modify` sets `adjusted_amount` and returns the item to `staged`, so it must be approved again. `reject` and `skip` close it (final). `reset` puts the computed amount back and returns the item to the status the engine computed (`staged` or `nothing_to_distribute`); an approved item whose amount was already the computed one stays approved."},"adjusted_amount":{"type":"string","description":"The amount to distribute instead of the computed one. Required when `action` is `modify`; ignored by every other action.","example":"1234.50"},"reason":{"type":"string","maxLength":200,"description":"Why the amount differs from the computed one, as free text. Required with a `modify` whose amount differs from the computed amount. Surrounding whitespace is trimmed; a blank value is rejected."},"note":{"type":"string","maxLength":2000},"acknowledge_cash_shortfall":{"type":"boolean","description":"Acknowledges a `cash_shortfall` flag, which an approval of an item exceeding available cash requires."}},"required":["action"]},"DistributionBatchV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending_approval","approved","rejected","executing","completed","completed_with_failures","cancelled"]},"item_count":{"type":"integer"},"total_amount":{"type":"string","description":"The sum of the adjusted amounts of the items currently in the batch, kept live while the batch is live; a cancelled or rejected batch keeps the total it had when it stopped.","example":"1234.50"},"executed_total":{"type":"string","description":"The sum of the items executed so far.","example":"1234.50"},"submitted_by":{"type":"string","format":"uuid","description":"The user who submitted it."},"submitted_at":{"type":"string","format":"date-time"},"executed_at":{"type":"string","nullable":true,"format":"date-time","description":"When the batch last closed; null while it has not."},"cancelled_at":{"type":"string","nullable":true,"format":"date-time"},"cancel_reason":{"type":"string","nullable":true,"maxLength":200},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","status","item_count","total_amount","executed_total","submitted_by","submitted_at","executed_at","cancelled_at","cancel_reason","created_at","updated_at"]},"SubmitDistributionBatchV1Dto":{"type":"object","properties":{"item_ids":{"minItems":1,"maxItems":500,"description":"The approved scheduled distributions to submit as one batch: 1 to 500, all distinct, any entities and due dates. The whole call is refused on the first refused item.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["item_ids"]},"DistributionBatchApprovalRequestV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","approved","rejected","withdrawn"]},"actionable":{"type":"boolean","description":"Whether the caller can decide this request now: true only on the open (`pending`) request, for a member of the organisation who is an eligible approver of its active step and, when that step requires authority, whose approval limit covers the batch total — the check `POST /v1/approvals/{id}/decision` enforces. False for an approver who already decided this step, and for a caller without the `documents:approve` scope. Always false for an API key."}},"required":["id","status","actionable"]},"DistributionBatchListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending_approval","approved","rejected","executing","completed","completed_with_failures","cancelled"]},"item_count":{"type":"integer"},"total_amount":{"type":"string","description":"The sum of the adjusted amounts of the items currently in the batch, kept live while the batch is live; a cancelled or rejected batch keeps the total it had when it stopped.","example":"1234.50"},"executed_total":{"type":"string","description":"The sum of the items executed so far.","example":"1234.50"},"submitted_by":{"type":"string","format":"uuid","description":"The user who submitted it."},"submitted_at":{"type":"string","format":"date-time"},"executed_at":{"type":"string","nullable":true,"format":"date-time","description":"When the batch last closed; null while it has not."},"cancelled_at":{"type":"string","nullable":true,"format":"date-time"},"cancel_reason":{"type":"string","nullable":true,"maxLength":200},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"submitted_by_name":{"type":"string","nullable":true,"description":"The submitter's display name — their first and last name in the organisation, from a live or a deactivated membership; falls back to their email when no name is on file; null when neither exists."},"approval_request":{"nullable":true,"description":"The open approval request if there is one, else the latest, else null (no rule matched the batch).","type":"object","allOf":[{"$ref":"#/components/schemas/DistributionBatchApprovalRequestV1Dto"}]}},"required":["id","status","item_count","total_amount","executed_total","submitted_by","submitted_at","executed_at","cancelled_at","cancel_reason","created_at","updated_at","submitted_by_name","approval_request"]},"DistributionBatchCountsV1Dto":{"type":"object","properties":{"items":{"type":"integer","description":"Items in the batch now."},"flagged":{"type":"integer","description":"Items carrying at least one flag."},"modified":{"type":"integer","description":"Items whose adjusted amount differs from the computed one."},"shortfalls":{"type":"integer","description":"Items with a cash shortfall above zero."}},"required":["items","flagged","modified","shortfalls"]},"DistributionBatchDueDatesV1Dto":{"type":"object","properties":{"from":{"type":"string","nullable":true,"format":"date"},"to":{"type":"string","nullable":true,"format":"date"}},"required":["from","to"]},"DistributionBatchEntityV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]},"DistributionBatchItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"due_date":{"type":"string","format":"date"},"depth":{"type":"integer","nullable":true,"description":"How many ownership tiers sit below the entity; the item waves run lowest first."},"status":{"type":"string","enum":["scheduled","staged","nothing_to_distribute","approved","rejected","skipped","needs_review","queued","executed","failed","cancelled"]},"adjusted_amount":{"type":"string","nullable":true,"example":"1234.50"},"flags":{"type":"array","items":{"type":"string","enum":["prior_period_open","cash_shortfall","period_open","no_cash_accounts","downstream_no_policy","upstream_pending","no_cap_table","period_already_declared"]}},"error_code":{"type":"string","nullable":true},"error_detail":{"type":"string","nullable":true},"declaration_id":{"type":"string","nullable":true,"format":"uuid","description":"The declaration this item executed; null until it executes. An undo takes the item out of the batch."}},"required":["id","legal_entity_id","legal_entity_name","due_date","depth","status","adjusted_amount","flags","error_code","error_detail","declaration_id"]},"DistributionBatchCardV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending_approval","approved","rejected","executing","completed","completed_with_failures","cancelled"]},"item_count":{"type":"integer"},"total_amount":{"type":"string","description":"The sum of the adjusted amounts of the items currently in the batch, kept live while the batch is live; a cancelled or rejected batch keeps the total it had when it stopped.","example":"1234.50"},"executed_total":{"type":"string","description":"The sum of the items executed so far.","example":"1234.50"},"submitted_by":{"type":"string","format":"uuid","description":"The user who submitted it."},"submitted_at":{"type":"string","format":"date-time"},"executed_at":{"type":"string","nullable":true,"format":"date-time","description":"When the batch last closed; null while it has not."},"cancelled_at":{"type":"string","nullable":true,"format":"date-time"},"cancel_reason":{"type":"string","nullable":true,"maxLength":200},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"submitted_by_name":{"type":"string","nullable":true,"description":"The submitter's display name — their first and last name in the organisation, from a live or a deactivated membership; falls back to their email when no name is on file; null when neither exists."},"approval_request":{"nullable":true,"description":"The open approval request if there is one, else the latest, else null (no rule matched the batch).","type":"object","allOf":[{"$ref":"#/components/schemas/DistributionBatchApprovalRequestV1Dto"}]},"counts":{"$ref":"#/components/schemas/DistributionBatchCountsV1Dto"},"due_dates":{"$ref":"#/components/schemas/DistributionBatchDueDatesV1Dto"},"entities":{"type":"array","items":{"$ref":"#/components/schemas/DistributionBatchEntityV1Dto"}},"items":{"type":"array","items":{"$ref":"#/components/schemas/DistributionBatchItemV1Dto"}}},"required":["id","status","item_count","total_amount","executed_total","submitted_by","submitted_at","executed_at","cancelled_at","cancel_reason","created_at","updated_at","submitted_by_name","approval_request","counts","due_dates","entities","items"]},"CancelDistributionBatchV1Dto":{"type":"object","properties":{"reason":{"type":"string","maxLength":200,"description":"Why the batch is cancelled, as free text. Surrounding whitespace is trimmed; a blank value is rejected."}}},"DistributionEntitySummaryPolicyV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["active","paused"]},"template":{"nullable":true,"description":"Null on a custom policy.","type":"object","allOf":[{"$ref":"#/components/schemas/DistributionPolicyTemplateRefV1Dto"}]},"cadence":{"type":"string","enum":["monthly","quarterly","semi_annual","annual"],"description":"The cadence the policy computes with (its own, or its template’s)."}},"required":["id","status","template","cadence"]},"DistributionEntitySummaryPositionV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"The position at the latest computation, less that item’s amount once approved, queued or executed. Not today’s position.","example":"1234.50"},"as_of":{"type":"string","format":"date","description":"The due date of the item the position was computed for."}},"required":["amount","as_of"]},"DistributionEntitySummaryV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"policy":{"nullable":true,"description":"The active or paused policy; null when there is none.","type":"object","allOf":[{"$ref":"#/components/schemas/DistributionEntitySummaryPolicyV1Dto"}]},"next_due_date":{"type":"string","format":"date","nullable":true,"description":"Earliest due date of an item still scheduled."},"pending_count":{"type":"integer","description":"Items waiting for a decision: staged, needs review, or below the minimum."},"position":{"nullable":true,"description":"Null when no item was computed yet.","type":"object","allOf":[{"$ref":"#/components/schemas/DistributionEntitySummaryPositionV1Dto"}]},"ytd_distributed":{"type":"string","description":"Active declarations dated in the fiscal year containing the org’s today.","example":"1234.50"},"fiscal_year_from":{"type":"string","format":"date"},"fiscal_year_to":{"type":"string","format":"date"}},"required":["legal_entity_id","legal_entity_name","policy","next_due_date","pending_count","position","ytd_distributed","fiscal_year_from","fiscal_year_to"]},"DistributionTimelineEntryV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["declaration","scheduled_distribution"],"description":"`declaration`: a distribution declared (manual or scheduled; an undone one stays, as `undone`). `scheduled_distribution`: an item in any status but executed and cancelled."},"id":{"type":"string","format":"uuid","description":"The declaration's or the scheduled item's id, by `kind`."},"date":{"type":"string","format":"date","description":"A declaration's date, or an item's due date."},"amount":{"type":"string","nullable":true,"description":"A declaration's total, or an item's adjusted amount (null until it is staged).","example":"1234.50"},"status":{"type":"string","enum":["active","undone","scheduled","staged","nothing_to_distribute","approved","rejected","skipped","needs_review","queued","executed","failed","cancelled"],"description":"A declaration's status (`active`, `undone`) or an item's status."},"source":{"type":"string","nullable":true,"enum":["manual","scheduled"],"description":"How a declaration was created; null on an item."},"distribution_type":{"type":"string","nullable":true,"description":"A declaration's distribution type; null on an item."},"covered_period_start":{"type":"string","nullable":true,"format":"date"},"covered_period_end":{"type":"string","nullable":true,"format":"date"},"scheduled_distribution_id":{"type":"string","nullable":true,"format":"uuid","description":"The item an item entry is, or the item a scheduled declaration came from."},"declaration_id":{"type":"string","nullable":true,"format":"uuid","description":"The declaration a declaration entry is, or the one an item produced."},"flags":{"type":"array","description":"An item's flags; empty on a declaration.","items":{"type":"string","enum":["prior_period_open","cash_shortfall","period_open","no_cash_accounts","downstream_no_policy","upstream_pending","no_cap_table","period_already_declared"]}}},"required":["kind","id","date","amount","status","source","distribution_type","covered_period_start","covered_period_end","scheduled_distribution_id","declaration_id","flags"]},"DistributionTimelineV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"from_date":{"type":"string","format":"date"},"to_date":{"type":"string","format":"date"},"entries":{"description":"Sorted by date, then declarations before items, then id. Executed items appear as their declaration; cancelled items are omitted.","type":"array","items":{"$ref":"#/components/schemas/DistributionTimelineEntryV1Dto"}}},"required":["legal_entity_id","from_date","to_date","entries"]},"WaterfallPreviewRequestV1Dto":{"type":"object","properties":{"distribution_type":{"type":"string","enum":["operating_income","capital_event","distribution_in_kind","tax_distribution"],"description":"The distribution's type. The entity's waterfall of this type splits it, else its `any` waterfall. `distribution_in_kind` and `tax_distribution` never go through a waterfall and are refused."},"amount":{"type":"string","description":"The amount to split. Greater than zero.","example":"1234.50"},"as_of":{"type":"string","format":"date","description":"The date the split is computed on: the cap table, positions and the effective waterfall version are read as of it."},"version_id":{"type":"string","format":"uuid","description":"The waterfall's open draft (`draft` or `pending_approval`), to preview it appended to the waterfall's active history from its effective date. Nothing is stored either way."}},"required":["distribution_type","amount","as_of"]},"DistributionsOverviewFigureV1Dto":{"type":"object","properties":{"count":{"type":"integer","description":"How many items, batches or declarations the figure covers."},"total":{"type":"string","description":"Sum of the amounts the count covers.","example":"1234.50"}},"required":["count","total"]},"DistributionsOverviewYtdFigureV1Dto":{"type":"object","properties":{"count":{"type":"integer","description":"How many items, batches or declarations the figure covers."},"total":{"type":"string","description":"Sum of the amounts the count covers.","example":"1234.50"},"fiscal_year_from":{"type":"string","format":"date","description":"First day of the fiscal year containing the org’s today."},"fiscal_year_to":{"type":"string","format":"date","description":"Last day of the fiscal year containing the org’s today."}},"required":["count","total","fiscal_year_from","fiscal_year_to"]},"DistributionsOverviewV1Dto":{"type":"object","properties":{"to_decide":{"description":"Scheduled items staged, needing review, below the minimum or approved that are in no batch; total is their adjusted amounts.","allOf":[{"$ref":"#/components/schemas/DistributionsOverviewFigureV1Dto"}]},"awaiting_approval":{"description":"Batches pending approval. A batch with an item outside the caller’s entities is left out.","allOf":[{"$ref":"#/components/schemas/DistributionsOverviewFigureV1Dto"}]},"in_progress":{"description":"Batches executing or completed with failures. A batch with an item outside the caller’s entities is left out.","allOf":[{"$ref":"#/components/schemas/DistributionsOverviewFigureV1Dto"}]},"distributed_fiscal_ytd":{"description":"Active declarations dated in the fiscal year containing the org’s today.","allOf":[{"$ref":"#/components/schemas/DistributionsOverviewYtdFigureV1Dto"}]}},"required":["to_decide","awaiting_approval","in_progress","distributed_fiscal_ytd"]},"DistributionRefundV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"},"position_id":{"type":"string","nullable":true,"format":"uuid","description":"The position the capital event landed on; null when none was written (the holder has no position, or the date is before the ledger start)."},"refund_date":{"type":"string","format":"date"},"amount":{"type":"string","example":"1234.50"},"bucket":{"type":"string","enum":["profit","capital","pref"]},"distribution_declaration_id":{"type":"string","nullable":true,"format":"uuid"},"memo":{"type":"string","nullable":true},"external_ref":{"type":"string","nullable":true,"description":"Another system's key for this record, unique in the org; set by an importer."},"holder_external_ref":{"type":"string","nullable":true},"refund_document_id":{"type":"string","format":"uuid","description":"The entity's `distribution_refund` document."},"holder_document_id":{"type":"string","nullable":true,"format":"uuid","description":"The in-group holder's `distribution_refund_payable`; null for an outside holder or when the holder's side was omitted."},"capital_event_id":{"type":"string","nullable":true,"format":"uuid"},"voided_at":{"type":"string","nullable":true,"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","legal_entity_id","party_id","position_id","refund_date","amount","bucket","distribution_declaration_id","memo","external_ref","holder_external_ref","refund_document_id","holder_document_id","capital_event_id","voided_at","created_at","updated_at"]},"CreateDistributionRefundV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid","description":"The entity that distributed and receives the money back."},"party_id":{"type":"string","format":"uuid","description":"The holder that refunds."},"position_id":{"type":"string","format":"uuid","description":"The holder's equity position in the entity. Needed only when the holder has more than one active position there."},"refund_date":{"type":"string","format":"date","description":"The refund's date on the entity's books (YYYY-MM-DD)."},"amount":{"type":"string","description":"The amount paid back. Greater than zero.","example":"1234.50"},"bucket":{"type":"string","enum":["profit","capital","pref"],"default":"profit","description":"Which distributed column of the holder's capital account it reduces: `profit` (default; draws), `capital` (a return of capital given back) or `pref`."},"distribution_declaration_id":{"type":"string","format":"uuid","description":"The declaration it refunds, when known. It must be of this entity and have paid this holder."},"memo":{"type":"string","maxLength":2000},"external_ref":{"type":"string","nullable":true,"minLength":1,"maxLength":200,"description":"Another system's key for this record, unique in the org; set by an importer."},"holder_side":{"type":"boolean","description":"In-group holder only: record the holder's own side (its payable). Default true; false when the holder has no counterpart in its books. Ignored for an outside holder."},"holder_date":{"type":"string","format":"date","description":"In-group holder only: the date of the holder's side on its own books. Defaults to `refund_date`."},"holder_external_ref":{"type":"string","minLength":1,"maxLength":200,"description":"In-group holder only: the loader's reference for the holder's side, unique per org like `external_ref`."}},"required":["legal_entity_id","party_id","refund_date","amount"]},"SearchHitV1Dto":{"type":"object","properties":{"kind":{"type":"string","description":"Result type — a document type (`invoice`, `bill`, …) or an entity kind (`party`, `property`, `space`, `contract`, …). The client maps this to a route; the API deliberately returns no URL. There is one kind per navigable page and no sub-type beside it, which is why a property and a space are two kinds rather than one.","example":"invoice"},"id":{"type":"string","description":"Id of the record in its own table."},"property_id":{"type":"string","nullable":true,"description":"The property this result belongs to — its own id when `kind` is `property`, its parent property when `kind` is `space`, null for every other kind. A space has no page of its own, so this is what a client opens for one; the API still returns no URL, only the identifier.","example":"3f1a7c62-9d84-4b1e-8f2a-6c5d0e7b1a93"},"title":{"type":"string","example":"1042"},"subtitle":{"type":"string","nullable":true,"example":"August rent - Suite 300"},"amount":{"type":"string","nullable":true,"example":"1250.00"},"date":{"type":"string","nullable":true,"example":"2026-08-01"},"status":{"type":"string","nullable":true,"description":"Voided and reversed records remain searchable.","example":"posted"},"legal_entity_id":{"type":"string","nullable":true},"legal_entity_name":{"type":"string","nullable":true},"party_id":{"type":"string","nullable":true},"party_name":{"type":"string","nullable":true},"score":{"type":"number","description":"Relevance score, recency-weighted."}},"required":["kind","id","title","score"]},"SearchMetaV1Dto":{"type":"object","properties":{"limit":{"type":"number","description":"Page size actually applied."},"offset":{"type":"number","description":"Rows skipped."},"has_more":{"type":"boolean","description":"Another page exists past this one. Determined by over-fetching one row, so it does not report a page that turns out to be empty."}},"required":["limit","offset","has_more"]},"ResolveMetaV1Dto":{"type":"object","properties":{"count":{"type":"number","description":"Number of refs that resolved to a readable row."}},"required":["count"]},"ReindexResultV1Dto":{"type":"object","properties":{"job_id":{"type":"string","description":"Queued job id, or the dedup key when an identical rebuild is already running."},"dedup_key":{"type":"string","description":"Stable key for this rebuild request. A second call with the same scope while one is running returns this and enqueues nothing."}},"required":["job_id","dedup_key"]},"ReindexV1Dto":{"type":"object","properties":{"table":{"type":"string","enum":["parties","legal_entities","documents","properties","spaces","contracts","loans","bank_accounts","bank_transactions","accounts","items","ticket","parcels","re_tax_bills","tax_rates"],"description":"Rebuild only this source table. Omit to rebuild every indexed table for the org.","example":"properties"},"batch_size":{"type":"number","minimum":100,"maximum":10000,"description":"Rows read per keyset page. Lower it to reduce load on a busy database; the default suits a routine rebuild.","example":2000}}},"ParcelV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid"},"apn":{"type":"string","description":"Assessor Parcel Number (APN)."},"name":{"type":"string"},"jurisdiction":{"type":"string","nullable":true},"assessed_value":{"type":"string","nullable":true,"description":"Most recent assessed value in USD.","example":"1234.50"},"assessment_year":{"type":"number","nullable":true,"description":"Assessment year."},"legal_entity_id":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["active","inactive"]},"state":{"type":"string","nullable":true,"description":"State where the parcel is located."},"city":{"type":"string","nullable":true,"description":"City where the parcel is located."}},"required":["id","property_id","apn","name","status"]},"CreateParcelV1Dto":{"type":"object","properties":{"property_id":{"type":"string","format":"uuid","description":"UUID of the property this parcel belongs to."},"apn":{"type":"string","maxLength":100,"description":"Assessor Parcel Number (APN) assigned by the local assessor."},"name":{"type":"string","maxLength":200,"description":"Human-readable name for this parcel."},"jurisdiction":{"type":"string","maxLength":200,"description":"Taxing jurisdiction name (e.g. \"Los Angeles County\")."},"assessed_value":{"type":"string","description":"Most recent assessed value of the parcel in USD.","example":"1500000.00"},"assessment_year":{"type":"number","description":"Assessment year (e.g. 2024).","minimum":1900,"maximum":2200,"example":2024},"legal_entity_id":{"type":"string","format":"uuid","description":"Legal entity that owns or is responsible for this parcel."},"state":{"type":"string","maxLength":100,"description":"State where the parcel is located (e.g. \"CA\")."},"city":{"type":"string","maxLength":200,"description":"City where the parcel is located."}},"required":["property_id","apn","name"]},"UpdateParcelV1Dto":{"type":"object","properties":{"property_id":{"type":"string","format":"uuid"},"apn":{"type":"string","maxLength":100},"name":{"type":"string","maxLength":200},"jurisdiction":{"type":"string","maxLength":200},"assessed_value":{"type":"string","example":"1234.50"},"assessment_year":{"type":"number","minimum":1900,"maximum":2200},"legal_entity_id":{"type":"string","format":"uuid"},"is_active":{"type":"boolean","default":true},"state":{"type":"string","maxLength":100},"city":{"type":"string","maxLength":200}}},"ReTaxLatestPeriodV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"tax_year":{"type":"number"},"status":{"type":"string","enum":["open","active","closed"]}},"required":["id","tax_year","status"]},"ReTaxParcelSummaryV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid","nullable":true},"apn":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}},"required":["id","property_id"]},"PartyRefV1Dto":{"type":"object","properties":{"party_id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true}},"required":["party_id","name"]},"NextPaymentV1Dto":{"type":"object","properties":{"date":{"type":"string","format":"date"},"amount":{"type":"string","nullable":true,"description":"Null only for an estimate whose slot carries no estimated amount. billed: the open balance on the payable; estimate: the schedule slot's estimated amount; tenant: the bill total a tenant pays directly.","example":"1234.50"},"amount_source":{"type":"string","enum":["billed","estimate","tenant"],"description":"billed — an entered bill/invoice still owed by the org; estimate — a scheduled installment with no bill entered yet; tenant — a bill whose whole org share is zero, paid directly by tenants."},"date_status":{"type":"string","enum":["upcoming","due_today","late"],"description":"Relative to the org's today. No grace period."},"days_until":{"type":"number"},"days_past_due":{"type":"number"},"installment_index":{"type":"number","nullable":true,"description":"1-based position among the term/period's scheduled installments; null for an unplanned bill."},"installment_count":{"type":"number","nullable":true},"source_id":{"type":"string","format":"uuid","description":"The bill/invoice id (billed, tenant) or the slot id (estimate)."},"slot_id":{"type":"string","format":"uuid","nullable":true},"payee":{"nullable":true,"description":"Who gets paid: the bill's own issuer/vendor once billed, else the term/period's default payee.","type":"object","allOf":[{"$ref":"#/components/schemas/PartyRefV1Dto"}]}},"required":["date","amount","amount_source","date_status","days_until","days_past_due","installment_index","installment_count","source_id","slot_id","payee"]},"PastDueV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"What the org owes, past its due date.","example":"1234.50"},"count":{"type":"number","description":"Past-due bills plus past unbilled installments."}},"required":["amount","count"]},"ReTaxCurrentPeriodV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"tax_year":{"type":"number"},"start_date":{"type":"string","format":"date","description":"First day of the period window."},"end_date":{"type":"string","format":"date","description":"Last day (inclusive) of the window."},"status":{"type":"string","enum":["open","active","closed"]}},"required":["id","tax_year","start_date","end_date","status"]},"ReTaxRowAttentionV1Dto":{"type":"object","properties":{"bill_expected_missing":{"type":"boolean","description":"A scheduled bill whose date has passed with no bill entered."},"tenant_share_unpaid":{"type":"boolean","description":"A tenant share past its due date and unpaid."},"appeal_deadline_on":{"type":"string","format":"date","nullable":true,"description":"The soonest appeal deadline within the attention lead (30 days), else null."},"delinquent":{"type":"boolean","description":"A bill past its delinquency date with the AP bill still open."},"config_problem":{"type":"boolean","description":"A configuration problem the attention provider flags. Row tag only — it does not put a row in the needs_attention view."}},"required":["bill_expected_missing","tenant_share_unpaid","appeal_deadline_on","delinquent","config_problem"]},"ReTaxListRowV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"parcel_id":{"type":"string","format":"uuid"},"tax_type":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"notes":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true},"latest_period":{"nullable":true,"description":"Most recent period of this tax by tax_year, or null.","type":"object","allOf":[{"$ref":"#/components/schemas/ReTaxLatestPeriodV1Dto"}]},"parcel":{"description":"Parcel summary — display labels for the registry list.","allOf":[{"$ref":"#/components/schemas/ReTaxParcelSummaryV1Dto"}]},"property_name":{"type":"string","description":"Name of the parcel's property.","example":"Birch Tower"},"owed_to_authorities":{"type":"string","description":"This tax's own open AP balance — the same rule as ReTaxSummaryV1Dto.owed_to_authorities (`status = posted AND balance_amount > 0`), scoped to this tax's active bills instead of the whole org. Numeric string; '0' when nothing is owed."},"pending_tenant_reimbursement":{"type":"string","description":"This tax's own open AR balance from invoiced reimbursement shares of either method — the same scope as ReTaxSummaryV1Dto.pending_tenant_reimbursement (a legacy via-CAM share with no invoice is excluded; the CAM invoice collects it). Numeric string; '0' when nothing is pending."},"pending_landlord_direct":{"type":"string","description":"This tax's own landlord-direct-pay share amounts — not document balances — for shares whose AP bill is still open, mirroring ReTaxSummaryV1Dto.pending_landlord_direct. Numeric string; '0' when nothing is pending."},"pending_tenant_direct":{"type":"string","description":"This tax's own tenant-direct-pay share amounts — not document balances — for shares not yet marked paid, mirroring ReTaxSummaryV1Dto.pending_tenant_direct. Numeric string; '0' when nothing is pending."},"next_payment":{"nullable":true,"description":"The earliest payment still ahead (or overdue): an open billed bill on ANY period, else a scheduled installment with no bill on a period not closed, else a tenant-paid bill.","type":"object","allOf":[{"$ref":"#/components/schemas/NextPaymentV1Dto"}]},"past_due":{"$ref":"#/components/schemas/PastDueV1Dto"},"current_period":{"nullable":true,"description":"The period whose window contains the org's today; else the newest tax year.","type":"object","allOf":[{"$ref":"#/components/schemas/ReTaxCurrentPeriodV1Dto"}]},"attention":{"$ref":"#/components/schemas/ReTaxRowAttentionV1Dto"}},"required":["id","parcel_id","tax_type","status","created_at","parcel","property_name","owed_to_authorities","pending_tenant_reimbursement","pending_landlord_direct","pending_tenant_direct","next_payment","past_due","current_period","attention"]},"ReTaxParticipationParcelV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"apn":{"type":"string"},"name":{"type":"string"}},"required":["id","apn","name"]},"ReTaxParticipationV1Dto":{"type":"object","properties":{"tax_id":{"type":"string","format":"uuid"},"parcel":{"$ref":"#/components/schemas/ReTaxParticipationParcelV1Dto"},"tax_type":{"type":"string"},"period_id":{"type":"string","format":"uuid"},"tax_year":{"type":"number"},"period_start":{"type":"string","format":"date","description":"First day of the period's window, 'YYYY-MM-DD', inclusive. A non-Jan-1 start means a fiscal-year period."},"period_end":{"type":"string","format":"date","description":"Last day of the period's window, 'YYYY-MM-DD', inclusive."},"share_basis":{"type":"string","enum":["negotiated","sqft"]},"share_pct":{"type":"string","nullable":true,"description":"Null for 'sqft' — resolved at bill input."},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"`tenant_direct_pay`: the tenant pays the taxing authority. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."}},"required":["tax_id","parcel","tax_type","period_id","tax_year","period_start","period_end","share_basis","method"]},"ReTaxMetricGroupV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"Numeric string — no float math."},"count":{"type":"number"}},"required":["amount","count"]},"DueSoonV1Dto":{"type":"object","properties":{"amount":{"type":"string","example":"1234.50"},"count":{"type":"number"},"next_date":{"type":"string","format":"date","nullable":true}},"required":["amount","count","next_date"]},"ReTaxAppealDeadlinesV1Dto":{"type":"object","properties":{"count":{"type":"number"},"soonest":{"type":"string","format":"date","nullable":true}},"required":["count","soonest"]},"ReTaxSummaryV1Dto":{"type":"object","properties":{"owed_to_authorities":{"description":"Open balance on the AP bills. \"Open\" is `status = posted AND balance_amount > 0`, the same rule `Documents.summary` uses, so the two cannot disagree. The AP bill is posted for `total_amount − Σ tenant_direct_pay`, so this amount already excludes tenant-direct dollars by construction.","allOf":[{"$ref":"#/components/schemas/ReTaxMetricGroupV1Dto"}]},"pending_tenant_reimbursement":{"description":"Open balance on AR invoices raised from tax shares. Counts both reimbursement methods through the share's own invoice: `tenant_reimbursement` and `tenant_reimbursement_via_cam` (invoiced as a CAM estimate). A legacy via-CAM share with no invoice is collected by the CAM invoice and excluded, and the two direct-pay methods are tracked by their own cards below, not as receivables from tenants.","allOf":[{"$ref":"#/components/schemas/ReTaxMetricGroupV1Dto"}]},"pending_landlord_direct":{"description":"Landlord-direct-pay share amounts — not document balances — for shares whose AP bill is still open (or has no AP document, which happens only when the share amount rounded to zero, or the AP document was deleted).","allOf":[{"$ref":"#/components/schemas/ReTaxMetricGroupV1Dto"}]},"pending_tenant_direct":{"description":"Tenant-direct-pay share amounts — not document balances — for shares not yet marked paid. `paid_date` is the manual spine for this method only.","allOf":[{"$ref":"#/components/schemas/ReTaxMetricGroupV1Dto"}]},"due_30d":{"description":"What the org pays in the next 30 days, late included — exactly the rows of the registry's `view=due_30`.","allOf":[{"$ref":"#/components/schemas/DueSoonV1Dto"}]},"past_due":{"description":"Everything past due — the registry's `past_due` column summed.","allOf":[{"$ref":"#/components/schemas/PastDueV1Dto"}]},"appeal_deadlines_60d":{"description":"Appeal deadlines on entered bills from today to 60 days ahead.","allOf":[{"$ref":"#/components/schemas/ReTaxAppealDeadlinesV1Dto"}]},"annual_tax_current":{"description":"Gross tax of each tax's current period: each installment's entered bill total, else its estimate, plus bills entered outside the schedule — before any tenant split. `count` is the number of taxes with a current period.","allOf":[{"$ref":"#/components/schemas/ReTaxMetricGroupV1Dto"}]}},"required":["owed_to_authorities","pending_tenant_reimbursement","pending_landlord_direct","pending_tenant_direct","due_30d","past_due","appeal_deadlines_60d","annual_tax_current"]},"ReTaxBillShareV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bill_id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"share_basis":{"type":"string","enum":["negotiated","sqft"],"description":"Which rule produced the frozen percentage below."},"share_pct":{"type":"string","description":"The frozen percentage, numeric(7,4) as a decimal string. Always present — a bill resolves every share at input, whatever basis produced it.","example":"13.8710"},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"`tenant_direct_pay`: the tenant pays the taxing authority. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."},"amount":{"type":"string"},"invoice_document_id":{"type":"string","format":"uuid","nullable":true},"paid_date":{"type":"string","format":"date","nullable":true},"paid_note":{"type":"string","nullable":true},"paid":{"type":"boolean","nullable":true,"description":"Derived paid-state (period-workspace read only). Tri-state: true = settled, false = still owed, null = no information (do NOT render as unpaid). null for every method when the bill is voided (nothing is owed on a retracted bill, even if paid_date is still set); otherwise: tenant_direct_pay — paid_date is set; tenant_reimbursement — the invoice document is posted with a zero balance, or null if that document has been voided/reversed/deleted; landlord_direct_pay — follows landlord_paid; tenant_reimbursement_via_cam — follows its own invoice like tenant_reimbursement, or null for a legacy share with no invoice (collected by the CAM invoice)."},"contract_title":{"type":"string","example":"Suite 300 lease"},"counterparty_name":{"type":"string","nullable":true,"example":"Acme Corp"}},"required":["id","bill_id","contract_id","share_basis","share_pct","method","amount","contract_title","counterparty_name"]},"MarkReTaxSharePaidV1Dto":{"type":"object","properties":{"paid_date":{"type":"string","format":"date"},"note":{"type":"string","nullable":true}},"required":["paid_date"]},"ReTaxBillAttachmentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bill_id":{"type":"string","format":"uuid"},"share_id":{"type":"string","nullable":true,"format":"uuid"},"kind":{"type":"string","enum":["tax_bill","proof_of_payment"],"description":"The original tax bill (bill-level, no share_id) or proof that a share's direct-pay was made (share-level, share_id required)."},"file_name":{"type":"string","description":"Original filename supplied by the client."},"content_type":{"type":"string","enum":["application/pdf","image/png","image/jpeg","image/webp"]},"size_bytes":{"type":"number","description":"File size in bytes."},"uploaded_by":{"type":"string","nullable":true,"format":"uuid"},"created_at":{"type":"string","format":"date-time"}},"required":["id","bill_id","kind","file_name","content_type","size_bytes","created_at"]},"ReTaxBillAttachmentDownloadUrlV1Dto":{"type":"object","properties":{"url":{"type":"string","description":"Short-lived Supabase signed URL. Treat as opaque; do not bookmark."}},"required":["url"]},"ReTaxPeriodV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"tax_id":{"type":"string","format":"uuid"},"tax_year":{"type":"number"},"period_start_month":{"type":"number","description":"Month (1-12) the period starts in; with the day, anchors the window."},"period_start_day":{"type":"number","description":"Day of month the period starts on."},"period_start":{"type":"string","format":"date","description":"First day of the period's window, 'YYYY-MM-DD', inclusive. Derived from tax_year and the tax's period start month and day."},"period_end":{"type":"string","format":"date","description":"Last day of the period's window, 'YYYY-MM-DD', inclusive. Derived from tax_year and the tax's period start month and day; one year after the start, less a day."},"status":{"type":"string","enum":["open","active","closed"]},"payee_party_id":{"type":"string","format":"uuid","nullable":true},"expense_account_id":{"type":"string","format":"uuid","nullable":true,"description":"NULL falls back to the property_tax_expense system role."},"recovery_group_id":{"type":"string","format":"uuid","nullable":true,"description":"NULL = no CAM regime for this period."},"denominator_basis":{"type":"string","enum":["participant_area","fixed_area"]},"fixed_area_sqft":{"type":"string","nullable":true,"description":"The whole-building area used when denominator_basis is fixed_area."},"notes":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true},"payee_party_name":{"type":"string","nullable":true,"example":"Hamilton County Treasurer"},"expense_account_code":{"type":"string","nullable":true,"example":"6120"},"expense_account_name":{"type":"string","nullable":true,"example":"Property Taxes"},"recovery_group_name":{"type":"string","nullable":true,"example":"Birch Tower — CAM 2026"}},"required":["id","tax_id","tax_year","period_start_month","period_start_day","period_start","period_end","status","denominator_basis","created_at","payee_party_name","expense_account_code","expense_account_name","recovery_group_name"]},"ReTaxDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"parcel_id":{"type":"string","format":"uuid"},"tax_type":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"notes":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true},"latest_period":{"nullable":true,"description":"Most recent period of this tax by tax_year, or null.","type":"object","allOf":[{"$ref":"#/components/schemas/ReTaxLatestPeriodV1Dto"}]},"parcel":{"description":"Parcel summary — display labels for the registry list.","allOf":[{"$ref":"#/components/schemas/ReTaxParcelSummaryV1Dto"}]},"property_name":{"type":"string","description":"Name of the parcel's property.","example":"Birch Tower"},"periods":{"type":"array","items":{"$ref":"#/components/schemas/ReTaxPeriodV1Dto"}}},"required":["id","parcel_id","tax_type","status","created_at","parcel","property_name","periods"]},"ReTaxV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"parcel_id":{"type":"string","format":"uuid"},"tax_type":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"notes":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true},"latest_period":{"nullable":true,"description":"Most recent period of this tax by tax_year, or null.","type":"object","allOf":[{"$ref":"#/components/schemas/ReTaxLatestPeriodV1Dto"}]},"parcel":{"description":"Parcel summary — display labels for the registry list.","allOf":[{"$ref":"#/components/schemas/ReTaxParcelSummaryV1Dto"}]},"property_name":{"type":"string","description":"Name of the parcel's property.","example":"Birch Tower"}},"required":["id","parcel_id","tax_type","status","created_at","parcel","property_name"]},"CreateReTaxInitialPeriodV1Dto":{"type":"object","properties":{"tax_year":{"type":"number","minimum":1900,"maximum":2200,"example":2026},"period_start_month":{"type":"number","minimum":1,"maximum":12,"example":7,"description":"Month the period starts in (1-12). A period runs one year from tax_year-month-day. Omitted: inherited from the prior period when inheriting, else 1 (January)."},"period_start_day":{"type":"number","minimum":1,"maximum":31,"example":1,"description":"Day of the month the period starts on. Must exist every year: Feb 29 and the 31st of a 30-day month are rejected. Omitted: inherited like period_start_month, else 1."},"payee_party_id":{"type":"string","format":"uuid","nullable":true},"expense_account_id":{"type":"string","format":"uuid","nullable":true},"recovery_group_id":{"type":"string","format":"uuid","nullable":true,"description":"NULL = no CAM regime for this period."}},"required":["tax_year"]},"CreateReTaxV1Dto":{"type":"object","properties":{"parcel_id":{"type":"string","format":"uuid"},"tax_type":{"type":"string","enum":["city","township","county","school","real_estate","franchise","special_assessment","other"]},"notes":{"type":"string","nullable":true},"initial_period":{"$ref":"#/components/schemas/CreateReTaxInitialPeriodV1Dto"}},"required":["parcel_id","tax_type"]},"UpdateReTaxV1Dto":{"type":"object","properties":{"status":{"type":"string","enum":["active","inactive"]},"notes":{"type":"string","nullable":true}}},"CreateReTaxPeriodV1Dto":{"type":"object","properties":{"tax_year":{"type":"number","minimum":1900,"maximum":2200,"example":2026},"period_start_month":{"type":"number","minimum":1,"maximum":12,"example":7,"description":"Month the period starts in (1-12). A period runs one year from tax_year-month-day. Omitted: inherited from the prior period when inheriting, else 1 (January)."},"period_start_day":{"type":"number","minimum":1,"maximum":31,"example":1,"description":"Day of the month the period starts on. Must exist every year: Feb 29 and the 31st of a 30-day month are rejected. Omitted: inherited like period_start_month, else 1."},"inherit":{"type":"boolean","description":"Copy the latest prior period's config + participants and seed slots. Defaults to true when a prior period exists, false otherwise."},"payee_party_id":{"type":"string","format":"uuid","nullable":true},"expense_account_id":{"type":"string","format":"uuid","nullable":true},"recovery_group_id":{"type":"string","format":"uuid","nullable":true,"description":"NULL = no CAM regime for this period."},"denominator_basis":{"type":"string","enum":["participant_area","fixed_area"],"description":"Who absorbs vacancy for sqft participants. `fixed_area` divides by `fixed_area_sqft` and leaves the unleased remainder with the owner; `participant_area` divides by the participants' own areas. Omitted: the previous period's when inheriting, else `fixed_area` when the property's rentable_sqft is measured, else `participant_area`."},"fixed_area_sqft":{"type":"string","description":"The whole-building rentable area, numeric(12,2) as a decimal string. Under `fixed_area`, omitted means the property's rentable_sqft; with neither above zero the request is refused (RE_TAX_FIXED_AREA_REQUIRED)."},"notes":{"type":"string","nullable":true}},"required":["tax_year"]},"ReTaxParticipantInPlaceV1Dto":{"type":"object","properties":{"from":{"type":"string","format":"date","description":"First day in place (inclusive)."},"to":{"type":"string","format":"date","description":"Last day in place (inclusive)."},"days":{"type":"number","description":"Days in place, inclusive of both ends."},"period_days":{"type":"number","description":"Days in the period, inclusive of both ends."}},"required":["from","to","days","period_days"]},"YearEndTrueUpV1Dto":{"type":"object","properties":{"status":{"type":"string","enum":["trued_up","not_trued_up","not_applicable"],"description":"'trued_up': the share is invoiced now as an estimate and the Expense Recovery run trues it up at year-end (base year, cap and gross-up applied). 'not_trued_up': the share is billed as-is and never reconciled — `reason` says why. 'not_applicable': nothing is reconciled by design: a direct payer, the landlord, or a share billed directly."},"reason":{"type":"string","enum":["no_recovery_group","lease_not_included"],"nullable":true,"description":"Null unless status is 'not_trued_up'. 'no_recovery_group': the period/term names no recovery group. 'lease_not_included': the lease holds no participating recovery term on the period's/term's expense account in that group."},"recovery_group_id":{"type":"string","format":"uuid","nullable":true,"description":"The period's/term's recovery group."},"recovery_group_name":{"type":"string","nullable":true}},"required":["status","reason","recovery_group_id","recovery_group_name"]},"ReTaxPeriodParticipantV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"period_id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"share_basis":{"type":"string","enum":["negotiated","sqft"],"description":"Percent in (0, 100]."},"share_pct":{"type":"string","nullable":true,"description":"Null for 'sqft' — resolved at bill input."},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"`tenant_direct_pay`: the tenant pays the taxing authority. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."},"started_on":{"type":"string","format":"date","nullable":true,"description":"First day of participation (inclusive); null = from the period start."},"ended_on":{"type":"string","format":"date","nullable":true,"description":"Last day of participation (inclusive); null = through the period end."},"billed":{"type":"boolean","description":"True when this row was billed: an active bill on the period carrying a share for this lease was issued at or after the row was created. A billed row cannot be deleted (409 RE_TAX_PARTICIPANT_BILLED) — end it with ended_on, or void those bills first — and its share_basis/share_pct change only by a dated change (409 RE_TAX_PARTICIPANT_BILLED_SHARE_IMMUTABLE). A row a dated change added after the latest bill is not billed."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true},"contract_title":{"type":"string","example":"Suite 300 lease"},"counterparty_name":{"type":"string","nullable":true,"example":"Acme Corp"},"in_place":{"nullable":true,"description":"The span this lease was in place within the period — the lease's start, its occupancy end and the row's own dates, clipped to the period. It is the span a bill counts the share on, day by day — a lease in place for part of the period is billed for those days only. Null when the row shares no day of the period.","type":"object","allOf":[{"$ref":"#/components/schemas/ReTaxParticipantInPlaceV1Dto"}]},"year_end_true_up":{"description":"Whether this lease's share is trued up at year-end by the Expense Recovery run, read as of today clamped into the period — the same decision a bill entered today would make.","allOf":[{"$ref":"#/components/schemas/YearEndTrueUpV1Dto"}]}},"required":["id","period_id","contract_id","share_basis","method","started_on","ended_on","billed","created_at","contract_title","counterparty_name","in_place","year_end_true_up"]},"ReTaxExpectedBillV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"period_id":{"type":"string","format":"uuid"},"expected_date":{"type":"string","format":"date"},"estimated_amount":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"bill_id":{"type":"string","format":"uuid","nullable":true,"description":"The id of the LIVE bill filling this slot, if any."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","period_id","expected_date","created_at"]},"ReTaxBillV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"period_id":{"type":"string","format":"uuid"},"expected_bill_id":{"type":"string","format":"uuid","nullable":true},"total_amount":{"type":"string"},"bill_date":{"type":"string","format":"date","nullable":true},"due_date":{"type":"string","format":"date"},"discount_date":{"type":"string","format":"date","nullable":true},"delinquent_date":{"type":"string","format":"date","nullable":true},"appeal_deadline":{"type":"string","format":"date","nullable":true},"ap_document_id":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["active","voided"]},"notes":{"type":"string","nullable":true},"shares":{"type":"array","items":{"$ref":"#/components/schemas/ReTaxBillShareV1Dto"}},"landlord_paid":{"type":"boolean","nullable":true,"description":"Derived paid-state (period-workspace read only). Tri-state: true = settled, false = still owed, null = no information (do NOT render as unpaid). The AP document is posted with a zero balance; null when the bill is voided, when there is no AP document (e.g. a 100% tenant_direct_pay bill), or when the AP document has been voided/reversed/deleted."},"landlord_balance":{"type":"string","nullable":true,"description":"What is still owed on the AP bill to the payee (period-workspace read only): its open balance, so a partly paid bill shows what is left. Null exactly when landlord_paid is null — a voided bill, no AP document, or a retracted one.","example":"4000.00"},"amount_outstanding":{"type":"string","nullable":true,"description":"Derived (reads only): what is still owed to the payee on the WHOLE bill — the open balance of the payable plus every tenant_direct_pay share not yet marked paid. Null for a voided bill or a retracted payable.","example":"6000.00"},"amount_paid":{"type":"string","nullable":true,"description":"Derived (reads only): how much of the bill the payee has been paid — the total less amount_outstanding. Null exactly when amount_outstanding is.","example":"4000.00"}},"required":["id","period_id","total_amount","due_date","status","shares"]},"ReTaxPeriodDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"tax_id":{"type":"string","format":"uuid"},"tax_year":{"type":"number"},"period_start_month":{"type":"number","description":"Month (1-12) the period starts in; with the day, anchors the window."},"period_start_day":{"type":"number","description":"Day of month the period starts on."},"period_start":{"type":"string","format":"date","description":"First day of the period's window, 'YYYY-MM-DD', inclusive. Derived from tax_year and the tax's period start month and day."},"period_end":{"type":"string","format":"date","description":"Last day of the period's window, 'YYYY-MM-DD', inclusive. Derived from tax_year and the tax's period start month and day; one year after the start, less a day."},"status":{"type":"string","enum":["open","active","closed"]},"payee_party_id":{"type":"string","format":"uuid","nullable":true},"expense_account_id":{"type":"string","format":"uuid","nullable":true,"description":"NULL falls back to the property_tax_expense system role."},"recovery_group_id":{"type":"string","format":"uuid","nullable":true,"description":"NULL = no CAM regime for this period."},"denominator_basis":{"type":"string","enum":["participant_area","fixed_area"]},"fixed_area_sqft":{"type":"string","nullable":true,"description":"The whole-building area used when denominator_basis is fixed_area."},"notes":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true},"payee_party_name":{"type":"string","nullable":true,"example":"Hamilton County Treasurer"},"expense_account_code":{"type":"string","nullable":true,"example":"6120"},"expense_account_name":{"type":"string","nullable":true,"example":"Property Taxes"},"recovery_group_name":{"type":"string","nullable":true,"example":"Birch Tower — CAM 2026"},"participants":{"type":"array","items":{"$ref":"#/components/schemas/ReTaxPeriodParticipantV1Dto"}},"slots":{"type":"array","items":{"$ref":"#/components/schemas/ReTaxExpectedBillV1Dto"}},"bills":{"description":"Empty until Task 6 (bill input) ships.","type":"array","items":{"$ref":"#/components/schemas/ReTaxBillV1Dto"}}},"required":["id","tax_id","tax_year","period_start_month","period_start_day","period_start","period_end","status","denominator_basis","created_at","payee_party_name","expense_account_code","expense_account_name","recovery_group_name","participants","slots","bills"]},"UpdateReTaxPeriodV1Dto":{"type":"object","properties":{"period_start_month":{"type":"number","minimum":1,"maximum":12,"example":7,"description":"Month the period starts in (1-12). A period runs one year from tax_year-month-day. Changing it is refused once the period has a bill."},"period_start_day":{"type":"number","minimum":1,"maximum":31,"example":1,"description":"Day of the month the period starts on. Must exist every year: Feb 29 and the 31st of a 30-day month are rejected. Changing it is refused once the period has a bill."},"payee_party_id":{"type":"string","format":"uuid","nullable":true},"expense_account_id":{"type":"string","format":"uuid","nullable":true},"recovery_group_id":{"type":"string","format":"uuid","nullable":true,"description":"NULL = no CAM regime for this period. Set to null to clear the recovery group link; rejected (422) when a via_cam participant would lose its collection channel — see PropertyTaxes.updatePeriod."},"denominator_basis":{"type":"string","enum":["participant_area","fixed_area"],"description":"Who absorbs vacancy for sqft participants. `fixed_area` divides by `fixed_area_sqft` and leaves the unleased remainder with the owner; `participant_area` divides by the participants' own areas. Changing it is refused when it takes a day of the period over 100%, and flags the differences on issued bills in the Work Center."},"fixed_area_sqft":{"type":"string","nullable":true,"description":"The whole-building rentable area, numeric(12,2) as a decimal string. Under `fixed_area` it must be above zero: omitted, the stored area is kept, else the property's rentable_sqft is used; with none the request is refused (RE_TAX_FIXED_AREA_REQUIRED)."},"notes":{"type":"string","nullable":true},"status":{"type":"string","enum":["open","closed"],"description":"Affects FUTURE bills only (§12 lean). 'open' reopens a closed period; 'closed' closes it. 'active' is set internally on first bill input and cannot be set via this endpoint."}}},"ReTaxAllocationShareV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"share_basis":{"type":"string","enum":["negotiated","sqft"]},"share_pct":{"type":"string","example":"13.8710","description":"The resolved percentage bill input will freeze."}},"required":["contract_id","share_basis","share_pct"]},"ReTaxAllocationV1Dto":{"type":"object","properties":{"shares":{"type":"array","items":{"$ref":"#/components/schemas/ReTaxAllocationShareV1Dto"}},"landlord_remainder_pct":{"type":"string","example":"61.1290","description":"Unallocated balance — the owner's cost, and real vacancy."}},"required":["shares","landlord_remainder_pct"]},"ReTaxParticipantV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"period_id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"share_basis":{"type":"string","enum":["negotiated","sqft"],"description":"Percent in (0, 100]."},"share_pct":{"type":"string","nullable":true,"description":"Null for 'sqft' — resolved at bill input."},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"`tenant_direct_pay`: the tenant pays the taxing authority. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."},"started_on":{"type":"string","format":"date","nullable":true,"description":"First day of participation (inclusive); null = from the period start."},"ended_on":{"type":"string","format":"date","nullable":true,"description":"Last day of participation (inclusive); null = through the period end."},"billed":{"type":"boolean","description":"True when this row was billed: an active bill on the period carrying a share for this lease was issued at or after the row was created. A billed row cannot be deleted (409 RE_TAX_PARTICIPANT_BILLED) — end it with ended_on, or void those bills first — and its share_basis/share_pct change only by a dated change (409 RE_TAX_PARTICIPANT_BILLED_SHARE_IMMUTABLE). A row a dated change added after the latest bill is not billed."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true},"contract_title":{"type":"string","example":"Suite 300 lease"},"counterparty_name":{"type":"string","nullable":true,"example":"Acme Corp"}},"required":["id","period_id","contract_id","share_basis","method","started_on","ended_on","billed","created_at","contract_title","counterparty_name"]},"AddReTaxParticipantV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"share_basis":{"type":"string","enum":["negotiated","sqft"],"default":"negotiated","description":"How the percentage is arrived at. 'negotiated' states it below; 'sqft' derives it from the lease's rentable area when a bill is input."},"share_pct":{"type":"string","description":"Percent in (0, 100], numeric(7,4) as a decimal string. Required for share_basis 'negotiated'; must be omitted for 'sqft'.","example":"40"},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"`tenant_direct_pay`: the tenant pays the taxing authority. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."},"started_on":{"type":"string","format":"date","nullable":true,"description":"The first day this lease participates in the period (inclusive). Null or omitted = from the period start."}},"required":["contract_id","method"]},"AddReTaxParticipantsBatchV1Dto":{"type":"object","properties":{"participants":{"description":"The participants to add, applied in one transaction: either every entry lands or none does. A contract_id repeated within this array is rejected, as is one already on the period on the same days. Capped at 100 — the bound exists to keep the transaction finite, not to ration.","type":"array","items":{"$ref":"#/components/schemas/AddReTaxParticipantV1Dto"}}},"required":["participants"]},"ReTaxParticipantChangesResultV1Dto":{"type":"object","properties":{"participants":{"description":"The period's participants after the change.","type":"array","items":{"$ref":"#/components/schemas/ReTaxParticipantV1Dto"}}},"required":["participants"]},"ReTaxParticipantOperationV1Dto":{"type":"object","properties":{"op":{"type":"string","enum":["add","change","end"],"description":"'add' a lease (contract_id, method, share_basis, share_pct, started_on, ended_on); 'change' a participant's share from a date (participant_id, from, share_basis, share_pct) — its row ends the day before `from` and a new row starts on it, keeping the old end and method; 'end' a participant (participant_id, ended_on)."},"contract_id":{"type":"string","format":"uuid","description":"The lease to add. Required for 'add'."},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"How the tenant pays. Required for 'add'; all rows of one lease in a period share one method (400 RE_TAX_PARTICIPANT_METHOD_MISMATCH). `tenant_direct_pay`: the tenant pays the taxing authority. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."},"participant_id":{"type":"string","format":"uuid","description":"The participant row to change or end. Required for 'change' and 'end'."},"share_basis":{"type":"string","enum":["negotiated","sqft"],"description":"Required for 'add' and 'change'."},"share_pct":{"type":"string","nullable":true,"description":"Percent in (0, 100], numeric(7,4) as a decimal string. Required for share_basis 'negotiated'; omitted or null for 'sqft'.","example":"25"},"started_on":{"type":"string","format":"date","nullable":true,"description":"'add' only: the first day (inclusive); null = from the period start."},"ended_on":{"type":"string","format":"date","nullable":true,"description":"The last day (inclusive). Required for 'end'; optional for 'add' (null = through the period end)."},"from":{"type":"string","format":"date","description":"'change' only, required: the first day of the new share. Must be on or after the participant's first day and on or before its last. On the first day the row is corrected in place (no split), which is refused with 409 when an issued bill used the row's share."}},"required":["op"]},"ReTaxParticipantChangesV1Dto":{"type":"object","properties":{"operations":{"description":"Applied in order and atomically: every operation lands or none does. Capped at 100.","type":"array","items":{"$ref":"#/components/schemas/ReTaxParticipantOperationV1Dto"}},"accept_cuts":{"description":"Participant ids whose share the caller accepts will go down. Under participant area a change may cut only the participants it names — as the subject of an operation or here; the preview lists who would be cut. Defaults to none.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["operations"]},"ReTaxTimelineShareV1Dto":{"type":"object","properties":{"participant_id":{"type":"string","format":"uuid","nullable":true,"description":"The participant row; null for a row the change would create."},"contract_id":{"type":"string","format":"uuid"},"share_basis":{"type":"string","enum":["negotiated","sqft"]},"share_pct":{"type":"string","description":"The resolved share in this range, percent at 4 decimals.","example":"33.3333"}},"required":["participant_id","contract_id","share_basis","share_pct"]},"ReTaxTimelineRangeV1Dto":{"type":"object","properties":{"start_date":{"type":"string","format":"date"},"end_date":{"type":"string","format":"date","description":"Inclusive."},"days":{"type":"number","description":"Days in the range, inclusive."},"shares":{"type":"array","items":{"$ref":"#/components/schemas/ReTaxTimelineShareV1Dto"}},"owner_pct":{"type":"string","description":"The owner's remainder in this range, percent.","example":"10.0000"}},"required":["start_date","end_date","days","shares","owner_pct"]},"ReTaxPreviewTimelineV1Dto":{"type":"object","properties":{"ranges":{"nullable":true,"description":"The period split into ranges over which the participants do not change, each with its resolved shares. Null when the set does not resolve on some day — then `problem` says why.","type":"array","items":{"$ref":"#/components/schemas/ReTaxTimelineRangeV1Dto"}},"problem":{"type":"string","nullable":true,"description":"Why the set does not resolve (a participant by area whose lease records no area, shares over 100%, no room left for the area tenants); null when it does."}},"required":["ranges","problem"]},"ReTaxParticipantCutV1Dto":{"type":"object","properties":{"participant_id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true,"example":"Acme Corp"},"before_pct":{"type":"string","nullable":true,"description":"Resolved share on `from` before the change; null when the period as it stands does not resolve (before.problem).","example":"30.0000"},"after_pct":{"type":"string","nullable":true,"description":"Resolved share on `from` after the change; null when the result does not resolve (after.problem).","example":"6.0000"},"from":{"type":"string","format":"date","description":"The first day the share is cut."}},"required":["participant_id","contract_id","name","before_pct","after_pct","from"]},"ReTaxParticipantChangesPreviewV1Dto":{"type":"object","properties":{"before":{"description":"The period as it stands.","allOf":[{"$ref":"#/components/schemas/ReTaxPreviewTimelineV1Dto"}]},"after":{"description":"The period after the operations.","allOf":[{"$ref":"#/components/schemas/ReTaxPreviewTimelineV1Dto"}]},"refusal":{"type":"string","nullable":true,"description":"Why saving these operations would be refused (400) because the result does not resolve; null when it would not be. A set that already did not resolve is not refused for an edit that leaves it no worse only under fixed area with shares over 100%. Cuts are listed in `cuts`, apart from this."},"cuts":{"description":"Participants whose share the change would cut and that it does not name; saving refuses (400 RE_TAX_PARTICIPANT_SHARE_CUT) until each is in accept_cuts.","type":"array","items":{"$ref":"#/components/schemas/ReTaxParticipantCutV1Dto"}}},"required":["before","after","refusal","cuts"]},"UpdateReTaxParticipantV1Dto":{"type":"object","properties":{"share_pct":{"type":"string","description":"Percent in (0, 100], numeric(7,4) as a decimal string."},"share_basis":{"type":"string","enum":["negotiated","sqft"]},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"`tenant_direct_pay`: the tenant pays the taxing authority. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."},"started_on":{"type":"string","format":"date","nullable":true,"description":"The first day this lease participates in the period (inclusive). Null = from the period start. Omit to leave unchanged."},"ended_on":{"type":"string","format":"date","nullable":true,"description":"The last day this lease participates in the period (inclusive). Null = through the period end. Omit to leave unchanged."}}},"ReplaceReTaxParticipantResultV1Dto":{"type":"object","properties":{"ended":{"description":"The replaced participant, now ending the day before.","allOf":[{"$ref":"#/components/schemas/ReTaxParticipantV1Dto"}]},"started":{"description":"The successor, starting on effective_from.","allOf":[{"$ref":"#/components/schemas/ReTaxParticipantV1Dto"}]}},"required":["ended","started"]},"ReplaceReTaxParticipantV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid","description":"The successor lease."},"share_basis":{"type":"string","enum":["negotiated","sqft"],"default":"negotiated","description":"How the percentage is arrived at. 'negotiated' states it below; 'sqft' derives it from the lease's rentable area when a bill is input."},"share_pct":{"type":"string","description":"Percent in (0, 100], numeric(7,4) as a decimal string. Required for share_basis 'negotiated'; must be omitted for 'sqft'.","example":"40"},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"`tenant_direct_pay`: the tenant pays the taxing authority. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."},"effective_from":{"type":"string","format":"date","description":"The successor's first day (inclusive). The replaced participant ends the day before. Must be after the replaced participant's first day and inside the tax period."}},"required":["contract_id","method","effective_from"]},"AddReTaxExpectedBillV1Dto":{"type":"object","properties":{"expected_date":{"type":"string","format":"date"},"estimated_amount":{"type":"string","nullable":true,"example":"12500.00"},"notes":{"type":"string","nullable":true}},"required":["expected_date"]},"UpdateReTaxExpectedBillV1Dto":{"type":"object","properties":{"expected_date":{"type":"string","format":"date"},"estimated_amount":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}}},"ReTaxProratedParticipantV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"reason":{"type":"string","enum":["lease_not_live_for_full_period"],"description":"Why the share was prorated. Today there is one reason: the lease was not in place for the whole assessment period."},"billed_fraction":{"type":"number","description":"Fraction of the assessment period the lease was in place for, in [0, 1]. 0 means it was not billed at all."}},"required":["contract_id","reason","billed_fraction"]},"ReTaxBillInputResultV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"period_id":{"type":"string","format":"uuid"},"expected_bill_id":{"type":"string","format":"uuid","nullable":true},"total_amount":{"type":"string"},"bill_date":{"type":"string","format":"date","nullable":true},"due_date":{"type":"string","format":"date"},"discount_date":{"type":"string","format":"date","nullable":true},"delinquent_date":{"type":"string","format":"date","nullable":true},"appeal_deadline":{"type":"string","format":"date","nullable":true},"ap_document_id":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["active","voided"]},"notes":{"type":"string","nullable":true},"shares":{"type":"array","items":{"$ref":"#/components/schemas/ReTaxBillShareV1Dto"}},"landlord_paid":{"type":"boolean","nullable":true,"description":"Derived paid-state (period-workspace read only). Tri-state: true = settled, false = still owed, null = no information (do NOT render as unpaid). The AP document is posted with a zero balance; null when the bill is voided, when there is no AP document (e.g. a 100% tenant_direct_pay bill), or when the AP document has been voided/reversed/deleted."},"landlord_balance":{"type":"string","nullable":true,"description":"What is still owed on the AP bill to the payee (period-workspace read only): its open balance, so a partly paid bill shows what is left. Null exactly when landlord_paid is null — a voided bill, no AP document, or a retracted one.","example":"4000.00"},"amount_outstanding":{"type":"string","nullable":true,"description":"Derived (reads only): what is still owed to the payee on the WHOLE bill — the open balance of the payable plus every tenant_direct_pay share not yet marked paid. Null for a voided bill or a retracted payable.","example":"6000.00"},"amount_paid":{"type":"string","nullable":true,"description":"Derived (reads only): how much of the bill the payee has been paid — the total less amount_outstanding. Null exactly when amount_outstanding is.","example":"4000.00"},"warnings":{"description":"Non-blocking warnings, e.g. \"contract <counterparty_or_title> (<status>) was in place for 42.7% of <period_start>..<period_end> — its share was prorated to match\".","type":"array","items":{"type":"string"}},"prorated":{"description":"Participants whose share was reduced or dropped because the lease was not in place for the whole assessment period, with the fraction of it they were billed for. A billed_fraction of 0 means the lease was not billed at all and its share stayed with the owner.","type":"array","items":{"$ref":"#/components/schemas/ReTaxProratedParticipantV1Dto"}}},"required":["id","period_id","total_amount","due_date","status","shares","warnings","prorated"]},"InputReTaxBillV1Dto":{"type":"object","properties":{"expected_bill_id":{"type":"string","format":"uuid","nullable":true,"description":"Fill this expected-bill slot. Omit for a supplemental/unplanned bill."},"total_amount":{"type":"string","description":"Positive dollar amount.","example":"10000.00"},"bill_date":{"type":"string","format":"date","nullable":true},"due_date":{"type":"string","format":"date"},"discount_date":{"type":"string","format":"date","nullable":true},"delinquent_date":{"type":"string","format":"date","nullable":true},"appeal_deadline":{"type":"string","format":"date","nullable":true},"notes":{"type":"string","nullable":true}},"required":["total_amount","due_date"]},"UpdateReTaxBillV1Dto":{"type":"object","properties":{"bill_date":{"type":"string","format":"date","nullable":true,"description":"Critical dates + notes only — total_amount is immutable."},"due_date":{"type":"string","format":"date"},"discount_date":{"type":"string","format":"date","nullable":true},"delinquent_date":{"type":"string","format":"date","nullable":true},"appeal_deadline":{"type":"string","format":"date","nullable":true},"notes":{"type":"string","nullable":true}}},"VoidReTaxBillV1Dto":{"type":"object","properties":{"memo":{"type":"string","description":"Required — recorded on the voided documents."}},"required":["memo"]},"RecoveryGroupListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Recovery group id — what the row links to."},"code":{"type":"string"},"name":{"type":"string"},"property_id":{"type":"string","format":"uuid"},"property_name":{"type":"string"},"legal_entity_id":{"type":"string","format":"uuid"},"frequency":{"type":"string","enum":["annual","quarterly","monthly"]},"period_start_month":{"type":"number"},"period_start_day":{"type":"number"},"is_active":{"type":"boolean"},"account_count":{"type":"number","description":"Recoverable accounts in this group."},"latest_run_id":{"type":"string","format":"uuid","nullable":true,"description":"The cycle every figure below describes: the group's newest, or the one matching `cycle_year`. Null when the group has no cycle in scope, in which case every amount below is \"0\"."},"cycle_year":{"type":"number","nullable":true},"run_status":{"type":"string","enum":["draft","computed","approved"],"nullable":true},"period_start":{"type":"string","format":"date","nullable":true},"period_end":{"type":"string","format":"date","nullable":true},"pool_cost":{"type":"string","description":"The cycle's recoverable expense, counted once per journal line. Name retained deliberately across the 2026-09-19 account-grain cutover.","example":"1234.50"},"unrecovered":{"type":"string","description":"The share of that cost no tenant owes.","example":"1234.50"},"recoverable":{"type":"string","description":"`pool_cost - unrecovered` — what tenants owe of the cost. Excludes the admin fee, which is charged on top, so `billed` can legitimately exceed this.","example":"1234.50"},"unrecovered_vacancy":{"type":"string","description":"Of `unrecovered`: space nobody occupied.","example":"1234.50"},"unrecovered_non_participant":{"type":"string","description":"Of `unrecovered`: leases with no participating recovery term naming this account.","example":"1234.50"},"unrecovered_cap":{"type":"string","description":"Of `unrecovered`: absorbed by binding caps.","example":"1234.50"},"unrecovered_base_year":{"type":"string","description":"Of `unrecovered`: absorbed by base years.","example":"1234.50"},"billed":{"type":"string","description":"Charges from this cycle a document has been raised for. Includes the admin fee, which `recoverable` does not.","example":"1234.50"},"staged":{"type":"string","description":"Approved charges still on the property's shelf. Excludes charges that settled with no document — a tenant whose charges netted to zero.","example":"1234.50"},"billed_all_cycles":{"type":"string","description":"Billed across EVERY cycle of this group. `cycle_year` does NOT narrow this.","example":"1234.50"},"staged_all_cycles":{"type":"string","description":"Staged across EVERY cycle of this group, which `cycle_year` does NOT narrow. Money owed is not a property of a cycle: a group whose 2024 is approved-but-unbilled while its 2025 is a draft still has that balance outstanding, and scoping it to the year in view would hide it — which Billing cannot surface either, being one property at a time.","example":"1234.50"}},"required":["id","code","name","property_id","property_name","legal_entity_id","frequency","period_start_month","period_start_day","is_active","account_count","pool_cost","unrecovered","recoverable","unrecovered_vacancy","unrecovered_non_participant","unrecovered_cap","unrecovered_base_year","billed","staged","billed_all_cycles","staged_all_cycles"]},"RecoveryKpiMetricGroupV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"Numeric string — no float math.","example":"1234.50"},"count":{"type":"number","description":"Recovery groups contributing to this figure — NOT a charge count. A group with no cycle in scope contributes nothing and is not counted."}},"required":["amount","count"]},"ExpenseRecoverySummaryV1Dto":{"type":"object","properties":{"pool_cost":{"$ref":"#/components/schemas/RecoveryKpiMetricGroupV1Dto"},"recoverable":{"$ref":"#/components/schemas/RecoveryKpiMetricGroupV1Dto"},"billed":{"$ref":"#/components/schemas/RecoveryKpiMetricGroupV1Dto"},"staged":{"$ref":"#/components/schemas/RecoveryKpiMetricGroupV1Dto"},"billed_all_cycles":{"description":"Billed across every cycle; `cycle_year` does not narrow it.","allOf":[{"$ref":"#/components/schemas/RecoveryKpiMetricGroupV1Dto"}]},"staged_all_cycles":{"description":"Staged across every cycle; `cycle_year` does not narrow it. `count` is groups with money outstanding, not groups with a cycle.","allOf":[{"$ref":"#/components/schemas/RecoveryKpiMetricGroupV1Dto"}]}},"required":["pool_cost","recoverable","billed","staged","billed_all_cycles","staged_all_cycles"]},"RecoveryGroupV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"code":{"type":"string","example":"CAM"},"name":{"type":"string"},"recovery_income_account_id":{"type":"string","format":"uuid","nullable":true,"description":"The income account this group's recovery revenue posts to. Null falls back to the org's default recovery income account."},"frequency":{"type":"string","enum":["annual","quarterly","monthly"]},"period_start_month":{"type":"number"},"period_start_day":{"type":"number"},"reconciliation_months":{"type":"array","items":{"type":"number"}},"is_active":{"type":"boolean"},"created_at":{"type":"string"},"modified_at":{"type":"string","nullable":true}},"required":["id","property_id","legal_entity_id","code","name","recovery_income_account_id","frequency","period_start_month","period_start_day","reconciliation_months","is_active","created_at","modified_at"]},"CreateRecoveryGroupV1Dto":{"type":"object","properties":{"property_id":{"type":"string","format":"uuid","description":"The property this cycle reconciles"},"legal_entity_id":{"type":"string","format":"uuid"},"code":{"type":"string","maxLength":32,"example":"CAM","description":"Unique per property; portfolio rollups group by this"},"name":{"type":"string","maxLength":128,"example":"Easton — CAM"},"recovery_income_account_id":{"type":"string","format":"uuid","nullable":true,"description":"The income account this group's recovery revenue posts to. Must be an income-type account in the org. Null clears the group income account; omitted or null falls back to the org's default recovery income account."},"frequency":{"type":"string","enum":["annual","quarterly","monthly"],"default":"annual","description":"Only `annual` is implemented. `quarterly` and `monthly` are accepted by schema validation but rejected at write time with 400 VALIDATION_FAILED; they remain in the enum so the published contract stays backward compatible."},"period_start_month":{"type":"number","default":1,"minimum":1,"maximum":12},"period_start_day":{"type":"number","default":1,"minimum":1,"maximum":31},"reconciliation_months":{"default":[1],"description":"Months the cycle is performed and billed in. Drives the run-due signal only.","type":"array","items":{"type":"number"}}},"required":["property_id","legal_entity_id","code","name"]},"UpdateRecoveryGroupV1Dto":{"type":"object","properties":{"property_id":{"type":"string","format":"uuid","description":"The property this cycle reconciles"},"legal_entity_id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":128,"example":"Easton — CAM"},"recovery_income_account_id":{"type":"string","format":"uuid","nullable":true,"description":"The income account this group's recovery revenue posts to. Must be an income-type account in the org. Null clears the group income account; omitted or null falls back to the org's default recovery income account."},"frequency":{"type":"string","enum":["annual","quarterly","monthly"],"default":"annual","description":"Only `annual` is implemented. `quarterly` and `monthly` are accepted by schema validation but rejected at write time with 400 VALIDATION_FAILED; they remain in the enum so the published contract stays backward compatible."},"period_start_month":{"type":"number","default":1,"minimum":1,"maximum":12},"period_start_day":{"type":"number","default":1,"minimum":1,"maximum":31},"reconciliation_months":{"default":[1],"description":"Months the cycle is performed and billed in. Drives the run-due signal only.","type":"array","items":{"type":"number"}},"is_active":{"type":"boolean"}}},"RecoveryGroupAccountV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recovery_group_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"classification":{"type":"string","enum":["fixed","variable"]},"is_controllable":{"type":"boolean"},"denominator_basis":{"type":"string","enum":["participant_area","fixed_area","leased_area"]},"fixed_area":{"type":"number","nullable":true,"description":"Typed area when denominator_basis is fixed_area; null for participant_area or leased_area."},"gross_up_enabled":{"type":"boolean"},"gross_up_target_occupancy":{"type":"number","nullable":true}},"required":["id","recovery_group_id","account_id","classification","is_controllable","denominator_basis","fixed_area","gross_up_enabled","gross_up_target_occupancy"]},"GroupAccountItemV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"classification":{"type":"string","enum":["fixed","variable"],"default":"variable"},"is_controllable":{"type":"boolean","default":true,"description":"The default a new term row takes for in_cap."},"denominator_basis":{"type":"string","enum":["participant_area","fixed_area","leased_area"],"default":"fixed_area"},"fixed_area":{"type":"number","nullable":true,"minimum":0},"gross_up_enabled":{"type":"boolean","default":false},"gross_up_target_occupancy":{"type":"number","nullable":true,"minimum":0,"maximum":100}},"required":["account_id"]},"PutGroupAccountsV1Dto":{"type":"object","properties":{"accounts":{"type":"array","items":{"$ref":"#/components/schemas/GroupAccountItemV1Dto"}}},"required":["accounts"]},"ShareRuleDto":{"type":"object","properties":{"numerator":{"type":"number","nullable":true,"description":"Top of an exact ratio. A flat percent is a ratio over 100: 33% is 33/100. Null with `denominator` null means this row names a basis instead, or inherits. Carried as a JSON number: exact up to a double's ~15-17 significant digits, under the column's full numeric(18,6) range (up to 999999999999). An area-scale ratio — the intended use, e.g. 6600 / 108236.58 — round-trips exactly."},"denominator":{"type":"number","nullable":true,"description":"Bottom of the ratio. Never zero. Carried as a JSON number — see `numerator` for the usable range."},"basis":{"type":"string","enum":["participant_area","leased_area"],"nullable":true,"description":"Auto-calculated share: lease sqft over this denominator, re-resolved every run. `fixed_area` is account-level only — a typed area is stated as a ratio."},"reason":{"type":"string","nullable":true,"description":"Required whenever a ratio or a basis is given."}}},"RecoveryTermV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"recovery_group_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"participates":{"type":"boolean"},"share_rule":{"nullable":true,"description":"Null inherits the tier below.","type":"object","allOf":[{"$ref":"#/components/schemas/ShareRuleDto"}]},"admin_fee_pct":{"type":"number","nullable":true},"in_cap":{"type":"boolean"},"effective_start":{"type":"string","format":"date","nullable":true},"effective_end":{"type":"string","format":"date","nullable":true},"template_id":{"type":"string","format":"uuid","nullable":true,"description":"The template this row was last stamped from, if any."},"tracks_template":{"type":"boolean","description":"True while the row still follows its template; a hand edit detaches it and a template push then skips it."}},"required":["id","contract_id","recovery_group_id","account_id","participates","share_rule","admin_fee_pct","in_cap","effective_start","effective_end","template_id","tracks_template"]},"TermItemV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"participates":{"type":"boolean","nullable":true,"default":true,"description":"false records an explicit exclusion — the row still exists, so the exclusion is visible rather than inferred from a missing row."},"share_rule":{"nullable":true,"description":"Overrides the profile's share rule for this account only. Null inherits the profile, and omitting the key does the same.","type":"object","allOf":[{"$ref":"#/components/schemas/ShareRuleDto"}]},"admin_fee_pct":{"type":"number","nullable":true,"minimum":0,"example":0,"description":"This lease's admin fee ON THIS ACCOUNT — the most specific tier, and the only one that can differ per account for the same lease. Null inherits the lease's own recovery_profiles.admin_fee_pct. A value of 0 is honoured as a real 0% fee, not as absent — a lease paying 15% on CAM and 0% on real-estate taxes is exactly what this is for. No upper bound: a negotiated fee above 100% is unusual, not invalid."},"in_cap":{"type":"boolean","nullable":true,"default":false,"description":"Whether this account counts toward the lease's cap. Requires participates = true."},"effective_start":{"type":"string","format":"date","nullable":true,"example":"2026-01-01"},"effective_end":{"type":"string","format":"date","nullable":true,"example":"2026-12-31"}},"required":["account_id"]},"PutContractTermsV1Dto":{"type":"object","properties":{"terms":{"type":"array","items":{"$ref":"#/components/schemas/TermItemV1Dto"}}},"required":["terms"]},"RecoveryTemplateRowV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"template_id":{"type":"string","format":"uuid"},"recovery_group_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"participates":{"type":"boolean"},"share_rule":{"nullable":true,"description":"Null inherits the tier below.","type":"object","allOf":[{"$ref":"#/components/schemas/ShareRuleDto"}]},"admin_fee_pct":{"type":"number","nullable":true},"in_cap":{"type":"boolean"}},"required":["id","template_id","recovery_group_id","account_id","participates","share_rule","admin_fee_pct","in_cap"]},"RecoveryTemplateV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recovery_group_id":{"type":"string","format":"uuid"},"code":{"type":"string","maxLength":32,"example":"STD"},"name":{"type":"string","maxLength":128},"is_active":{"type":"boolean"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryTemplateRowV1Dto"}}},"required":["id","recovery_group_id","code","name","is_active","rows"]},"TemplateRowItemV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"participates":{"type":"boolean","nullable":true,"default":true},"share_rule":{"nullable":true,"description":"Overrides the profile's share rule for this account only. Null inherits the profile, and omitting the key does the same.","type":"object","allOf":[{"$ref":"#/components/schemas/ShareRuleDto"}]},"admin_fee_pct":{"type":"number","nullable":true,"minimum":0,"example":0,"description":"Admin fee on this account. A value of 0 is honoured as a real 0% fee, not as absent; null inherits the lease's own profile rate. No upper bound: a negotiated fee above 100% is unusual, not invalid."},"in_cap":{"type":"boolean","nullable":true,"default":false}},"required":["account_id"]},"CreateRecoveryTemplateV1Dto":{"type":"object","properties":{"code":{"type":"string","maxLength":32,"example":"STD"},"name":{"type":"string","maxLength":128,"example":"Standard CAM terms"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/TemplateRowItemV1Dto"}}},"required":["code","name","rows"]},"RecoveryTemplateWithPushV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recovery_group_id":{"type":"string","format":"uuid"},"code":{"type":"string","maxLength":32,"example":"STD"},"name":{"type":"string","maxLength":128},"is_active":{"type":"boolean"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryTemplateRowV1Dto"}},"pushed_contracts":{"type":"number","description":"Leases still tracking this template whose term rows this edit restamped. 0 for a header-only patch."}},"required":["id","recovery_group_id","code","name","is_active","rows","pushed_contracts"]},"UpdateRecoveryTemplateV1Dto":{"type":"object","properties":{"code":{"type":"string","maxLength":32,"example":"STD"},"name":{"type":"string","maxLength":128,"example":"Standard CAM terms"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/TemplateRowItemV1Dto"}},"is_active":{"type":"boolean"}}},"ApplyRecoveryTemplateResultV1Dto":{"type":"object","properties":{"applied":{"type":"number","description":"Leases stamped."},"skipped_manual":{"type":"number","description":"Term rows left untouched because a hand edit had detached them and reset was not requested."}},"required":["applied","skipped_manual"]},"ApplyRecoveryTemplateV1Dto":{"type":"object","properties":{"contract_ids":{"description":"The leases to stamp. Must name at least one.","type":"array","items":{"type":"string","format":"uuid"}},"reset":{"type":"boolean","default":false,"description":"true also restamps rows a hand edit had detached from the template; false (the default) leaves those manual rows alone and reports them as skipped_manual."}},"required":["contract_ids"]},"RecoveryGroupContributionV1Dto":{"type":"object","properties":{"journal_line_id":{"type":"string","format":"uuid"},"recovery_group_id":{"type":"string","format":"uuid"},"fraction":{"type":"string","description":"Portion of the line feeding this group, 0 < fraction ≤ 1.","example":"1"},"source":{"type":"string","enum":["rule"]},"entry_date":{"type":"string","description":"Journal entry date (YYYY-MM-DD)."},"account_id":{"type":"string","format":"uuid"},"amount":{"type":"string","description":"Signed line amount (debit − credit)."},"source_type":{"type":"string","nullable":true,"description":"Journal entry source type (usually the document type)."},"source_id":{"type":"string","format":"uuid","nullable":true,"description":"Source document id."},"created_at":{"type":"string","format":"date-time"},"entry_status":{"type":"string","description":"Source journal entry's posting status. `posted` for every live line, including one whose document was later voided: a void stays posted and is netted by a contra entry, whose lines appear in this list with the same group and fraction and the opposite-signed amount. The contra is dated in the original's period while that period is open, and in the current open period once it is closed.","example":"posted"},"is_effective":{"type":"boolean","description":"True when both the journal line and its entry are effective, which is every line written since voids began to offset instead of erase. False only on legacy rows, which contribute nothing to group actuals."}},"required":["journal_line_id","recovery_group_id","fraction","source","entry_date","account_id","amount","source_type","source_id","created_at","entry_status","is_effective"]},"SetGroupContributionFractionV1Dto":{"type":"object","properties":{"fraction":{"type":"string","example":"0.6"}},"required":["fraction"]},"RecoveryProfileV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"recovery_group_id":{"type":"string","format":"uuid"},"share_rule":{"nullable":true,"description":"Null inherits the tier below.","type":"object","allOf":[{"$ref":"#/components/schemas/ShareRuleDto"}]},"base_year_amount":{"type":"string","nullable":true,"example":"1234.50"},"cap_type":{"type":"string","enum":["none","annual","cumulative","compounding"],"description":"How the recoverable ceiling is built. 'none' = uncapped. 'annual' = the prior approved run's recoverable over the group's in-cap accounts, grossed by cap_pct; if the group has no approved prior run the cap is skipped and the run line is flagged cap_skipped_no_prior. 'cumulative' = cap_base_amount grown linearly from cap_base_year; 'compounding' = grown geometrically. All four behave distinctly. The ceiling applies PER LEASE across the recovery group's in-cap accounts, not per account."},"cap_pct":{"type":"number","nullable":true,"example":0.05,"description":"Cap ceiling as a fraction. Required when cap_type <> none, and must be absent when cap_type = none. No upper bound — a cap above 100% is legitimate."},"cap_base_year":{"type":"number","nullable":true,"description":"The year a cumulative/compounding ceiling compounds from. Required for those cap types."},"cap_base_amount":{"type":"string","nullable":true,"description":"The recoverable amount a cumulative/compounding ceiling compounds from. Required for those cap types.","example":"1234.50"},"admin_fee_pct":{"type":"number","nullable":true,"description":"The lease's negotiated admin fee, the fallback for every one of its recovery terms. A term's own admin_fee_pct wins over it; null inherits it. A value of 0 is honoured as a real 0% fee, not as absent."},"effective_start":{"type":"string","nullable":true,"example":"2026-01-01"},"effective_end":{"type":"string","nullable":true,"example":"2026-12-31"},"created_at":{"type":"string"},"modified_at":{"type":"string","nullable":true}},"required":["id","contract_id","recovery_group_id","share_rule","base_year_amount","cap_type","cap_pct","cap_base_year","cap_base_amount","admin_fee_pct","effective_start","effective_end","created_at","modified_at"]},"UpsertRecoveryProfileV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"recovery_group_id":{"type":"string","format":"uuid"},"share_rule":{"nullable":true,"description":"Null inherits the tier below.","type":"object","allOf":[{"$ref":"#/components/schemas/ShareRuleDto"}]},"base_year_amount":{"type":"string","nullable":true,"example":"1234.50"},"cap_type":{"type":"string","nullable":true,"enum":["none","annual","cumulative","compounding"],"default":"none","description":"How the recoverable ceiling is built. 'none' = uncapped. 'annual' = the prior approved run's recoverable over the group's in-cap accounts, grossed by cap_pct; if the group has no approved prior run the cap is skipped and the run line is flagged cap_skipped_no_prior. 'cumulative' = cap_base_amount grown linearly from cap_base_year (base x (1 + cap_pct x years elapsed)); 'compounding' = grown geometrically (base x (1 + cap_pct) ^ years elapsed), both requiring cap_base_year and cap_base_amount. All four now behave distinctly. The ceiling applies PER LEASE across the recovery group's in-cap accounts, not per account: any reduction is allocated back across those accounts pro-rata."},"cap_pct":{"type":"number","nullable":true,"minimum":0,"example":0.05,"description":"Cap ceiling as a fraction. Deliberately has NO upper bound — a cap above 100% is a real deal term."},"cap_base_year":{"type":"number","nullable":true,"example":2025,"description":"The year a cumulative/compounding ceiling compounds from. Required for those cap types."},"cap_base_amount":{"type":"string","nullable":true,"description":"The recoverable amount a cumulative/compounding ceiling compounds from. Required for those cap types.","example":"1234.50"},"admin_fee_pct":{"type":"number","nullable":true,"minimum":0,"description":"The lease-level default. A recovery_terms.admin_fee_pct on an account wins over it; a run admin_fee adjustment wins over both; null here means 0%. A value of 0 is honoured as a real 0% fee."},"effective_start":{"type":"string","nullable":true,"example":"2026-01-01"},"effective_end":{"type":"string","nullable":true,"example":"2026-12-31"}},"required":["contract_id","recovery_group_id"]},"RecoveryModuleAccountV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"module":{"type":"string"},"reason":{"type":"string"},"created_at":{"type":"string"}},"required":["id","property_id","account_id","module","reason","created_at"]},"CreateRecoveryModuleAccountV1Dto":{"type":"object","properties":{"property_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"module":{"type":"string","enum":["re_tax","insurance"]},"reason":{"type":"string"}},"required":["property_id","account_id","module","reason"]},"RecoveryRunLineV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"run_id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"share_basis":{"type":"string","enum":["negotiated","sqft","none"],"description":"The roll-up of the detail rows' bases: 'sqft' as soon as one participating row was area-derived, 'negotiated' when every one that fired was negotiated, else 'none'. The per-row basis is on the detail."},"share_pct_used":{"type":"string","nullable":true,"example":null,"description":"Always null. The share varies by account now and is reported per row on `share_pct_used` of the line detail (spec 2026-09-19 D8)."},"proration_factor":{"type":"string","example":"1.000000","description":"The LEASE-level factor (occupancy ∩ period), which is what the base-year stop is prorated by. Each row's own factor is on the detail."},"recoverable_share":{"type":"string","example":"5000.00"},"estimates_billed":{"type":"string","example":"0.00"},"true_up_amount":{"type":"string","example":"5000.00"},"true_ups_already_billed":{"type":"string","example":"0.00","description":"True-ups this run already billed (or settled) to this tenant in earlier revisions. The staged true-up is recoverable_share − estimates_billed − this. 0.00 on a run that was never revised."},"unallocatable":{"type":"boolean"},"cap_skipped_no_prior":{"type":"boolean"},"contract_status":{"type":"string","nullable":true,"example":"active","description":"The contract's CURRENT status, read when the run is fetched — not the status at compute time. Populated by GET /runs/:id. Null on the responses of POST /runs, POST /runs/:id/recompute and the adjustment write, which return the computation before any read-time decoration; refetch to see it. A line whose contract is draft or assigned was dropped by the run (zero days) and is named in the run-level `warnings`."}},"required":["id","run_id","contract_id","share_basis","share_pct_used","proration_factor","recoverable_share","estimates_billed","true_up_amount","true_ups_already_billed","unallocatable","cap_skipped_no_prior","contract_status"]},"RecoveryRunAdjustmentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"run_id":{"type":"string","format":"uuid"},"target_type":{"type":"string","enum":["exclude_journal_line","admin_fee","denominator","share","estimate"]},"target_ref":{"type":"string"},"old_value":{"type":"string","nullable":true},"new_value":{"type":"string","nullable":true},"reason":{"type":"string"},"created_by":{"type":"string","nullable":true,"format":"uuid"},"carried_forward_from":{"type":"string","nullable":true,"format":"uuid","description":"The adjustment this row was seeded from when its run was created (carry-forward from the prior period). Null for a manually-created row."},"created_at":{"type":"string"}},"required":["id","run_id","target_type","target_ref","old_value","new_value","reason","created_by","carried_forward_from","created_at"]},"RecoveryRunAccountTotalV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"run_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"account_actual":{"type":"string","example":"31431.00","description":"The recoverable expense on this account across the whole recovery group, counted ONCE per journal line regardless of how many leases recover it. Additive across the run."},"allocated":{"type":"string","example":"24102.55","description":"Sum of the run's persisted per-detail amount_before_admin_fee for this account — PRE-modifier, i.e. before the base year and the cap, so this is NOT what the tenants were billed. Excludes the admin fee, which is a contractual markup rather than a recovery of cost. The over-recovery guard runs on this figure so that a cap cannot mask a double-billing."},"unrecovered_total":{"type":"string","example":"7328.45","description":"max(0, account_actual − (allocated − unrecovered_cap − unrecovered_base_year) − charged_direct) — the landlord-absorbed share, measured against what the tenants were actually billed. Never negative. Equals the sum of the four components below, exactly."},"unrecovered_non_participant":{"type":"string","example":"2639.28","description":"The residual: unrecovered_total − unrecovered_vacancy − unrecovered_cap − unrecovered_base_year. Expense carried by the landlord because occupied space has no participating recovery term naming this account."},"unrecovered_vacancy":{"type":"string","example":"4689.17","description":"Computed (not residual) from unleased area and each participant's occupancy proration, against the account's denominator."},"unrecovered_cap":{"type":"string","example":"0.00","description":"Computed (not residual). This account's share of the run's cap_applied: each line's cap reduction pro-rated across its own detail rows by amount_before_admin_fee. Expense the landlord absorbed because a lease's cap ceiling bound."},"unrecovered_base_year":{"type":"string","example":"0.00","description":"Computed (not residual). This account's share of the run's base_year_applied, allocated the same way as unrecovered_cap. Expense the landlord absorbed because a lease pays only the increase above its base year."},"charged_direct":{"type":"string","example":"0.00","description":"Expense billed directly to a tenant rather than recovered through the group — nonzero for the percent-of-own-rent administrative fee, and for RE Taxes' via_cam charges staged before 2026-11-01 (tax bill input stages none since; a through-CAM share is now an invoice linked as the group's estimate)."},"over_recovered":{"type":"boolean","description":"allocated + charged_direct exceeds account_actual by more than one cent — a configuration error (a lease recovering the same account both through the group and by a direct charge, or a negotiated share above the sqft basis). Blocks approval."},"created_at":{"type":"string","format":"date-time"}},"required":["id","run_id","account_id","account_actual","allocated","unrecovered_total","unrecovered_non_participant","unrecovered_vacancy","unrecovered_cap","unrecovered_base_year","charged_direct","over_recovered","created_at"]},"RecoveryRunExclusionBucketV1Dto":{"type":"object","properties":{"count":{"type":"number","description":"How many posted journal lines fell in this bucket.","example":1},"total":{"type":"string","description":"Signed dollars that did NOT reach the account actual. For `partial_fraction` this is the unrecovered remainder (amount × (1 − fraction)), not the whole line.","example":"750.00"}},"required":["count","total"]},"RecoveryRunExclusionsByReasonV1Dto":{"type":"object","properties":{"producer_declared":{"description":"The line belongs to a document whose producing module declares its own group participation (RE taxes, insurance) and bills through recovery charges instead. Excluded by design — nothing to fix, and tagging such a line would not change its treatment.","allOf":[{"$ref":"#/components/schemas/RecoveryRunExclusionBucketV1Dto"}]},"untagged":{"description":"No contribution link, and the line carries the property dimension on neither itself nor its entry. The only reason that tagging fixes.","allOf":[{"$ref":"#/components/schemas/RecoveryRunExclusionBucketV1Dto"}]},"link_removed":{"description":"Tagged, not producer-declared, on an account the group recovers — so the rule sweep would have linked it — yet no link exists. Someone removed it, or it posted while the group was inactive and no resync has run.","allOf":[{"$ref":"#/components/schemas/RecoveryRunExclusionBucketV1Dto"}]},"partial_fraction":{"description":"A link exists but carries a fraction below 1, so only part of the line reached the account actual.","allOf":[{"$ref":"#/components/schemas/RecoveryRunExclusionBucketV1Dto"}]}},"required":["producer_declared","untagged","link_removed","partial_fraction"]},"RecoveryRunExclusionsV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"count":{"type":"number","description":"Total journal lines excluded, across every reason.","example":4},"total":{"type":"string","description":"Signed dollars excluded from this account's actual, across every reason. Added to it, this is every dollar posted on the account in the run's window.","example":"2250.00"},"by_reason":{"description":"Breakdown; the buckets sum to `count`/`total`. Reasons: producer_declared, untagged, link_removed, partial_fraction.","allOf":[{"$ref":"#/components/schemas/RecoveryRunExclusionsByReasonV1Dto"}]}},"required":["account_id","count","total","by_reason"]},"RecoveryRunDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"recovery_group_id":{"type":"string","format":"uuid","description":"The recovery group this run computes. Always set: a run is a cycle of one group, which fixes the account set it recovers and the income account its true-up charges are billed to."},"period_year":{"type":"number","nullable":true,"example":2025},"period_start":{"type":"string","example":"2025-01-01"},"period_end":{"type":"string","example":"2025-12-31"},"status":{"type":"string","enum":["draft","computed","approved"]},"revision":{"type":"number","example":1,"description":"Starts at 1; each POST /runs/:id/revise of an approved run adds one. A run with revision > 1 that is not approved is being revised."},"approved_at":{"type":"string","nullable":true,"example":null},"approved_by":{"type":"string","nullable":true},"created_by":{"type":"string","nullable":true},"created_at":{"type":"string"},"modified_at":{"type":"string","nullable":true},"lines":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryRunLineV1Dto"}},"adjustments":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryRunAdjustmentV1Dto"}},"account_totals":{"type":"array","items":{"$ref":"#/components/schemas/RecoveryRunAccountTotalV1Dto"}},"account_exclusions":{"description":"Per GL account, the expense excluded from that account's actual, by reason. Empty for runs computed before this field existed, and for drafts.","type":"array","items":{"$ref":"#/components/schemas/RecoveryRunExclusionsV1Dto"}},"warnings":{"example":["contract Jenny Nails & Spa (draft) is not active for 2025-01-01..2025-12-31"],"description":"Non-blocking warnings, one per dropped LEASE (not per line), in order of first appearance in `lines`, for contracts not in an active/terminated/expired status. Populated by GET /runs/:id; empty on the mutation responses, which return the computation before any read-time decoration. The run-level count is the array length.","type":"array","items":{"type":"string"}}},"required":["id","property_id","legal_entity_id","recovery_group_id","period_year","period_start","period_end","status","revision","approved_at","approved_by","created_by","created_at","modified_at","lines","adjustments","account_totals","account_exclusions","warnings"]},"CreateRecoveryRunV1Dto":{"type":"object","properties":{"recovery_group_id":{"type":"string","format":"uuid","description":"The recovery group to reconcile. Supplies the property, legal entity, pool set, and period."},"period_year":{"type":"number","example":2025,"description":"The cycle year. Combined with the group's anchor to derive the period — a Jul 1 anchor makes 2025 run Jul 2025 to Jun 2026."}},"required":["recovery_group_id","period_year"]},"RecoveryRunV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"recovery_group_id":{"type":"string","format":"uuid","description":"The recovery group this run computes. Always set: a run is a cycle of one group, which fixes the account set it recovers and the income account its true-up charges are billed to."},"period_year":{"type":"number","nullable":true,"example":2025},"period_start":{"type":"string","example":"2025-01-01"},"period_end":{"type":"string","example":"2025-12-31"},"status":{"type":"string","enum":["draft","computed","approved"]},"revision":{"type":"number","example":1,"description":"Starts at 1; each POST /runs/:id/revise of an approved run adds one. A run with revision > 1 that is not approved is being revised."},"approved_at":{"type":"string","nullable":true,"example":null},"approved_by":{"type":"string","nullable":true},"created_by":{"type":"string","nullable":true},"created_at":{"type":"string"},"modified_at":{"type":"string","nullable":true}},"required":["id","property_id","legal_entity_id","recovery_group_id","period_year","period_start","period_end","status","revision","approved_at","approved_by","created_by","created_at","modified_at"]},"RecoveryRunLineDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"run_id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid","description":"The tenant — the worksheet's primary axis."},"account_id":{"type":"string","format":"uuid","description":"Statement row."},"participates":{"type":"boolean","description":"False on a row written for an explicitly excluded term. Such a row carries zero amounts and exists so the statement can show \"Excluded\" rather than omit the line; every total skips it."},"account_actual":{"type":"string","example":"31431.00"},"admin_fee_pct_used":{"type":"string","example":"0.1500","description":"The resolved admin fee after the override cascade, not the lease-level default."},"denominator_used":{"type":"string","nullable":true,"example":"125000.00","description":"Null when the basis yielded nothing to divide by."},"gross_up_factor_used":{"type":"string","example":"1.000000","description":"'1' when gross-up is off."},"share_pct_used":{"type":"string","nullable":true,"example":"0.100000"},"share_basis":{"type":"string","enum":["negotiated","sqft","none"],"description":"This row's own basis — a lease can be negotiated on CAM and sqft on taxes. 'none' on an excluded row, and on a row nothing could divide by."},"proration_factor":{"type":"string","example":"1.000000","description":"Term window ∩ lease occupancy ∩ run period, over days in period. '0' on an excluded row."},"amount":{"type":"string","example":"5750.00","description":"What the tenant is billed for this row — INCLUDES the admin fee."},"amount_before_admin_fee":{"type":"string","example":"5000.00","description":"Excludes the admin fee — the figure the over-recovery guard and the recovery rate run on. Both amount columns are required: shipping only one makes the worksheet and the recovery-rate panel silently disagree by exactly the admin fee."},"base_year_applied":{"type":"string","example":"0.00","description":"This row's share of the lease's base-year stop, spread across its rows pro-rata. Never reduces `amount`, which stays pre-modifier."},"cap_applied":{"type":"string","example":"0.00","description":"This row's share of the lease's cap; '0.00' when the cap did not bind or this row is not `in_cap`."},"recoverable":{"type":"string","example":"5750.00","description":"`amount − base_year_applied − cap_applied` — what the tenant actually owes for this account. Next cycle's annual cap reads this row."},"created_at":{"type":"string","format":"date-time"}},"required":["id","run_id","contract_id","account_id","participates","account_actual","admin_fee_pct_used","denominator_used","gross_up_factor_used","share_pct_used","share_basis","proration_factor","amount","amount_before_admin_fee","base_year_applied","cap_applied","recoverable","created_at"]},"CreateRecoveryRunAdjustmentV1Dto":{"type":"object","properties":{"target_type":{"type":"string","enum":["exclude_journal_line","admin_fee","denominator","share","estimate"],"description":"Type of adjustment being applied"},"target_ref":{"type":"string","description":"Structured key naming what the adjustment applies to; the grammar depends on target_type (validated against recovery_run_adjustments_target_ref_check):\n  exclude_journal_line -> line:<journal_line_id>\n  admin_fee            -> account:<id> | line:<journal_line_id>\n  denominator          -> account:<id>\n  share                -> account:<id>|contract:<id>\n  estimate             -> contract:<id>\nSpec 2026-09-19 D7/D10: the run is keyed (contract, account), so the expense side of the key is the GL account, never a pool.","example":"account:550e8400-e29b-41d4-a716-446655440000|contract:6ba7b810-9dad-11d1-80b4-00c04fd430c8"},"old_value":{"type":"string","nullable":true,"description":"Previous value (for audit trail). Dollar amount for estimate; fraction in [0,1] for share; fraction for admin_fee; a positive number of square feet for denominator.","example":"1000.00"},"new_value":{"type":"string","nullable":true,"description":"New value to apply. A dollar amount for estimate (e.g. \"3000.00\"). A fraction in [0,1] for share (e.g. \"0.10\" = 10%). A fraction for admin_fee (0 is a valid, real deal term and is honoured, not treated as absent). A positive number of square feet for denominator. Not used for exclude_journal_line.","example":"900.00"},"reason":{"type":"string","description":"Reason for the adjustment","example":"Non-recoverable utility spike in July"}},"required":["target_type","target_ref","reason"]},"BillingPreviewV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["invoice","credit_memo","none"],"description":"'none' means every unbilled charge for this tenant nets to exactly zero — billing would settle them without producing a document."},"amount":{"type":"string","description":"Non-negative — the netted magnitude.","example":"400.00"},"charge_count":{"type":"number","example":2}},"required":["contract_id","kind","amount","charge_count"]},"BillingDocumentLineV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"amount":{"type":"string","description":"Signed within the document's own convention: positive credits this account (invoice), or positive debits it (credit_memo) — see the parent kind.","example":"1200.00"},"description":{"type":"string"}},"required":["account_id","amount","description"]},"BillingDocumentV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["invoice","credit_memo"]},"amount":{"type":"string","example":"400.00"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/BillingDocumentLineV1Dto"}}},"required":["contract_id","document_id","kind","amount","lines"]},"RecoveryBillingResultV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid"},"billed_at":{"type":"string"},"documents":{"type":"array","items":{"$ref":"#/components/schemas/BillingDocumentV1Dto"}},"settled_without_document":{"description":"Tenants whose charges netted to exactly zero — settled without a document.","type":"array","items":{"type":"string"}}},"required":["id","property_id","billed_at","documents","settled_without_document"]},"CollectBillingV1Dto":{"type":"object","properties":{"property_id":{"type":"string","format":"uuid","description":"The property to bill. Collects every ready charge on its shelf."},"contract_ids":{"description":"Narrows collection to these tenants only. Omit (or send an empty array) to collect every tenant with charges on the shelf.","type":"array","items":{"type":"string"}}},"required":["property_id"]},"BillingDocumentSummaryV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["invoice","credit_memo"]},"amount":{"type":"string","example":"400.00"},"balance":{"type":"string","description":"The document's outstanding balance, not the billed amount.","example":"400.00"}},"required":["contract_id","document_id","kind","amount","balance"]},"RecoveryBillingV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid"},"billed_at":{"type":"string"},"created_by":{"type":"string","format":"uuid","nullable":true},"created_at":{"type":"string"},"documents":{"description":"The tenant documents this billing produced. Empty when every tenant netted to zero.","type":"array","items":{"$ref":"#/components/schemas/BillingDocumentSummaryV1Dto"}}},"required":["id","property_id","billed_at","created_by","created_at","documents"]},"RecoveryChargeV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid"},"run_id":{"type":"string","format":"uuid","nullable":true,"description":"The run that staged this charge. Null for module charges (re_tax), whose producer is not a run."},"recovery_group_id":{"type":"string","format":"uuid","nullable":true,"description":"The recovery cycle a run true-up belongs to; billing resolves the income account from it. Set for source=run; null otherwise. Exactly one of recovery_group_id/account_id."},"account_id":{"type":"string","format":"uuid","nullable":true,"description":"Set for account-naming producers; null for source=run."},"source":{"type":"string","enum":["run","re_tax","insurance","escalation","percentage_rent"]},"source_ref":{"type":"string"},"period_start":{"type":"string","example":"2025-01-01"},"period_end":{"type":"string","example":"2025-12-31"},"amount":{"type":"string","example":"1200.00","description":"Signed — positive means the tenant owes more."},"memo":{"type":"string","nullable":true},"billed_document_id":{"type":"string","format":"uuid","nullable":true},"settled_at":{"type":"string","nullable":true,"description":"Set when this charge netted to exactly zero for its tenant at billing time — settled with no document to point billed_document_id at."},"created_at":{"type":"string"}},"required":["id","contract_id","property_id","run_id","recovery_group_id","account_id","source","source_ref","period_start","period_end","amount","memo","billed_document_id","settled_at","created_at"]},"ChargeExplanationRefV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The charge."},"document_line_id":{"type":"string","format":"uuid","nullable":true,"description":"The invoice line that carries the charge. Null for a charge billed by \"Prepare statements\" or before invoice lines were recorded."},"source":{"type":"string","description":"The charge's producer (`percentage_rent`, `escalation`, `run`, ...)."},"explainable":{"type":"boolean","description":"Whether `GET /v1/charges/{id}/explanation` can explain it. Only percentage rent charges can today."}},"required":["id","document_line_id","source","explainable"]},"ChargeExplanationChargeV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"amount":{"type":"string","description":"Signed; negative is a credit.","example":"1234.50"},"part":{"type":"string","enum":["rent","interest","costs"],"description":"Which of the line's charges: its percentage rent, or an audit line's interest or audit costs."},"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"billed_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The invoice that billed it; null while on the shelf."}},"required":["id","amount","part","period_start","period_end","billed_document_id"]},"ChargeExplanationLineV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The percentage rent run line."},"run_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["annual","interim","audit","termination"]},"status":{"type":"string","enum":["pending","held","blocked","approved"]}},"required":["id","run_id","kind","status"]},"ChargeExplanationPeriodV1Dto":{"type":"object","properties":{"start":{"type":"string","format":"date"},"end":{"type":"string","format":"date","description":"Inclusive."},"days_in_period":{"type":"number","nullable":true,"description":"Days in the period; null on a line computed before it was stored."},"days_open":{"type":"number","nullable":true,"description":"Days in the period less closure days; null on a line computed before it was stored."}},"required":["start","end","days_in_period","days_open"]},"ChargeExplanationSalesV1Dto":{"type":"object","properties":{"category_id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true,"description":"The sales category name; null when it no longer exists."},"qualifying":{"type":"string","description":"Qualifying sales after deductions.","example":"1234.50"}},"required":["category_id","name","qualifying"]},"ChargeExplanationDerivationV1Dto":{"type":"object","properties":{"base_rent":{"type":"string","nullable":true,"description":"A natural breakpoint's base rent; null for any other type.","example":"1234.50"},"rate":{"type":"number","nullable":true,"description":"A natural breakpoint's rate, basis points; null otherwise."},"proration":{"description":"Each proration factor applied, in order.","type":"array","items":{"type":"string"}},"text":{"type":"string","description":"The whole derivation as one sentence."}},"required":["base_rent","rate","proration","text"]},"ChargeExplanationBreakpointV1Dto":{"type":"object","properties":{"rule":{"description":"The rule ids sharing this breakpoint.","type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["none","natural","stated","tiered"]},"amount":{"type":"string","description":"The breakpoint, prorated.","example":"1234.50"},"derivation":{"$ref":"#/components/schemas/ChargeExplanationDerivationV1Dto"}},"required":["rule","type","amount","derivation"]},"ChargeExplanationTierV1Dto":{"type":"object","properties":{"rule":{"type":"string","format":"uuid","description":"The tiered rule."},"from":{"type":"string","description":"Where the tier starts, prorated.","example":"1234.50"},"rate":{"type":"number","description":"Basis points."},"sales":{"type":"string","description":"The sales the tier's rate applied to.","example":"1234.50"},"amount":{"type":"string","example":"1234.50"}},"required":["rule","from","rate","sales","amount"]},"ChargeExplanationSplitV1Dto":{"type":"object","properties":{"category_id":{"type":"string","format":"uuid"},"group":{"type":"string","description":"The shared breakpoint group."},"amount":{"type":"string","description":"The overage share the category was billed on.","example":"1234.50"}},"required":["category_id","group","amount"]},"ChargeExplanationAllocationV1Dto":{"type":"object","properties":{"rule":{"type":"string","enum":["pro_rata","sequenced"]},"split":{"type":"array","items":{"$ref":"#/components/schemas/ChargeExplanationSplitV1Dto"}}},"required":["rule","split"]},"ChargeExplanationAdjustmentV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["manual","interest","audit_costs"]},"amount":{"type":"string","description":"Signed.","example":"1234.50"},"reason":{"type":"string"}},"required":["kind","amount","reason"]},"ChargeExplanationV1Dto":{"type":"object","properties":{"source":{"type":"string","enum":["percentage_rent"],"description":"The charge's producer; the shape below is its explanation."},"charge":{"$ref":"#/components/schemas/ChargeExplanationChargeV1Dto"},"line":{"$ref":"#/components/schemas/ChargeExplanationLineV1Dto"},"period":{"$ref":"#/components/schemas/ChargeExplanationPeriodV1Dto"},"sales_by_category":{"type":"array","items":{"$ref":"#/components/schemas/ChargeExplanationSalesV1Dto"}},"breakpoints":{"type":"array","items":{"$ref":"#/components/schemas/ChargeExplanationBreakpointV1Dto"}},"tiers":{"type":"array","items":{"$ref":"#/components/schemas/ChargeExplanationTierV1Dto"}},"allocation":{"nullable":true,"description":"How a shared breakpoint's overage was split; null when none is shared.","type":"object","allOf":[{"$ref":"#/components/schemas/ChargeExplanationAllocationV1Dto"}]},"gross":{"type":"string","nullable":true,"description":"Percentage rent for the period.","example":"1234.50"},"previously_billed":{"type":"string","nullable":true,"description":"Percentage rent of the year already charged by earlier lines.","example":"1234.50"},"delta":{"type":"string","nullable":true,"description":"Gross less previously billed.","example":"1234.50"},"adjustments":{"type":"array","items":{"$ref":"#/components/schemas/ChargeExplanationAdjustmentV1Dto"}},"estimated":{"type":"boolean","description":"Whether any sales in it were estimated, not reported."}},"required":["source","charge","line","period","sales_by_category","breakpoints","tiers","allocation","gross","previously_billed","delta","adjustments","estimated"]},"InsuranceListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["active","inactive"]},"notes":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true},"property_name":{"type":"string","description":"Display label of the property."},"coverage_count":{"type":"number","description":"How many coverage types sit under it."}},"required":["id","property_id","legal_entity_id","status","created_at","property_name","coverage_count"]},"InsuranceV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["active","inactive"]},"notes":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","property_id","legal_entity_id","status","created_at"]},"CreateInsuranceV1Dto":{"type":"object","properties":{"property_id":{"type":"string","format":"uuid","description":"The property this insurance covers."},"legal_entity_id":{"type":"string","format":"uuid","description":"The entity that carries the cost and bills tenants. Every AP, AR and IC document this module writes belongs to it."},"notes":{"type":"string","nullable":true}},"required":["property_id","legal_entity_id"]},"InsuranceParticipationPropertyV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","description":"Display label of the property."}},"required":["id","name"]},"InsuranceParticipationV1Dto":{"type":"object","properties":{"participant_id":{"type":"string","format":"uuid"},"insurance_id":{"type":"string","format":"uuid"},"property":{"$ref":"#/components/schemas/InsuranceParticipationPropertyV1Dto"},"coverage_id":{"type":"string","format":"uuid"},"coverage_type":{"type":"string","enum":["property","general_liability","umbrella","flood","earthquake","boiler_machinery","business_interruption","environmental","terrorism","other"]},"term_id":{"type":"string","format":"uuid"},"effective_date":{"type":"string","format":"date"},"expiry_date":{"type":"string","format":"date"},"policy_number":{"type":"string","nullable":true},"term_status":{"type":"string","enum":["open","active","closed"]},"share_basis":{"type":"string","enum":["negotiated","sqft"]},"share_pct":{"type":"string","nullable":true,"description":"Null for sqft — resolved at invoice input."},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"`tenant_direct_pay`: the tenant pays the insurer. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."}},"required":["participant_id","insurance_id","property","coverage_id","coverage_type","term_id","effective_date","expiry_date","term_status","share_basis","method"]},"InsuranceMetricGroupV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"Numeric string — no float math."},"count":{"type":"number"}},"required":["amount","count"]},"InsuranceExpiringGroupV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"Numeric string — no float math."},"count":{"type":"number"},"days":{"type":"number","description":"Width of the look-ahead window, in days."}},"required":["amount","count","days"]},"InsuranceCoverageGapsV1Dto":{"type":"object","properties":{"count":{"type":"number"}},"required":["count"]},"InsuranceExpiringPolicyGroupV1Dto":{"type":"object","properties":{"count":{"type":"number"},"soonest":{"type":"string","format":"date","nullable":true}},"required":["count","soonest"]},"InsuranceSummaryV1Dto":{"type":"object","properties":{"owed_to_issuers":{"description":"Open balance on the AP bills and intercompany documents behind active premium invoices. \"Open\" is `status = posted AND balance_amount > 0`, the same rule `Documents.summary` uses, so the two cannot disagree.","allOf":[{"$ref":"#/components/schemas/InsuranceMetricGroupV1Dto"}]},"owed_by_tenants":{"description":"Open balance on AR invoices raised from insurance shares. Counts both reimbursement methods through the share's own AR invoice: `tenant_reimbursement` and `tenant_reimbursement_via_cam` (invoiced as a CAM estimate). A legacy via-CAM share with no AR invoice is collected by the CAM invoice and excluded, and neither direct-pay method is a receivable. This is therefore NOT total recoverable cost.","allOf":[{"$ref":"#/components/schemas/InsuranceMetricGroupV1Dto"}]},"expiring_soon":{"description":"Terms not yet closed whose expiry falls within the window, and their combined annual premium.","allOf":[{"$ref":"#/components/schemas/InsuranceExpiringGroupV1Dto"}]},"coverage_gaps":{"description":"Active coverages with no term in force today — a coverage type on the books that is not actually covering anything right now.","allOf":[{"$ref":"#/components/schemas/InsuranceCoverageGapsV1Dto"}]},"due_30d":{"description":"What the org pays in the next 30 days, late included — exactly the rows of the registry's `view=due_30`.","allOf":[{"$ref":"#/components/schemas/DueSoonV1Dto"}]},"past_due":{"description":"Everything past due — the registry's `past_due` column summed.","allOf":[{"$ref":"#/components/schemas/PastDueV1Dto"}]},"expiring_60d":{"description":"Coverages whose newest term ends within 60 days with no renewal staged — exactly the rows of `view=expiring_60`.","allOf":[{"$ref":"#/components/schemas/InsuranceExpiringPolicyGroupV1Dto"}]}},"required":["owed_to_issuers","owed_by_tenants","expiring_soon","coverage_gaps","due_30d","past_due","expiring_60d"]},"InsuranceCurrentTermV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"effective_date":{"type":"string","format":"date"},"expiry_date":{"type":"string","format":"date"},"status":{"type":"string","enum":["open","active","closed"]},"days_to_expiry":{"type":"number","description":"Days from the org's today to the expiry date; negative once expired."},"carrier":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/PartyRefV1Dto"}]},"broker":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/PartyRefV1Dto"}]}},"required":["id","effective_date","expiry_date","status","days_to_expiry","carrier","broker"]},"InsuranceRowAttentionV1Dto":{"type":"object","properties":{"policy_expiring_on":{"type":"string","format":"date","nullable":true,"description":"Set when the newest term (no renewal staged) ends within 60 days, or has ended."},"invoice_expected_missing":{"type":"boolean"},"share_unpaid_past_due":{"type":"boolean"},"coverage_gap":{"type":"boolean","description":"No term in force on the org's today."},"config_problem":{"type":"boolean","description":"A configuration problem the attention provider flags. Row tag only — it does not put a row in the needs_attention view."}},"required":["policy_expiring_on","invoice_expected_missing","share_unpaid_past_due","coverage_gap","config_problem"]},"InsuranceCoverageListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Coverage id — what the row links to."},"insurance_id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid"},"property_name":{"type":"string"},"legal_entity_id":{"type":"string","format":"uuid"},"coverage_type":{"type":"string","enum":["property","general_liability","umbrella","flood","earthquake","boiler_machinery","business_interruption","environmental","terrorism","other"]},"status":{"type":"string","enum":["active","inactive"]},"notes":{"type":"string","nullable":true},"latest_term_id":{"type":"string","format":"uuid","nullable":true},"latest_term_effective":{"type":"string","format":"date","nullable":true},"latest_term_expiry":{"type":"string","format":"date","nullable":true},"latest_term_status":{"type":"string","enum":["open","active","closed"],"nullable":true},"annual_premium":{"type":"string","nullable":true,"example":"1234.50"},"carrier_party_id":{"type":"string","format":"uuid","nullable":true},"broker_party_id":{"type":"string","format":"uuid","nullable":true,"description":"The TERM's broker of record. There is no insurance-level broker: a BOR letter is per policy, and renewal carries it forward per term."},"next_expected_date":{"type":"string","format":"date","nullable":true,"description":"Earliest instalment with no active invoice against it."},"open_term_count":{"type":"number","description":"Terms on this coverage that are not closed."},"owed_to_issuers":{"type":"string","description":"Open balance owed to carriers/brokers for this coverage, across ALL its terms — a superseded term's unpaid bill is still owed. Numeric string.","example":"1234.50"},"owed_by_tenants":{"type":"string","description":"Open balance on AR invoices raised from this coverage's reimbursement shares of either method, across all terms. Excludes direct-pay shares and a legacy via-CAM share with no AR invoice, so it is NOT total recoverable cost. Numeric string.","example":"1234.50"},"next_payment":{"nullable":true,"description":"The earliest payment still ahead (or overdue): an open billed invoice on ANY term, else a scheduled installment with no invoice on a term not closed, else a tenant-paid invoice.","type":"object","allOf":[{"$ref":"#/components/schemas/NextPaymentV1Dto"}]},"past_due":{"$ref":"#/components/schemas/PastDueV1Dto"},"current_term":{"nullable":true,"description":"The term in force on the org's today; else the next one not closed; else the newest.","type":"object","allOf":[{"$ref":"#/components/schemas/InsuranceCurrentTermV1Dto"}]},"attention":{"$ref":"#/components/schemas/InsuranceRowAttentionV1Dto"}},"required":["id","insurance_id","property_id","property_name","legal_entity_id","coverage_type","status","annual_premium","open_term_count","owed_to_issuers","owed_by_tenants","next_payment","past_due","current_term","attention"]},"InsuranceCoverageV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"insurance_id":{"type":"string","format":"uuid"},"coverage_type":{"type":"string","enum":["property","general_liability","umbrella","flood","earthquake","boiler_machinery","business_interruption","environmental","terrorism","other"]},"status":{"type":"string","enum":["active","inactive"]},"notes":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","insurance_id","coverage_type","status","created_at"]},"AddCoverageToPropertyV1Dto":{"type":"object","properties":{"property_id":{"type":"string","format":"uuid"},"coverage_type":{"type":"string","enum":["property","general_liability","umbrella","flood","earthquake","boiler_machinery","business_interruption","environmental","terrorism","other"]},"notes":{"type":"string","nullable":true}},"required":["property_id","coverage_type"]},"UpdateInsuranceV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["active","inactive"]},"notes":{"type":"string","nullable":true}}},"CreateInsuranceCoverageV1Dto":{"type":"object","properties":{"coverage_type":{"type":"string","enum":["property","general_liability","umbrella","flood","earthquake","boiler_machinery","business_interruption","environmental","terrorism","other"]},"notes":{"type":"string","nullable":true}},"required":["coverage_type"]},"UpdateInsuranceCoverageV1Dto":{"type":"object","properties":{"status":{"type":"string","enum":["active","inactive"]},"notes":{"type":"string","nullable":true}}},"InsuranceDeletedV1Dto":{"type":"object","properties":{"deleted":{"type":"boolean","example":true}},"required":["deleted"]},"InsuranceTermV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coverage_id":{"type":"string","format":"uuid"},"effective_date":{"type":"string","format":"date"},"expiry_date":{"type":"string","format":"date"},"carrier_party_id":{"type":"string","format":"uuid","nullable":true},"broker_party_id":{"type":"string","format":"uuid","nullable":true},"policy_number":{"type":"string","nullable":true},"annual_premium":{"type":"string","nullable":true,"example":"1234.50"},"payment_cadence":{"type":"string","enum":["annual","semi_annual","quarterly","monthly"]},"first_due_date":{"type":"string","format":"date","nullable":true},"limit_per_occurrence":{"type":"string","nullable":true},"limit_aggregate":{"type":"string","nullable":true},"deductible":{"type":"string","nullable":true},"recoverable":{"type":"boolean"},"payee_party_id":{"type":"string","format":"uuid","nullable":true},"expense_account_id":{"type":"string","format":"uuid","nullable":true},"recovery_group_id":{"type":"string","format":"uuid","nullable":true},"denominator_basis":{"type":"string","enum":["participant_area","fixed_area"]},"fixed_area_sqft":{"type":"string","nullable":true},"status":{"type":"string","enum":["open","active","closed"]},"notes":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","coverage_id","effective_date","expiry_date","annual_premium","payment_cadence","recoverable","denominator_basis","status","created_at"]},"InsuranceExpectedInvoiceV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"term_id":{"type":"string","format":"uuid"},"expected_date":{"type":"string","format":"date"},"estimated_amount":{"type":"string","nullable":true},"source":{"type":"string","enum":["cadence","manual"]},"notes":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","term_id","expected_date","source","created_at"]},"InsuranceTermCreatedV1Dto":{"type":"object","properties":{"term":{"$ref":"#/components/schemas/InsuranceTermV1Dto"},"expected_invoices":{"description":"The schedule generated from the term’s payment cadence.","type":"array","items":{"$ref":"#/components/schemas/InsuranceExpectedInvoiceV1Dto"}}},"required":["term","expected_invoices"]},"CreateInsuranceTermV1Dto":{"type":"object","properties":{"effective_date":{"type":"string","format":"date","example":"2026-01-01"},"expiry_date":{"type":"string","format":"date","example":"2026-12-31"},"carrier_party_id":{"type":"string","format":"uuid","nullable":true},"broker_party_id":{"type":"string","format":"uuid","nullable":true},"policy_number":{"type":"string","nullable":true,"example":"GL-2026-88214"},"annual_premium":{"type":"string","nullable":true,"example":"84000.00"},"payment_cadence":{"type":"string","enum":["annual","semi_annual","quarterly","monthly"],"default":"annual","description":"Generates the expected-invoice schedule together with first_due_date."},"first_due_date":{"type":"string","format":"date","nullable":true,"description":"Defaults to the effective date."},"limit_per_occurrence":{"type":"string","nullable":true},"limit_aggregate":{"type":"string","nullable":true},"deductible":{"type":"string","nullable":true},"recoverable":{"type":"boolean","default":true,"description":"When false the premium is the owner’s cost: no participants, no tenant shares."},"payee_party_id":{"type":"string","format":"uuid","nullable":true,"description":"Default issuer offered at invoice entry. Never itself the vendor of a payable — the invoice’s own issuer is."},"expense_account_id":{"type":"string","format":"uuid","nullable":true,"description":"Null falls back to the insurance_expense system role."},"recovery_group_id":{"type":"string","format":"uuid","nullable":true,"description":"NULL = no CAM regime for this term."},"denominator_basis":{"type":"string","enum":["participant_area","fixed_area"],"description":"Omitted: the previous term's when inheriting, else `fixed_area` when the property's rentable_sqft is measured, else `participant_area`."},"fixed_area_sqft":{"type":"string","nullable":true,"description":"Under `fixed_area`, omitted means the property's rentable_sqft; with neither above zero the request is refused (INSURANCE_FIXED_AREA_REQUIRED)."},"notes":{"type":"string","nullable":true},"inherit_from_latest":{"type":"boolean","default":false,"description":"Renewal: carry every unset field forward from this coverage’s latest term."},"generate_slots":{"type":"boolean","default":true,"description":"Set false to create the term without its cadence schedule."}},"required":["effective_date","expiry_date"]},"UpdateInsuranceTermV1Dto":{"type":"object","properties":{"effective_date":{"type":"string","format":"date"},"expiry_date":{"type":"string","format":"date"},"carrier_party_id":{"type":"string","format":"uuid","nullable":true},"broker_party_id":{"type":"string","format":"uuid","nullable":true},"policy_number":{"type":"string","nullable":true},"annual_premium":{"type":"string","nullable":true},"payment_cadence":{"type":"string","enum":["annual","semi_annual","quarterly","monthly"]},"first_due_date":{"type":"string","format":"date","nullable":true},"limit_per_occurrence":{"type":"string","nullable":true},"limit_aggregate":{"type":"string","nullable":true},"deductible":{"type":"string","nullable":true},"recoverable":{"type":"boolean"},"payee_party_id":{"type":"string","format":"uuid","nullable":true},"expense_account_id":{"type":"string","format":"uuid","nullable":true},"recovery_group_id":{"type":"string","format":"uuid","nullable":true},"denominator_basis":{"type":"string","enum":["participant_area","fixed_area"],"description":"Changing it is refused when it takes a day of the term over 100%, and flags the differences on issued invoices in the Work Center."},"fixed_area_sqft":{"type":"string","nullable":true,"description":"Under `fixed_area` it must be above zero: omitted, the stored area is kept, else the property's rentable_sqft is used; with none the request is refused (INSURANCE_FIXED_AREA_REQUIRED)."},"status":{"type":"string","enum":["open","active","closed"]},"notes":{"type":"string","nullable":true}}},"InsuranceParticipantInPlaceV1Dto":{"type":"object","properties":{"from":{"type":"string","format":"date","description":"First day in place (inclusive)."},"to":{"type":"string","format":"date","description":"Last day in place (inclusive)."},"days":{"type":"number","description":"Days in place, inclusive of both ends."},"term_days":{"type":"number","description":"Days in the term, inclusive of both ends."}},"required":["from","to","days","term_days"]},"InsuranceTermParticipantV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"term_id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"share_basis":{"type":"string","enum":["negotiated","sqft"]},"share_pct":{"type":"string","nullable":true,"description":"Null for sqft — resolved at invoice input."},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"`tenant_direct_pay`: the tenant pays the insurer. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."},"started_on":{"type":"string","format":"date","nullable":true,"description":"First day of participation (inclusive); null = from the term start."},"ended_on":{"type":"string","format":"date","nullable":true,"description":"Last day of participation (inclusive); null = through the term end."},"billed":{"type":"boolean","description":"True when this row was billed: an active premium invoice of the term carrying a share for its lease was input at or after the row was created. A billed row cannot be deleted (409 INSURANCE_PARTICIPANT_BILLED) — end it with ended_on, or void those invoices first — and its share_basis and share_pct are not edited in place (409 INSURANCE_PARTICIPANT_BILLED_SHARE_IMMUTABLE): use a dated change. A row a dated change created after the latest active invoice is unbilled."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true},"contract_title":{"type":"string","example":"Suite 300 lease"},"counterparty_name":{"type":"string","nullable":true,"example":"Acme Corp"},"in_place":{"nullable":true,"description":"The span this lease was in place within the term — the lease's start, its occupancy end and the row's own dates, clipped to the term. It is the span a premium invoice counts the share on, day by day — a lease in place for part of the term is invoiced for those days only. Null when the row shares no day of the term.","type":"object","allOf":[{"$ref":"#/components/schemas/InsuranceParticipantInPlaceV1Dto"}]},"year_end_true_up":{"description":"Whether this lease's share is trued up at year-end by the Expense Recovery run, read as of today clamped into the term — the same decision a premium invoice entered today would make.","allOf":[{"$ref":"#/components/schemas/YearEndTrueUpV1Dto"}]}},"required":["id","term_id","contract_id","share_basis","method","started_on","ended_on","billed","created_at","contract_title","counterparty_name","in_place","year_end_true_up"]},"InsuranceParticipantV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"term_id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"share_basis":{"type":"string","enum":["negotiated","sqft"]},"share_pct":{"type":"string","nullable":true,"description":"Null for sqft — resolved at invoice input."},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"`tenant_direct_pay`: the tenant pays the insurer. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."},"started_on":{"type":"string","format":"date","nullable":true,"description":"First day of participation (inclusive); null = from the term start."},"ended_on":{"type":"string","format":"date","nullable":true,"description":"Last day of participation (inclusive); null = through the term end."},"billed":{"type":"boolean","description":"True when this row was billed: an active premium invoice of the term carrying a share for its lease was input at or after the row was created. A billed row cannot be deleted (409 INSURANCE_PARTICIPANT_BILLED) — end it with ended_on, or void those invoices first — and its share_basis and share_pct are not edited in place (409 INSURANCE_PARTICIPANT_BILLED_SHARE_IMMUTABLE): use a dated change. A row a dated change created after the latest active invoice is unbilled."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","term_id","contract_id","share_basis","method","started_on","ended_on","billed","created_at"]},"CreateInsuranceParticipantV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid","description":"The lease."},"share_basis":{"type":"string","enum":["negotiated","sqft"],"description":"negotiated carries its own share_pct; sqft resolves from the lease’s rentable area at invoice input."},"share_pct":{"type":"string","nullable":true,"example":"13.8710","description":"Required for negotiated, must be omitted for sqft."},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"`tenant_direct_pay`: the tenant pays the insurer. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."},"started_on":{"type":"string","format":"date","nullable":true,"description":"The first day this lease participates in the term (inclusive). Null or omitted = from the term start."}},"required":["contract_id","share_basis","method"]},"AddInsuranceParticipantsBatchV1Dto":{"type":"object","properties":{"participants":{"description":"The participants to add, applied in one transaction: either every entry lands or none does. A contract_id repeated within this array is rejected, as is one already on the term. Capped at 100 — the largest insured property in production carries 8 active leases, so the bound exists to keep the transaction finite, not to ration.","type":"array","items":{"$ref":"#/components/schemas/CreateInsuranceParticipantV1Dto"}}},"required":["participants"]},"InsuranceParticipantChangesResultV1Dto":{"type":"object","properties":{"participants":{"description":"The term's participants after the change.","type":"array","items":{"$ref":"#/components/schemas/InsuranceParticipantV1Dto"}}},"required":["participants"]},"InsuranceParticipantOperationV1Dto":{"type":"object","properties":{"op":{"type":"string","enum":["add","change","end"],"description":"'add' a lease (contract_id, method, share_basis, share_pct, started_on, ended_on); 'change' a participant's share from a date (participant_id, from, share_basis, share_pct) — its row ends the day before `from` and a new row starts on it, keeping the old end and method; 'end' a participant (participant_id, ended_on)."},"contract_id":{"type":"string","format":"uuid","description":"The lease to add. Required for 'add'."},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"How the tenant pays. Required for 'add'; all rows of one lease in a term share one method (400 INSURANCE_PARTICIPANT_METHOD_MISMATCH). `tenant_direct_pay`: the tenant pays the insurer. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."},"participant_id":{"type":"string","format":"uuid","description":"The participant row to change or end. Required for 'change' and 'end'."},"share_basis":{"type":"string","enum":["negotiated","sqft"],"description":"Required for 'add' and 'change'."},"share_pct":{"type":"string","nullable":true,"description":"Percent as a decimal string. Required for share_basis 'negotiated'; omitted or null for 'sqft'.","example":"13.8710"},"started_on":{"type":"string","format":"date","nullable":true,"description":"'add' only: the first day (inclusive); null = from the term start."},"ended_on":{"type":"string","format":"date","nullable":true,"description":"The last day (inclusive). Required for 'end'; optional for 'add' (null = through the term end)."},"from":{"type":"string","format":"date","description":"'change' only, required: the first day of the new share. Must be on or after the participant's first effective day (its dates narrowed by its lease's) and on or before its last. On that first day the row is corrected in place (no split), which is refused with 409 when an issued invoice used the row's share."}},"required":["op"]},"InsuranceParticipantChangesV1Dto":{"type":"object","properties":{"operations":{"description":"Applied in order and atomically: every operation lands or none does. Capped at 100.","type":"array","items":{"$ref":"#/components/schemas/InsuranceParticipantOperationV1Dto"}},"accept_cuts":{"description":"Participant ids whose share the caller accepts will go down. Under participant area a change may cut only the participants it names — as the subject of an operation or here; the preview lists who would be cut. Defaults to none.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["operations"]},"InsuranceTimelineShareV1Dto":{"type":"object","properties":{"participant_id":{"type":"string","format":"uuid","nullable":true,"description":"The participant row; null for a row the change would create."},"contract_id":{"type":"string","format":"uuid"},"share_basis":{"type":"string","enum":["negotiated","sqft"]},"share_pct":{"type":"string","description":"The resolved share in this range, percent at 4 decimals.","example":"33.3333"}},"required":["participant_id","contract_id","share_basis","share_pct"]},"InsuranceTimelineRangeV1Dto":{"type":"object","properties":{"start_date":{"type":"string","format":"date"},"end_date":{"type":"string","format":"date","description":"Inclusive."},"days":{"type":"number","description":"Days in the range, inclusive."},"shares":{"type":"array","items":{"$ref":"#/components/schemas/InsuranceTimelineShareV1Dto"}},"owner_pct":{"type":"string","description":"The owner's remainder in this range, percent.","example":"10.0000"}},"required":["start_date","end_date","days","shares","owner_pct"]},"InsurancePreviewTimelineV1Dto":{"type":"object","properties":{"ranges":{"nullable":true,"description":"The term split into ranges over which the participants do not change, each with its resolved shares. Null when the set does not resolve on some day — then `problem` says why.","type":"array","items":{"$ref":"#/components/schemas/InsuranceTimelineRangeV1Dto"}},"problem":{"type":"string","nullable":true,"description":"Why the set does not resolve (a participant by area whose lease records no area, shares over 100%, no room left for the area tenants); null when it does."}},"required":["ranges","problem"]},"InsuranceParticipantCutV1Dto":{"type":"object","properties":{"participant_id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true,"example":"Acme Corp"},"before_pct":{"type":"string","nullable":true,"description":"Resolved share on `from` before the change; null when the term as it stands does not resolve (before.problem).","example":"30.0000"},"after_pct":{"type":"string","nullable":true,"description":"Resolved share on `from` after the change; null when the result does not resolve (after.problem).","example":"6.0000"},"from":{"type":"string","format":"date","description":"The first day the share is cut."}},"required":["participant_id","contract_id","name","before_pct","after_pct","from"]},"InsuranceParticipantChangesPreviewV1Dto":{"type":"object","properties":{"before":{"description":"The term as it stands.","allOf":[{"$ref":"#/components/schemas/InsurancePreviewTimelineV1Dto"}]},"after":{"description":"The term after the operations.","allOf":[{"$ref":"#/components/schemas/InsurancePreviewTimelineV1Dto"}]},"refusal":{"type":"string","nullable":true,"description":"Why saving these operations would be refused (400) because the result does not resolve; null when it would not be. A set that already did not resolve is not refused for an edit that leaves it no worse only under fixed area with shares over 100%. Cuts are listed in `cuts`, apart from this."},"cuts":{"description":"Participants whose share the change would cut and that it does not name; saving refuses (400 INSURANCE_PARTICIPANT_SHARE_CUT) until each is in accept_cuts.","type":"array","items":{"$ref":"#/components/schemas/InsuranceParticipantCutV1Dto"}}},"required":["before","after","refusal","cuts"]},"InsuranceAllocationShareV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"share_basis":{"type":"string","enum":["negotiated","sqft"]},"share_pct":{"type":"string","example":"13.8710","description":"The resolved percentage invoice input will freeze."}},"required":["contract_id","share_basis","share_pct"]},"InsuranceAllocationV1Dto":{"type":"object","properties":{"shares":{"type":"array","items":{"$ref":"#/components/schemas/InsuranceAllocationShareV1Dto"}},"landlord_remainder_pct":{"type":"string","example":"61.1290","description":"Unallocated balance — the owner’s cost, and real vacancy."}},"required":["shares","landlord_remainder_pct"]},"UpdateInsuranceParticipantV1Dto":{"type":"object","properties":{"share_basis":{"type":"string","enum":["negotiated","sqft"]},"share_pct":{"type":"string","nullable":true},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"`tenant_direct_pay`: the tenant pays the insurer. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."},"started_on":{"type":"string","format":"date","nullable":true,"description":"The first day this lease participates in the term (inclusive). Null = from the term start. Omit to leave unchanged."},"ended_on":{"type":"string","format":"date","nullable":true,"description":"The last day this lease participates in the term (inclusive). Null = through the term end. Omit to leave unchanged."}}},"ReplaceInsuranceParticipantResultV1Dto":{"type":"object","properties":{"ended":{"description":"The replaced participant, now ending the day before.","allOf":[{"$ref":"#/components/schemas/InsuranceParticipantV1Dto"}]},"started":{"description":"The successor, starting on effective_from.","allOf":[{"$ref":"#/components/schemas/InsuranceParticipantV1Dto"}]}},"required":["ended","started"]},"ReplaceInsuranceParticipantV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid","description":"The successor lease."},"share_basis":{"type":"string","enum":["negotiated","sqft"],"description":"negotiated carries its own share_pct; sqft resolves from the lease’s rentable area at invoice input."},"share_pct":{"type":"string","nullable":true,"example":"13.8710","description":"Required for negotiated, must be omitted for sqft."},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"`tenant_direct_pay`: the tenant pays the insurer. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."},"effective_from":{"type":"string","format":"date","description":"The successor’s first day (inclusive). The replaced participant ends the day before. Must be after the replaced participant’s first day and inside the policy term."}},"required":["contract_id","share_basis","method","effective_from"]},"CreateInsuranceExpectedInvoiceV1Dto":{"type":"object","properties":{"expected_date":{"type":"string","format":"date"},"estimated_amount":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["expected_date"]},"UpdateInsuranceExpectedInvoiceV1Dto":{"type":"object","properties":{"expected_date":{"type":"string","format":"date"},"estimated_amount":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}}},"InsurancePremiumInvoiceV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"term_id":{"type":"string","format":"uuid"},"expected_invoice_id":{"type":"string","format":"uuid","nullable":true},"issuer_party_id":{"type":"string","format":"uuid"},"total_amount":{"type":"string"},"invoice_date":{"type":"string","format":"date","nullable":true},"due_date":{"type":"string","format":"date"},"recoverable":{"type":"boolean"},"non_recoverable_reason":{"type":"string","nullable":true},"ap_document_id":{"type":"string","format":"uuid","nullable":true,"description":"Set when the issuer is external."},"ic_document_id":{"type":"string","format":"uuid","nullable":true,"description":"Set when the issuer is one of your own legal entities."},"status":{"type":"string","enum":["active","voided"]},"payable_paid":{"type":"boolean","nullable":true,"description":"Derived (reads only): the payable to the issuer — the AP bill, or the intercompany transaction for an own-entity issuer — is paid off. Tri-state: null = no information (a voided invoice, no payable, or a retracted one), never render it as unpaid."},"payable_balance":{"type":"string","nullable":true,"description":"Derived (reads only): what is still owed on that payable, so a partly paid invoice shows what is left. Null exactly when payable_paid is null.","example":"2500.00"},"amount_outstanding":{"type":"string","nullable":true,"description":"Derived (reads only): what is still owed to the payee on the WHOLE invoice — the open balance of the payable plus every tenant_direct_pay share not yet marked paid. Null for a voided invoice or a retracted payable.","example":"6000.00"},"amount_paid":{"type":"string","nullable":true,"description":"Derived (reads only): how much of the invoice the payee has been paid — the total less amount_outstanding. Null exactly when amount_outstanding is.","example":"4000.00"},"notes":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","term_id","issuer_party_id","total_amount","due_date","recoverable","status","created_at"]},"InsuranceInvoiceShareV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"invoice_id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"share_basis":{"type":"string","enum":["negotiated","sqft"]},"share_pct":{"type":"string","example":"13.8710","description":"The resolved percentage, frozen at input."},"method":{"type":"string","enum":["tenant_direct_pay","landlord_direct_pay","tenant_reimbursement","tenant_reimbursement_via_cam"],"description":"`tenant_direct_pay`: the tenant pays the insurer. `landlord_direct_pay`: the landlord keeps the cost. `tenant_reimbursement`: the landlord bills the tenant a flat invoice per bill, never reconciled; refused (409) while the lease participates on the expense account in the recovery group. `tenant_reimbursement_via_cam`: the landlord bills an invoice per bill as a CAM estimate that the year-end run reconciles with the lease's base year, cap and gross-up; requires the recovery group and a participating term."},"amount":{"type":"string","example":"2960.07"},"ar_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The AR invoice raised for this share, when one was."},"paid_date":{"type":"string","format":"date","nullable":true},"paid":{"type":"boolean","nullable":true,"description":"Derived paid state (the single-invoice read only). Tri-state: true = settled, false = still owed, null = no information (do NOT render as unpaid). tenant_direct_pay — paid_date is set; tenant_reimbursement — its AR invoice is paid off; tenant_reimbursement_via_cam — the same when it has an invoice, null when the CAM invoice collects it; landlord_direct_pay — follows payable_paid. Null for every share of a voided invoice."},"paid_note":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","invoice_id","contract_id","share_basis","share_pct","method","amount","created_at"]},"InsuranceProratedParticipantV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"reason":{"type":"string","enum":["lease_not_live_for_full_term"],"description":"Why the share was prorated. Today there is one reason: the lease was not in place for the whole policy term."},"billed_fraction":{"type":"number","description":"Fraction of the policy term the lease was in place for, in [0, 1]. 0 means it was not billed at all."}},"required":["contract_id","reason","billed_fraction"]},"InsurancePremiumInvoiceDetailV1Dto":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/InsurancePremiumInvoiceV1Dto"},"shares":{"type":"array","items":{"$ref":"#/components/schemas/InsuranceInvoiceShareV1Dto"}},"warnings":{"description":"Lease-lifecycle problems that did not stop the input — a lease that ended before the invoice date, for instance. Said out loud rather than passing silently.","type":"array","items":{"type":"string"}},"prorated":{"description":"Participants whose share was reduced or dropped because the lease was not in place for the whole policy term, with the fraction of the term they were billed for. A billed_fraction of 0 means the lease was not billed at all and its share stayed with the owner. Present so a skip is reported rather than silently moving money onto the owner.","type":"array","items":{"$ref":"#/components/schemas/InsuranceProratedParticipantV1Dto"}}},"required":["invoice","shares","warnings","prorated"]},"InputPremiumInvoiceV1Dto":{"type":"object","properties":{"expected_invoice_id":{"type":"string","format":"uuid","nullable":true,"description":"The expected invoice this fills. Omit for an unplanned invoice — an endorsement or premium audit."},"issuer_party_id":{"type":"string","format":"uuid","description":"Who sent the invoice. When this party represents one of your own legal entities, the payable becomes an intercompany transaction instead of a bill."},"total_amount":{"type":"string","example":"21340.00"},"invoice_date":{"type":"string","format":"date","nullable":true},"due_date":{"type":"string","format":"date"},"recoverable":{"type":"boolean","description":"Overrides the term’s flag for this invoice alone. Requires non_recoverable_reason when false."},"non_recoverable_reason":{"type":"string","nullable":true,"example":"owner-elected extra limits"},"notes":{"type":"string","nullable":true}},"required":["issuer_party_id","total_amount","due_date"]},"VoidPremiumInvoiceV1Dto":{"type":"object","properties":{"reason":{"type":"string","nullable":true}}},"MarkSharePaidV1Dto":{"type":"object","properties":{"paid_date":{"type":"string","format":"date"},"paid_note":{"type":"string","nullable":true}},"required":["paid_date"]},"InsuranceAttachmentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"term_id":{"type":"string","format":"uuid","nullable":true},"invoice_id":{"type":"string","format":"uuid","nullable":true},"share_id":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string","enum":["policy_document","premium_invoice","proof_of_payment"]},"file_name":{"type":"string"},"content_type":{"type":"string","enum":["application/pdf","image/png","image/jpeg","image/webp"]},"size_bytes":{"type":"number","description":"File size in bytes."},"uploaded_by":{"type":"string","format":"uuid","nullable":true},"created_at":{"type":"string","format":"date-time"}},"required":["id","kind","file_name","content_type","size_bytes","created_at"]},"InsuranceAttachmentDownloadUrlV1Dto":{"type":"object","properties":{"url":{"type":"string","description":"Short-lived signed URL (300s)."},"expires_at":{"type":"string","format":"date-time"}},"required":["url","expires_at"]},"EligibleBillV1Dto":{"type":"object","properties":{"document_type":{"type":"string","enum":["bill","owner_distribution","intercompany_transaction"],"description":"What the row is: `bill`, or `owner_distribution` (a distribution leg)."},"id":{"type":"string","format":"uuid"},"document_number":{"type":"string","nullable":true},"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"party_id":{"type":"string","format":"uuid"},"party_name":{"type":"string"},"document_date":{"type":"string","format":"date"},"due_date":{"type":"string","nullable":true,"format":"date"},"total_amount":{"type":"string","description":"Bill total, as a number.","example":"1234.50"},"balance_amount":{"type":"string","description":"Open balance remaining on the bill, as a number.","example":"1234.50"},"reserved_amount":{"type":"string","description":"Amount other active runs already reserve on this bill (as a number).","example":"1234.50"},"available_amount":{"type":"string","description":"Amount still allocatable = balance_amount − reserved_amount (as a number).","example":"1234.50"},"currency_code":{"type":"string"},"memo":{"type":"string","nullable":true,"description":"The bill's memo/description, shown for context in the picker."},"payment_method":{"type":"string","nullable":true,"enum":["ach","wire","check"],"description":"How the vendor is paid today. Null when the vendor has no payment method — a draft may hold its bills, but the run cannot be submitted."},"payment_method_detail":{"type":"string","nullable":true,"description":"Masked: ACH \"••6789\"; wire \"SWIFT · EUR\" (international) or \"••6789 · USD\" (domestic); check the city it is mailed to. Never a full account or routing number."}},"required":["document_type","id","document_number","legal_entity_id","legal_entity_name","party_id","party_name","document_date","due_date","total_amount","balance_amount","reserved_amount","available_amount","currency_code","memo","payment_method","payment_method_detail"]},"PaymentRunMethodTotalsV1Dto":{"type":"object","properties":{"ach":{"type":"string","example":"1234.50"},"wire":{"type":"string","example":"1234.50"},"check":{"type":"string","example":"1234.50"},"none":{"type":"string","example":"1234.50"}},"required":["ach","wire","check","none"]},"PaymentRunEntityV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"bank_account_id":{"type":"string","format":"uuid","nullable":true,"description":"The account this entity pays from. Null while a draft entity has several eligible accounts and none was chosen — submit refuses it."},"bank_account_name":{"type":"string","nullable":true},"bank_account_last4":{"type":"string","nullable":true,"description":"Last four digits of the paying account."},"eligible_bank_account_count":{"type":"number","description":"How many accounts this entity could pay from (its own, active, with a GL cash account, in the run currency). Without a choice the entity pays from its default paying account while that is still eligible (`bank_account_is_default`), else from its only eligible account; with several and no usable default it has none until one is chosen."},"bank_account_is_default":{"type":"boolean","description":"Whether the entity pays from its default paying account (see /v1/payment-run-default-accounts), so a client can label it \"default\". False with no account, or with any other account."},"status":{"type":"string","enum":["pending","paid","released"]},"paid_on":{"type":"string","nullable":true,"format":"date"},"completed_by":{"type":"string","format":"uuid","nullable":true},"completed_by_name":{"type":"string","nullable":true,"description":"Who marked the entity paid: their display name, else their email. Null while unpaid, or when the settler is not an org member (a Spark Pay settlement)."},"completed_at":{"type":"string","format":"date-time","nullable":true},"ach_exported_at":{"type":"string","format":"date-time","nullable":true,"description":"The NACHA rail’s claim on this entity: when the operator declared its file submitted to the bank. Non-null closes Spark Pay for the entity."},"spark_pay_enqueued_at":{"type":"string","format":"date-time","nullable":true,"description":"The Spark Pay rail’s claim on this entity: when its sends were enqueued. Non-null closes the NACHA file for the entity."},"ach_origination_missing":{"description":"The ACH origination settings the paying account still lacks — empty when a NACHA file can be built from it; all of them while the entity has no account.","type":"array","items":{"type":"string"}},"totals_by_method":{"$ref":"#/components/schemas/PaymentRunMethodTotalsV1Dto"},"vendor_count":{"type":"number","description":"Distinct vendors this entity pays."}},"required":["legal_entity_id","legal_entity_name","bank_account_id","bank_account_name","bank_account_last4","eligible_bank_account_count","bank_account_is_default","status","paid_on","completed_by","completed_at","ach_exported_at","spark_pay_enqueued_at","ach_origination_missing","totals_by_method","vendor_count"]},"PaymentRunBillDestinationV1Dto":{"type":"object","properties":{"account_last4":{"type":"string","nullable":true,"description":"Last four digits of the vendor’s account: ACH, and a domestic wire."},"bank_name":{"type":"string","nullable":true,"description":"The vendor’s bank: ACH and wire."},"swift_bic":{"type":"string","nullable":true,"description":"SWIFT/BIC (a public bank identifier): an international wire."},"international":{"type":"boolean","description":"True for an international wire; false otherwise."},"receive_currency_code":{"type":"string","nullable":true,"description":"The currency the vendor receives: a wire (USD by default)."},"payee_name":{"type":"string","nullable":true,"description":"Who a check is payable to: the account holder, else the vendor."},"city":{"type":"string","nullable":true,"description":"The city a check is mailed to."}},"required":["account_last4","bank_name","swift_bic","international","receive_currency_code","payee_name","city"]},"PaymentRunBillV1Dto":{"type":"object","properties":{"bill_document_id":{"type":"string","format":"uuid"},"document_type":{"type":"string","enum":["bill","owner_distribution","intercompany_transaction"],"description":"What the line is: `bill`, or `owner_distribution` (a distribution leg)."},"legal_entity_id":{"type":"string","format":"uuid","description":"The bill’s legal entity — the run entity it is paid by."},"document_number":{"type":"string","nullable":true},"party_id":{"type":"string","format":"uuid","nullable":true},"party_name":{"type":"string","nullable":true},"document_date":{"type":"string","format":"date"},"due_date":{"type":"string","nullable":true,"format":"date"},"total_amount":{"type":"string","description":"The bill's total amount.","example":"1234.50"},"balance_amount":{"type":"string","description":"Live open balance remaining on the bill.","example":"1234.50"},"available_amount":{"type":"string","description":"Run-relative available amount = balance minus what OTHER active runs reserve (this run excluded). Caps how far this run may raise the bill’s amount_to_pay.","example":"1234.50"},"amount_paid":{"type":"string","nullable":true,"description":"Stamped at generation; the authoritative paid amount afterwards. Null until then.","example":"1234.50"},"amount_to_pay":{"type":"string","nullable":true,"description":"requested partial; null = pay full balance","example":"1234.50"},"payment_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The generated payment_out document. Null until generation."},"payment_document_number":{"type":"string","nullable":true,"description":"Joined from the generated payment_out. Null until generation."},"released_at":{"type":"string","nullable":true,"description":"Set when the bill is released from this run (removed, or the run is cancelled/completed)."},"memo":{"type":"string","nullable":true,"description":"The bill's memo/description."},"payment_method":{"type":"string","nullable":true,"enum":["ach","wire","check"],"description":"How the vendor is paid: the method frozen when the run was submitted, or the vendor’s current one while the run is a draft. Null when the vendor has none — the run cannot be submitted until it does."},"payment_method_detail":{"type":"string","nullable":true,"description":"Masked: ACH \"••6789\"; wire \"SWIFT · EUR\" or \"••6789 · USD\"; check the city it is mailed to. Null when the vendor’s current details no longer match payment_method. Never a full account or routing number."},"payment_destination":{"nullable":true,"description":"The same destination as `payment_method_detail`, as fields; null under the same rule (no method, or the vendor’s current details no longer match payment_method).","type":"object","allOf":[{"$ref":"#/components/schemas/PaymentRunBillDestinationV1Dto"}]},"payment_document_status":{"type":"string","nullable":true,"enum":["draft","posting_pending","pending_approval","rejected","posting_failed","posted","voided","reversed","deleted"],"description":"Status of the generated payment_out (posted, voided, …). Null until generation."},"open_before_run":{"type":"string","description":"What the bill had open when this run paid it: the bill total less every other settlement applied before this run’s own application and not unapplied by then. Later settlements, and a later void of this run’s payment, do not move it. Equals balance_amount until the run applies a payment to the bill.","example":"1234.50"}},"required":["bill_document_id","document_type","legal_entity_id","document_number","party_id","party_name","document_date","due_date","total_amount","balance_amount","available_amount","amount_paid","amount_to_pay","payment_document_id","payment_document_number","released_at","memo","payment_method","payment_method_detail"]},"PaymentRunApprovalRequestV1Dto":{"type":"object","properties":{"request_id":{"type":"string","format":"uuid"},"status":{"type":"string"},"submitted_by":{"type":"string","format":"uuid"},"submitted_at":{"type":"string"},"resolved_at":{"type":"string","nullable":true},"resolution_note":{"type":"string","nullable":true},"decided_by":{"type":"string","nullable":true,"format":"uuid","description":"The user who made the request's final decision (the closing approve, or the reject); null while pending or when it closed without a decision."},"decided_by_name":{"type":"string","nullable":true,"description":"`decided_by`'s display name in the org, else their email; null when neither is on file."},"decided_at":{"type":"string","nullable":true,"description":"When the final decision was made; null alongside `decided_by`."},"actionable":{"type":"boolean","description":"True only for an open (pending) request when the CALLER can decide it now: a member eligible for its active step whose approval limit covers the request's amount when that step requires authority — the rule POST /v1/approvals/{id}/decision enforces. False for an approver who already decided this step, and for a caller without the documents:approve scope. Always false for an API key."},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid","description":"The legal entity this request approves (one request per triggering entity); null for a payment-group or org-wide request."},"legal_entity_name":{"type":"string","nullable":true},"entity_group_id":{"type":"string","nullable":true,"format":"uuid","description":"The payment group this request approves; null for an entity or org-wide request."},"entity_group_name":{"type":"string","nullable":true},"amount":{"type":"string","description":"The request's amount: the entity's share, the payment group's total, or the run total for an org-wide request.","example":"1234.50"},"scope_legal_entity_ids":{"description":"The legal entities an approver of this request may change when they edit and approve it: exactly the set the server enforces. For an entity request, that entity; for a payment-group request, the group's members as frozen when the run was submitted (not the live group). Empty for an org-wide request, which reaches every entity of the run.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["request_id","status","submitted_by","submitted_at","resolved_at","resolution_note","decided_by","decided_by_name","decided_at","actionable","legal_entity_id","legal_entity_name","entity_group_id","entity_group_name","amount","scope_legal_entity_ids"]},"PaymentRunSendStateV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid","description":"The entity that paid it. A vendor in two entities of a run gets one transfer from each."},"party_id":{"type":"string","format":"uuid","description":"The vendor being paid."},"status":{"type":"string","enum":["created","pending","completed","failed","reversed","queued","canceled"]},"moov_transfer_id":{"type":"string","nullable":true,"description":"Moov's transfer id. Null means we sent but do not yet know Moov's id."},"document_id":{"type":"string","format":"uuid","nullable":true,"description":"The draft payment_out document this transfer executes."},"failure_reason":{"type":"string","nullable":true}},"required":["legal_entity_id","party_id","status","moov_transfer_id","document_id","failure_reason"]},"PaymentRunOwnerWithoutTaxIdV1Dto":{"type":"object","properties":{"party_id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true}},"required":["party_id","name"]},"PaymentRunPairedSideNotRecordableV1Dto":{"type":"object","properties":{"bill_document_id":{"type":"string","format":"uuid","description":"The distribution leg (`owner_distribution`) in the run."},"document_number":{"type":"string","nullable":true},"receiver_legal_entity_id":{"type":"string","format":"uuid","nullable":true,"description":"The entity that receives the leg (its in-group counterparty)."},"receiver_name":{"type":"string","nullable":true,"description":"The leg's payee: the receiving entity's mirror party."},"reason":{"type":"string","enum":["document_missing","document_short","already_paired","no_bank_account","period_closed"],"description":"Why the receiving side cannot be recorded. `no_bank_account`: the receiving entity has no default payment account (`PATCH /v1/payment-run-default-accounts/{legalEntityId}`); `period_closed`: it has no open period on the payment date; `document_short` / `document_missing`: its receipt owes less than the leg, or is missing."}},"required":["bill_document_id","document_number","receiver_legal_entity_id","receiver_name","reason"]},"PaymentRunDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"run_number":{"type":"string","description":"Human-readable run number, e.g. PR-2026-000001."},"status":{"type":"string","enum":["draft","pending_approval","approved","partially_completed","completed","rejected","cancelled"]},"currency_code":{"type":"string"},"payment_date":{"type":"string","nullable":true,"format":"date","description":"document_date of the generated payments. When empty at approval time, the approval date is used."},"memo":{"type":"string","nullable":true},"total_amount":{"type":"string","description":"Header total, as a number. Live Σ over the run's bills of COALESCE(amount_paid, amount_to_pay, balance_amount) — the stamped amount_paid once generation has run, else the requested amount_to_pay (partial pay), else the full live balance_amount.","example":"1234.50"},"bill_count":{"type":"number"},"vendor_count":{"type":"number"},"created_by":{"type":"string","format":"uuid","nullable":true,"description":"The user who created the run. FE gates the Withdraw action on created_by === current user."},"created_at":{"type":"string"},"approved_by":{"type":"string","format":"uuid","nullable":true},"approved_at":{"type":"string","nullable":true},"completed_by":{"type":"string","format":"uuid","nullable":true},"completed_at":{"type":"string","nullable":true},"origin":{"type":"string","enum":["batch","single_bill","schedule","distribution"],"description":"How the run came to exist: `batch` (built by hand), `single_bill` (the Pay this bill shortcut), `schedule` (a payment run schedule built it) or `distribution` (built for a distribution declaration)."},"distribution_declaration_id":{"type":"string","format":"uuid","nullable":true,"description":"The distribution declaration this run pays; null for any other origin, or when the declaration was deleted. Like a scheduled run, any user with `payment-runs:write` may submit (and revert) it."},"schedule_id":{"type":"string","format":"uuid","nullable":true,"description":"The payment run schedule that generated this run; null for a run built by hand, or when its schedule was deleted. Any user with `payment-runs:write` may submit (and revert) a run that has one; every other run is its creator’s to submit."},"schedule_name":{"type":"string","nullable":true,"description":"The current name of that schedule. Null with no schedule, and null when the caller may not see the schedule — it spans a legal entity outside their scope — while schedule_id is still returned."},"entities":{"description":"Every legal entity of the run, by name.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunEntityV1Dto"}},"bills":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRunBillV1Dto"}},"approval_requests":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRunApprovalRequestV1Dto"}},"sends":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRunSendStateV1Dto"}},"owners_without_tax_id":{"description":"Draft only, empty otherwise: owners paid by ACH through a distribution leg who have no tax ID type. While any is listed, submit refuses with `PAYMENT_RUN_OWNERS_WITHOUT_TAX_ID`; set the type on the party (`PUT /v1/parties/{id}`, `tax_id_type`) or remove the leg.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunOwnerWithoutTaxIdV1Dto"}},"paired_sides_not_recordable":{"description":"Draft only, empty otherwise: in-group distribution legs whose receiving entity cannot record its side of the payment today (paired payments). While any is listed, submit refuses with `PAYMENT_RUN_GENERATION_STALE_BILLS` (reason `paired_side_not_recordable`); fix the receiving side or remove the leg.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunPairedSideNotRecordableV1Dto"}}},"required":["id","run_number","status","currency_code","payment_date","memo","total_amount","bill_count","vendor_count","created_by","created_at","approved_by","approved_at","completed_by","completed_at","origin","distribution_declaration_id","schedule_id","schedule_name","entities","bills","approval_requests","sends","owners_without_tax_id","paired_sides_not_recordable"]},"PaymentRunBillInputV1Dto":{"type":"object","properties":{"bill_id":{"type":"string","format":"uuid"},"amount_to_pay":{"type":"string","description":"Exact amount to pay for this bill. Must be > 0 and <= the bill’s live open balance. Omitted/absent pays the full balance at generation.","example":"500.00"}},"required":["bill_id"]},"PaymentRunEntityAccountV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"bank_account_id":{"type":"string","format":"uuid"}},"required":["legal_entity_id","bank_account_id"]},"CreatePaymentRunV1Dto":{"type":"object","properties":{"payment_date":{"type":"string","format":"date","nullable":true,"description":"document_date of the generated payments. When empty at approval time, the approval date is used."},"memo":{"type":"string","nullable":true,"maxLength":500},"bills":{"description":"Bills to include (at least one). They may belong to several legal entities of the org: the run gets one entity row per entity, and takes its currency from the first bill’s entity — every bill must be in it (PAYMENT_RUN_CURRENCY_MISMATCH). Each must pass eligibility: posted bill, open balance, vendor party, not reserved by another active run, in an entity the caller may act in. An optional per-bill `amount_to_pay` requests a partial payment (0 < amount_to_pay <= its live balance); omitted pays the full balance. A run holds at most 200 bills in v1 (PAYMENT_RUN_TOO_MANY_BILLS) — deliberately NOT capped here via `@ArrayMaxSize` so the domain error (with the request's bill count) is what the client sees rather than a generic VALIDATION_FAILED.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunBillInputV1Dto"}},"bank_accounts":{"description":"Optional paying account per legal entity of the run. An entity left out gets its default paying account while still eligible, else its only eligible account (active, with a GL cash account, in the run currency), else none when it has several — choose it later with PATCH /v1/payment-runs/{id}/entities/{legalEntityId}; submit refuses an entity without one. Each entry must name an entity with a bill in the run.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunEntityAccountV1Dto"}}},"required":["bills"]},"PaymentRunListEntityV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"bank_account_id":{"type":"string","format":"uuid","nullable":true,"description":"The account this entity pays from. Null while a draft entity has several eligible accounts and none was chosen yet."},"bank_account_name":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","paid","released"]}},"required":["legal_entity_id","legal_entity_name","bank_account_id","bank_account_name","status"]},"PaymentRunV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"run_number":{"type":"string","description":"Human-readable run number, e.g. PR-2026-000001."},"status":{"type":"string","enum":["draft","pending_approval","approved","partially_completed","completed","rejected","cancelled"]},"currency_code":{"type":"string"},"payment_date":{"type":"string","nullable":true,"format":"date","description":"document_date of the generated payments. When empty at approval time, the approval date is used."},"memo":{"type":"string","nullable":true},"total_amount":{"type":"string","description":"Header total, as a number. Live Σ over the run's bills of COALESCE(amount_paid, amount_to_pay, balance_amount) — the stamped amount_paid once generation has run, else the requested amount_to_pay (partial pay), else the full live balance_amount.","example":"1234.50"},"bill_count":{"type":"number"},"vendor_count":{"type":"number"},"created_by":{"type":"string","format":"uuid","nullable":true,"description":"The user who created the run. FE gates the Withdraw action on created_by === current user."},"created_at":{"type":"string"},"approved_by":{"type":"string","format":"uuid","nullable":true},"approved_at":{"type":"string","nullable":true},"completed_by":{"type":"string","format":"uuid","nullable":true},"completed_at":{"type":"string","nullable":true},"origin":{"type":"string","enum":["batch","single_bill","schedule","distribution"],"description":"How the run came to exist: `batch` (built by hand), `single_bill` (the Pay this bill shortcut), `schedule` (a payment run schedule built it) or `distribution` (built for a distribution declaration)."},"distribution_declaration_id":{"type":"string","format":"uuid","nullable":true,"description":"The distribution declaration this run pays; null for any other origin, or when the declaration was deleted. Like a scheduled run, any user with `payment-runs:write` may submit (and revert) it."},"schedule_id":{"type":"string","format":"uuid","nullable":true,"description":"The payment run schedule that generated this run; null for a run built by hand, or when its schedule was deleted. Any user with `payment-runs:write` may submit (and revert) a run that has one; every other run is its creator’s to submit."},"schedule_name":{"type":"string","nullable":true,"description":"The current name of that schedule. Null with no schedule, and null when the caller may not see the schedule — it spans a legal entity outside their scope — while schedule_id is still returned."},"entities":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRunListEntityV1Dto"}},"entity_count":{"type":"number","description":"How many legal entities the run spans."},"paid_entity_count":{"type":"number","description":"How many of those entities are paid (Partially paid · paid/count)."},"payment_methods":{"type":"array","description":"The payment methods of the run’s bills, in the order ach, wire, check — frozen at submit, the vendors’ live methods while a draft. A vendor without a method adds nothing here.","items":{"type":"string","enum":["ach","wire","check"]}}},"required":["id","run_number","status","currency_code","payment_date","memo","total_amount","bill_count","vendor_count","created_by","created_at","approved_by","approved_at","completed_by","completed_at","origin","distribution_declaration_id","schedule_id","schedule_name","entities","entity_count","paid_entity_count","payment_methods"]},"UpdatePaymentRunV1Dto":{"type":"object","properties":{"payment_date":{"type":"string","format":"date","nullable":true,"description":"document_date of the generated payments. When empty at approval time, the approval date is used."},"memo":{"type":"string","nullable":true,"maxLength":500}}},"AddPaymentRunBillsV1Dto":{"type":"object","properties":{"bills":{"description":"Bills to add to this draft run. Each must pass the same eligibility gate as create: posted bill, open balance, vendor party, in the run currency, and not reserved by another active run. A bill of an entity new to the run adds that entity. An optional per-bill `amount_to_pay` requests a partial payment (0 < amount_to_pay <= its live balance); omitted pays the full balance. The resulting total (bills already in the run plus this batch) must stay at or under 200 (PAYMENT_RUN_TOO_MANY_BILLS).","type":"array","items":{"$ref":"#/components/schemas/PaymentRunBillInputV1Dto"}},"bank_accounts":{"description":"Optional paying account per legal entity of the run. An entity left out gets its default paying account while still eligible, else its only eligible account (active, with a GL cash account, in the run currency), else none when it has several — choose it later with PATCH /v1/payment-runs/{id}/entities/{legalEntityId}; submit refuses an entity without one. Each entry must name an entity with a bill in the run.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunEntityAccountV1Dto"}}},"required":["bills"]},"SetPaymentRunEntityAccountV1Dto":{"type":"object","properties":{"bank_account_id":{"type":"string","format":"uuid","description":"One of the entity's own bank accounts: active, with a linked GL cash account, in the run's currency."}},"required":["bank_account_id"]},"UpdatePaymentRunBillV1Dto":{"type":"object","properties":{"amount_to_pay":{"type":"string","nullable":true,"description":"Exact amount to pay for this bill; null resets it to the full live balance. Must be > 0 and <= the bill’s live open balance when non-null.","example":"500.00"}},"required":["amount_to_pay"]},"PaymentRunActionResultV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string"}},"required":["id","status"]},"PaymentRunApproverAmountChangeV1Dto":{"type":"object","properties":{"bill_id":{"type":"string","format":"uuid"},"amount_to_pay":{"type":"string","description":"The new amount to pay: more than 0 and at most the bill’s current amount to pay in the run (its `amount_to_pay`, else its open balance). More is refused with 422 PAYMENT_RUN_APPROVER_CHANGE_INCREASE.","example":"400.00"}},"required":["bill_id","amount_to_pay"]},"ApprovePaymentRunWithChangesV1Dto":{"type":"object","properties":{"remove_bill_ids":{"description":"Bills to take out of the run. Their reservation is released; an entity left with no bill leaves the run. Removing every bill is refused (422 PAYMENT_RUN_APPROVER_CHANGE_EMPTIES_RUN): reject the run instead.","type":"array","items":{"type":"string","format":"uuid"}},"amount_changes":{"description":"Lower amounts to pay. The difference is released from the bill’s reservation.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunApproverAmountChangeV1Dto"}},"account_changes":{"description":"Another paying account for an entity of the run: one of its eligible accounts (its own, active, in the run currency, linked to a GL cash account), else 422 PAYMENT_RUN_APPROVER_ACCOUNT_NOT_ELIGIBLE.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunEntityAccountV1Dto"}},"note":{"type":"string","nullable":true,"maxLength":2000,"description":"Optional note, recorded on the decision after the list of changes."}}},"MarkPaymentRunEntitiesPaidV1Dto":{"type":"object","properties":{"legal_entity_ids":{"minItems":1,"maxItems":200,"uniqueItems":true,"description":"The run’s legal entities to mark paid, together. Each must be one the single-entity Mark paid would accept; the first that it would refuse refuses the whole request with that same code.","type":"array","items":{"type":"string","format":"uuid"}},"paid_on":{"type":"string","format":"date","description":"The day the entities paid — the document_date of every payment they post. Not after the org’s today."},"ach_submitted":{"type":"boolean","description":"The operator declares the listed entities’ ACH payments were sent through their banks (spec §13.5). When true, every listed entity on the NACHA/manual rail with ACH vendors whose file is not yet confirmed submitted is confirmed first — through the same path as POST …/ach-file/confirm-submitted, with its audit row — in the same transaction, then settled; any refusal refuses the whole request. Entities Spark Pay has claimed are not confirmed and settle by their own rail, so one request can mix both rails. Entities with no ACH vendor, or already confirmed, are untouched by it. Absent or false: an unconfirmed ACH is refused with 409 PAYMENT_RUN_ACH_NOT_SUBMITTED, as before."}},"required":["legal_entity_ids","paid_on"]},"MarkPaymentRunEntityPaidV1Dto":{"type":"object","properties":{"paid_on":{"type":"string","format":"date","description":"The day the entity paid — the document_date of every payment it posts. Absent: the run’s payment date, capped at the org’s today (today when the run has none)."},"ach_submitted":{"type":"boolean","description":"The operator declares the entity’s ACH payments were sent through its bank (spec §13.5). When true and the entity, on the NACHA/manual rail, has ACH vendors whose file is not yet confirmed submitted, it is confirmed first — through the same path as POST …/ach-file/confirm-submitted, with its audit row — in the same transaction, then settled. An entity Spark Pay has claimed is not confirmed: it settles by its own rail, as without the flag. Absent or false: an unconfirmed ACH is refused with 409 PAYMENT_RUN_ACH_NOT_SUBMITTED, as before. Downloading the file first is not required."}}},"PaymentRunSendResultV1Dto":{"type":"object","properties":{"run_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"vendors_enqueued":{"type":"number","description":"How many of the entity’s ACH vendors were enqueued for sending — one background job each. A vendor already sent by an earlier press is still counted here; the job itself skips it."}},"required":["run_id","legal_entity_id","vendors_enqueued"]},"PaymentRunEntityClaimV1Dto":{"type":"object","properties":{"run_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"ach_exported_at":{"type":"string","format":"date-time","nullable":true,"description":"When the operator declared this entity’s NACHA file submitted to its bank. Non-null closes the entity to Spark Pay. Never set by downloading the file — only by POST …/ach-file/confirm-submitted."},"spark_pay_enqueued_at":{"type":"string","format":"date-time","nullable":true,"description":"When Spark Pay sends were enqueued for this entity. Non-null closes it to the NACHA rail, from the instant Send was pressed rather than from the first transfer row."}},"required":["run_id","legal_entity_id","ach_exported_at","spark_pay_enqueued_at"]},"PaymentRunAchFileExclusionReason":{"type":"string","enum":["PAYMENT_RUN_ENTITY_NOT_PENDING","PAYMENT_RUN_VENDOR_METHOD_CHANGED","PAYMENT_RUN_SEND_METHOD_CONFLICT","BANK_ACCOUNT_ACH_NOT_CONFIGURED","PAYMENT_RUN_ACH_VENDORS_NOT_PAYABLE","PAYMENT_RUN_NO_ACH_ENTRIES","PAYMENT_RUN_ACH_ALREADY_SUBMITTED"],"description":"The error code the entity’s own download (GET …/entities/{legalEntityId}/ach-file) answers with: PAYMENT_RUN_ENTITY_NOT_PENDING (already paid or released), PAYMENT_RUN_VENDOR_METHOD_CHANGED, PAYMENT_RUN_SEND_METHOD_CONFLICT (Spark Pay claimed it), BANK_ACCOUNT_ACH_NOT_CONFIGURED, PAYMENT_RUN_ACH_VENDORS_NOT_PAYABLE or PAYMENT_RUN_NO_ACH_ENTRIES (no ACH vendor) — or, for a bank’s combined file only, PAYMENT_RUN_ACH_ALREADY_SUBMITTED: the entity’s own file was already confirmed submitted, so a second file would credit its vendors twice (its own file stays re-downloadable)."},"PaymentRunAchFileExclusionV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string","nullable":true},"reason":{"description":"The error code the entity’s own download (GET …/entities/{legalEntityId}/ach-file) answers with: PAYMENT_RUN_ENTITY_NOT_PENDING (already paid or released), PAYMENT_RUN_VENDOR_METHOD_CHANGED, PAYMENT_RUN_SEND_METHOD_CONFLICT (Spark Pay claimed it), BANK_ACCOUNT_ACH_NOT_CONFIGURED, PAYMENT_RUN_ACH_VENDORS_NOT_PAYABLE or PAYMENT_RUN_NO_ACH_ENTRIES (no ACH vendor) — or, for a bank’s combined file only, PAYMENT_RUN_ACH_ALREADY_SUBMITTED: the entity’s own file was already confirmed submitted, so a second file would credit its vendors twice (its own file stays re-downloadable).","example":"BANK_ACCOUNT_ACH_NOT_CONFIGURED","allOf":[{"$ref":"#/components/schemas/PaymentRunAchFileExclusionReason"}]},"detail":{"type":"string","description":"That refusal’s message, for display."},"context":{"type":"object","additionalProperties":true,"nullable":true,"description":"That refusal’s structured context, as its error body carries it — e.g. `vendors` for PAYMENT_RUN_ACH_VENDORS_NOT_PAYABLE. Null when it has none."}},"required":["legal_entity_id","legal_entity_name","reason","detail","context"]},"PaymentRunAchFileV1Dto":{"type":"object","properties":{"origin_routing":{"type":"string","nullable":true,"description":"The originating routing number (9 digits) of the bank this file goes to — the `origin_routing` to download it with. Null for the one group of entities whose account has no originating routing number: they belong to no bank’s file, so it only lists them under `excluded`.","example":"021000021"},"bank_name":{"type":"string","nullable":true,"description":"The bank’s name (institution name of its accounts), if known."},"legal_entity_ids":{"description":"The entities the file holds, in batch order (by entity name). Empty when every entity of this bank is excluded — the file cannot be downloaded then (422 PAYMENT_RUN_ACH_FILE_EMPTY).","type":"array","items":{"type":"string","format":"uuid"}},"excluded":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRunAchFileExclusionV1Dto"}}},"required":["origin_routing","bank_name","legal_entity_ids","excluded"]},"PaymentRunAchFilesV1Dto":{"type":"object","properties":{"files":{"description":"One entry per originating bank, by routing number; the no-routing group, when any, last.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunAchFileV1Dto"}}},"required":["files"]},"PaymentRunDefaultAccountEligibleV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"last4":{"type":"string","nullable":true,"description":"Last four digits of the account number."}},"required":["id","name","last4"]},"PaymentRunDefaultAccountV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"currency_code":{"type":"string","description":"The entity's currency."},"eligible_accounts":{"description":"The accounts the entity may pay a run from, by name: its own, active, in its currency, with a linked GL cash account. The default must be one of them.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunDefaultAccountEligibleV1Dto"}},"eligible_account_count":{"type":"number","description":"How many accounts `eligible_accounts` holds."},"default_bank_account_id":{"type":"string","format":"uuid","nullable":true,"description":"The entity's default paying account, while it is still eligible. A default deactivated, archived, moved to another currency or unlinked from its cash account reads as null, and is never replaced by another account. Null when none was chosen."}},"required":["legal_entity_id","legal_entity_name","currency_code","eligible_accounts","eligible_account_count","default_bank_account_id"]},"SetPaymentRunDefaultAccountResultV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"currency_code":{"type":"string","description":"The entity's currency."},"eligible_accounts":{"description":"The accounts the entity may pay a run from, by name: its own, active, in its currency, with a linked GL cash account. The default must be one of them.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunDefaultAccountEligibleV1Dto"}},"eligible_account_count":{"type":"number","description":"How many accounts `eligible_accounts` holds."},"default_bank_account_id":{"type":"string","format":"uuid","nullable":true,"description":"The entity's default paying account, while it is still eligible. A default deactivated, archived, moved to another currency or unlinked from its cash account reads as null, and is never replaced by another account. Null when none was chosen."},"drafts_updated":{"type":"number","description":"How many draft payment runs, of any origin, had no account for this entity and took the new default. 0 when the default was cleared."},"drafts_skipped":{"type":"number","description":"Drafts with an empty slot for this entity that were left alone: the run covers an entity the caller may not act on, or the new default cannot pay it (currency, no cash account). 0 when cleared."}},"required":["legal_entity_id","legal_entity_name","currency_code","eligible_accounts","eligible_account_count","default_bank_account_id","drafts_updated","drafts_skipped"]},"SetPaymentRunDefaultAccountV1Dto":{"type":"object","properties":{"bank_account_id":{"type":"string","format":"uuid","nullable":true,"description":"One of the entity's `eligible_accounts`, or null to clear the default."}},"required":["bank_account_id"]},"PaymentRunScheduleEntityV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"currency_code":{"type":"string"}},"required":["id","name","currency_code"]},"PaymentRunScheduleGroupV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"member_count":{"type":"number","description":"How many legal entities the group holds now. A group is resolved to its members each time the schedule runs."}},"required":["id","name","member_count"]},"PaymentRunScheduleVendorV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]},"PaymentRunScheduleDroppedEntityV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true,"description":"The entity’s name; null for a `no_access` drop, since an entity outside the acting user’s scope is never named."},"reason":{"type":"string","enum":["no_access","inactive","not_usd"],"description":"`no_access`: the acting user (the owner, or the preview’s caller) may not act on the entity. `inactive`: the entity is not active (inactive, dissolved or in process). `not_usd`: the entity is not in USD, and runs are USD only."}},"required":["legal_entity_id","name","reason"]},"PaymentRunScheduleMissingItemV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["entity_without_account","vendor_without_method"],"description":"`entity_without_account`: a legal entity with no paying account (`id` is the entity). `vendor_without_method`: a vendor with no payment method (`id` is the party)."},"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true}},"required":["kind","id","name"]},"PaymentRunScheduleOpenDraftV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"run_number":{"type":"string"}},"required":["id","run_number"]},"PaymentRunScheduleExecutionV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"schedule_id":{"type":"string","format":"uuid"},"trigger":{"type":"string","enum":["scheduled","manual"],"description":"`scheduled`: the schedule fired on its date. `manual`: someone pressed Generate now."},"scheduled_for":{"type":"string","format":"date","description":"The schedule date this execution answers."},"generated_on":{"type":"string","format":"date","description":"The org-local date it actually ran on."},"payment_run_id":{"type":"string","format":"uuid","nullable":true,"description":"The run it created or added to. Null when none was made, or the run was deleted since."},"run_number":{"type":"string","nullable":true},"payment_date":{"type":"string","format":"date","nullable":true},"result":{"type":"string","enum":["draft_ready","draft_missing_info","no_bills","failed"],"description":"`draft_ready`: a draft is waiting for a person to review and submit it; nothing is missing. `draft_missing_info`: a draft is waiting, and something is missing (`missing`), or an open draft could not be refreshed (`error_code`). `no_bills`: nothing qualified, so no run. `failed`: no run could be built (`error_code`). A schedule never submits a run itself."},"bill_count":{"type":"number"},"total_amount":{"type":"string","nullable":true,"example":"1234.50"},"vendor_count":{"type":"number"},"entity_count":{"type":"number"},"left_out_count":{"type":"number","description":"Bills that qualified but did not fit under the run’s bill limit."},"absorbed":{"type":"boolean","description":"True when the execution added to the schedule's open draft instead of creating a run."},"dropped_entities":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRunScheduleDroppedEntityV1Dto"}},"missing":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRunScheduleMissingItemV1Dto"}},"error_code":{"type":"string","nullable":true,"description":"Why it failed or the open draft could not be refreshed: `OWNER_INACTIVE`, `OWNER_FORBIDDEN`, `SCOPE_NOT_ACCESSIBLE`, `EXECUTION_ERROR`, or the refusing error code."},"error_message":{"type":"string","nullable":true},"open_draft":{"nullable":true,"description":"On a `failed` execution: the schedule’s open draft, which the failure left as it was and a person can still fix and submit. Null otherwise.","type":"object","allOf":[{"$ref":"#/components/schemas/PaymentRunScheduleOpenDraftV1Dto"}]},"triggered_by":{"type":"string","format":"uuid","nullable":true,"description":"Who pressed Generate now; null for a scheduled execution."},"created_at":{"type":"string","format":"date-time"}},"required":["id","schedule_id","trigger","scheduled_for","generated_on","payment_run_id","run_number","payment_date","result","bill_count","total_amount","vendor_count","entity_count","left_out_count","absorbed","dropped_entities","missing","error_code","error_message","open_draft","triggered_by","created_at"]},"PaymentRunScheduleOverlapRefV1Dto":{"type":"object","properties":{"schedule_id":{"type":"string","format":"uuid","nullable":true,"description":"Null when the caller may not see the other schedule."},"name":{"type":"string","nullable":true,"description":"Null when the caller may not see the other schedule."}},"required":["schedule_id","name"]},"PaymentRunScheduleVendorScopeV1Dto":{"type":"object","properties":{"mode":{"type":"string","enum":["all","only","except"],"description":"`all` vendors, `only` the listed ones, or all `except` the listed ones."},"party_ids":{"description":"The listed vendors; empty for `all`.","type":"array","items":{"type":"string","format":"uuid"}},"vendors":{"description":"`party_ids` with their names, in the same order.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunScheduleVendorV1Dto"}}},"required":["mode","party_ids","vendors"]},"PaymentRunScheduleOverlapV1Dto":{"type":"object","properties":{"schedule_id":{"type":"string","format":"uuid","nullable":true,"description":"The other schedule. Null when the caller may not see it (some entity of its scope is outside theirs): show \"a schedule you can’t see\"."},"name":{"type":"string","nullable":true,"description":"Its name; null when the caller may not see it."},"entity_ids":{"description":"The legal entities a run of both schedules would pay from (active, USD, listed or a member of a live payment group), limited to the caller’s own entities: one outside them is never disclosed, so this can be empty when every shared entity is outside them (preview only).","type":"array","items":{"type":"string","format":"uuid"}},"vendor_scope":{"description":"The vendors both schedules can pay.","allOf":[{"$ref":"#/components/schemas/PaymentRunScheduleVendorScopeV1Dto"}]}},"required":["schedule_id","name","entity_ids","vendor_scope"]},"PaymentRunScheduleV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["active","paused"],"description":"A paused schedule never runs and has no next_run_date."},"owner_user_id":{"type":"string","format":"uuid","description":"The user whose name the schedule's runs are created in."},"owner_name":{"type":"string","nullable":true},"legal_entity_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"entity_group_ids":{"description":"Payment groups in scope.","type":"array","items":{"type":"string","format":"uuid"}},"legal_entities":{"description":"The legal entities listed in `legal_entity_ids`, by name.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunScheduleEntityV1Dto"}},"entity_groups":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRunScheduleGroupV1Dto"}},"vendor_mode":{"type":"string","enum":["all","only","except"],"description":"`all` vendors, `only` the listed ones, or all `except` the listed ones."},"vendor_party_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"vendors":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRunScheduleVendorV1Dto"}},"frequency":{"type":"string","enum":["weekly","biweekly","twice_monthly","monthly"]},"weekday":{"type":"number","nullable":true,"description":"0 (Sunday) to 6. Weekly and biweekly only; else null."},"days_of_month":{"description":"`'1'`–`'28'` or `'last'`: one for monthly, two for twice_monthly; empty otherwise.","type":"array","items":{"type":"string"}},"start_date":{"type":"string","format":"date","description":"No run before it; a biweekly schedule counts from it."},"extra_days":{"type":"number","description":"Days past the next run date that bills may still be due and be paid now (0–30)."},"payment_offset_days":{"type":"number","description":"Business days from the run date to its payment date (0–30); a weekend moves to Monday."},"memo_template":{"type":"string","nullable":true,"description":"The runs' memo; `{date}` becomes the generation date in MM/DD/YYYY."},"next_run_date":{"type":"string","format":"date","nullable":true,"description":"The org-local date the schedule runs next (at or after 05:00 org time). Null while paused."},"last_execution":{"nullable":true,"description":"The newest execution, scheduled or manual.","type":"object","allOf":[{"$ref":"#/components/schemas/PaymentRunScheduleExecutionV1Dto"}]},"non_usd_legal_entity_ids":{"description":"Entities in scope — listed or current group members — not in USD. Runs are USD only, so executions leave them out (a warning to show when saving).","type":"array","items":{"type":"string","format":"uuid"}},"overlaps_with":{"description":"The other ACTIVE schedules this one competes with for bills (spec D16), for the list’s warning icon: the short form of `overlaps`. Empty when there are none and always empty while this one is paused.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunScheduleOverlapRefV1Dto"}},"overlaps":{"description":"The other ACTIVE schedules this one competes with for bills (spec D16), with the shared entities and vendors — computed on read from the current schedules and group memberships. Always empty while this one is paused. Visible ones first by name, then those the caller may not see.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunScheduleOverlapV1Dto"}},"created_by":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","status","owner_user_id","owner_name","legal_entity_ids","entity_group_ids","legal_entities","entity_groups","vendor_mode","vendor_party_ids","vendors","frequency","weekday","days_of_month","start_date","extra_days","payment_offset_days","memo_template","next_run_date","last_execution","non_usd_legal_entity_ids","overlaps_with","overlaps","created_by","created_at","updated_at"]},"PaymentRunScheduleSummaryV1Dto":{"type":"object","properties":{"active_count":{"type":"number","description":"Active schedules the caller can see."},"paused_count":{"type":"number","description":"Paused schedules the caller can see."}},"required":["active_count","paused_count"]},"PaymentRunSchedulePreviewEntityV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"legal_entity_name":{"type":"string"},"bank_account_id":{"type":"string","format":"uuid","nullable":true,"description":"The account the run would pay this entity from: its default paying account while still eligible, else its only eligible USD account. Null when neither resolves — the run would stay in draft."},"bank_account_name":{"type":"string","nullable":true},"bank_account_last4":{"type":"string","nullable":true,"description":"Last four digits of the account number, when known."},"bank_account_is_default":{"type":"boolean","description":"True when `bank_account_id` is the entity’s default paying account, false when it is its only eligible account or none resolves."},"totals_by_method":{"$ref":"#/components/schemas/PaymentRunMethodTotalsV1Dto"},"total_amount":{"type":"string","example":"1234.50"}},"required":["legal_entity_id","legal_entity_name","bank_account_id","bank_account_name","bank_account_last4","bank_account_is_default","totals_by_method","total_amount"]},"PaymentRunSchedulePreviewV1Dto":{"type":"object","properties":{"generated_on":{"type":"string","format":"date","description":"The org's today: the run's generation date."},"payment_date":{"type":"string","format":"date","description":"`generated_on` plus `payment_offset_days` business days; a weekend moves to Monday."},"next_run_date":{"type":"string","format":"date","description":"The schedule's first run date on or after today."},"next_payment_date":{"type":"string","format":"date","description":"`next_run_date` plus `payment_offset_days` business days."},"window_end":{"type":"string","format":"date","description":"Exclusive end of the bill window: the run date after `next_run_date` plus `extra_days`. A bill is taken when its due date — its document date when it has none — is before it; overdue bills always are."},"total_amount":{"type":"string","example":"1234.50"},"bill_count":{"type":"number"},"vendor_count":{"type":"number"},"entity_count":{"type":"number","description":"Entities with at least one bill in the run."},"left_out_count":{"type":"number","description":"Bills that qualified but stayed out because a run holds at most 200."},"entities":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRunSchedulePreviewEntityV1Dto"}},"dropped_entities":{"description":"Entities in scope the run would leave out: those the caller may not access (`no_access`, id only), inactive ones (`inactive`) and non-USD ones (`not_usd`).","type":"array","items":{"$ref":"#/components/schemas/PaymentRunScheduleDroppedEntityV1Dto"}},"missing":{"description":"What a person must supply before the draft can be submitted.","type":"array","items":{"$ref":"#/components/schemas/PaymentRunScheduleMissingItemV1Dto"}},"overlaps":{"description":"The active schedules this one would compete with for bills (spec D16): the schedule in the body counts as active whatever its status and is compared with every OTHER active schedule (`schedule_id` is never compared with itself). Visible ones first by name, then those the caller may not see (null `schedule_id` and `name`).","type":"array","items":{"$ref":"#/components/schemas/PaymentRunScheduleOverlapV1Dto"}}},"required":["generated_on","payment_date","next_run_date","next_payment_date","window_end","total_amount","bill_count","vendor_count","entity_count","left_out_count","entities","dropped_entities","missing","overlaps"]},"PreviewPaymentRunScheduleV1Dto":{"type":"object","properties":{"legal_entity_ids":{"description":"Legal entities in scope. With `entity_group_ids`, at least one entity or group is required.","type":"array","items":{"type":"string","format":"uuid"}},"entity_group_ids":{"description":"Payment groups in scope (`group_type = payment`; a consolidation group is refused with ENTITY_GROUP_WRONG_TYPE). Each is resolved to its current members every time the schedule runs.","type":"array","items":{"type":"string","format":"uuid"}},"vendor_mode":{"type":"string","enum":["all","only","except"],"description":"`all` (default) pays every vendor; `only` / `except` need `vendor_party_ids`."},"vendor_party_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"weekday":{"type":"number","nullable":true,"minimum":0,"maximum":6,"description":"0 (Sunday) to 6. Required for weekly and biweekly; null otherwise."},"days_of_month":{"type":"array","description":"`'1'`–`'28'` or `'last'`: one for monthly, two different ones for twice_monthly; empty for weekly and biweekly.","items":{"type":"string","enum":["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","last"]}},"extra_days":{"type":"number","minimum":0,"maximum":30,"description":"Days past the next run date a bill may be due and still be paid now. Default 0."},"payment_offset_days":{"type":"number","minimum":0,"maximum":30,"description":"Business days from the run date to the payment date. Default 1."},"frequency":{"type":"string","enum":["weekly","biweekly","twice_monthly","monthly"]},"start_date":{"type":"string","format":"date","description":"No run before it; a biweekly schedule counts from it."},"owner_user_id":{"type":"string","format":"uuid","description":"Whose name the runs act in (spec D8): a live member who may create payment runs and access the whole scope. Defaults to the caller; required for an API key."},"schedule_id":{"type":"string","format":"uuid","description":"The saved schedule being edited, if any. Its window then starts from the `next_run_date` the rule in this body would get on save — after its last scheduled run, so with the rule unchanged it is the stored date Generate now uses — or, while paused, from the first run date on or after today. Without it (a new schedule) the window starts from the first run date on or after today."}},"required":["frequency","start_date"]},"CreatePaymentRunScheduleV1Dto":{"type":"object","properties":{"legal_entity_ids":{"description":"Legal entities in scope. With `entity_group_ids`, at least one entity or group is required.","type":"array","items":{"type":"string","format":"uuid"}},"entity_group_ids":{"description":"Payment groups in scope (`group_type = payment`; a consolidation group is refused with ENTITY_GROUP_WRONG_TYPE). Each is resolved to its current members every time the schedule runs.","type":"array","items":{"type":"string","format":"uuid"}},"vendor_mode":{"type":"string","enum":["all","only","except"],"description":"`all` (default) pays every vendor; `only` / `except` need `vendor_party_ids`."},"vendor_party_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"weekday":{"type":"number","nullable":true,"minimum":0,"maximum":6,"description":"0 (Sunday) to 6. Required for weekly and biweekly; null otherwise."},"days_of_month":{"type":"array","description":"`'1'`–`'28'` or `'last'`: one for monthly, two different ones for twice_monthly; empty for weekly and biweekly.","items":{"type":"string","enum":["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","last"]}},"extra_days":{"type":"number","minimum":0,"maximum":30,"description":"Days past the next run date a bill may be due and still be paid now. Default 0."},"payment_offset_days":{"type":"number","minimum":0,"maximum":30,"description":"Business days from the run date to the payment date. Default 1."},"memo_template":{"type":"string","nullable":true,"maxLength":500,"description":"The runs' memo; every `{date}` becomes the generation date in MM/DD/YYYY. Null or blank for none."},"status":{"type":"string","enum":["active","paused"],"description":"Default `active`. A paused schedule never runs."},"name":{"type":"string","minLength":1,"maxLength":120},"frequency":{"type":"string","enum":["weekly","biweekly","twice_monthly","monthly"]},"start_date":{"type":"string","format":"date","description":"No run before it; a biweekly schedule counts from it."},"owner_user_id":{"type":"string","format":"uuid","description":"Whose name the runs act in (spec D8): a live member who may create payment runs and access the whole scope. Defaults to the caller; required for an API key."}},"required":["name","frequency","start_date"]},"UpdatePaymentRunScheduleV1Dto":{"type":"object","properties":{"legal_entity_ids":{"description":"Legal entities in scope. With `entity_group_ids`, at least one entity or group is required.","type":"array","items":{"type":"string","format":"uuid"}},"entity_group_ids":{"description":"Payment groups in scope (`group_type = payment`; a consolidation group is refused with ENTITY_GROUP_WRONG_TYPE). Each is resolved to its current members every time the schedule runs.","type":"array","items":{"type":"string","format":"uuid"}},"vendor_mode":{"type":"string","enum":["all","only","except"],"description":"`all` (default) pays every vendor; `only` / `except` need `vendor_party_ids`."},"vendor_party_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"weekday":{"type":"number","nullable":true,"minimum":0,"maximum":6,"description":"0 (Sunday) to 6. Required for weekly and biweekly; null otherwise."},"days_of_month":{"type":"array","description":"`'1'`–`'28'` or `'last'`: one for monthly, two different ones for twice_monthly; empty for weekly and biweekly.","items":{"type":"string","enum":["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","last"]}},"extra_days":{"type":"number","minimum":0,"maximum":30,"description":"Days past the next run date a bill may be due and still be paid now. Default 0."},"payment_offset_days":{"type":"number","minimum":0,"maximum":30,"description":"Business days from the run date to the payment date. Default 1."},"memo_template":{"type":"string","nullable":true,"maxLength":500,"description":"The runs' memo; every `{date}` becomes the generation date in MM/DD/YYYY. Null or blank for none."},"status":{"type":"string","enum":["active","paused"],"description":"Default `active`. A paused schedule never runs."},"name":{"type":"string","minLength":1,"maxLength":120},"frequency":{"type":"string","enum":["weekly","biweekly","twice_monthly","monthly"],"description":"Changing it drops the stored field the new frequency does not use (`weekday` or `days_of_month`) unless the request sends it."},"start_date":{"type":"string","format":"date"},"owner_user_id":{"type":"string","format":"uuid","description":"Reassign the schedule (spec D14): a live member who may create payment runs and access the whole scope."}}},"LegalEntityPaymentsStatusV1Dto":{"type":"object","properties":{"status":{"type":"string","enum":["not_connected","pending","active","action_required","disabled"],"description":"`not_connected` means this legal entity has no Moov account at all — it is synthesized from the absence of a row, not stored. The rest mirror Moov: `pending` while verification is in progress, `action_required` when Moov needs something from the user, `disabled` when verification failed terminally."},"moov_account_id":{"type":"string","nullable":true,"description":"Moov's account id for this legal entity, or `null` when not connected. Pass it to the `<moov-onboarding>` Drop as `account-id`."},"last_synced_at":{"type":"string","nullable":true,"format":"date-time","description":"When `status` was last confirmed against Moov. `null` before the first successful refresh."},"stale":{"type":"boolean","description":"True when Moov could not be reached and these values came from our last stored snapshot rather than a live read. The status is still the best information we have — render it, but qualify it with `last_synced_at` rather than treating it as current."}},"required":["status","moov_account_id","last_synced_at","stale"]},"ConnectLegalEntityPaymentsV1Dto":{"type":"object","properties":{"business_type":{"type":"string","enum":["soleProprietorship","llc","partnership","privateCorporation","publicCorporation","unincorporatedAssociation","trust","unincorporatedNonProfit","incorporatedNonProfit","governmentEntity"],"description":"Moov business type for this legal entity. Omit to derive it from the entity's `entity_type`; required when that mapping is ambiguous (`other`), and accepted as an override when it is not (e.g. `publicCorporation` instead of the suggested `privateCorporation`). An unaccepted value returns 422 PAYMENTS_BUSINESS_TYPE_INVALID with the full list in `context.valid_business_types`.","example":"llc"}}},"MoovOnboardingTokenV1Dto":{"type":"object","properties":{"access_token":{"type":"string","description":"Short-lived Moov OAuth token for the browser. Hand it straight to the `<moov-onboarding>` Drop; do not store it, log it, or send it anywhere other than Moov."},"token_type":{"type":"string","example":"Bearer"},"expires_in":{"type":"number","example":1736964352,"description":"Moov's `expires_in`, forwarded verbatim. **This is a Unix timestamp in seconds, not a duration** — Moov names the field per OAuth convention but documents and returns an absolute expiry. Compare it against the current time; do not add it to `now`. `0` means Moov reported nothing, which reads as already-expired — re-mint rather than assuming the token is good."},"scope":{"type":"string","description":"Space-delimited scopes actually granted. Every account-specific scope names this legal entity's Moov account and no other."},"facilitator_account_id":{"type":"string","example":"67bdcbcb-28d5-4494-ad7b-a5fd4f0f8a50","description":"**Our platform account**, not this legal entity's — the Drop's `facilitatorAccountID`. Returned here rather than configured in the browser so it cannot drift from the credentials that minted the token: a facilitator id that disagrees with the key fails inside Moov's dialog, not at our boundary. Note this is NOT the `aid` claim on the token (that is the API key's application identity, a different id)."}},"required":["access_token","token_type","expires_in","scope","facilitator_account_id"]},"MintOnboardingTokenV1Dto":{"type":"object","properties":{"scope_set":{"type":"string","enum":["initial","full"],"default":"initial","description":"Which phase of the embedded `<moov-onboarding>` Drop the token is for. `initial` grants read-only access to this legal entity's Moov account plus document upload — enough to open the dialog — and is the default, so an omitted `scope_set` never over-grants. `full` adds the writes the Drop needs once the user starts entering representatives and ownership; ask for it explicitly at that point. Both are scoped exclusively to this legal entity's Moov account; neither can create accounts or touch another account.","example":"initial"}}},"LinkedSourceBankV1Dto":{"type":"object","properties":{"bank_account_id":{"type":"string","format":"uuid"},"moov_payment_method_id":{"type":"string","description":"Moov payment method used to debit this bank when funding a payment."},"already_linked":{"type":"boolean","description":"True when the account was already linked and this call changed nothing."}},"required":["bank_account_id","moov_payment_method_id","already_linked"]},"FundingAccountV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The bank account id; the same value as `bank_account_id`."},"bank_account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"institution_name":{"type":"string","nullable":true},"linked_for_payments":{"type":"boolean","description":"Whether a Moov payment method is stored for this account. This says a link was made, NOT that it still works — read funding_account_status for that. An ACH return errors the bank account at Moov and removes its debit payment method while this stays true."},"linkable":{"type":"boolean","description":"Whether this account can be linked at all. False when it has no Plaid connection, so there is no way to verify it."},"funding_account_status":{"type":"string","enum":["ready","unusable","not_linked","unknown"],"description":"Whether this account can fund a payment RIGHT NOW, decided against Moov's live payment-method list rather than against our stored id. `ready`: Moov still offers the stored method. `unusable`: Moov will not debit it (typically after an ACH return) — which is NOT the same as gone for good, so read `status_detail` for the remedy: Moov documents an `errored` account as needing a DIFFERENT bank account and a `verificationFailed` one as always re-verifiable, i.e. keep it and verify it again. `not_linked`: no Moov payment method is stored. `unknown`: Moov could not be reached, so this row is the last state we recorded and not a fresh answer — treat it as neither confirmed good nor confirmed dead. Named funding_account_status, not funding_status, because `loans` already puts an unrelated `funding_status` on the wire."},"status_detail":{"type":"string","nullable":true,"description":"Operator-facing explanation for a funding_account_status that needs one (`unusable`, `unknown`); null for `ready` and `not_linked`. For `unusable` it names the remedy Moov documents for the state Moov actually reported — add a different bank account for an errored account, or reverify this same one for a verificationFailed account — and it never suggests re-linking as a repair."}},"required":["id","bank_account_id","name","institution_name","linked_for_payments","linkable","funding_account_status","status_detail"]},"TransferV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"moov_transfer_id":{"type":"string","nullable":true,"description":"Moov’s transfer id. Null means we have no confirmation money moved — unresolved, not failed."},"party_id":{"type":"string","format":"uuid"},"amount_cents":{"type":"number","example":24750},"currency":{"type":"string","example":"USD"},"status":{"type":"string","enum":["created","pending","completed","failed","reversed","queued","canceled"]},"failure_reason":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"created_at":{"type":"string"}},"required":["id","moov_transfer_id","party_id","amount_cents","currency","status","failure_reason","description","created_at"]},"SendPaymentV1Dto":{"type":"object","properties":{"party_id":{"type":"string","format":"uuid","description":"The vendor being paid."},"amount_cents":{"type":"number","example":24750,"maximum":2147483647,"description":"Amount in cents. 24750 = $247.50."},"description":{"type":"string","example":"INV-1042"},"bank_account_id":{"type":"string","format":"uuid"},"idempotency_key":{"type":"string","description":"Replay guard, minted once per payment intent (not per attempt). Retrying with the same key returns the original transfer."}},"required":["party_id","amount_cents","idempotency_key"]},"VendorPaymentStatusV1Dto":{"type":"object","properties":{"status":{"type":"string","enum":["ready","not_enrolled","no_bank_details","check_only","wire_only","incomplete"],"description":"ready — payable. not_enrolled — details present, not yet sent to Moov. no_bank_details / check_only / wire_only / incomplete — each needs a different fix, which is why this is not a boolean."},"moov_account_id":{"type":"string","nullable":true,"description":"The vendor’s Moov account, once enrolled."},"account_number_last4":{"type":"string","nullable":true}},"required":["status","moov_account_id","account_number_last4"]},"SalesCategoryV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string","description":"Upper snake case, unique per org (e.g. `GENERAL`, `FOOD`)."},"name":{"type":"string"},"is_active":{"type":"boolean","description":"Inactive categories stay on the leases and reports that already use them, but a sales config cannot newly require one."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","code","name","is_active","created_at","updated_at"]},"CreateSalesCategoryV1Dto":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Z][A-Z0-9_]*$","description":"Upper snake case, unique per org."},"name":{"type":"string","minLength":1,"maxLength":128}},"required":["code","name"]},"UpdateSalesCategoryV1Dto":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":128},"is_active":{"type":"boolean","description":"Set false to retire the category; categories are never deleted."}}},"SalesConfigCategoryV1Dto":{"type":"object","properties":{"sales_category_id":{"type":"string","format":"uuid"},"allowed_deductions":{"type":"array","description":"The deductions the lease lets the tenant subtract from gross sales in this category (spec §4.2). Qualifying sales = gross minus only these.","items":{"type":"string","enum":["sales_tax","returns","employee_discounts","comps","gift_card_sales","third_party_delivery_commission","ecommerce","other"]}}},"required":["sales_category_id","allowed_deductions"]},"ContractSalesConfigV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"reporting_cadence":{"type":"string","enum":["monthly","quarterly","annual"]},"report_due_days":{"type":"number","description":"Days after a period ends that its report is due."},"annual_statement_required":{"type":"boolean"},"annual_statement_certified":{"type":"boolean","description":"The lease requires a CPA or officer certification on the statement."},"annual_statement_due_days":{"type":"number","description":"Days after a measurement year ends that its statement is due."},"measurement_basis":{"type":"string","enum":["lease_year","calendar_year","tenant_fiscal"]},"fiscal_year_end_month":{"type":"number","nullable":true,"minimum":1,"maximum":12,"description":"Set exactly when measurement_basis is tenant_fiscal."},"reporting_start_date":{"type":"string","format":"date","nullable":true,"description":"The stored first period owed; null = derived from the lease."},"effective_reporting_start_date":{"type":"string","format":"date","nullable":true,"description":"`reporting_start_date`, else the lease anchor (rent commencement date, else start date). Null only when the lease states neither."},"reminder_emails":{"type":"string","enum":["inherit","on","off"],"description":"`inherit` follows the org switch; `on`/`off` override it."},"categories":{"type":"array","items":{"$ref":"#/components/schemas/SalesConfigCategoryV1Dto"}}},"required":["contract_id","reporting_cadence","report_due_days","annual_statement_required","annual_statement_certified","annual_statement_due_days","measurement_basis","fiscal_year_end_month","reporting_start_date","effective_reporting_start_date","reminder_emails","categories"]},"PutSalesConfigCategoryV1Dto":{"type":"object","properties":{"sales_category_id":{"type":"string","format":"uuid","description":"An ACTIVE category of the org."},"allowed_deductions":{"type":"array","description":"Defaults to `[\"sales_tax\", \"returns\"]`.","items":{"type":"string","enum":["sales_tax","returns","employee_discounts","comps","gift_card_sales","third_party_delivery_commission","ecommerce","other"]}}},"required":["sales_category_id"]},"PutContractSalesConfigV1Dto":{"type":"object","properties":{"reporting_cadence":{"type":"string","enum":["monthly","quarterly","annual"],"default":"monthly"},"report_due_days":{"type":"number","minimum":0,"default":20},"annual_statement_required":{"type":"boolean","default":true},"annual_statement_certified":{"type":"boolean","default":false},"annual_statement_due_days":{"type":"number","minimum":0,"default":60},"measurement_basis":{"type":"string","enum":["lease_year","calendar_year","tenant_fiscal"],"default":"calendar_year"},"fiscal_year_end_month":{"type":"number","nullable":true,"minimum":1,"maximum":12,"description":"Required (1-12) exactly when measurement_basis is tenant_fiscal."},"reporting_start_date":{"type":"string","format":"date","nullable":true,"description":"Omit or null to derive it from the lease."},"reminder_emails":{"type":"string","enum":["inherit","on","off"],"default":"inherit"},"categories":{"description":"At least one; each category at most once.","type":"array","items":{"$ref":"#/components/schemas/PutSalesConfigCategoryV1Dto"}}},"required":["categories"]},"SalesCategoryMappingV1Dto":{"type":"object","properties":{"source_label":{"type":"string","description":"The tenant's own label, as it appears in their CSV."},"sales_category_id":{"type":"string","format":"uuid"},"effective_from":{"type":"string","format":"date","description":"First day the mapping applies."},"effective_to":{"type":"string","format":"date","nullable":true,"description":"EXCLUSIVE: the first day the mapping no longer applies (`[from, to)`). Null = open-ended."}},"required":["source_label","sales_category_id","effective_from","effective_to"]},"PutSalesCategoryMappingV1Dto":{"type":"object","properties":{"source_label":{"type":"string","minLength":1,"maxLength":200},"sales_category_id":{"type":"string","format":"uuid","description":"A category of the org."},"effective_from":{"type":"string","format":"date"},"effective_to":{"type":"string","format":"date","nullable":true,"description":"Exclusive end; omit or null for open-ended."}},"required":["source_label","sales_category_id","effective_from"]},"PutSalesCategoryMappingsV1Dto":{"type":"object","properties":{"mappings":{"type":"array","items":{"$ref":"#/components/schemas/PutSalesCategoryMappingV1Dto"}}},"required":["mappings"]},"SalesSummaryCategoryV1Dto":{"type":"object","properties":{"sales_category_id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true,"description":"Null when the category no longer exists."},"qualifying_amount":{"type":"string","description":"Gross minus the allowed deductions; may be negative.","example":"1234.50"}},"required":["sales_category_id","name","qualifying_amount"]},"SalesSummaryPeriodV1Dto":{"type":"object","properties":{"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"version":{"type":"number","description":"The current submitted version."},"by_category":{"type":"array","items":{"$ref":"#/components/schemas/SalesSummaryCategoryV1Dto"}},"qualifying_total":{"type":"string","example":"1234.50"},"prior_year_total":{"type":"string","nullable":true,"description":"The qualifying total of the period starting 12 months earlier; null when it has no submitted report.","example":"1234.50"},"yoy_change_pct":{"type":"string","nullable":true,"example":"8.00","description":"`(total − prior) ÷ |prior| × 100`, 2 decimals, rounded half-up. Null when the prior year is missing or zero."}},"required":["period_start","period_end","version","by_category","qualifying_total","prior_year_total","yoy_change_pct"]},"SalesSummaryV1Dto":{"type":"object","properties":{"as_of":{"type":"string","format":"date","description":"The org-local today used."},"currency_code":{"type":"string","example":"USD"},"periods":{"description":"The current submitted version of every regular period (annual statements excluded) ending in the last 24 months, newest first.","type":"array","items":{"$ref":"#/components/schemas/SalesSummaryPeriodV1Dto"}},"trailing_12_total":{"type":"string","description":"Qualifying sales of the periods ending in the 12 whole months before the current one.","example":"1234.50"},"rentable_sqft":{"type":"string","nullable":true,"example":"1000.00","description":"The lease's rentable square feet: the area the lease states, else the sum of its linked spaces, else (a whole-property lease) the property's area. Null when none is stated."},"sales_per_sqft":{"type":"string","nullable":true,"example":"120.00","description":"`trailing_12_total ÷ rentable_sqft`, 2 decimals, rounded half-up. Null when the area is unknown or zero."},"trailing_12_billed":{"type":"string","description":"Pre-tax subtotal of the contract's posted invoices minus its posted credit memos dated in the same 12 months: rent and the charges that ride the rent invoice. Year-end recovery reconciliation invoices are not included.","example":"1234.50"},"occupancy_cost_pct":{"type":"string","nullable":true,"example":"8.00","description":"`trailing_12_billed ÷ trailing_12_total × 100`, 2 decimals, rounded half-up. Null when trailing sales are zero or negative."},"breakpoint_progress":{"type":"object","additionalProperties":true,"nullable":true,"description":"Reserved for percentage rent, which will define its shape; always null until then."}},"required":["as_of","currency_code","periods","trailing_12_total","rentable_sqft","sales_per_sqft","trailing_12_billed","occupancy_cost_pct","breakpoint_progress"]},"SalesReportListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"is_annual_statement":{"type":"boolean"},"version":{"type":"number","description":"1 for the first report of the period."},"status":{"type":"string","enum":["draft","submitted","superseded","verified"],"description":"`draft` → `submitted`; `superseded` once a later version is submitted. `verified` is reserved."},"source":{"type":"string","enum":["manual","csv","estimate"]},"superseded_by_id":{"type":"string","format":"uuid","nullable":true},"submitted_at":{"type":"string","format":"date-time","nullable":true},"submitted_by":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"certified_by":{"type":"string","nullable":true},"certified_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","contract_id","period_start","period_end","is_annual_statement","version","status","source","superseded_by_id","submitted_at","submitted_by","notes","certified_by","certified_at","created_at","updated_at"]},"SalesReportLineV1Dto":{"type":"object","properties":{"sales_category_id":{"type":"string","format":"uuid"},"gross_amount":{"type":"string","example":"1234.50"},"deductions":{"type":"object","additionalProperties":{"type":"string"},"example":{"sales_tax":"80.00","returns":"25.00"},"description":"`{ <deduction_type>: \"amount\" }`. Keys are from the closed list `sales_tax`, `returns`, `employee_discounts`, `comps`, `gift_card_sales`, `third_party_delivery_commission`, `ecommerce`, `other`; each value is a non-negative decimal string with at most 2 decimals. A deduction the lease does not allow for the category is kept but not subtracted."},"qualifying_amount":{"type":"string","description":"Gross minus the deductions the lease's CURRENT config allows for the category. Derived on read, never stored; may be negative.","example":"1234.50"}},"required":["sales_category_id","gross_amount","deductions","qualifying_amount"]},"SalesReportV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"is_annual_statement":{"type":"boolean"},"version":{"type":"number","description":"1 for the first report of the period."},"status":{"type":"string","enum":["draft","submitted","superseded","verified"],"description":"`draft` → `submitted`; `superseded` once a later version is submitted. `verified` is reserved."},"source":{"type":"string","enum":["manual","csv","estimate"]},"superseded_by_id":{"type":"string","format":"uuid","nullable":true},"submitted_at":{"type":"string","format":"date-time","nullable":true},"submitted_by":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"certified_by":{"type":"string","nullable":true},"certified_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/SalesReportLineV1Dto"}},"qualifying_total":{"type":"string","description":"Sum of every line's `qualifying_amount`.","example":"1234.50"}},"required":["id","contract_id","period_start","period_end","is_annual_statement","version","status","source","superseded_by_id","submitted_at","submitted_by","notes","certified_by","certified_at","created_at","updated_at","lines","qualifying_total"]},"SalesReportLineInputV1Dto":{"type":"object","properties":{"sales_category_id":{"type":"string","format":"uuid","description":"One of the categories the lease's sales config requires."},"gross_amount":{"type":"string","description":"Gross sales for the category; may be negative (a returns month). At most 2 decimals. A malformed amount answers 422 `SALES_REPORT_LINES_INVALID`.","example":"1234.50"},"deductions":{"type":"object","additionalProperties":{"type":"string"},"example":{"sales_tax":"80.00","returns":"25.00"},"description":"`{ <deduction_type>: \"amount\" }`. Keys are from the closed list `sales_tax`, `returns`, `employee_discounts`, `comps`, `gift_card_sales`, `third_party_delivery_commission`, `ecommerce`, `other`; each value is a non-negative decimal string with at most 2 decimals. A deduction the lease does not allow for the category is kept but not subtracted."}},"required":["sales_category_id","gross_amount"]},"CreateSalesReportV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"is_annual_statement":{"type":"boolean","default":false,"description":"True for the annual statement of a measurement year."},"notes":{"type":"string","nullable":true,"maxLength":2000},"lines":{"description":"Category lines; may be partial on a draft. Submit requires every category the config requires.","type":"array","items":{"$ref":"#/components/schemas/SalesReportLineInputV1Dto"}}},"required":["contract_id","period_start","period_end"]},"BulkSalesReportRowV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid","description":"At most once per request."},"lines":{"description":"One line per category the config requires.","type":"array","items":{"$ref":"#/components/schemas/SalesReportLineInputV1Dto"}},"notes":{"type":"string","nullable":true,"maxLength":2000}},"required":["contract_id","lines"]},"BulkSalesReportsV1Dto":{"type":"object","properties":{"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"reports":{"minItems":1,"maxItems":500,"type":"array","items":{"$ref":"#/components/schemas/BulkSalesReportRowV1Dto"}}},"required":["period_start","period_end","reports"]},"UpdateSalesReportV1Dto":{"type":"object","properties":{"notes":{"type":"string","nullable":true,"maxLength":2000},"certified_by":{"type":"string","nullable":true,"maxLength":200,"description":"Who certified an annual statement (name and title)."},"certified_at":{"type":"string","format":"date-time","nullable":true},"lines":{"description":"Replaces every line of the draft; `[]` clears them.","type":"array","items":{"$ref":"#/components/schemas/SalesReportLineInputV1Dto"}}}},"SalesImportCountsV1Dto":{"type":"object","properties":{"ready":{"type":"number","description":"Groups that commit as a new report."},"restatement":{"type":"number","description":"Groups that commit as a new version of a submitted report."},"blocked":{"type":"number","description":"Groups held back by a problem."},"committed":{"type":"number","description":"Groups already committed."}},"required":["ready","restatement","blocked","committed"]},"SalesImportIssueV1Dto":{"type":"object","properties":{"code":{"type":"string","enum":["INVALID_DATE","INVALID_AMOUNT","MISSING_VALUE","CONTRACT_REF_UNKNOWN","CONTRACT_REF_AMBIGUOUS","UNMAPPED_LABEL","SALES_CATEGORY_INACTIVE","SALES_CONFIG_NOT_FOUND","SALES_REPORT_OFF_CALENDAR","SALES_REPORT_LINES_INVALID","SALES_REPORT_DRAFT_EXISTS","BLOCKED_BY_OTHER_ROWS","BLOCKED_BY_UNMATCHED_ROWS","DUPLICATE_LABEL"]},"message":{"type":"string","description":"A complete sentence for the reviewer."}},"required":["code","message"]},"SalesImportLineV1Dto":{"type":"object","properties":{"sales_category_id":{"type":"string","format":"uuid"},"gross_amount":{"type":"string","description":"Gross, summed over the rows mapped to this category.","example":"1234.50"},"deductions":{"type":"object","additionalProperties":{"type":"string"},"description":"`{ <deduction_type>: \"amount\" }`, summed; keys from sales_tax, returns, employee_discounts, comps, gift_card_sales, third_party_delivery_commission, ecommerce, other."}},"required":["sales_category_id","gross_amount","deductions"]},"SalesImportGroupV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid","nullable":true,"description":"Null for a row whose contract ref named no contract."},"contract_title":{"type":"string","nullable":true},"period_start":{"type":"string","format":"date","nullable":true},"period_end":{"type":"string","format":"date","nullable":true},"is_annual_statement":{"type":"boolean","description":"The period resolved as the annual statement."},"outcome":{"type":"string","enum":["ready","restatement","blocked","committed"]},"blocked_by":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/SalesImportIssueV1Dto"}]},"lines":{"type":"array","items":{"$ref":"#/components/schemas/SalesImportLineV1Dto"}},"row_numbers":{"description":"The file rows in this group.","type":"array","items":{"type":"number"}},"prior_report_id":{"type":"string","format":"uuid","nullable":true,"description":"For a restatement: the submitted report it supersedes."},"committed_report_id":{"type":"string","format":"uuid","nullable":true,"description":"For a committed group: the report it became."}},"required":["contract_id","contract_title","period_start","period_end","is_annual_statement","outcome","blocked_by","lines","row_numbers","prior_report_id","committed_report_id"]},"SalesImportRowV1Dto":{"type":"object","properties":{"row_number":{"type":"number"},"raw":{"type":"object","additionalProperties":{"type":"string"},"description":"The row's cells keyed by normalised header; the shape is the uploaded file's."},"status":{"type":"string","enum":["pending","committed","skipped"]},"issue":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/SalesImportIssueV1Dto"}]}},"required":["row_number","raw","status","issue"]},"SalesImportDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"file_name":{"type":"string"},"status":{"type":"string","enum":["open","committed","discarded"],"description":"`open` while any row is pending; `committed` once none is; `discarded` after a discard (what was committed stays)."},"row_count":{"type":"number","description":"Data rows in the file."},"uploaded_by":{"type":"string","format":"uuid","nullable":true},"committed_at":{"type":"string","format":"date-time","nullable":true},"discarded_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"counts":{"$ref":"#/components/schemas/SalesImportCountsV1Dto"},"groups":{"description":"One per (contract, period): what committing would do.","type":"array","items":{"$ref":"#/components/schemas/SalesImportGroupV1Dto"}},"rows":{"type":"array","items":{"$ref":"#/components/schemas/SalesImportRowV1Dto"}}},"required":["id","file_name","status","row_count","uploaded_by","committed_at","discarded_at","created_at","updated_at","counts","groups","rows"]},"SalesImportListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"file_name":{"type":"string"},"status":{"type":"string","enum":["open","committed","discarded"],"description":"`open` while any row is pending; `committed` once none is; `discarded` after a discard (what was committed stays)."},"row_count":{"type":"number","description":"Data rows in the file."},"uploaded_by":{"type":"string","format":"uuid","nullable":true},"committed_at":{"type":"string","format":"date-time","nullable":true},"discarded_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"counts":{"$ref":"#/components/schemas/SalesImportCountsV1Dto"}},"required":["id","file_name","status","row_count","uploaded_by","committed_at","discarded_at","created_at","updated_at","counts"]},"SalesTrackerLastReminderV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["due_soon","overdue","manual"]},"sequence":{"type":"number","description":"The nth reminder of this kind for the report, from 1."},"status":{"type":"string","enum":["pending","sent","failed"],"description":"`pending` (claimed, provider not answered yet), `sent`, or `failed`."},"sent_at":{"type":"string","format":"date-time","nullable":true}},"required":["kind","sequence","status","sent_at"]},"SalesTrackerCellV1Dto":{"type":"object","properties":{"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"is_annual_statement":{"type":"boolean","description":"An annual statement for the measurement year, not a period."},"due_date":{"type":"string","format":"date"},"status":{"type":"string","enum":["upcoming","due","overdue","estimated","received","restated"],"description":"`upcoming` (period not ended), `due` (ended, not received, on or before the due date), `overdue` (not received, past due), `estimated` (the current version is an estimate), `received`, `restated` (received, version > 1). Judged on the org-local today."},"days_late":{"type":"number","description":"Days past the due date: up to today when not received, up to the org-local submission day when received; 0 when on time or estimated."},"report_id":{"type":"string","format":"uuid","nullable":true,"description":"The current submitted version; null when none."},"version":{"type":"number","nullable":true},"qualifying_total":{"type":"string","nullable":true,"description":"The current version's qualifying sales under the lease's current allowed deductions; null when nothing is submitted.","example":"1234.50"},"reminder_count":{"type":"number","description":"How many reminder emails for this report were sent."},"last_reminder":{"nullable":true,"description":"The report's newest reminder, whatever its status; null when none.","type":"object","allOf":[{"$ref":"#/components/schemas/SalesTrackerLastReminderV1Dto"}]}},"required":["period_start","period_end","is_annual_statement","due_date","status","days_late","report_id","version","qualifying_total","reminder_count","last_reminder"]},"SalesTrackerRowV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"contract_name":{"type":"string","description":"The contract's title."},"tenant_name":{"type":"string","nullable":true},"property_id":{"type":"string","format":"uuid","nullable":true,"description":"The lease's location: on the filtered property when `property_id` is given, else its primary link. Null when the lease has none."},"property_name":{"type":"string","nullable":true},"space_label":{"type":"string","nullable":true,"description":"The space's designation (else its name); null for a whole property."},"cells":{"description":"Every expected report overlapping the window, oldest first; an annual statement follows the period ending on its last day.","type":"array","items":{"$ref":"#/components/schemas/SalesTrackerCellV1Dto"}}},"required":["contract_id","contract_name","tenant_name","property_id","property_name","space_label","cells"]},"SalesTrackerV1Dto":{"type":"object","properties":{"as_of":{"type":"string","format":"date","description":"The org-local today used."},"from_date":{"type":"string","format":"date"},"to_date":{"type":"string","format":"date"},"rows":{"description":"One row per lease with a sales config, by property then tenant name.","type":"array","items":{"$ref":"#/components/schemas/SalesTrackerRowV1Dto"}}},"required":["as_of","from_date","to_date","rows"]},"SalesReminderSendV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"is_annual_statement":{"type":"boolean","description":"An annual statement for the measurement year, not a period."},"kind":{"type":"string","enum":["due_soon","overdue","manual"],"description":"`due_soon` (before the due date), `overdue` (after it, at most 3, a week apart) — both sent by the daily job — or `manual` (a user sent it)."},"sequence":{"type":"number","description":"The nth reminder of this kind for the report, from 1."},"status":{"type":"string","enum":["pending","sent","failed"],"description":"`pending` (claimed, the provider has not answered), `sent`, or `failed` (see `error`; the job retries a failed automatic reminder once, on its next run)."},"recipients":{"description":"The tenant contacts' email addresses it went to.","type":"array","items":{"type":"string"}},"attempt_count":{"type":"number","description":"How many times it was attempted (at most 2)."},"error":{"type":"string","nullable":true,"description":"The provider's error on the last failed attempt."},"sent_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"}},"required":["id","contract_id","period_start","period_end","is_annual_statement","kind","sequence","status","recipients","attempt_count","error","sent_at","created_at"]},"SendSalesReminderV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"is_annual_statement":{"type":"boolean","default":false,"description":"True for the annual statement of a measurement year."}},"required":["contract_id","period_start","period_end"]},"PercentageRentClosurePeriodV1Dto":{"type":"object","properties":{"from":{"type":"string","format":"date","description":"First closed day."},"to":{"type":"string","format":"date","description":"Last closed day (inclusive)."}},"required":["from","to"]},"PercentageRentTierV1Dto":{"type":"object","properties":{"from_amount":{"type":"string","description":"Full-year sales from which `rate_bp` applies; prorated for a stub year.","example":"1234.50"},"rate_bp":{"type":"number","minimum":1,"maximum":10000,"description":"600 = 6%."}},"required":["from_amount","rate_bp"]},"PercentageRentRuleV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"position":{"type":"number","description":"Order within the version, from 1; `sequenced` groups consume the shared breakpoint in this order."},"rate_bp":{"type":"number","nullable":true,"minimum":1,"maximum":10000,"description":"The rate in basis points (600 = 6%); null for `tiered`."},"breakpoint":{"type":"string","enum":["none","natural","stated","tiered"],"description":"`natural` = base rent ÷ rate; `stated` = `stated_amount`; `tiered` = the tiers; `none` = rent on every dollar."},"stated_amount":{"type":"string","nullable":true,"description":"Full-year stated breakpoint; set for `stated` only.","example":"1234.50"},"tiers":{"type":"array","items":{"$ref":"#/components/schemas/PercentageRentTierV1Dto"}},"breakpoint_group":{"type":"string","nullable":true,"description":"Rules with the same non-null group share one breakpoint."},"sales_category_ids":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["id","position","rate_bp","breakpoint","stated_amount","tiers","breakpoint_group","sales_category_ids"]},"PercentageRentConfigV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"effective_from":{"type":"string","format":"date"},"effective_to":{"type":"string","format":"date","nullable":true,"description":"Last day of the version (inclusive); null while it is open-ended."},"superseded_at":{"type":"string","format":"date-time","nullable":true,"description":"Set when a same-day re-save replaced this version; null = not superseded."},"supersedes_config_id":{"type":"string","format":"uuid","nullable":true,"description":"The version this one replaced by a same-day re-save."},"billing_method":{"type":"string","enum":["annual_only","cumulative","periodic"]},"rate_style":{"type":"string","enum":["marginal","cliff"]},"allocation_rule":{"type":"string","enum":["pro_rata","sequenced","per_category"]},"proration":{"type":"string","enum":["days"]},"rounding":{"type":"string","enum":["cents","whole_dollar"]},"invoice_mode":{"type":"string","enum":["inherit","next_rent_invoice","separate"],"description":"How approved % rent for this lease is invoiced: `inherit` = the org's `pct_rent_invoice_mode`; `next_rent_invoice` = added to the lease's next rent invoice; `separate` = an invoice of its own, posted but not emailed. Termination and audit lines always bill separately, whatever this says."},"natural_breakpoint_rent_term_ids":{"description":"The fixed base-rent terms a natural breakpoint divides; `[]` = all of them.","type":"array","items":{"type":"string","format":"uuid"}},"closure_periods":{"type":"array","items":{"$ref":"#/components/schemas/PercentageRentClosurePeriodV1Dto"}},"late_estimate_enabled":{"type":"boolean"},"late_estimate_basis_pct":{"type":"number","description":"Percent of the prior year's sales a late-report estimate bills on."},"late_estimate_after_days":{"type":"number","nullable":true,"description":"Days past a missing report's due date after which the daily job bills on an estimate (when `late_estimate_enabled`); null = only a person writes estimates."},"audit_threshold_bp":{"type":"number","nullable":true},"audit_interest_rate_bp":{"type":"number","nullable":true},"audit_costs_recoverable":{"type":"boolean"},"item_id":{"type":"string","format":"uuid"},"tax_rate_id":{"type":"string","format":"uuid","nullable":true},"rules":{"type":"array","items":{"$ref":"#/components/schemas/PercentageRentRuleV1Dto"}},"created_by":{"type":"string","format":"uuid","nullable":true},"created_at":{"type":"string","format":"date-time"}},"required":["id","contract_id","effective_from","effective_to","superseded_at","supersedes_config_id","billing_method","rate_style","allocation_rule","proration","rounding","invoice_mode","natural_breakpoint_rent_term_ids","closure_periods","late_estimate_enabled","late_estimate_basis_pct","late_estimate_after_days","audit_threshold_bp","audit_interest_rate_bp","audit_costs_recoverable","item_id","tax_rate_id","rules","created_by","created_at"]},"ContractPercentageRentV1Dto":{"type":"object","properties":{"live":{"nullable":true,"description":"The version live on the org's today; null when none is.","type":"object","allOf":[{"$ref":"#/components/schemas/PercentageRentConfigV1Dto"}]},"versions":{"description":"Every version, newest start first. Bounded per contract (one per save).","type":"array","items":{"$ref":"#/components/schemas/PercentageRentConfigV1Dto"}}},"required":["live","versions"]},"PutPercentageRentClosurePeriodV1Dto":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date","description":"Inclusive."}},"required":["from","to"]},"PutPercentageRentTierV1Dto":{"type":"object","properties":{"from_amount":{"type":"string","example":"1234.50"},"rate_bp":{"type":"number","minimum":1,"maximum":10000}},"required":["from_amount","rate_bp"]},"PutPercentageRentRuleV1Dto":{"type":"object","properties":{"rate_bp":{"type":"number","nullable":true,"minimum":1,"maximum":10000,"description":"Required for every breakpoint except `tiered`."},"breakpoint":{"type":"string","enum":["none","natural","stated","tiered"]},"stated_amount":{"type":"string","nullable":true,"description":"Required for `stated`: the full-year breakpoint.","example":"1234.50"},"tiers":{"description":"Required for `tiered`, ascending by `from_amount`.","type":"array","items":{"$ref":"#/components/schemas/PutPercentageRentTierV1Dto"}},"breakpoint_group":{"type":"string","nullable":true,"maxLength":64},"sales_category_ids":{"description":"Categories of the lease's sales config this rule rates.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["breakpoint","sales_category_ids"]},"PutPercentageRentConfigV1Dto":{"type":"object","properties":{"effective_from":{"type":"string","format":"date","description":"The version's first day. Equal to the live version's start replaces it; later closes it the day before; earlier is refused."},"billing_method":{"type":"string","enum":["annual_only","cumulative","periodic"],"default":"annual_only"},"rate_style":{"type":"string","enum":["marginal","cliff"],"default":"marginal"},"allocation_rule":{"type":"string","enum":["pro_rata","sequenced","per_category"],"default":"pro_rata","description":"`per_category` is refused in v1 (`allocation_unsupported`)."},"proration":{"type":"string","enum":["days"],"default":"days"},"rounding":{"type":"string","enum":["cents","whole_dollar"],"default":"cents"},"invoice_mode":{"type":"string","enum":["inherit","next_rent_invoice","separate"],"default":"inherit","description":"How approved % rent for this lease is invoiced: `inherit` = the org's `pct_rent_invoice_mode`; `next_rent_invoice` = added to the lease's next rent invoice; `separate` = an invoice of its own, posted but not emailed. Termination and audit lines always bill separately, whatever this says."},"natural_breakpoint_rent_term_ids":{"description":"Fixed base-rent terms of this lease a natural breakpoint divides; omitted or `[]` = all of them.","type":"array","items":{"type":"string","format":"uuid"}},"closure_periods":{"type":"array","items":{"$ref":"#/components/schemas/PutPercentageRentClosurePeriodV1Dto"}},"late_estimate_enabled":{"type":"boolean","default":true},"late_estimate_basis_pct":{"type":"number","minimum":0,"maximum":1000,"default":125},"late_estimate_after_days":{"type":"number","nullable":true,"minimum":0,"maximum":3650,"description":"Days late before the daily job bills an estimate; omitted or null = never on its own."},"audit_threshold_bp":{"type":"number","nullable":true,"minimum":0},"audit_interest_rate_bp":{"type":"number","nullable":true,"minimum":0},"audit_costs_recoverable":{"type":"boolean","default":false},"item_id":{"type":"string","format":"uuid","description":"An active `income` item of the org that % rent bills through."},"tax_rate_id":{"type":"string","format":"uuid","nullable":true},"rules":{"description":"The rules in order; `[]` saves a config with no rules yet.","type":"array","items":{"$ref":"#/components/schemas/PutPercentageRentRuleV1Dto"}}},"required":["effective_from","item_id","rules"]},"PercentageRentAutomationOverrideV1Dto":{"type":"object","properties":{"auto_send":{"type":"string","enum":["always","up_to_limit","never"],"nullable":true},"auto_send_limit":{"type":"string","nullable":true,"example":"1234.50"},"hold_first_billed_year":{"type":"boolean","nullable":true},"hold_swing":{"type":"boolean","nullable":true},"swing_pct":{"type":"number","nullable":true},"hold_estimated":{"type":"boolean","nullable":true},"hold_credit":{"type":"boolean","nullable":true}},"required":["auto_send","auto_send_limit","hold_first_billed_year","hold_swing","swing_pct","hold_estimated","hold_credit"]},"PercentageRentSettingsV1Dto":{"type":"object","properties":{"auto_send":{"type":"string","enum":["always","up_to_limit","never"],"description":"When a computed charge goes out on its own: `always` (every charge not held), `up_to_limit` (charges whose absolute value is at most `auto_send_limit`; larger ones are held `over_auto_send_limit`), `never` (every charge is held `approval_required`)."},"auto_send_limit":{"type":"string","nullable":true,"description":"Set with `up_to_limit`; compared against |charge|.","example":"1234.50"},"hold_first_billed_year":{"type":"boolean","description":"Hold a lease's first billed year (`first_billed_year`)."},"hold_swing":{"type":"boolean","description":"Hold a charge or a month of sales that moved more than `swing_pct` against last year (`charge_swing`, `sales_swing`)."},"swing_pct":{"type":"number","minimum":1,"maximum":1000},"hold_estimated":{"type":"boolean","description":"Hold a charge on estimated sales (`estimated_sales`)."},"hold_credit":{"type":"boolean","description":"Hold a credit to the tenant (`credit`)."}},"required":["auto_send","auto_send_limit","hold_first_billed_year","hold_swing","swing_pct","hold_estimated","hold_credit"]},"ContractPercentageRentAutomationV1Dto":{"type":"object","properties":{"override":{"nullable":true,"description":"Null when the lease inherits every field from the org.","type":"object","allOf":[{"$ref":"#/components/schemas/PercentageRentAutomationOverrideV1Dto"}]},"effective":{"description":"The policy this lease's charges follow.","allOf":[{"$ref":"#/components/schemas/PercentageRentSettingsV1Dto"}]}},"required":["override","effective"]},"PutContractPercentageRentAutomationV1Dto":{"type":"object","properties":{"auto_send":{"type":"string","enum":["always","up_to_limit","never"],"nullable":true,"description":"When a computed charge goes out on its own: `always` (every charge not held), `up_to_limit` (charges whose absolute value is at most `auto_send_limit`; larger ones are held `over_auto_send_limit`), `never` (every charge is held `approval_required`). `up_to_limit` needs a limit here or on the org."},"auto_send_limit":{"type":"string","nullable":true,"example":"1234.50"},"hold_first_billed_year":{"type":"boolean","nullable":true},"hold_swing":{"type":"boolean","nullable":true},"swing_pct":{"type":"number","nullable":true,"minimum":1,"maximum":1000},"hold_estimated":{"type":"boolean","nullable":true},"hold_credit":{"type":"boolean","nullable":true}}},"PercentageRentMeasurementPeriodV1Dto":{"type":"object","properties":{"period_start":{"type":"string","format":"date","description":"First day, clipped to the lease anchor."},"period_end":{"type":"string","format":"date","description":"Last day (inclusive), clipped to the lease end."},"days_in_year":{"type":"number","description":"Days in the full, unclipped year (365/366)."},"days_in_period":{"type":"number","description":"Days in the clipped period."},"days_open":{"type":"number","description":"Days in the period less closure days inside it."}},"required":["period_start","period_end","days_in_year","days_in_period","days_open"]},"PercentageRentBreakpointV1Dto":{"type":"object","properties":{"rule_ids":{"description":"The rules sharing this breakpoint (one unless grouped).","type":"array","items":{"type":"string"}},"kind":{"type":"string","enum":["none","natural","stated","tiered"]},"amount":{"type":"string","description":"The breakpoint for the period, after stub and closure proration. For `tiered`, the first tier start.","example":"1234.50"},"derivation":{"type":"string","description":"How the amount was derived, in words."}},"required":["rule_ids","kind","amount","derivation"]},"PercentageRentTierMathV1Dto":{"type":"object","properties":{"rule_id":{"type":"string"},"band":{"type":"string","description":"The sales band, e.g. `0.00..2000000.00`."},"base":{"type":"string","description":"Sales billed in this band.","example":"1234.50"},"rate_bp":{"type":"number","description":"Rate in basis points (600 = 6%)."},"amount":{"type":"string","description":"Rent from this band.","example":"1234.50"}},"required":["rule_id","band","base","rate_bp","amount"]},"PercentageRentAllocationV1Dto":{"type":"object","properties":{"group":{"type":"string","description":"The shared breakpoint group."},"rule":{"type":"string","enum":["pro_rata","sequenced"]},"split":{"type":"object","additionalProperties":{"type":"string","example":"1234.50"},"description":"Sales category id → the overage that category was billed on (money string)."}},"required":["group","rule","split"]},"PercentageRentResultV1Dto":{"type":"object","properties":{"qualifying_by_category":{"type":"object","additionalProperties":{"type":"string","example":"1234.50"},"description":"Sales category id → qualifying sales (money string). Includes every category a rule names, at 0.00 when none were reported."},"breakpoints":{"type":"array","items":{"$ref":"#/components/schemas/PercentageRentBreakpointV1Dto"}},"tier_math":{"type":"array","items":{"$ref":"#/components/schemas/PercentageRentTierMathV1Dto"}},"allocation":{"description":"One entry per shared breakpoint group.","type":"array","items":{"$ref":"#/components/schemas/PercentageRentAllocationV1Dto"}},"gross_by_category":{"type":"object","additionalProperties":{"type":"string","example":"1234.50"},"description":"Sales category id → percentage rent (money string)."},"gross":{"type":"string","description":"Percentage rent for the period.","example":"1234.50"},"previously_billed":{"type":"string","description":"Already billed for the period (0.00 until runs exist).","example":"1234.50"},"delta":{"type":"string","description":"`gross` less `previously_billed`.","example":"1234.50"},"fingerprint":{"type":"string","description":"sha256 of the inputs (config version, report versions, base rent, estimate flag); changes when any of them does."}},"required":["qualifying_by_category","breakpoints","tier_math","allocation","gross_by_category","gross","previously_billed","delta","fingerprint"]},"PercentageRentPreviewV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"as_of":{"type":"string","format":"date"},"config_id":{"type":"string","format":"uuid","description":"The config version live on `as_of`."},"period":{"description":"The measurement year containing `as_of`.","allOf":[{"$ref":"#/components/schemas/PercentageRentMeasurementPeriodV1Dto"}]},"sales_to_date":{"type":"string","description":"Qualifying sales from the period start through `as_of`: the current submitted monthly reports whose period has ended by then.","example":"1234.50"},"breakpoints":{"description":"The full measurement year's breakpoints (as in `result`).","type":"array","items":{"$ref":"#/components/schemas/PercentageRentBreakpointV1Dto"}},"percent_of_breakpoint":{"type":"string","nullable":true,"example":"87.50","description":"`sales_to_date` (ALL qualifying sales, informational categories included) as a percent of the sum of every rule's breakpoint, two decimals (`120.00` = 20% over). Not a per-rule measure: it can exceed 100 while `result` bills gross 0, when the sales sit in categories no billing rule covers. Null when the breakpoints sum to zero."},"months_remaining":{"type":"number","description":"Months of the period with no report received yet; the run-rate projects these."},"projected_year_end_sales":{"type":"string","description":"`sales_to_date` + the mean of the last ≤3 received months × `months_remaining`; equal to `sales_to_date` when no month is received.","example":"1234.50"},"projected_overage":{"type":"string","description":"Projected percentage rent DOLLARS for the year (not a sales amount over the breakpoint): the same engine on projected per-category sales, split by the to-date category shares.","example":"1234.50"},"estimated":{"type":"boolean","description":"True when any report consumed is a system-written estimate."},"result":{"description":"The engine result on sales to date against the full-year breakpoints: what the year would bill if it ended on `as_of`.","allOf":[{"$ref":"#/components/schemas/PercentageRentResultV1Dto"}]}},"required":["contract_id","as_of","config_id","period","sales_to_date","breakpoints","percent_of_breakpoint","months_remaining","projected_year_end_sales","projected_overage","estimated","result"]},"PercentageRentRunV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid"},"property_name":{"type":"string","nullable":true,"description":"The property's name; null when the property is gone."},"legal_entity_id":{"type":"string","format":"uuid","description":"The property's legal entity, which bills the charges."},"kind":{"type":"string","enum":["annual","interim","audit","termination"]},"window_start":{"type":"string","format":"date"},"window_end":{"type":"string","format":"date"},"status":{"type":"string","enum":["draft","computed","approved"],"description":"Derived from the lines: `approved` once every line is approved or nets to zero, `computed` otherwise."},"revision":{"type":"number","description":"Starts at 1; each revise adds 1."},"origin":{"type":"string","enum":["job","manual"]},"notes":{"type":"string","nullable":true},"created_by":{"type":"string","format":"uuid","nullable":true,"description":"Null for the daily job or an API key."},"approved_at":{"type":"string","format":"date-time","nullable":true},"approved_by":{"type":"string","format":"uuid","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"stale_line_count":{"type":"number","description":"Lines marked stale (`stale_at` set): an approved line whose inputs changed since it was computed. Checked daily, and on demand by `POST /v1/percentage-rent/runs/{id}/staleness-check`."},"blocked_line_count":{"type":"number","description":"Lines in `blocked`."}},"required":["id","property_id","property_name","legal_entity_id","kind","window_start","window_end","status","revision","origin","notes","created_by","approved_at","approved_by","created_at","updated_at","stale_line_count","blocked_line_count"]},"PercentageRentAdjustmentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["manual","interest","audit_costs"]},"amount":{"type":"string","example":"1234.50"},"reason":{"type":"string"},"created_by":{"type":"string","format":"uuid","nullable":true},"created_at":{"type":"string","format":"date-time"}},"required":["id","kind","amount","reason","created_by","created_at"]},"PercentageRentLineChargeV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"part":{"type":"string","enum":["rent","interest","costs"],"description":"`rent` (delta + manual adjustments), or an audit line’s `interest` or `costs`."},"amount":{"type":"string","example":"1234.50"},"billed_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The rent invoice that collected it; null while staged."},"settled_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","part","amount","billed_document_id","settled_at"]},"PercentageRentRunLineV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"tenant_name":{"type":"string","nullable":true,"description":"The lease's tenant (its counterparty's name); null when it names none."},"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"measurement_basis":{"type":"string","enum":["lease_year","calendar_year","tenant_fiscal"]},"kind":{"type":"string","enum":["annual","interim","audit","termination"],"description":"The run’s kind. An audit line shares its year’s period."},"is_interim":{"type":"boolean","description":"Same as `kind = interim`."},"config_version_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","held","blocked","approved"],"description":"`pending` (the daily job approves it), `held` (a person approves it), `blocked` (never approves until the cause is fixed), `approved`."},"hold_reasons":{"type":"array","items":{"type":"string","enum":["first_billed_year","charge_swing","sales_swing","estimated_sales","manual_adjustment","credit","audit_finding","over_auto_send_limit","approval_required"]}},"block_reasons":{"type":"array","items":{"type":"string","enum":["missing_sales","unmapped_category","natural_breakpoint_no_base_rent","rule_category_not_in_sales_config","engine_input","earlier_window_unapproved","annual_line_exists","later_line_approved","after_termination"]}},"computation":{"nullable":true,"description":"The engine's computation; null when it could not run.","type":"object","allOf":[{"$ref":"#/components/schemas/PercentageRentResultV1Dto"}]},"inputs_fingerprint":{"type":"string","nullable":true},"gross_amount":{"type":"string","nullable":true,"example":"1234.50"},"previously_billed":{"type":"string","nullable":true,"description":"% rent charges already staged or billed for the measurement year (for a periodic interim: its window), this line excluded.","example":"1234.50"},"delta":{"type":"string","nullable":true,"example":"1234.50"},"charge_amount":{"type":"string","description":"`delta` + Σ `manual` adjustments: the rent charge approval stages. An audit line’s interest and costs stage as their own charges.","example":"1234.50"},"estimated":{"type":"boolean","description":"True when any sales read is an estimate."},"approved_at":{"type":"string","format":"date-time","nullable":true},"approved_by":{"type":"string","format":"uuid","nullable":true},"stale_at":{"type":"string","format":"date-time","nullable":true,"description":"When `stale_reason` was last set; unchanged while the reason stays the same."},"stale_reason":{"type":"string","enum":["terminated","config_changed","actuals_replaced_estimate","sales_restated","base_rent_changed","inputs_changed","recomputed_after_billing","later_line_approved"],"nullable":true,"description":"Why an approved line no longer matches its inputs, one per line in this precedence: `terminated` (the lease ended on or before the period end), `config_changed`, `actuals_replaced_estimate`, `sales_restated`, `base_rent_changed`, `inputs_changed` (a line computed before its inputs were recorded); then `recomputed_after_billing` (a billed line whose numbers moved on the same inputs) and `later_line_approved` (an approved line under a later approved line of the same year in another run). The six named causes clear once the inputs match again."},"blocked_since":{"type":"string","format":"date-time","nullable":true,"description":"When the line entered `blocked`; kept while it stays blocked, null otherwise."},"billed":{"type":"boolean","description":"True when the line’s rent charge is collected (billed on a document or settled): a stale billed line is corrected by an audit run, an unbilled one by revising its run."},"adjustments":{"type":"array","items":{"$ref":"#/components/schemas/PercentageRentAdjustmentV1Dto"}},"charge":{"nullable":true,"description":"The rent charge on the shelf (staged or billed), else null.","type":"object","allOf":[{"$ref":"#/components/schemas/PercentageRentLineChargeV1Dto"}]},"charges":{"description":"Every charge of the line on the shelf: rent, then an audit line’s interest and costs.","type":"array","items":{"$ref":"#/components/schemas/PercentageRentLineChargeV1Dto"}}},"required":["id","contract_id","tenant_name","period_start","period_end","measurement_basis","kind","is_interim","config_version_id","status","hold_reasons","block_reasons","computation","inputs_fingerprint","gross_amount","previously_billed","delta","charge_amount","estimated","approved_at","approved_by","stale_at","stale_reason","blocked_since","billed","adjustments","charge","charges"]},"PercentageRentRunDetailV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid"},"property_name":{"type":"string","nullable":true,"description":"The property's name; null when the property is gone."},"legal_entity_id":{"type":"string","format":"uuid","description":"The property's legal entity, which bills the charges."},"kind":{"type":"string","enum":["annual","interim","audit","termination"]},"window_start":{"type":"string","format":"date"},"window_end":{"type":"string","format":"date"},"status":{"type":"string","enum":["draft","computed","approved"],"description":"Derived from the lines: `approved` once every line is approved or nets to zero, `computed` otherwise."},"revision":{"type":"number","description":"Starts at 1; each revise adds 1."},"origin":{"type":"string","enum":["job","manual"]},"notes":{"type":"string","nullable":true},"created_by":{"type":"string","format":"uuid","nullable":true,"description":"Null for the daily job or an API key."},"approved_at":{"type":"string","format":"date-time","nullable":true},"approved_by":{"type":"string","format":"uuid","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"stale_line_count":{"type":"number","description":"Lines marked stale (`stale_at` set): an approved line whose inputs changed since it was computed. Checked daily, and on demand by `POST /v1/percentage-rent/runs/{id}/staleness-check`."},"blocked_line_count":{"type":"number","description":"Lines in `blocked`."},"lines":{"type":"array","items":{"$ref":"#/components/schemas/PercentageRentRunLineV1Dto"}}},"required":["id","property_id","property_name","legal_entity_id","kind","window_start","window_end","status","revision","origin","notes","created_by","approved_at","approved_by","created_at","updated_at","stale_line_count","blocked_line_count","lines"]},"CreatePercentageRentRunV1Dto":{"type":"object","properties":{"property_id":{"type":"string","format":"uuid","description":"The property to run."},"kind":{"type":"string","enum":["annual","interim","audit","termination"],"description":"`annual` selects measurement years, `interim` the reporting periods of leases billed `cumulative` or `periodic`, `audit` every year ending in the window whose annual (or termination) line is approved: it recomputes the year from the current (restated) sales against what the year already billed, and is always held `audit_finding`; `termination` the truncated final year of every lease whose termination date falls in the window (once that year has closed), billed as the year's true-up against its approved interims."},"window_start":{"type":"string","format":"date","description":"First day of the window the periods closed in."},"window_end":{"type":"string","format":"date","description":"Last day (inclusive) of the window the periods closed in."},"notes":{"type":"string","maxLength":2000,"description":"Free text. Required for an `audit` run: the audit finding (422 `PERCENTAGE_RENT_AUDIT_INVALID` when blank)."}},"required":["property_id","kind","window_start","window_end"]},"CreatePercentageRentAdjustmentV1Dto":{"type":"object","properties":{"kind":{"type":"string","enum":["manual","interest","audit_costs"],"default":"manual","description":"`manual` adds into the line’s rent charge. `interest` and `audit_costs` go on an audit line only, one of each, and stage as their own charges."},"amount":{"type":"string","description":"Signed amount: a `manual` one is added to the line’s rent charge (negative reduces it); `interest` and `audit_costs` are their own charge and must be positive (422 `PERCENTAGE_RENT_ADJUSTMENT_KIND_INVALID`).","example":"1234.50"},"reason":{"type":"string","maxLength":2000,"description":"Why; required."}},"required":["amount","reason"]},"PercentageRentRunApprovalV1Dto":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/PercentageRentRunDetailV1Dto"},"charges_staged":{"type":"number","description":"Charges this call put on the shelf."},"documents_created":{"description":"The separate % rent documents this call created: one per lease whose approved lines bill `separate` (the lease mode, `inherit` taking the org default; termination and audit lines always). Posted, or `pending_approval` when an approval rule holds one. Empty when every charge waits for the next rent invoice.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["run","charges_staged","documents_created"]},"ApprovePercentageRentRunV1Dto":{"type":"object","properties":{"line_ids":{"description":"Approve only these lines. Omitted: every pending and held line. A blocked line named here is 422 `PERCENTAGE_RENT_LINE_NOT_APPROVABLE`.","type":"array","items":{"type":"string","format":"uuid"}}}},"PercentageRentRunInvoiceV1Dto":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/PercentageRentRunDetailV1Dto"},"documents_created":{"description":"The documents this call created, one per lease (none for a lease whose unbilled charges net to zero: they are settled instead).","type":"array","items":{"type":"string","format":"uuid"}}},"required":["run","documents_created"]},"PercentageRentRunEstimateLineV1Dto":{"type":"object","properties":{"line_id":{"type":"string","format":"uuid"},"written":{"description":"Period starts (`period_start` of the expected report) an estimate was written for.","type":"array","items":{"type":"string"}},"impossible":{"description":"Period starts with no history to estimate from; their months stay missing.","type":"array","items":{"type":"string"}},"skipped_draft":{"description":"Period starts with an open draft: nothing was written for them.","type":"array","items":{"type":"string"}}},"required":["line_id","written","impossible","skipped_draft"]},"PercentageRentRunEstimatesV1Dto":{"type":"object","properties":{"lines":{"type":"array","items":{"$ref":"#/components/schemas/PercentageRentRunEstimateLineV1Dto"}},"run":{"$ref":"#/components/schemas/PercentageRentRunDetailV1Dto"}},"required":["lines","run"]},"PutPercentageRentSettingsV1Dto":{"type":"object","properties":{"auto_send":{"type":"string","enum":["always","up_to_limit","never"],"description":"When a computed charge goes out on its own: `always` (every charge not held), `up_to_limit` (charges whose absolute value is at most `auto_send_limit`; larger ones are held `over_auto_send_limit`), `never` (every charge is held `approval_required`)."},"auto_send_limit":{"type":"string","nullable":true,"description":"Required with `up_to_limit`; 0 or more.","example":"1234.50"},"hold_first_billed_year":{"type":"boolean"},"hold_swing":{"type":"boolean"},"swing_pct":{"type":"number","minimum":1,"maximum":1000},"hold_estimated":{"type":"boolean"},"hold_credit":{"type":"boolean"}},"required":["auto_send","hold_first_billed_year","hold_swing","swing_pct","hold_estimated","hold_credit"]},"PercentageRentQueueLineV1Dto":{"type":"object","properties":{"line_id":{"type":"string","format":"uuid"},"run_id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid"},"tenant_name":{"type":"string","nullable":true},"property_id":{"type":"string","format":"uuid"},"property_name":{"type":"string","nullable":true},"unit_label":{"type":"string","nullable":true,"description":"The lease's space on the property (designation or name)."},"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"kind":{"type":"string","enum":["annual","interim","audit","termination"]},"status":{"type":"string","enum":["held","blocked"]},"charge":{"type":"string","description":"The rent charge: delta plus manual adjustments.","example":"1234.50"},"estimated":{"type":"boolean","description":"Computed on estimated sales."},"hold_reasons":{"type":"array","items":{"type":"string","enum":["first_billed_year","charge_swing","sales_swing","estimated_sales","manual_adjustment","credit","audit_finding","over_auto_send_limit","approval_required"]}},"block_reasons":{"type":"array","items":{"type":"string","enum":["missing_sales","unmapped_category","natural_breakpoint_no_base_rent","rule_category_not_in_sales_config","engine_input","earlier_window_unapproved","annual_line_exists","later_line_approved","after_termination"]}}},"required":["line_id","run_id","contract_id","tenant_name","property_id","property_name","unit_label","period_start","period_end","kind","status","charge","estimated","hold_reasons","block_reasons"]},"PctTenantLastReportV1Dto":{"type":"object","properties":{"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"is_annual_statement":{"type":"boolean"},"submitted_at":{"type":"string","format":"date-time","nullable":true},"qualifying_sales":{"type":"string","description":"Qualifying sales of the report.","example":"1234.50"}},"required":["period_start","period_end","is_annual_statement","submitted_at","qualifying_sales"]},"PctTenantNextDueReportV1Dto":{"type":"object","properties":{"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"is_annual_statement":{"type":"boolean"},"due_date":{"type":"string","format":"date"},"status":{"type":"string","enum":["upcoming","due","overdue","estimated"],"description":"`estimated`: only an estimate covers it, the tenant still owes it."},"days_late":{"type":"number"}},"required":["period_start","period_end","is_annual_statement","due_date","status","days_late"]},"PctTenantBreakpointV1Dto":{"type":"object","properties":{"ytd_sales":{"type":"string","description":"Qualifying sales reported this measurement year.","example":"1234.50"},"breakpoint":{"type":"string","description":"The year's lowest breakpoint not yet met (the highest once all are).","example":"1234.50"},"year_start":{"type":"string","format":"date"},"year_end":{"type":"string","format":"date"}},"required":["ytd_sales","breakpoint","year_start","year_end"]},"PctTenantNextBillV1Dto":{"type":"object","properties":{"line_id":{"type":"string","format":"uuid"},"run_id":{"type":"string","format":"uuid"},"amount":{"type":"string","example":"1234.50"},"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"kind":{"type":"string","enum":["annual","interim","audit","termination"]},"status":{"type":"string","enum":["pending","held","blocked","approved"]},"hold_reasons":{"type":"array","items":{"type":"string","enum":["first_billed_year","charge_swing","sales_swing","estimated_sales","manual_adjustment","credit","audit_finding","over_auto_send_limit","approval_required"]}},"block_reasons":{"type":"array","items":{"type":"string","enum":["missing_sales","unmapped_category","natural_breakpoint_no_base_rent","rule_category_not_in_sales_config","engine_input","earlier_window_unapproved","annual_line_exists","later_line_approved","after_termination"]}},"estimated":{"type":"boolean"}},"required":["line_id","run_id","amount","period_start","period_end","kind","status","hold_reasons","block_reasons","estimated"]},"PercentageRentTenantV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid"},"tenant_name":{"type":"string","nullable":true},"contract_name":{"type":"string"},"property_id":{"type":"string","format":"uuid","nullable":true},"property_name":{"type":"string","nullable":true},"unit_label":{"type":"string","nullable":true},"has_pct_config":{"type":"boolean","description":"False: the lease reports sales only."},"status":{"type":"string","enum":["automatic","needs_you","waiting_on_sales","under_breakpoint","sales_only"]},"last_report":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/PctTenantLastReportV1Dto"}]},"next_due_report":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/PctTenantNextDueReportV1Dto"}]},"overdue_report_count":{"type":"number","description":"Reports past due with no actual report (estimates count)."},"breakpoint":{"nullable":true,"description":"Null without a % rent config, or when no breakpoint can be resolved (a natural breakpoint with no base rent).","type":"object","allOf":[{"$ref":"#/components/schemas/PctTenantBreakpointV1Dto"}]},"next_bill":{"nullable":true,"description":"The line that bills next: a held line first, then an approved charge still waiting for its invoice, then a pending line, then a blocked one.","type":"object","allOf":[{"$ref":"#/components/schemas/PctTenantNextBillV1Dto"}]},"next_bill_reason":{"type":"string","enum":["waiting_on_sales","under_breakpoint","no_closed_period"],"nullable":true},"invoice_mode":{"type":"string","enum":["next_rent_invoice","separate"],"nullable":true},"bills_on":{"type":"string","format":"date","nullable":true,"description":"The date of the lease's next rent invoice the charge rides on; null for separate invoicing (bills at approval) or a charge not yet approvable."}},"required":["contract_id","tenant_name","contract_name","property_id","property_name","unit_label","has_pct_config","status","last_report","next_due_report","overdue_report_count","breakpoint","next_bill","next_bill_reason","invoice_mode","bills_on"]},"PercentageRentOverviewV1Dto":{"type":"object","properties":{"held_count":{"type":"number","description":"Lines waiting for approval (`held`)."},"held_amount":{"type":"string","example":"1234.50"},"overdue_report_count":{"type":"number","description":"Sales reports past due with no actual report (a period covered only by an estimate still counts), last 36 months."},"approved_unbilled_amount":{"type":"string","description":"Approved charges not yet on an invoice: they go on the next rent invoices (or bill at approval for separate invoicing).","example":"1234.50"},"billed_this_fiscal_year_amount":{"type":"string","description":"Charges of lines approved this fiscal year that are on an invoice.","example":"1234.50"},"fiscal_year_start":{"type":"string","format":"date"},"auto_send":{"type":"string","enum":["always","up_to_limit","never"],"description":"The org's send mode (`/v1/percentage-rent/settings`)."}},"required":["held_count","held_amount","overdue_report_count","approved_unbilled_amount","billed_this_fiscal_year_amount","fiscal_year_start","auto_send"]},"TicketOwnerV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"owner_user_id":{"type":"string","nullable":true,"format":"uuid"},"owner_party_id":{"type":"string","nullable":true,"format":"uuid"},"owner_name":{"type":"string","nullable":true},"participation_pct":{"type":"number","nullable":true}},"required":["id","owner_user_id","owner_party_id","owner_name","participation_pct"]},"TicketCoordinatorV1Dto":{"type":"object","properties":{"assignment_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","nullable":true,"format":"uuid"},"party_id":{"type":"string","nullable":true,"format":"uuid"},"name":{"type":"string","nullable":true}},"required":["assignment_id","user_id","party_id","name"]},"TicketListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"ticket_number":{"type":"string"},"legacy_ticketid":{"type":"number","nullable":true},"date_received":{"type":"string","nullable":true},"follow_up_date":{"type":"string","nullable":true},"status_code":{"type":"string"},"priority_code":{"type":"string","nullable":true},"ticket_type_code":{"type":"string","nullable":true},"category":{"type":"string","nullable":true},"category_name":{"type":"string","nullable":true},"subject":{"type":"string","nullable":true},"property_id":{"type":"string","nullable":true,"format":"uuid"},"property_name":{"type":"string","nullable":true},"property_city":{"type":"string","nullable":true},"property_state":{"type":"string","nullable":true},"space_id":{"type":"string","nullable":true,"format":"uuid"},"space_name":{"type":"string","nullable":true},"tenant_party_id":{"type":"string","nullable":true,"format":"uuid"},"tenant_name":{"type":"string","nullable":true},"tenant_store":{"type":"string","nullable":true},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"who_pays":{"type":"string","nullable":true},"owners":{"type":"array","items":{"$ref":"#/components/schemas/TicketOwnerV1Dto"}},"coordinator":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/TicketCoordinatorV1Dto"}]},"created_at":{"type":"string","format":"date-time"}},"required":["id","org_id","ticket_number","legacy_ticketid","date_received","follow_up_date","status_code","priority_code","ticket_type_code","category","category_name","subject","property_id","property_name","property_city","property_state","space_id","space_name","tenant_party_id","tenant_name","tenant_store","legal_entity_id","who_pays","owners","coordinator","created_at"]},"TicketMetricsOpenV1Dto":{"type":"object","properties":{"total":{"type":"number"},"new_":{"type":"number","description":"status_code='open'"},"in_progress":{"type":"number"},"on_hold":{"type":"number"}},"required":["total","new_","in_progress","on_hold"]},"TicketMetricsV1Dto":{"type":"object","properties":{"open":{"$ref":"#/components/schemas/TicketMetricsOpenV1Dto"},"unassigned":{"type":"number"},"past_due":{"type":"number"},"due_in_7":{"type":"number"}},"required":["open","unassigned","past_due","due_in_7"]},"TicketV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"ticket_number":{"type":"string"},"legacy_ticketid":{"type":"number","nullable":true},"date_received":{"type":"string","nullable":true},"follow_up_date":{"type":"string","nullable":true},"status_code":{"type":"string"},"priority_code":{"type":"string","nullable":true},"ticket_type_code":{"type":"string","nullable":true},"category":{"type":"string","nullable":true},"category_name":{"type":"string","nullable":true},"subject":{"type":"string","nullable":true},"property_id":{"type":"string","nullable":true,"format":"uuid"},"property_name":{"type":"string","nullable":true},"property_city":{"type":"string","nullable":true},"property_state":{"type":"string","nullable":true},"space_id":{"type":"string","nullable":true,"format":"uuid"},"space_name":{"type":"string","nullable":true},"tenant_party_id":{"type":"string","nullable":true,"format":"uuid"},"tenant_name":{"type":"string","nullable":true},"tenant_store":{"type":"string","nullable":true},"legal_entity_id":{"type":"string","nullable":true,"format":"uuid"},"who_pays":{"type":"string","nullable":true},"owners":{"type":"array","items":{"$ref":"#/components/schemas/TicketOwnerV1Dto"}},"coordinator":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/TicketCoordinatorV1Dto"}]},"created_at":{"type":"string","format":"date-time"},"description":{"type":"string","nullable":true},"communication_channel_code":{"type":"string","nullable":true},"reported_by":{"type":"string","nullable":true},"contact_name":{"type":"string","nullable":true},"contact_email":{"type":"string","nullable":true},"contact_phone":{"type":"string","nullable":true},"service_name":{"type":"string","nullable":true},"issue_type_name":{"type":"string","nullable":true},"is_repair":{"type":"boolean","nullable":true},"anticipated_completion_date":{"type":"string","nullable":true},"date_closed":{"type":"string","nullable":true},"resolved_at":{"type":"string","nullable":true},"lease_responsibility":{"type":"string","nullable":true},"warranty_status":{"type":"string","nullable":true},"warranty_note":{"type":"string","nullable":true},"credit_status":{"type":"string","nullable":true},"resolution":{"type":"string","nullable":true},"legal_entity_name":{"type":"string","nullable":true},"notify_reporter":{"type":"boolean"},"tracks_count":{"type":"number"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","org_id","ticket_number","legacy_ticketid","date_received","follow_up_date","status_code","priority_code","ticket_type_code","category","category_name","subject","property_id","property_name","property_city","property_state","space_id","space_name","tenant_party_id","tenant_name","tenant_store","legal_entity_id","who_pays","owners","coordinator","created_at","description","communication_channel_code","reported_by","contact_name","contact_email","contact_phone","service_name","issue_type_name","is_repair","anticipated_completion_date","date_closed","resolved_at","lease_responsibility","warranty_status","warranty_note","credit_status","resolution","legal_entity_name","notify_reporter","tracks_count","updated_at"]},"CreateTicketOwnerV1Dto":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"},"participation_pct":{"type":"number","minimum":0,"maximum":100}}},"TicketCoordinatorInputV1Dto":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"}}},"CreateTicketV1Dto":{"type":"object","properties":{"subject":{"type":"string","maxLength":500},"description":{"type":"string","maxLength":20000},"ticket_type_code":{"type":"string","maxLength":64},"category":{"type":"string","maxLength":128},"priority_code":{"type":"string","maxLength":64},"communication_channel_code":{"type":"string","maxLength":64},"date_received":{"type":"string"},"follow_up_date":{"type":"string"},"anticipated_completion_date":{"type":"string"},"reported_by":{"type":"string","maxLength":200},"contact_name":{"type":"string","maxLength":200},"contact_email":{"type":"string","maxLength":320},"contact_phone":{"type":"string","maxLength":64},"service_name":{"type":"string","maxLength":256},"issue_type_name":{"type":"string","maxLength":256},"is_repair":{"type":"boolean"},"property_id":{"type":"string","format":"uuid"},"space_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"tenant_party_id":{"type":"string","format":"uuid"},"tenant_store":{"type":"string","maxLength":128},"who_pays":{"type":"string","maxLength":128},"lease_responsibility":{"type":"string","maxLength":128},"warranty_status":{"type":"string","maxLength":128},"warranty_note":{"type":"string","maxLength":500},"credit_status":{"type":"string","maxLength":128},"notify_reporter":{"type":"boolean"},"owners":{"type":"array","items":{"$ref":"#/components/schemas/CreateTicketOwnerV1Dto"}},"coordinator":{"$ref":"#/components/schemas/TicketCoordinatorInputV1Dto"}}},"UpdateTicketV1Dto":{"type":"object","properties":{"subject":{"type":"string","maxLength":500},"description":{"type":"string","maxLength":20000},"ticket_type_code":{"type":"string","maxLength":64},"category":{"type":"string","maxLength":128},"priority_code":{"type":"string","maxLength":64},"communication_channel_code":{"type":"string","maxLength":64},"date_received":{"type":"string"},"follow_up_date":{"type":"string"},"anticipated_completion_date":{"type":"string"},"reported_by":{"type":"string","maxLength":200},"contact_name":{"type":"string","maxLength":200},"contact_email":{"type":"string","maxLength":320},"contact_phone":{"type":"string","maxLength":64},"service_name":{"type":"string","maxLength":256},"issue_type_name":{"type":"string","maxLength":256},"is_repair":{"type":"boolean"},"property_id":{"type":"string","format":"uuid"},"space_id":{"type":"string","format":"uuid"},"legal_entity_id":{"type":"string","format":"uuid"},"tenant_party_id":{"type":"string","format":"uuid"},"tenant_store":{"type":"string","maxLength":128},"who_pays":{"type":"string","maxLength":128},"lease_responsibility":{"type":"string","maxLength":128},"warranty_status":{"type":"string","maxLength":128},"warranty_note":{"type":"string","maxLength":500},"credit_status":{"type":"string","maxLength":128},"notify_reporter":{"type":"boolean"},"status_code":{"type":"string","maxLength":64},"resolution":{"type":"string","maxLength":20000},"date_closed":{"type":"string"},"owners":{"description":"When provided, replaces the ticket owners wholesale (like contract terms). Omit to leave owners unchanged; send [] to clear.","type":"array","items":{"$ref":"#/components/schemas/CreateTicketOwnerV1Dto"}}}},"TrackPerformerV1Dto":{"type":"object","properties":{"assignment_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","nullable":true,"format":"uuid"},"party_id":{"type":"string","nullable":true,"format":"uuid"},"name":{"type":"string","nullable":true}},"required":["assignment_id","user_id","party_id","name"]},"TrackListItemV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"ticket_id":{"type":"string","format":"uuid"},"track_number":{"type":"number"},"label":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"track_type_code":{"type":"string"},"status_code":{"type":"string"},"follow_up_date":{"type":"string","nullable":true},"due_date":{"type":"string","nullable":true},"is_default_track":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"performer":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/TrackPerformerV1Dto"}]},"attachments_count":{"type":"number","description":"Number of attachments on this track's own scope."},"first_image_attachment_id":{"type":"string","nullable":true,"format":"uuid","description":"Id of the earliest-uploaded image attachment (content_type image/png, image/jpeg, or image/webp) on this track's own scope, or null if none."}},"required":["id","org_id","ticket_id","track_number","label","title","track_type_code","status_code","follow_up_date","due_date","is_default_track","created_at","performer","attachments_count","first_image_attachment_id"]},"TrackV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"ticket_id":{"type":"string","format":"uuid"},"track_number":{"type":"number"},"label":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"track_type_code":{"type":"string"},"status_code":{"type":"string"},"follow_up_date":{"type":"string","nullable":true},"due_date":{"type":"string","nullable":true},"is_default_track":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"performer":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/TrackPerformerV1Dto"}]},"attachments_count":{"type":"number","description":"Number of attachments on this track's own scope."},"first_image_attachment_id":{"type":"string","nullable":true,"format":"uuid","description":"Id of the earliest-uploaded image attachment (content_type image/png, image/jpeg, or image/webp) on this track's own scope, or null if none."}},"required":["id","org_id","ticket_id","track_number","label","title","track_type_code","status_code","follow_up_date","due_date","is_default_track","created_at","performer","attachments_count","first_image_attachment_id"]},"CreateTrackV1Dto":{"type":"object","properties":{"ticket_id":{"type":"string","format":"uuid"},"label":{"type":"string","maxLength":200},"title":{"type":"string","maxLength":500},"track_type_code":{"type":"string","maxLength":64},"status_code":{"type":"string","maxLength":64},"follow_up_date":{"type":"string"},"due_date":{"type":"string"}},"required":["ticket_id"]},"UpdateTrackV1Dto":{"type":"object","properties":{"label":{"type":"string","maxLength":200},"title":{"type":"string","maxLength":500},"track_type_code":{"type":"string","maxLength":64},"status_code":{"type":"string","maxLength":64},"follow_up_date":{"type":"string"},"due_date":{"type":"string"}}},"TicketAssignmentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"scope":{"type":"string","enum":["ticket","track"]},"scope_id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["owner_coordinator","performer"]},"assignee_user_id":{"type":"string","nullable":true,"format":"uuid"},"assignee_party_id":{"type":"string","nullable":true,"format":"uuid"},"assignee_name":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"}},"required":["id","org_id","scope","scope_id","role","assignee_user_id","assignee_party_id","assignee_name","created_at"]},"CreateTicketAssignmentV1Dto":{"type":"object","properties":{"scope":{"type":"string","enum":["ticket","track"]},"scope_id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["owner_coordinator","performer"]},"user_id":{"type":"string","format":"uuid","description":"Internal employee assignee. Provide exactly one of user_id or party_id."},"party_id":{"type":"string","format":"uuid","description":"Vendor/party assignee. Provide exactly one of user_id or party_id."}},"required":["scope","scope_id","role"]},"TicketNoteReplyToV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"author_kind":{"type":"string","enum":["internal","reporter"]},"body_preview":{"type":"string","description":"Truncated body of the quoted note."},"external_author_email":{"type":"string","nullable":true}},"required":["id","author_kind","body_preview","external_author_email"]},"TicketNoteV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"scope":{"type":"string","enum":["ticket","track"]},"scope_id":{"type":"string","format":"uuid"},"author_user_id":{"type":"string","nullable":true,"format":"uuid"},"subject":{"type":"string","nullable":true},"body":{"type":"string"},"note_type":{"type":"string"},"status_note":{"type":"string","nullable":true},"visibility":{"type":"string","enum":["private","public"]},"author_kind":{"type":"string","enum":["internal","reporter"]},"external_author_email":{"type":"string","nullable":true},"reply_to_note_id":{"type":"string","nullable":true,"format":"uuid","description":"The note this one replies to, or null."},"reply_to":{"nullable":true,"description":"Snapshot of the replied-to note for a quoted preview, or null.","type":"object","allOf":[{"$ref":"#/components/schemas/TicketNoteReplyToV1Dto"}]},"posted_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"}},"required":["id","org_id","scope","scope_id","author_user_id","subject","body","note_type","status_note","visibility","author_kind","external_author_email","reply_to_note_id","reply_to","posted_at","created_at"]},"TicketAttachmentV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"scope":{"type":"string","enum":["ticket","track"]},"scope_id":{"type":"string","format":"uuid"},"note_id":{"type":"string","nullable":true,"format":"uuid"},"file_name":{"type":"string"},"content_type":{"type":"string","enum":["application/pdf","image/png","image/jpeg","image/webp"]},"file_size_bytes":{"type":"number"},"uploaded_by":{"type":"string","nullable":true,"format":"uuid"},"uploaded_at":{"type":"string","format":"date-time"}},"required":["id","org_id","scope","scope_id","note_id","file_name","content_type","file_size_bytes","uploaded_by","uploaded_at"]},"TicketAttachmentDownloadUrlV1Dto":{"type":"object","properties":{"url":{"type":"string"},"expires_at":{"type":"string","format":"date-time"}},"required":["url","expires_at"]},"TicketAssigneeV1Dto":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"display_name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true}},"required":["user_id","display_name","email"]},"TicketLookupV1Dto":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"sort_order":{"type":"number"},"is_default":{"type":"boolean"}},"required":["code","name","sort_order"]},"PingResponseDto":{"type":"object","properties":{"ok":{"type":"boolean","example":true}},"required":["ok"]},"AuthedPingResponseDto":{"type":"object","properties":{"principal_kind":{"type":"string","example":"user","enum":["user","api_key"]},"principal_id":{"type":"string","example":"2b0a1f7c-3e2d-4f5e-a1b2-c3d4e5f6a7b8"}},"required":["principal_kind","principal_id"]},"CreateApiKeyResponseDto":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"kind":{"type":"string","enum":["standard","sparkiq_internal"]},"scopes":{"type":"array","items":{"type":"string"}},"legal_entity_id":{"type":"string","nullable":true},"rate_limit_tier":{"type":"string","enum":["default","elevated"]},"plan_only":{"type":"boolean","description":"Plan-only: reads and /v1/plans only; writes go through plans."},"expires_at":{"type":"string","nullable":true},"revoked_at":{"type":"string","nullable":true},"last_used_at":{"type":"string","nullable":true},"created_by":{"type":"string"},"created_at":{"type":"string"},"secret":{"type":"string","description":"The one-time full secret token. Shown ONCE at creation (or rotation); never returned again."}},"required":["id","name","prefix","kind","scopes","legal_entity_id","rate_limit_tier","plan_only","expires_at","revoked_at","last_used_at","created_by","created_at","secret"]},"CreateApiKeyDto":{"type":"object","properties":{"name":{"type":"string","description":"Human-readable label for this key."},"scopes":{"type":"array","items":{"type":"string","enum":["documents:read","documents:write","documents:approve","approvals:read","approvals:configure","accounting:read","accounting:write","accounting:periods_override","auth:read","banking:read","banking:write","parties:read","parties:write","contracts:read","contracts:write","billing-schedules:read","billing-schedules:write","intercompany:read","intercompany:write","items:read","items:write","tax-rates:read","tax-rates:write","legal-entities:read","legal-entities:write","loans:read","loans:write","loans:activate","loans:rates","org:read","org:write","ownership:read","ownership:write","distributions:read","distributions:write","equity:read","equity:write","properties:read","properties:write","deals:read","deals:write","deals:close","deals:admin","statistics:read","statistics:write","dimensions:read","dimensions:write","expense-recovery:read","expense-recovery:write","sales:read","sales:write","percentage-rent:read","percentage-rent:write","fixed-assets:read","fixed-assets:write","budgets:read","budgets:write","accounts-payable:read","accounts-payable:write","user-preferences:read","user-preferences:write","notifications:read","notifications:write","profile:write","payment-runs:read","payment-runs:write","property-taxes:read","property-taxes:write","insurance:read","insurance:write","tickets:read","tickets:write","work-items:read","work-items:write","payments:read","payments:write","portal:manage","reports:read","reports:write","search:read","plans:preview","plans:commit","plans:release","admin:keys","admin:users","admin:impersonate","admin:billing-schedules","admin:loans","admin:audit","files:delete","documents:delete","attention:dismiss_permanent","attention:manage","admin:*","admin:roles"]}},"legal_entity_id":{"type":"string","description":"Bind the key to a single legal entity (hard refusal on cross-LE access)."},"expires_at":{"type":"string","description":"ISO-8601 timestamp after which the key stops authenticating."},"kind":{"type":"string","enum":["standard","sparkiq_internal"],"default":"standard"},"rate_limit_tier":{"type":"string","enum":["default","elevated"],"default":"default"},"plan_only":{"type":"boolean","default":false,"description":"A plan-only key can read (GET) and call /v1/plans, but cannot write directly: its writes must be steps of a plan (preview, then commit)."}},"required":["name","scopes"]},"ApiKeyResponseDto":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"kind":{"type":"string","enum":["standard","sparkiq_internal"]},"scopes":{"type":"array","items":{"type":"string"}},"legal_entity_id":{"type":"string","nullable":true},"rate_limit_tier":{"type":"string","enum":["default","elevated"]},"plan_only":{"type":"boolean","description":"Plan-only: reads and /v1/plans only; writes go through plans."},"expires_at":{"type":"string","nullable":true},"revoked_at":{"type":"string","nullable":true},"last_used_at":{"type":"string","nullable":true},"created_by":{"type":"string"},"created_at":{"type":"string"}},"required":["id","name","prefix","kind","scopes","legal_entity_id","rate_limit_tier","plan_only","expires_at","revoked_at","last_used_at","created_by","created_at"]},"ApiKeyUsageResponseDto":{"type":"object","properties":{"requests_24h":{"type":"number","description":"Sum over today + yesterday"},"requests_30d":{"type":"number","description":"Sum over the last 30 days"},"last_used_at":{"type":"string","nullable":true,"description":"ISO8601"}},"required":["requests_24h","requests_30d","last_used_at"]},"UpdateApiKeyDto":{"type":"object","properties":{"name":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["documents:read","documents:write","documents:approve","approvals:read","approvals:configure","accounting:read","accounting:write","accounting:periods_override","auth:read","banking:read","banking:write","parties:read","parties:write","contracts:read","contracts:write","billing-schedules:read","billing-schedules:write","intercompany:read","intercompany:write","items:read","items:write","tax-rates:read","tax-rates:write","legal-entities:read","legal-entities:write","loans:read","loans:write","loans:activate","loans:rates","org:read","org:write","ownership:read","ownership:write","distributions:read","distributions:write","equity:read","equity:write","properties:read","properties:write","deals:read","deals:write","deals:close","deals:admin","statistics:read","statistics:write","dimensions:read","dimensions:write","expense-recovery:read","expense-recovery:write","sales:read","sales:write","percentage-rent:read","percentage-rent:write","fixed-assets:read","fixed-assets:write","budgets:read","budgets:write","accounts-payable:read","accounts-payable:write","user-preferences:read","user-preferences:write","notifications:read","notifications:write","profile:write","payment-runs:read","payment-runs:write","property-taxes:read","property-taxes:write","insurance:read","insurance:write","tickets:read","tickets:write","work-items:read","work-items:write","payments:read","payments:write","portal:manage","reports:read","reports:write","search:read","plans:preview","plans:commit","plans:release","admin:keys","admin:users","admin:impersonate","admin:billing-schedules","admin:loans","admin:audit","files:delete","documents:delete","attention:dismiss_permanent","attention:manage","admin:*","admin:roles"]}},"expires_at":{"type":"string"},"rate_limit_tier":{"type":"string","enum":["default","elevated"]},"plan_only":{"type":"boolean","description":"Make the key plan-only (reads and /v1/plans only; writes go through plans) or lift that."}}},"CreateImpersonationResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"impersonation_issued_by":{"type":"string","format":"uuid","nullable":true},"impersonation_reason":{"type":"string","nullable":true},"expires_at":{"type":"string","nullable":true},"revoked_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"secret":{"type":"string","description":"The bearer secret. Shown exactly once."}},"required":["id","org_id","name","prefix","scopes","impersonation_issued_by","impersonation_reason","expires_at","revoked_at","created_at","secret"]},"CreateImpersonationDto":{"type":"object","properties":{"target_org_id":{"type":"string","format":"uuid"},"scopes":{"description":"Defaults to read-only bundle","type":"array","items":{"type":"string"}},"ttl_minutes":{"type":"number","minimum":1,"maximum":60,"default":60},"reason":{"type":"string","minLength":3,"maxLength":200}},"required":["target_org_id","reason"]},"ImpersonationResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"impersonation_issued_by":{"type":"string","format":"uuid","nullable":true},"impersonation_reason":{"type":"string","nullable":true},"expires_at":{"type":"string","nullable":true},"revoked_at":{"type":"string","nullable":true},"created_at":{"type":"string"}},"required":["id","org_id","name","prefix","scopes","impersonation_issued_by","impersonation_reason","expires_at","revoked_at","created_at"]},"TrueUpV1Dto":{"type":"object","properties":{"amount":{"type":"string","description":"The signed retro delta staged as a charge. Positive is owed by the tenant, negative is a credit. \"0.00\" with target_count 0 means nothing was billed at the pre-reset rent and no charge was staged.","example":"180.00"},"target_count":{"type":"number","description":"How many already-billed periods the delta covers.","example":1},"charge_id":{"type":"string","format":"uuid","nullable":true,"description":"The staged charges row, or null when the delta is zero."}},"required":["amount","target_count","charge_id"]},"EscalationEventV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contract_term_id":{"type":"string","format":"uuid"},"config_id":{"type":"string","format":"uuid"},"reset_date":{"type":"string","format":"date","example":"2026-03-15","description":"The date the escalation takes economic effect."},"status":{"type":"string","enum":["awaiting_index","proposed","accepted","overridden","superseded","cancelled"]},"proposed_factor_num":{"type":"string","nullable":true,"description":"Numerator of the factor the sweep computed. Exact."},"proposed_factor_den":{"type":"string","nullable":true},"accepted_factor_num":{"type":"string","nullable":true,"description":"Numerator of the factor actually decided — the proposed one on accept, the human figure on override. Always this ONE period's factor, never a cumulative one. Exact."},"accepted_factor_den":{"type":"string","nullable":true},"prior_amount":{"type":"string","nullable":true,"description":"The settled rent in force before this reset: the last settled event's resulting amount, else the term base. prior_rent compounding multiplies it; original_base (simple escalation) multiplies the term base by 1 + the sum of every settled year's growth and this one's.","example":"1234.50"},"resulting_amount":{"type":"string","nullable":true,"description":"The rent after the accepted factor, computed once at decision time. Resolution reads this rather than re-multiplying the factor.","example":"1234.50"},"bound_hit":{"type":"string","nullable":true,"enum":["floor","cap","ratchet","none"],"description":"Which bound clamped the computed factor, if any."},"bank_balance_before_bp":{"type":"number","nullable":true,"description":"Carryover bank before this reset, in basis points."},"bank_balance_after_bp":{"type":"number","nullable":true},"override_reason":{"type":"string","nullable":true,"description":"Why the computed factor was replaced. Set only on override."},"accepted_by":{"type":"string","format":"uuid","nullable":true},"accepted_at":{"type":"string","format":"date-time","nullable":true,"description":"Decision time — the axis resolution reads to decide what was known when. Set by the server, never by the caller."},"true_up":{"description":"What the decision staged, or explicitly did not stage.","allOf":[{"$ref":"#/components/schemas/TrueUpV1Dto"}]}},"required":["id","contract_term_id","config_id","reset_date","status","proposed_factor_num","proposed_factor_den","accepted_factor_num","accepted_factor_den","prior_amount","resulting_amount","bound_hit","bank_balance_before_bp","bank_balance_after_bp","override_reason","accepted_by","accepted_at","true_up"]},"AcceptEscalationV1Dto":{"type":"object","properties":{"expected_factor_num":{"type":"string","description":"Numerator of the factor the reviewer was shown — echo `proposed_factor_num` from the event as read. Send with `expected_factor_den`. A mismatch refuses with ESCALATION_INPUTS_STALE.","example":"519"},"expected_factor_den":{"type":"string","description":"Denominator of the factor the reviewer was shown — echo `proposed_factor_den`. Send with `expected_factor_num`.","example":"500"}}},"OverrideEscalationV1Dto":{"type":"object","properties":{"effective_bp":{"type":"number","description":"The escalation the parties agreed, in BASIS POINTS (3.7% is 370). May be negative for a downward override. Converted to the exact rational the event stores, so an overridden 3.7% and a configured 3.7% are byte-identical in the columns. Send exactly one of this or `resulting_amount`.","example":370},"resulting_amount":{"type":"string","description":"The concluded new rent, instead of `effective_bp` (exactly one of the two). Stored exactly; the factor is derived from it. Not rounded by the clause.","example":"10380.50"},"reason":{"type":"string","description":"Why the computed factor was replaced. Required and must be non-empty — a database CHECK enforces btrim(...) <> '', because NOT NULL alone accepts an empty string.","example":"negotiated at 3.7% per the side letter"}},"required":["reason"]},"ReverseEscalationV1Dto":{"type":"object","properties":{"reason":{"type":"string","description":"Why the decision is being undone. Recorded on the event, which keeps its decision columns — a reversal is history, not an erasure.","example":"accepted against the wrong lookback month"}},"required":["reason"]},"StagedChargeV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"amount":{"type":"string","description":"Signed. Positive is owed by the tenant, negative is a credit.","example":"370.00"},"billed_document_id":{"type":"string","format":"uuid","nullable":true,"description":"The document billing collected this charge onto, or null while it is still on the shelf. NON-NULL MEANS THE DECISION CAN NO LONGER BE REVERSED. On a recovery statement, void it, then reverse; on a rent invoice, correct it with a credit memo (voiding a rent invoice reissues it with the charge)."},"settled_at":{"type":"string","format":"date-time","nullable":true,"description":"When the charge settled, or null."}},"required":["id","amount","billed_document_id","settled_at"]},"ContractEscalationEventV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contract_id":{"type":"string","format":"uuid","description":"The contract (lease) this event's term belongs to."},"contract_term_id":{"type":"string","format":"uuid"},"config_id":{"type":"string","format":"uuid","description":"The clause version this event was computed against."},"reset_date":{"type":"string","format":"date","description":"The day the reset takes economic effect."},"status":{"type":"string","enum":["awaiting_index","proposed","accepted","overridden","superseded","cancelled"],"description":"Lifecycle. `awaiting_index` is due but unpublished; `proposed` awaits review; `accepted`/`overridden` are decided; `superseded` is what a reversal leaves behind; `cancelled` never applied."},"proposed_factor_num":{"type":"string","nullable":true,"description":"Numerator of the proposed factor, as a STRING. An exact ratio of two published readings has no decimal image, and the value passes 2^53 once compounded — parsing it as a number stops it reproducing the amount (U4-D2)."},"proposed_factor_den":{"type":"string","nullable":true},"accepted_factor_num":{"type":"string","nullable":true,"description":"Numerator of the factor actually decided. Same string rule."},"accepted_factor_den":{"type":"string","nullable":true},"prior_amount":{"type":"string","nullable":true,"description":"The settled rent in force before this reset (the last settled event's resulting amount, else the term base).","example":"10000.00"},"resulting_amount":{"type":"string","nullable":true,"description":"The rent the decided factor produced.","example":"10370.00"},"bound_hit":{"type":"string","nullable":true,"enum":["floor","cap","ratchet","none"],"description":"Which bound bound the result, so a reviewer can see WHY the factor is what it is rather than what the index alone would give."},"bank_balance_before_bp":{"type":"number","nullable":true,"description":"Carryover bank before this reset, in basis points (ESC-5)."},"bank_balance_after_bp":{"type":"number","nullable":true,"description":"Carryover bank after it. Both sides are recorded because a bank draw consumed while the ratchet clamps the year to zero silently destroys banked excess."},"override_reason":{"type":"string","nullable":true,"description":"Why the computed factor was replaced. Non-empty when set."},"accepted_by":{"type":"string","format":"uuid","nullable":true},"accepted_at":{"type":"string","format":"date-time","nullable":true},"staged_charge":{"nullable":true,"description":"The retro catch-up charge this decision staged, or null when none is staged — a pending event, or a decision whose delta was zero. The live retro figure for a PENDING event is a different thing and comes from `GET /v1/escalations/{id}/true-up-preview`.","type":"object","allOf":[{"$ref":"#/components/schemas/StagedChargeV1Dto"}]}},"required":["id","contract_id","contract_term_id","config_id","reset_date","status","proposed_factor_num","proposed_factor_den","accepted_factor_num","accepted_factor_den","prior_amount","resulting_amount","bound_hit","bank_balance_before_bp","bank_balance_after_bp","override_reason","accepted_by","accepted_at","staged_charge"]},"EscalationBreakdownComponentV1Dto":{"type":"object","properties":{"index":{"type":"number"},"kind":{"type":"string","enum":["cpi_change","fixed_percent"]},"growth_bp":{"type":"number","description":"This leg's growth in basis points (380 = 3.80%), half away from zero."},"fixed_bp":{"type":"number","nullable":true},"series_label":{"type":"string","nullable":true},"reference_month":{"type":"string","format":"date","nullable":true,"description":"The month the lookback landed on."},"current_value":{"type":"string","nullable":true,"description":"numeric(12,5) index level, as a string."},"baseline_month":{"type":"string","format":"date","nullable":true},"baseline_value":{"type":"string","nullable":true},"published_at":{"type":"string","format":"date-time","nullable":true,"description":"When the reading was fetched."}},"required":["index","kind","growth_bp","fixed_bp","series_label","reference_month","current_value","baseline_month","baseline_value","published_at"]},"EscalationBreakdownV1Dto":{"type":"object","properties":{"operator":{"type":"string"},"components":{"type":"array","items":{"$ref":"#/components/schemas/EscalationBreakdownComponentV1Dto"}},"winning_component_index":{"type":"number"},"floor_bp":{"type":"number","nullable":true},"cap_bp":{"type":"number","nullable":true},"bound_hit":{"type":"string","nullable":true,"enum":["floor","cap","ratchet","none"]}},"required":["operator","components","winning_component_index","floor_bp","cap_bp","bound_hit"]},"TrueUpTargetV1Dto":{"type":"object","properties":{"date":{"type":"string","format":"date","description":"The invoice date the period carried."},"period_start":{"type":"string","format":"date"},"period_end":{"type":"string","format":"date"},"proration_factor":{"type":"number","description":"1 for a full period; a fraction for a stub.","example":1},"invoiced":{"type":"boolean","description":"True when a posted invoice exists for this period and `prior_amount` is what it billed. False for a period dated before the reset that is not invoiced yet: it will bill the prior rent in full when generated, so `prior_amount` is that assumed amount and the post-reset days are trued up here."},"billed_nothing":{"type":"boolean","description":"True when the posted invoice billed nothing for this term (an abated period): the row is shown with no adjustment, because the same abatement applies at the new rent."},"prior_amount":{"type":"string","description":"What this period's posted invoice actually billed for the term — the holdover amount, if the period was invoiced during holdover. When `invoiced` is false, the prior rent the invoice will bill.","example":"1234.50"},"resulting_amount":{"type":"string","description":"What the period should have billed: the billed amount plus this reset's correction for its OWN days — the days of the period inside [reset, next reset). Days before the reset, or from the next reset on, keep what was billed.","example":"1234.50"},"delta":{"type":"string","description":"The signed difference for this period.","example":"1234.50"}},"required":["date","period_start","period_end","proration_factor","invoiced","billed_nothing","prior_amount","resulting_amount","delta"]},"TrueUpPreviewV1Dto":{"type":"object","properties":{"prior_amount":{"type":"string","description":"The settled pre-reset rent recorded on the decision (the last settled event's resulting amount, else the term base). The true-up does not read it: it nets against what was invoiced.","example":"1234.50"},"resulting_amount":{"type":"string","description":"The rent the accepted factor produces.","example":"1234.50"},"amount":{"type":"string","description":"The signed total that would stage as a charge. \"0.00\" means nothing would be staged.","example":"1234.50"},"targets":{"description":"One row per period already INVOICED (posted) whose billed days reach the reset, before the next live reset, so a reviewer can see where the total comes from — plus, marked `invoiced: false`, a period dated before the reset that is not invoiced yet (it will bill the prior rent). Any other period not yet invoiced is absent: it will bill the new rent when generated.","type":"array","items":{"$ref":"#/components/schemas/TrueUpTargetV1Dto"}}},"required":["prior_amount","resulting_amount","amount","targets"]},"EscalationPreviewRefusalV1Dto":{"type":"object","properties":{"code":{"type":"string","description":"The error code the preview (and accept) would return."},"detail":{"type":"string"},"context":{"type":"object","additionalProperties":true,"description":"The refusing AppError's serializeContext(), when it carries one — e.g. ESCALATION_EARLIER_RESET_UNDECIDED's earlierResetDate and earlierStatus. Shape is caller-defined per error code; omitted when the error carries no structured context."}},"required":["code","detail"]},"EscalationBillingV1Dto":{"type":"object","properties":{"billed_document_id":{"type":"string","format":"uuid","nullable":true},"billed_document_number":{"type":"string","nullable":true},"next_invoice_date":{"type":"string","format":"date","nullable":true,"description":"While the charge is unbilled: the date of the next rent invoice the lease will generate, which is expected to carry the charge. It may instead bill through \"Prepare statements\": a charge staged with no contract term (before migration 0305), a credit larger than the invoice it would ride on, or a taxed term while the tax-gate defect stands. This date does not detect those cases. Null once billed or settled, or when the lease has no pending rent invoice."}},"required":["billed_document_id","billed_document_number","next_invoice_date"]},"EscalationDetailV1Dto":{"type":"object","properties":{"contract_id":{"type":"string","format":"uuid","description":"The contract (lease) the event's term belongs to."},"event":{"$ref":"#/components/schemas/ContractEscalationEventV1Dto"},"breakdown":{"nullable":true,"description":"Null while awaiting an index (nothing computed yet).","type":"object","allOf":[{"$ref":"#/components/schemas/EscalationBreakdownV1Dto"}]},"preview":{"nullable":true,"description":"For a proposed event only.","type":"object","allOf":[{"$ref":"#/components/schemas/TrueUpPreviewV1Dto"}]},"preview_refusal":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/EscalationPreviewRefusalV1Dto"}]},"billing":{"nullable":true,"description":"Null when no charge was staged.","type":"object","allOf":[{"$ref":"#/components/schemas/EscalationBillingV1Dto"}]}},"required":["contract_id","event","breakdown","preview","preview_refusal","billing"]},"EscalationConfigV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"term_id":{"type":"string","format":"uuid"},"series_id":{"type":"string","format":"uuid","description":"The index catalog row's UUID (reference_rate_series.id), never the publisher's series string such as CUUR0000SA0."},"series_display_name":{"type":"string","nullable":true,"description":"The catalog's human-readable name for `series_id`, e.g. \"CPI-U, All Items, U.S. City Average (NSA)\". Null when the catalog row no longer exists — the clause is still valid; only the label is gone. Display only: never send it back on a write."},"effective_start":{"type":"string","format":"date","description":"First day this clause governs."},"effective_end_inclusive":{"type":"string","format":"date","nullable":true,"description":"Last day this clause governs, INCLUSIVE. Null means open-ended."},"operator":{"type":"string","enum":["single","max","min","clamp"],"description":"How the components combine. \"single\" takes one; \"max\"/\"min\" take two or more (\"greater of CPI or 2%\"); \"clamp\" needs both bounds."},"components":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"The component union, caller-defined per kind: `cpi_change` takes `lookbackMonths` and `comparison`; `fixed_percent` takes `valueBp`. At least one component must be a `cpi_change` — a clause made only of fixed percentages is a plain percentage escalation on the term itself."},"floor_bp":{"type":"number","nullable":true,"description":"Minimum escalation in basis points, or null for none."},"cap_bp":{"type":"number","nullable":true,"description":"Maximum escalation in basis points, or null for none."},"carryover_bank":{"type":"boolean","description":"Whether excess above the cap banks for a later year with headroom."},"ratchet":{"type":"boolean","description":"Whether rent may never fall, regardless of the index."},"compounding":{"type":"string","enum":["prior_rent","original_base"],"description":"What the factor multiplies: the previous settled rent, or the term base the lease started at."},"reset_schedule":{"type":"string","enum":["anniversary","fixed_date","custom"]},"reset_frequency":{"type":"string","enum":["annual","semiannual","quarterly","monthly"]},"reset_anchor_date":{"type":"string","format":"date","nullable":true,"description":"The anchor a fixed-date schedule resets on."},"reset_at_term_start":{"type":"boolean","default":false,"description":"Option periods only: the term's own start date is a reset too, growing from what the lease billed the day before the period started."},"stub_policy":{"type":"string","enum":["full","prorated","skip"],"description":"How a partial first period is treated."},"rounding":{"type":"string","enum":["cents","whole_dollar","psf_nearest_cent"]},"applies_to":{"type":"string","enum":["amount","amount_psf"],"description":"What the factor applies to. `amount_psf` may be configured and proposed, but a decision on one is refused until per-square-foot support ships."},"holdover_policy":{"type":"string","enum":["floor","prior_rate","stated_amount"]},"holdover_stated_amount_cents":{"type":"number","nullable":true,"description":"Holdover rent in minor units, when the policy states one."},"supersedes_config_id":{"type":"string","format":"uuid","nullable":true,"description":"The version this one replaced, if any."}},"required":["id","term_id","series_id","series_display_name","effective_start","effective_end_inclusive","operator","components","floor_bp","cap_bp","carryover_bank","ratchet","compounding","reset_schedule","reset_frequency","reset_anchor_date","reset_at_term_start","stub_policy","rounding","applies_to","holdover_policy","holdover_stated_amount_cents","supersedes_config_id"]},"PutEscalationConfigV1Dto":{"type":"object","properties":{"series_id":{"type":"string","format":"uuid"},"effective_start":{"type":"string","format":"date"},"effective_end_inclusive":{"type":"string","format":"date","nullable":true,"description":"Inclusive. Omit or null for an open-ended clause."},"operator":{"type":"string","enum":["single","max","min","clamp"]},"components":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"The component union, caller-defined per kind. At least one must be a `cpi_change`."},"floor_bp":{"type":"number","nullable":true},"cap_bp":{"type":"number","nullable":true},"carryover_bank":{"type":"boolean"},"ratchet":{"type":"boolean"},"compounding":{"type":"string","enum":["prior_rent","original_base"],"description":"prior_rent (default) compounds each reset on the rent before it. original_base is simple escalation: the term base times 1 + the sum of each year's growth (3% a year for three years is 9%). Under original_base every cpi_change component must use the same comparison."},"reset_schedule":{"type":"string","enum":["anniversary","fixed_date","custom"]},"reset_frequency":{"type":"string","enum":["annual","semiannual","quarterly","monthly"]},"reset_anchor_date":{"type":"string","format":"date","nullable":true},"reset_at_term_start":{"type":"boolean","default":false,"description":"Option-period terms only: also reset on the term's own start date. Refused with ESCALATION_CONFIG_INVALID on any other term."},"stub_policy":{"type":"string","enum":["full","prorated","skip"]},"rounding":{"type":"string","enum":["cents","whole_dollar","psf_nearest_cent"]},"applies_to":{"type":"string","enum":["amount","amount_psf"]},"holdover_policy":{"type":"string","enum":["floor","prior_rate","stated_amount"]},"holdover_stated_amount_cents":{"type":"number","nullable":true,"description":"Minor units — never a decimal, never a float."}},"required":["series_id","effective_start","operator","components","reset_schedule"]},"ConsolidationGroupV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string"},"currency_code":{"type":"string","example":"USD"},"status":{"type":"string","enum":["active","archived"]},"group_type":{"type":"string","enum":["consolidation","payment"]},"consolidation_basis":{"type":"string","enum":["consolidated","combined"],"description":"'consolidated' (the default) eliminates intercompany activity between members in consolidated reports; 'combined' sums the members as they are, for companies managed together but not under common control. Consolidation groups only."},"member_entity_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"member_count":{"type":"number"},"controlled_by_agreement_ids":{"description":"Members the parent controls through an agreement, whatever the ownership percentages say.","type":"array","items":{"type":"string","format":"uuid"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","currency_code","status","group_type","consolidation_basis","member_entity_ids","member_count","controlled_by_agreement_ids","created_at","updated_at"]},"GroupMemberControlV1Dto":{"type":"object","properties":{"legal_entity_id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["parent","controlled","not_controlled"],"description":"'parent' is the member that controls the most others; 'not_controlled' is a member the parent does not control (exactly 50% is not control)."},"control_basis":{"type":"string","enum":["majority","agreement"],"nullable":true,"description":"How a 'controlled' member is controlled: 'majority' (the parent and the members it controls hold more than 50%) or 'agreement' (marked on the group). Null for the parent and for a member not controlled."},"group_share_percent":{"type":"string","nullable":true,"description":"The parent's economic share of the member, percent at 15 decimals (the parent: 100). Null for a member not controlled.","example":"80.000000000000000"},"nci_percent":{"type":"string","nullable":true,"description":"Non-controlling interest: 100 minus the group share, percent at 15 decimals. Null for a member not controlled.","example":"20.000000000000000"}},"required":["legal_entity_id","role","control_basis","group_share_percent","nci_percent"]},"GroupControlV1Dto":{"type":"object","properties":{"as_of_date":{"type":"string","format":"date"},"parent_legal_entity_id":{"type":"string","format":"uuid","nullable":true,"description":"The member that controls the group. Null for an empty group."},"members":{"type":"array","items":{"$ref":"#/components/schemas/GroupMemberControlV1Dto"}}},"required":["as_of_date","parent_legal_entity_id","members"]},"CreateConsolidationGroupV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":128},"description":{"type":"string","maxLength":1024},"currency_code":{"type":"string","example":"USD"},"group_type":{"type":"string","enum":["consolidation","payment"],"default":"consolidation","description":"'consolidation' groups feed consolidated reports; 'payment' groups are used only by payment runs and may include managed legal entities. Immutable after creation."},"consolidation_basis":{"type":"string","enum":["consolidated","combined"],"default":"consolidated","description":"'consolidated' (the default) eliminates intercompany activity between members in consolidated reports; 'combined' sums the members as they are, for companies managed together but not under common control. Consolidation groups only."},"member_entity_ids":{"maxItems":100,"type":"array","items":{"type":"string","format":"uuid"}},"controlled_by_agreement_ids":{"maxItems":100,"description":"Members the parent controls through an agreement (a GP over an LP), whatever the ownership percentages say. Must be members; consolidation groups only.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["name","currency_code","member_entity_ids"]},"UpdateConsolidationGroupV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":128},"description":{"type":"string","maxLength":1024},"status":{"type":"string","enum":["active","archived"]},"consolidation_basis":{"type":"string","enum":["consolidated","combined"],"description":"'consolidated' (the default) eliminates intercompany activity between members in consolidated reports; 'combined' sums the members as they are, for companies managed together but not under common control. Consolidation groups only."},"member_entity_ids":{"maxItems":100,"type":"array","items":{"type":"string","format":"uuid"}},"controlled_by_agreement_ids":{"maxItems":100,"description":"Members the parent controls through an agreement (a GP over an LP), whatever the ownership percentages say. Must be members; consolidation groups only. Replaces the whole set; omit to keep it.","type":"array","items":{"type":"string","format":"uuid"}}}},"DashboardKpiSeriesPointV1Dto":{"type":"object","properties":{"period":{"type":"string","description":"Calendar month, YYYY-MM.","example":"2025-09"},"value":{"type":"number","nullable":true,"example":0.9}},"required":["period","value"]},"DashboardKpiV1Dto":{"type":"object","properties":{"key":{"type":"string","enum":["occupancy","noi","collection_rate","cash_on_hand"],"example":"occupancy"},"unit":{"type":"string","enum":["ratio","currency","count"],"example":"ratio"},"value":{"type":"number","nullable":true,"example":0.942},"prior_value":{"type":"number","nullable":true,"example":0.921},"delta_pct":{"type":"number","nullable":true,"example":0.0228},"polarity":{"type":"string","enum":["higher_is_better","lower_is_better"],"example":"higher_is_better"},"series":{"type":"array","items":{"$ref":"#/components/schemas/DashboardKpiSeriesPointV1Dto"}}},"required":["key","unit","value","prior_value","delta_pct","polarity","series"]},"MeasureV1Dto":{"type":"object","properties":{"key":{"type":"string","example":"net_income"},"label":{"type":"string","example":"Net income"},"read_scope":{"type":"string","example":"reports:read"},"format":{"type":"string","enum":["money","percent","number"]},"group_by":{"type":"array","items":{"type":"string","enum":["none","month","aging_bucket"]}},"filters":{"type":"array","items":{"type":"string","enum":["entity_id","period"]}},"viz_types":{"type":"array","items":{"type":"string","enum":["score","bar","line","area"]}},"default_viz":{"type":"string","enum":["score","bar","line","area"]}},"required":["key","label","read_scope","format","group_by","filters","viz_types","default_viz"]},"MeasureQueryPointV1Dto":{"type":"object","properties":{"label":{"type":"string","example":"2026-08"},"value":{"type":"number","nullable":true,"example":1200.5}},"required":["label","value"]},"MeasureQueryResultV1Dto":{"type":"object","properties":{"points":{"type":"array","items":{"$ref":"#/components/schemas/MeasureQueryPointV1Dto"}},"delta_pct":{"type":"number","nullable":true,"example":0.2},"format":{"type":"string","enum":["money","percent","number"]}},"required":["points","delta_pct","format"]},"MeasureQueryFilterDto":{"type":"object","properties":{"entity_ids":{"description":"Scope to one or more legal entities; aggregated. Empty/absent = dashboard/org scope.","type":"array","items":{"type":"string","format":"uuid"}},"period":{"type":"string","enum":["this_month","last_month","qtd","ytd","ttm"],"description":"Comparison window for the measure. Default: this_month."}}},"MeasureQueryV1BodyDto":{"type":"object","properties":{"measure":{"type":"string","example":"net_income","description":"Measure key from the `GET /v1/dashboard/measures` catalog."},"group_by":{"type":"string","enum":["none","month","aging_bucket"]},"filters":{"$ref":"#/components/schemas/MeasureQueryFilterDto"}},"required":["measure","group_by"]},"KpiAccountRefV1Dto":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"code":{"type":"string","example":"4001"},"name":{"type":"string","example":"Rent Income"}},"required":["account_id","code","name"]},"KpiV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"format":{"type":"string","enum":["money","percent","number"]},"basis":{"type":"string","enum":["flow","balance"]},"formula":{"type":"object","additionalProperties":true,"description":"Recursive KPI formula AST — see the create-request schema for node shapes."},"is_active":{"type":"boolean","default":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true},"account_refs":{"description":"Every GL account referenced anywhere in the formula, resolved to code + name for display. Deduplicated; order is not significant.","type":"array","items":{"$ref":"#/components/schemas/KpiAccountRefV1Dto"}}},"required":["id","name","format","basis","formula","is_active","created_at","account_refs"]},"CreateKpiV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":120,"example":"Rent Revenue"},"description":{"type":"string","nullable":true},"format":{"type":"string","enum":["money","percent","number"]},"basis":{"type":"string","enum":["flow","balance"]},"formula":{"type":"object","additionalProperties":true,"description":"Recursive KPI formula AST. Node shapes: { type: \"op\", op: \"+\"|\"-\"|\"*\"|\"/\", operands: KpiNode[], label?: string } (\"+\" n-ary >=1; \"-\" n-ary >=2 (a-b-c...); \"*\" and \"/\" binary (exactly 2); the optional `label` names the operand as a segment for display, purely cosmetic), { type: \"account\", accountId: uuid, includeSubtree: boolean }, { type: \"kpi\", kpiId: uuid } (reference to another KPI), { type: \"stat_measure\", measureKey: string } (a statistical measure), { type: \"const\", value: string } (decimal string literal). Operators are gated by the dimensional UNIT of their operands, not by the KPI format: money and quantities (stat measures) combine with \"+\"/\"-\" only within the same unit, \"/\" divides money or a quantity by a like quantity into a ratio, and \"*\" scales by a constant. `format` is presentation-only — it must agree with the formula's inferred unit (percent requires a ratio result; money/number accept any unit). Validated deeply server-side (shape, unit coherence, referenced accounts/KPIs/stat measures exist and are active, and no cycles)."}},"required":["name","format","basis","formula"]},"KpiPreviewPointV1Dto":{"type":"object","properties":{"label":{"type":"string","description":"Month key (`YYYY-MM`) for a `month` series point, or the as-of/period-end date for a single point."},"value":{"type":"number","nullable":true,"description":"null when undefined for this point (e.g. divide-by-zero)."}},"required":["label","value"]},"KpiPreviewResultV1Dto":{"type":"object","properties":{"points":{"type":"array","items":{"$ref":"#/components/schemas/KpiPreviewPointV1Dto"}},"delta_pct":{"type":"number","nullable":true,"description":"Ratio vs. the prior period; null for balance-basis or a month series."},"format":{"type":"string","enum":["money","percent","number"]}},"required":["points","delta_pct","format"]},"PreviewKpiV1Dto":{"type":"object","properties":{"formula":{"type":"object","additionalProperties":true,"description":"Recursive KPI formula AST — same shape as on create, including the { type: \"stat_measure\", measureKey: string } leaf and the optional `label` on an \"op\" node (a segment name). Operators are gated by unit, not by format."},"basis":{"type":"string","enum":["flow","balance"]},"format":{"type":"string","enum":["money","percent","number"]},"period":{"type":"string","enum":["this_month","last_month","qtd","ytd","ttm"],"description":"Reporting period. Default: this_month."},"group_by":{"type":"string","enum":["none","month"],"description":"none = a single point for `period` (flow) or as-of (balance); month = a trailing-12-month series (flow only). Default: none."},"entity_ids":{"type":"array","items":{"type":"string"}}},"required":["formula","basis","format"]},"UpdateKpiV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"description":{"type":"string","nullable":true},"format":{"type":"string","enum":["money","percent","number"]},"basis":{"type":"string","enum":["flow","balance"]},"formula":{"type":"object","additionalProperties":true,"description":"Recursive KPI formula AST — same shape as on create, including the { type: \"stat_measure\", measureKey: string } leaf and the optional `label` on an \"op\" node (a segment name). Operators are gated by unit, not by format. Re-validated (shape, unit coherence, refs, cycles) whenever supplied."},"is_active":{"type":"boolean"}}},"StatMeasureTypeV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Present only for manual types; derived types have no row id."},"key":{"type":"string","description":"Stable machine key."},"name":{"type":"string"},"unit_label":{"type":"string"},"basis":{"type":"string","enum":["flow","balance"]},"dimension":{"type":"string","enum":["property","space","legal_entity","org"]},"is_active":{"type":"boolean","default":true},"source":{"type":"string","enum":["derived","manual"],"description":"'derived' — a built-in computed over properties/spaces; 'manual' — a user-defined type with recorded entries."},"resolver_key":{"type":"string","description":"For derived types, the resolver that computes the quantity. Absent on manual types."}},"required":["key","name","unit_label","basis","dimension","is_active","source"]},"CreateStatMeasureTypeV1Dto":{"type":"object","properties":{"key":{"type":"string","maxLength":64,"description":"Stable machine key, unique per org. Lowercase alphanumerics and underscores only. Must not collide with a built-in derived measure key.","example":"foot_traffic"},"name":{"type":"string","maxLength":128,"example":"Monthly foot traffic"},"unit_label":{"type":"string","maxLength":32,"example":"visits"},"basis":{"type":"string","enum":["flow","balance"],"description":"'flow' — a per-period quantity (summed over a window); 'balance' — a point-in-time quantity (latest as-of value)."},"dimension":{"type":"string","enum":["property","space","legal_entity","org"],"description":"The dimension each entry of this type is recorded against."}},"required":["key","name","unit_label","basis","dimension"]},"UpdateStatMeasureTypeV1Dto":{"type":"object","properties":{"name":{"type":"string","maxLength":128},"unit_label":{"type":"string","maxLength":32},"basis":{"type":"string","enum":["flow","balance"]},"dimension":{"type":"string","enum":["property","space","legal_entity","org"]},"is_active":{"type":"boolean"}}},"StatMeasureV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"measure_type_id":{"type":"string","format":"uuid"},"property_id":{"type":"string","format":"uuid","nullable":true},"space_id":{"type":"string","format":"uuid","nullable":true},"legal_entity_id":{"type":"string","format":"uuid","nullable":true},"period_month":{"type":"string","format":"date","nullable":true},"as_of_date":{"type":"string","format":"date","nullable":true},"quantity":{"type":"string","description":"The recorded quantity as a decimal string."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","measure_type_id","property_id","space_id","legal_entity_id","period_month","as_of_date","quantity","created_at","updated_at"]},"CreateStatMeasureV1Dto":{"type":"object","properties":{"measure_type_id":{"type":"string","format":"uuid","description":"The manual measure type this entry records a quantity for."},"property_id":{"type":"string","format":"uuid","description":"Set only for a `property`-dimension type."},"space_id":{"type":"string","format":"uuid","description":"Set only for a `space`-dimension type."},"legal_entity_id":{"type":"string","format":"uuid","description":"Set only for a `legal_entity`-dimension type."},"period_month":{"type":"string","format":"date","description":"The period a `flow`-type quantity belongs to. Must be the first day of the month (YYYY-MM-01)."},"as_of_date":{"type":"string","format":"date","description":"The as-of date a `balance`-type quantity is measured at."},"quantity":{"type":"string","description":"The recorded quantity as a decimal string (numeric(18,4)).","example":"1200.5000"}},"required":["measure_type_id","quantity"]},"UpdateStatMeasureV1Dto":{"type":"object","properties":{"period_month":{"type":"string","format":"date","description":"For `flow` types — first day of the month (YYYY-MM-01). Mutually exclusive with `as_of_date`."},"as_of_date":{"type":"string","format":"date","description":"For `balance` types. Mutually exclusive with `period_month`."},"quantity":{"type":"string","description":"The recorded quantity as a decimal string (numeric(18,4)).","example":"1200.5000"}}},"PlanRunListItemDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The run, `plan_id` in reports."},"mode":{"type":"string","enum":["preview","commit"]},"status":{"type":"string","enum":["previewed","committed","held","released","undone","failed"]},"principal_id":{"type":"string","description":"Who ran it."},"principal_kind":{"type":"string","enum":["user","api_key","sparkiq_internal","portal_user"]},"session_id":{"type":"string","format":"uuid","nullable":true},"description":{"type":"string","nullable":true},"fingerprint":{"type":"string","description":"sha256 of the canonical plan body.","example":"sha256:9f2c…"},"created_at":{"type":"string","format":"date-time"},"released_at":{"type":"string","format":"date-time","nullable":true},"undone_at":{"type":"string","format":"date-time","nullable":true},"undo_mode":{"type":"string","enum":["clean","compensating"],"nullable":true}},"required":["id","mode","status","principal_id","principal_kind","session_id","description","fingerprint","created_at","released_at","undone_at","undo_mode"]},"PlannableRouteDto":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"],"description":"The HTTP method a step sends.","example":"POST"},"path":{"type":"string","description":"The route as an OpenAPI path template; a step fills each `{param}`, literally or with a `$<ref>` path reference.","example":"/v1/loans/{id}/activate"},"operation_id":{"type":"string","description":"The route's `operationId` in this contract.","example":"Loans.activate"}},"required":["method","path","operation_id"]},"PlanLimitsDto":{"type":"object","properties":{"max_steps":{"type":"number","description":"Most steps one plan may have; more is `PLAN_TOO_LARGE`.","example":50},"time_budget_ms":{"type":"number","description":"Wall-clock budget for one plan's run, in milliseconds; checked before each step. Running out is `PLAN_TIMEOUT`.","example":20000},"max_concurrent_per_instance":{"type":"number","description":"Plans one server instance runs at once; over it a plan is refused with `PLAN_ORG_BUSY` (retryable). Only one plan per organization runs at a time, whatever this says.","example":2}},"required":["max_steps","time_budget_ms","max_concurrent_per_instance"]},"PlanReferencesDto":{"type":"object","properties":{"grammar":{"type":"string","description":"How a step uses an earlier step's response: `$<ref>` followed by an RFC 6901 JSON pointer into that response."},"examples":{"description":"Worked references: an array index, a GET lookup, and a path segment.","type":"array","items":{"type":"string"}}},"required":["grammar","examples"]},"PlanErrorCodeDto":{"type":"object","properties":{"code":{"type":"string","description":"The error code.","example":"PLAN_TIMEOUT"},"http_status":{"type":"number","description":"The HTTP status it answers.","example":504},"retryable":{"type":"boolean","description":"Whether the same request can succeed unchanged later."},"next_action":{"type":"string","enum":["fix_step","re_preview","retry_later","split_plan","use_plan_mode","release_first","contact_operator"],"description":"What the caller does next."}},"required":["code","http_status","retryable","next_action"]},"PlanCapabilitiesDto":{"type":"object","properties":{"plannable_routes":{"description":"Every non-GET route a plan step may call (the operations marked `x-plannable`), sorted by path then method. Any other non-GET step fails with `PLAN_ROUTE_NOT_PLANNABLE`.","type":"array","items":{"$ref":"#/components/schemas/PlannableRouteDto"}},"implicitly_plannable":{"type":"string","description":"GET routes need no marking.","example":"Every GET under /v1/ is plannable."},"limits":{"$ref":"#/components/schemas/PlanLimitsDto"},"references":{"$ref":"#/components/schemas/PlanReferencesDto"},"step_headers":{"description":"The only headers a step may send (lower-case). Credentials come from the plan request; any other step header fails the plan's shape check.","example":["if-match","x-contract-version"],"type":"array","items":{"type":"string"}},"error_codes":{"description":"Every error code that declares a `next_action` (the plan codes, `API_KEY_PLAN_ONLY` and `TRANSACTION_RETRYABLE`), sorted by code. Inside a plan report `PERIOD_CLOSED`, `PERIOD_LOCKED` and `PERIOD_MISSING` also carry `next_action: fix_step`: change the step's date, or add the reason the route accepts for a closed period (a plan never grants the override scope).","type":"array","items":{"$ref":"#/components/schemas/PlanErrorCodeDto"}}},"required":["plannable_routes","implicitly_plannable","limits","references","step_headers","error_codes"]},"PlanRunDetailDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The run, `plan_id` in reports."},"mode":{"type":"string","enum":["preview","commit"]},"status":{"type":"string","enum":["previewed","committed","held","released","undone","failed"]},"principal_id":{"type":"string","description":"Who ran it."},"principal_kind":{"type":"string","enum":["user","api_key","sparkiq_internal","portal_user"]},"session_id":{"type":"string","format":"uuid","nullable":true},"description":{"type":"string","nullable":true},"fingerprint":{"type":"string","description":"sha256 of the canonical plan body.","example":"sha256:9f2c…"},"created_at":{"type":"string","format":"date-time"},"released_at":{"type":"string","format":"date-time","nullable":true},"undone_at":{"type":"string","format":"date-time","nullable":true},"undo_mode":{"type":"string","enum":["clean","compensating"],"nullable":true},"plan":{"type":"object","additionalProperties":true,"description":"The plan as submitted: `{ description?, steps: [{ ref, method, path, body? }] }`."},"report":{"type":"object","additionalProperties":true,"description":"The stored report, in the shape `POST /v1/plans/preview` or `POST /v1/plans` answered (capped; see `truncated`)."}},"required":["id","mode","status","principal_id","principal_kind","session_id","description","fingerprint","created_at","released_at","undone_at","undo_mode","plan","report"]},"PlanFirstErrorDto":{"type":"object","properties":{"code":{"type":"string","example":"VALIDATION_FAILED"},"detail":{"type":"string","example":"maturity_date must be after start_date"},"pointer":{"type":"string","description":"JSON Pointer into the SUBMITTED plan, by step index (`/steps/3/body/maturity_date`).","example":"/steps/3/body/maturity_date"},"next_action":{"type":"string","enum":["fix_step","re_preview","retry_later","split_plan","use_plan_mode","release_first","contact_operator"],"example":"fix_step","description":"What the caller does next. Sent only for codes that declare it (the `PLAN_*` codes)."},"retryable":{"type":"boolean","example":false,"description":"Whether the same step can succeed unchanged later. Sent only for codes that declare it (the `PLAN_*` codes)."},"step":{"type":"string","description":"The ref of the step that failed.","example":"l1"}},"required":["code","detail","step"]},"PlanReportSummaryDto":{"type":"object","properties":{"ok":{"type":"number","example":3},"error":{"type":"number","example":1},"skipped":{"type":"number","example":1},"tables_touched":{"type":"object","additionalProperties":{"type":"integer"},"description":"Rows inserted or updated, per table.","example":{"legal_entities":1,"accounts":42}},"journal_total_debit":{"type":"string","description":"Sum of every journal line debit the plan wrote.","example":"1234.50"},"first_error":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/PlanFirstErrorDto"}]}},"required":["ok","error","skipped","tables_touched","journal_total_debit","first_error"]},"PlanStepResourceDto":{"type":"object","properties":{"table":{"type":"string","example":"legal_entities"},"id":{"type":"string","example":"018f0b3d-2b1e-7c8a-9d4b-1a2b3c4d5e6f"}},"required":["table","id"]},"PlanStepErrorDto":{"type":"object","properties":{"code":{"type":"string","example":"VALIDATION_FAILED"},"detail":{"type":"string","example":"maturity_date must be after start_date"},"pointer":{"type":"string","description":"JSON Pointer into the SUBMITTED plan, by step index (`/steps/3/body/maturity_date`).","example":"/steps/3/body/maturity_date"},"next_action":{"type":"string","enum":["fix_step","re_preview","retry_later","split_plan","use_plan_mode","release_first","contact_operator"],"example":"fix_step","description":"What the caller does next. Sent only for codes that declare it (the `PLAN_*` codes)."},"retryable":{"type":"boolean","example":false,"description":"Whether the same step can succeed unchanged later. Sent only for codes that declare it (the `PLAN_*` codes)."}},"required":["code","detail"]},"PlanReportStepDto":{"type":"object","properties":{"ref":{"type":"string","example":"e1"},"index":{"type":"number","description":"Position in the submitted plan.","example":0},"status":{"type":"string","enum":["ok","error","skipped"]},"http_status":{"type":"number","example":201},"resource":{"description":"The row the step is about, from the row capture: the one whose id is the response's `data.id`, else the step's first insert, else its first update.","allOf":[{"$ref":"#/components/schemas/PlanStepResourceDto"}]},"response":{"type":"object","additionalProperties":true,"description":"The step's response body; its shape is the called route's. Over 4 KB it is replaced by `{ truncated: true, bytes }`."},"error":{"$ref":"#/components/schemas/PlanStepErrorDto"},"blocked_by":{"description":"The refs of the failed or skipped steps this one depends on.","type":"array","items":{"type":"string"}},"reason":{"type":"string","enum":["blocked","time_budget"]},"duration_ms":{"type":"number","example":12}},"required":["ref","index","status","duration_ms"]},"PlanReportWriteDto":{"type":"object","properties":{"step":{"type":"string","nullable":true,"example":"e1"},"table":{"type":"string","example":"accounts"},"op":{"type":"string","enum":["insert","update","delete"]},"count":{"type":"number","example":42},"ids":{"description":"Row ids, listed only when `count` is 20 or fewer.","type":"array","items":{"type":"string"}},"job_types":{"description":"On a `job_queue` insert only: the distinct job types (`job_queue.type`) queued, sorted.","example":["loan_accrual"],"type":"array","items":{"type":"string"}}},"required":["step","table","op","count"]},"PlanJournalLineDto":{"type":"object","properties":{"account_id":{"type":"string"},"debit":{"type":"string","example":"1234.50"},"credit":{"type":"string","example":"1234.50"}},"required":["account_id","debit","credit"]},"PlanReportJournalDto":{"type":"object","properties":{"step":{"type":"string","nullable":true},"journal_entry_id":{"type":"string"},"legal_entity_id":{"type":"string"},"source_type":{"type":"string"},"entry_date":{"type":"string","format":"date"},"total_debit":{"type":"string","example":"1234.50"},"total_credit":{"type":"string","example":"1234.50"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/PlanJournalLineDto"}}},"required":["step","journal_entry_id","legal_entity_id","source_type","entry_date","total_debit","total_credit","lines"]},"ScheduledEffectActsOnDto":{"type":"object","properties":{"table":{"type":"string","example":"loans","description":"A table the plan inserted or updated rows in, which the scheduled job reads."},"ids":{"description":"Ids of the rows the job will act on, at most 20.","type":"array","items":{"type":"string"}},"count":{"type":"number","example":1,"description":"Every row of `table` the plan inserted or updated."}},"required":["table","ids","count"]},"ScheduledEffectDto":{"type":"object","properties":{"handler":{"type":"string","description":"The scheduled job (`scheduled_jobs.name`).","example":"loan_rolling_window"},"next_run_at":{"type":"string","format":"date-time","description":"When the job next runs, as stored by the scheduler. A time in the past means the next scheduler tick."},"acts_on":{"description":"The plan's rows, in one table, that the job will act on.","allOf":[{"$ref":"#/components/schemas/ScheduledEffectActsOnDto"}]}},"required":["handler","next_run_at","acts_on"]},"WouldFireJobDto":{"type":"object","properties":{"step":{"type":"string","nullable":true,"example":"a1","description":"Ref of the step whose work queued the job; null when no step is known."},"job_type":{"type":"string","description":"The queued job type (`job_queue.type`).","example":"loan_accrual"},"count":{"type":"number","example":1,"description":"How many jobs of this type the step queued."}},"required":["step","job_type","count"]},"WouldFireEventDto":{"type":"object","properties":{"step":{"type":"string","nullable":true,"example":"a1","description":"Ref of the step whose post-commit work published the event; null when no step is known."},"event":{"type":"string","description":"The domain event class name.","example":"LoanActivatedEvent"}},"required":["step","event"]},"WouldFireDto":{"type":"object","properties":{"jobs":{"description":"Background jobs the plan queued, by step and job type. A commit runs them after it commits.","type":"array","items":{"$ref":"#/components/schemas/WouldFireJobDto"}},"events":{"description":"Domain events the post-commit work publishes, in order. Their handlers did not run in the preview.","type":"array","items":{"$ref":"#/components/schemas/WouldFireEventDto"}}},"required":["jobs","events"]},"PlanRunReportDto":{"type":"object","properties":{"fingerprint":{"type":"string","description":"sha256 of the canonical plan body.","example":"sha256:9f2c…"},"summary":{"$ref":"#/components/schemas/PlanReportSummaryDto"},"diff_summary":{"description":"One human-readable line per step.","example":["e1: create legal entity 'Acme Holdings LLC' (+42 accounts)"],"type":"array","items":{"type":"string"}},"steps":{"type":"array","items":{"$ref":"#/components/schemas/PlanReportStepDto"}},"writes":{"description":"Every row the plan wrote, grouped by step, table and operation (at most 200 entries).","type":"array","items":{"$ref":"#/components/schemas/PlanReportWriteDto"}},"journal_entries":{"description":"Journal entries the plan wrote (at most 500 lines in all).","type":"array","items":{"$ref":"#/components/schemas/PlanReportJournalDto"}},"scheduled_effects":{"description":"A forecast: each enabled scheduled job that will act on rows this plan inserted or updated, one entry per job and table, sorted by job then table.","type":"array","items":{"$ref":"#/components/schemas/ScheduledEffectDto"}},"would_fire":{"nullable":true,"description":"Preview only: the work that runs after a commit and so cannot run in a preview — the jobs it queues and the events it publishes (spec §D6). Null on a commit, whose post-commit work really ran.","type":"object","allOf":[{"$ref":"#/components/schemas/WouldFireDto"}]},"warnings":{"type":"array","items":{"type":"string"}},"truncated":{"type":"boolean","description":"True when a cap cut something out of this report."},"plan_id":{"type":"string","description":"The run (`plan_runs.id`)."},"mode":{"type":"string","enum":["preview","commit"],"description":"`preview`: a stored preview, nothing was kept. `commit`: a commit attempt; `committed` says whether it was kept."},"committed":{"type":"boolean","description":"True for a commit whose plan was kept. Always false for a preview, and for a commit whose step failed or was skipped."}},"required":["fingerprint","summary","diff_summary","steps","writes","journal_entries","scheduled_effects","would_fire","warnings","truncated","plan_id","mode","committed"]},"PlanUndoRowsDto":{"type":"object","properties":{"table":{"type":"string","description":"The table the rows are in.","example":"properties"},"ids":{"description":"The rows' ids (`kind:entity_id` for `search_documents`, which has no id).","type":"array","items":{"type":"string"}}},"required":["table","ids"]},"PlanUndoVoidedDto":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid"},"moved_to_current_period":{"type":"boolean","description":"True when the document's period was closed or locked, so its reversal was dated into the current open period instead."}},"required":["document_id","moved_to_current_period"]},"PlanUndoCompensatedDto":{"type":"object","properties":{"kind":{"type":"string","enum":["capital_contribution","distribution_declaration","credit_apply","loan_transaction","loan_hedge","escalation_decision"],"description":"What kind of posting record it is: a capital contribution reversed, a distribution declaration undone, or a credit memo or vendor credit un-applied (`id` is then the credit's).","example":"capital_contribution"},"id":{"type":"string","format":"uuid","description":"The record's id."}},"required":["kind","id"]},"PlanUndoResultDto":{"type":"object","properties":{"run_id":{"type":"string","format":"uuid","description":"The undone run (`plan_runs.id`)."},"undo_mode":{"type":"string","enum":["clean","compensating"],"description":"`clean`: the run posted nothing, and its rows were deleted or restored. `compensating`: it posted or applied a credit, so each posting was reversed through its module's own reversal (listed under `compensated` and `voided`; the reversal is in the ledger), ledger rows were kept, and rows the ledger still refers to were archived."},"deleted":{"description":"Rows the run created that undo deleted.","type":"array","items":{"$ref":"#/components/schemas/PlanUndoRowsDto"}},"restored":{"description":"Existing rows the run changed, put back as they were before it.","type":"array","items":{"$ref":"#/components/schemas/PlanUndoRowsDto"}},"voided":{"description":"Posted documents voided, through their normal void path or by a reversal listed under `compensated`.","type":"array","items":{"$ref":"#/components/schemas/PlanUndoVoidedDto"}},"compensated":{"description":"Posting records other than plain documents that undo reversed through their module's own reversal (a contribution reversed, a credit un-applied). The documents such a reversal voided are also listed under `voided`, each with `moved_to_current_period`. A record reversed since, through its own route, had nothing left to undo and is not listed.","type":"array","items":{"$ref":"#/components/schemas/PlanUndoCompensatedDto"}},"archived":{"description":"Rows kept because the ledger refers to them, retired through their own deactivation: `status = 'archived'` where the table allows it, else the resource's own terminal value (a loan `cancelled`, a legal entity `inactive`, a party or contact `is_active = false`).","type":"array","items":{"$ref":"#/components/schemas/PlanUndoRowsDto"}},"kept":{"description":"Rows kept as they are. Compensating: rows the ledger refers to whose table has no deactivation (an accounting period a reversed entry sits in); posted documents and journal rows are never listed, they are always kept. Either mode: `job_queue` rows of jobs the run queued that already finished (their writes were undone with the run).","type":"array","items":{"$ref":"#/components/schemas/PlanUndoRowsDto"}}},"required":["run_id","undo_mode","deleted","restored","voided","compensated","archived","kept"]},"PlanSessionUndoDto":{"type":"object","properties":{"session_id":{"type":"string","format":"uuid"},"runs":{"description":"The runs this call undid, newest first. Runs already undone (and failed runs, which kept nothing) are skipped, so a repeated call answers an empty list.","type":"array","items":{"$ref":"#/components/schemas/PlanUndoResultDto"}}},"required":["session_id","runs"]},"PlanReportDto":{"type":"object","properties":{"plan_id":{"type":"string","description":"The stored preview run. Nothing the plan wrote was kept."},"mode":{"type":"string","enum":["preview"]},"committed":{"type":"boolean","enum":[false]},"fingerprint":{"type":"string","description":"sha256 of the canonical plan body.","example":"sha256:9f2c…"},"summary":{"$ref":"#/components/schemas/PlanReportSummaryDto"},"diff_summary":{"description":"One human-readable line per step.","example":["e1: create legal entity 'Acme Holdings LLC' (+42 accounts)"],"type":"array","items":{"type":"string"}},"steps":{"type":"array","items":{"$ref":"#/components/schemas/PlanReportStepDto"}},"writes":{"description":"Every row the plan wrote, grouped by step, table and operation (at most 200 entries).","type":"array","items":{"$ref":"#/components/schemas/PlanReportWriteDto"}},"journal_entries":{"description":"Journal entries the plan wrote (at most 500 lines in all).","type":"array","items":{"$ref":"#/components/schemas/PlanReportJournalDto"}},"scheduled_effects":{"description":"A forecast: each enabled scheduled job that will act on rows this plan inserted or updated, one entry per job and table, sorted by job then table.","type":"array","items":{"$ref":"#/components/schemas/ScheduledEffectDto"}},"would_fire":{"nullable":true,"description":"Preview only: the work that runs after a commit and so cannot run in a preview — the jobs it queues and the events it publishes (spec §D6). Null on a commit, whose post-commit work really ran.","type":"object","allOf":[{"$ref":"#/components/schemas/WouldFireDto"}]},"warnings":{"type":"array","items":{"type":"string"}},"truncated":{"type":"boolean","description":"True when a cap cut something out of this report."}},"required":["plan_id","mode","committed","fingerprint","summary","diff_summary","steps","writes","journal_entries","scheduled_effects","would_fire","warnings","truncated"]},"PlanStepDto":{"type":"object","properties":{"ref":{"type":"string","description":"Names this step so later steps can reference its response as `\"$<ref>/<json-pointer>\"`. Unique within the plan.","example":"e1","pattern":"^[a-z][a-z0-9_]{0,31}$"},"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"],"example":"POST"},"path":{"type":"string","description":"A `/v1/` route path, optionally with a query string. A whole segment `$<ref>` followed by a pointer (`/v1/legal-entities/$e1/data/id`) is replaced by that value from an earlier step.","example":"/v1/properties","pattern":"^/v1/"},"body":{"type":"object","additionalProperties":true,"description":"The route's own request body; its shape is defined by the route the step calls. Any whole string value `\"$<ref>/<json-pointer>\"` is replaced by that value from an earlier step's response."},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Extra request headers for this step. Only `if-match` and `x-contract-version` are allowed (names compared case-insensitively); any other name, `authorization` included, is refused with `VALIDATION_FAILED` at `/steps/<i>/headers/<name>`. Credentials always come from the plan request. A value may be a whole-value reference `\"$<ref>/<json-pointer>\"` to a scalar in an earlier step's response (`\"$c1/data/version\"`). Part of the fingerprint.","example":{"x-contract-version":"$c1/data/version"}}},"required":["ref","method","path"]},"PlanPreviewDto":{"type":"object","properties":{"description":{"type":"string","description":"What the plan is for, in a sentence. Part of the fingerprint.","maxLength":500},"steps":{"minItems":1,"maxItems":50,"description":"The steps, run in order.","type":"array","items":{"$ref":"#/components/schemas/PlanStepDto"}}},"required":["steps"]},"PlanCommitReportDto":{"type":"object","properties":{"fingerprint":{"type":"string","description":"sha256 of the canonical plan body.","example":"sha256:9f2c…"},"summary":{"$ref":"#/components/schemas/PlanReportSummaryDto"},"diff_summary":{"description":"One human-readable line per step.","example":["e1: create legal entity 'Acme Holdings LLC' (+42 accounts)"],"type":"array","items":{"type":"string"}},"steps":{"type":"array","items":{"$ref":"#/components/schemas/PlanReportStepDto"}},"writes":{"description":"Every row the plan wrote, grouped by step, table and operation (at most 200 entries).","type":"array","items":{"$ref":"#/components/schemas/PlanReportWriteDto"}},"journal_entries":{"description":"Journal entries the plan wrote (at most 500 lines in all).","type":"array","items":{"$ref":"#/components/schemas/PlanReportJournalDto"}},"scheduled_effects":{"description":"A forecast: each enabled scheduled job that will act on rows this plan inserted or updated, one entry per job and table, sorted by job then table.","type":"array","items":{"$ref":"#/components/schemas/ScheduledEffectDto"}},"would_fire":{"nullable":true,"description":"Preview only: the work that runs after a commit and so cannot run in a preview — the jobs it queues and the events it publishes (spec §D6). Null on a commit, whose post-commit work really ran.","type":"object","allOf":[{"$ref":"#/components/schemas/WouldFireDto"}]},"warnings":{"type":"array","items":{"type":"string"}},"truncated":{"type":"boolean","description":"True when a cap cut something out of this report."},"plan_id":{"type":"string","description":"The run (`plan_runs.id`). Committed: its rows are kept and it can be undone. Not committed: nothing was kept, and the stored run has status `failed`."},"mode":{"type":"string","enum":["commit"]},"committed":{"type":"boolean","description":"True when every step succeeded and the plan was kept. False when a step failed or was skipped: nothing was kept, and `summary.first_error` says why."}},"required":["fingerprint","summary","diff_summary","steps","writes","journal_entries","scheduled_effects","would_fire","warnings","truncated","plan_id","mode","committed"]},"PlanCommitDto":{"type":"object","properties":{"plan_id":{"type":"string","format":"uuid","description":"The `plan_id` a preview returned. The stored plan is re-executed (not replayed) and must do what its preview showed, or the commit is refused with `PLAN_DRIFT`. Only the principal that previewed it can commit it, unless the caller holds `plans:release` (a plan-only key or a legal-entity-scoped principal never counts as holding it). Send this or `steps`, not both."},"description":{"type":"string","description":"What the plan is for, in a sentence. Only with `steps`; part of the fingerprint.","maxLength":500},"steps":{"minItems":1,"maxItems":50,"description":"The steps, run in order, as for a preview. Send this or `plan_id`, not both.","type":"array","items":{"$ref":"#/components/schemas/PlanStepDto"}},"allow_drift":{"type":"boolean","default":false,"description":"With `plan_id` only (refused with `steps`): commit even when the run no longer matches its preview (a lookup answers differently, or a step writes different rows). Sequence-allocated numbers (a document number, for example) and date fields defaulted to today can differ between preview and commit, and show as drift."},"session_id":{"type":"string","format":"uuid","description":"Groups this run with other runs of one build, so they can be undone together."}}},"ConnectorUploadTargetV1Dto":{"type":"object","properties":{"operation_id":{"type":"string","description":"The multipart operation the file is sent to (its `operationId` in this contract), or `ap_intake` for the AP intake flow."},"path_params":{"type":"object","additionalProperties":{"type":"string"},"description":"Values for the operation path's placeholders."},"query":{"type":"object","additionalProperties":true,"description":"Query parameters sent with the file. The shape is caller-defined (the target operation decides)."},"fields":{"type":"object","additionalProperties":{"type":"string"},"description":"Other form fields sent with the file."}},"required":["operation_id"]},"ConnectorUploadV1Dto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The upload link id."},"status":{"type":"string","enum":["pending","uploading","uploaded","failed","expired"],"description":"`pending` until the person uploads the file; `uploading` while it runs against the target operation; then `uploaded` (see `result`) or `failed` (see `error`); `expired` when a pending link passed `expires_at` unused."},"operation_id":{"type":"string","description":"The operation the file will be sent to (its `operationId`, or `ap_intake`)."},"target":{"description":"Where the file goes, as the AI connector asked.","allOf":[{"$ref":"#/components/schemas/ConnectorUploadTargetV1Dto"}]},"client_name":{"type":"string","nullable":true,"description":"The AI connector client that asked for the file (e.g. \"Claude\"), or null when unknown."},"result":{"type":"object","additionalProperties":true,"nullable":true,"description":"Once `uploaded`: the target operation's response `data` (for example the attachment). Its shape is set by the target operation."},"error":{"type":"object","additionalProperties":true,"nullable":true,"description":"Once `failed`: the target operation's error, `{ code, status, detail, context? }`. Its shape is caller-defined by the target operation's error."},"expires_at":{"type":"string","format":"date-time","description":"When the link stops accepting a file (30 minutes after it was issued)."},"created_at":{"type":"string","format":"date-time","description":"When it was issued."}},"required":["id","status","operation_id","target","client_name","result","error","expires_at","created_at"]},"BankRuleActionCategorizeV1Dto":{"type":"object","properties":{"type":{"type":"string","enum":["categorize"]},"economic_document_type":{"type":"string","enum":["sales_receipt","expense"]},"account_id":{"type":"string","format":"uuid"},"party_id":{"type":"string","format":"uuid"},"description":{"type":"string"},"dimensions":{"type":"object","description":"Line dimension values for the generated document, keyed by dimensions.code (UUIDs for data_type=entity). Null clears the assignment.","additionalProperties":{"type":"string","nullable":true}}},"required":["type","economic_document_type","account_id","party_id"]},"BankRuleActionTransferV1Dto":{"type":"object","properties":{"type":{"type":"string","enum":["transfer"]},"to_bank_account_id":{"type":"string","format":"uuid"}},"required":["type","to_bank_account_id"]},"BankRuleActionExcludeV1Dto":{"type":"object","properties":{"type":{"type":"string","enum":["exclude"]}},"required":["type"]}}}}