{"components":{"schemas":{"account":{"additionalProperties":false,"properties":{"auxiliaryCode":{"nullable":true,"type":"string"},"code":{"nullable":true,"type":"string"},"companyId":{"type":"string"},"createdAt":{"type":"string"},"creditCode":{"nullable":true,"type":"string"},"currency":{"nullable":true,"type":"string"},"description":{"nullable":true,"type":"string"},"externalId":{"nullable":true,"type":"string"},"id":{"format":"uuid","type":"string"},"isArchived":{"type":"boolean"},"isAvailable":{"type":"boolean"},"name":{"type":"string"},"purpose":{"enum":["company","spendesk","bankFees"],"nullable":true,"type":"string"},"taxRate":{"nullable":true,"type":"number"},"type":{"enum":["bank","expense","tax","supplier","employee","reverseCharge"],"type":"string"}},"required":["id","name","description","type","code","creditCode","auxiliaryCode","externalId","purpose","taxRate","currency","isAvailable","isArchived","companyId"],"title":"account","type":"object"},"accountingExportQuery":{"additionalProperties":false,"properties":{"from":{"description":"Period start date","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"},"includeAlreadyExportedPayables":{"default":false,"description":"Whether to include payables that have already been exported to accounting in the export results. When set to `false` (default), only payables not yet exported are included.","type":"boolean"},"markEntriesAsExported":{"default":false,"description":"Whether the entries included in the export should be marked as exported after the export is generated. When set to `false` (default), the export is generated without updating the bookkeeping status of the entries","type":"boolean"},"templates":{"additionalProperties":false,"description":"Accounting templates to use for the export","properties":{"bankJournalTemplateId":{"description":"The ID of the template to use for the bank journal","type":"string"},"purchaseJournalTemplateId":{"description":"The ID of the template to use for the purchase journal","type":"string"}},"type":"object"},"to":{"description":"Period end date, no more than 31 days from `from`","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"},"userLanguage":{"default":"en-GB","enum":["en-GB","fr","de"],"type":"string"}},"required":["from","to"],"title":"accountingExportQuery","type":"object"},"analyticalField":{"additionalProperties":false,"properties":{"id":{"description":"The analytical field id","type":"string"},"isArchived":{"type":"boolean"},"name":{"description":"The analytical field name","type":"string"}},"required":["id","name","isArchived"],"title":"analyticalField","type":"object"},"analyticalFieldQuery":{"allOf":[{"$ref":"#/components/schemas/paginationQuery"},{"properties":{"ids":{"description":"Field IDs to filter by.","items":{"format":"uuid","type":"string"},"type":"array"},"includeArchived":{"default":false,"description":"Include archived fields (retained for historical payables, not deleted)","type":"boolean"}},"type":"object"}],"title":"analyticalFieldQuery","type":"object","unevaluatedProperties":false},"analyticalFieldV2":{"additionalProperties":false,"properties":{"archivedAt":{"description":"ISO 8601 UTC timestamp of when the field was archived, or null.","oneOf":[{"$ref":"#/components/schemas/dateTime"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 UTC timestamp of when the field was created, or null.","oneOf":[{"$ref":"#/components/schemas/dateTime"},{"type":"null"}]},"id":{"description":"The analytical field ID.","type":"string"},"isRequired":{"description":"Whether the field is mandatory.","type":"boolean"},"isSplittable":{"description":"Whether the field is configured as splittable (stored setting). Does not indicate whether analytical split is enabled for the company.","nullable":true,"type":"boolean"},"name":{"description":"The analytical field name.","type":"string"},"type":{"description":"The field type.","enum":["list","boolean"],"type":"string"},"updatedAt":{"description":"ISO 8601 UTC timestamp of when the field was last updated, or null.","oneOf":[{"$ref":"#/components/schemas/dateTime"},{"type":"null"}]}},"required":["id","name","isRequired","isSplittable","type","archivedAt","createdAt","updatedAt"],"title":"analyticalFieldV2","type":"object"},"analyticalFieldV2ByIdParams":{"properties":{"fieldId":{"description":"Analytical field ID.","example":"x__8qsgm86n71g","type":"string"}},"required":["fieldId"],"title":"analyticalFieldV2ByIdParams","type":"object"},"analyticalFieldV2Query":{"allOf":[{"$ref":"#/components/schemas/paginationQuery"},{"properties":{"ids":{"description":"Field IDs to filter by.","items":{"examples":["x__8qsgm86n71g"],"type":"string"},"type":"array"}},"type":"object"}],"title":"analyticalFieldV2Query","type":"object","unevaluatedProperties":false},"analyticalFieldV2Value":{"additionalProperties":false,"properties":{"archivedAt":{"description":"ISO 8601 UTC timestamp of when the value was archived, or null.","oneOf":[{"$ref":"#/components/schemas/dateTime"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 UTC timestamp of when the value was created, or null.","oneOf":[{"$ref":"#/components/schemas/dateTime"},{"type":"null"}]},"id":{"description":"The value ID.","type":"string"},"isDefault":{"description":"Whether this value is pre-selected by default.","type":"boolean"},"updatedAt":{"description":"ISO 8601 UTC timestamp of when the value was last updated, or null.","oneOf":[{"$ref":"#/components/schemas/dateTime"},{"type":"null"}]},"value":{"description":"The value label.","type":"string"}},"required":["id","value","isDefault","archivedAt","createdAt","updatedAt"],"title":"analyticalFieldV2Value","type":"object"},"analyticalFieldV2ValueByIdParams":{"properties":{"fieldId":{"description":"Analytical field ID.","example":"x__8qsgm86n71g","type":"string"},"valueId":{"description":"Analytical field value ID.","example":"x__k3jd81ndos5","type":"string"}},"required":["fieldId","valueId"],"title":"analyticalFieldV2ValueByIdParams","type":"object"},"analyticalFieldV2ValuesCursorPagination":{"additionalProperties":false,"description":"Forward-only cursor pagination metadata.","properties":{"hasNextPage":{"description":"Whether a further page exists. Equivalent to `nextCursor !== null`.","type":"boolean"},"limit":{"description":"Maximum number of values requested for this page.","maximum":1000,"minimum":1,"type":"integer"},"nextCursor":{"description":"Cursor to pass as `cursor` to fetch the next page, or null on the last page.","type":["null","string"]},"nextUrl":{"description":"Ready-to-follow URL for the next page (same filters + `cursor`), or null.","type":["null","string"]}},"required":["limit","hasNextPage","nextCursor","nextUrl"],"title":"analyticalFieldV2ValuesCursorPagination","type":"object"},"analyticalFieldV2ValuesMeta":{"additionalProperties":false,"properties":{"pagination":{"$ref":"#/components/schemas/analyticalFieldV2ValuesCursorPagination"}},"required":["pagination"],"title":"analyticalFieldV2ValuesMeta","type":"object"},"analyticalFieldV2ValuesQuery":{"properties":{"cursor":{"description":"Opaque pagination cursor returned as `meta.pagination.nextCursor` by a previous call. Omit to fetch the first page.","type":"string"},"limit":{"default":30,"description":"Maximum number of values to return.","maximum":1000,"minimum":1,"type":"integer"}},"title":"analyticalFieldV2ValuesQuery","type":"object","unevaluatedProperties":false},"analyticalFieldValue":{"additionalProperties":false,"properties":{"id":{"description":"The analytical value id","type":"string"},"isArchived":{"type":"boolean"},"value":{"description":"The analytical value name","type":"string"}},"required":["id","value","isArchived"],"title":"analyticalFieldValue","type":"object"},"analyticalFieldValueQuery":{"allOf":[{"$ref":"#/components/schemas/paginationQuery"},{"properties":{"includeArchived":{"default":false,"description":"Include archived values (retained for historical payables, not deleted)","type":"boolean"}},"type":"object"}],"title":"analyticalFieldValueQuery","type":"object","unevaluatedProperties":false},"analyticalProperties":{"additionalProperties":false,"description":"Analytical fields and values of the payable.","properties":{"fieldId":{"description":"ID of the analytical field.","type":"string"},"fieldName":{"description":"Name of the analytical field.","type":"string"},"valueId":{"description":"ID of the analytical value.","nullable":true,"type":"string"},"valueName":{"description":"Name of the analytical value.","nullable":true,"type":"string"}},"required":["fieldId","fieldName","valueId","valueName"],"title":"analyticalProperties","type":"object"},"analyticalProperty":{"additionalProperties":false,"description":"A value set for one analytical field. Analytical fields are the customer's own bookkeeping dimensions (custom fields) — e.g. project, team — used to classify and report spend. `valueId`/`valueName` are null when the field applies but no value is selected.","properties":{"fieldId":{"type":"string"},"fieldName":{"type":"string"},"valueId":{"nullable":true,"type":"string"},"valueName":{"nullable":true,"type":"string"}},"required":["fieldId","fieldName","valueId","valueName"],"title":"analyticalProperty","type":"object"},"approval":{"additionalProperties":false,"description":"Detail of the approval workflow — the effective approval chain for this invoice's amount, with its completed, current and upcoming steps. The overall outcome shows in the invoice's `stage`; this object is the breakdown. Only the applicable chain is meant to be returned; while the invoice is pending approval, `current` steps from rules for higher amounts can also appear.","properties":{"autoApprovalReason":{"description":"Not populated yet: always null, even on an auto-approved invoice.","nullable":true,"type":"string"},"isAutoApproved":{"description":"Not populated yet: always false, even on an invoice approved automatically by a rule, so false does not mean approvers approved it.","type":"boolean"},"steps":{"description":"The approval steps in execution order.","items":{"$ref":"#/components/schemas/approvalStep"},"type":"array"}},"required":["isAutoApproved","autoApprovalReason","steps"],"title":"approval","type":"object"},"approvalDecision":{"additionalProperties":false,"description":"Who acted on a step, when, and why. Null on a step until it has been acted on. The outcome (approved vs rejected) is given by the step's `state`.","properties":{"at":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"When the decision was taken."},"byUserId":{"description":"Member who took the decision (the acting approver, i.e. the delegate when delegated).","type":"string"},"reason":{"description":"Optional note left with the decision (e.g. a denial reason). Null when none.","nullable":true,"type":"string"}},"required":["byUserId","at","reason"],"title":"approvalDecision","type":"object"},"approvalStep":{"additionalProperties":false,"description":"One step in the approval chain. Steps are returned in execution order (the array index is the position); each must be approved for the invoice to advance to the next.","properties":{"approvers":{"description":"Members who may act on this step. Usually one; when several are listed, any one of them acting resolves the step.","items":{"$ref":"#/components/schemas/approver"},"minItems":1,"type":"array"},"decision":{"description":"The decision recorded on this step, or null while it is `upcoming`/`current` and on a `notRequired` step.","oneOf":[{"$ref":"#/components/schemas/approvalDecision"},{"type":"null"}]},"state":{"$ref":"#/components/schemas/approvalStepState"}},"required":["state","approvers","decision"],"title":"approvalStep","type":"object"},"approvalStepState":{"description":"State of a single step within the approval chain. \n\n| State | Description |\n| --- | --- |\n| `approved` | This step was approved. |\n| `current` | This step is the one awaiting a decision now. |\n| `upcoming` | A later step, not yet reached. |\n| `rejected` | This step was declined (stops the chain). |\n| `notRequired` | The invoice closed (approved, rejected, cancelled or expired) before this step decided, so nobody waits on it. |","enum":["approved","current","upcoming","rejected","notRequired"],"title":"approvalStepState","type":"string"},"approver":{"additionalProperties":false,"description":"A person entitled to act on an approval step.","properties":{"actingUserId":{"description":"Member acting on the nominal approver's behalf via a delegation. Null when the approval is not delegated (then the acting approver is `userId`).","nullable":true,"type":"string"},"isDelegated":{"description":"Whether this approval is delegated (`actingUserId` differs from `userId`).","type":"boolean"},"type":{"$ref":"#/components/schemas/approverType"},"userId":{"description":"Member who nominally owns this approval slot (e.g. the reporting manager or cost-center owner). For `type: user` this is the directly-assigned approver.","type":"string"}},"required":["type","userId","actingUserId","isDelegated"],"title":"approver","type":"object"},"approverType":{"description":"The role by which a person is entitled to approve a step. \n\n| Type | Description |\n| --- | --- |\n| `reportingManager` | The buyer's reporting manager. |\n| `costCenterOwner` | The owner of the invoice's cost center. |\n| `accountOwner` | The company's account owner. |\n| `user` | A specific named user, assigned directly by an approval rule. |","enum":["reportingManager","costCenterOwner","accountOwner","user"],"title":"approverType","type":"string"},"badRequest":{"additionalProperties":false,"description":"Bad request","properties":{"correlationId":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["BAD_REQUEST_INCORRECT_OR_MISSING_FIELD","RESPONSE_TOO_LARGE"],"type":"string"},"detail":{"type":"string"},"source":{"type":"string"}},"required":["code","detail","source"],"type":"object"},"type":"array"}},"required":["errors"],"title":"badRequest","type":"object"},"bankFee":{"additionalProperties":false,"description":"When money moves via a card being charged or with a wire-transfer, a Settlement is be created. If there were any fees for this transaction, such as FX fees, they will be recorded as a Bank fee. Each item is an append-only entry: a correction adds an entry for the difference, which can be zero or negative, so the amount of a fee is the sum of the amounts of its entries.","properties":{"amount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Amount of the fee, always in wallet currency. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"bankFeeId":{"description":"ID of the bank fee this entry belongs to.","type":"string"},"chargedAt":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"Date and time of this entry: when the bank fee was incurred for its first entry, and when it was corrected for a correction entry."},"currency":{"$ref":"#/components/schemas/currency"},"id":{"description":"ID of this bank fee entry. One bank fee can have several entries; group them with bankFeeId.","type":"string"},"kind":{"description":"`fxFee` refers to fees incurred by a payment in a foreign currency, and `atmFee` refers to fees incurred at an atm, e.g. to withdraw cash.","enum":["fxFee","atmFee","otherFee"],"type":"string"},"settlementId":{"description":"The ID of the Settlement related to this bank fee.","type":"string"}},"required":["id","bankFeeId","kind","amount","currency","chargedAt","settlementId"],"title":"bankFee","type":"object"},"bookkeepingStatus":{"description":"Status of the payable in the Spendesk flow. \n\n| Status | Description |\n| ---|--- |\n| `created` | Payable (approved expense) has been created. There is no accounting or supplier information on the payable in this state. |\n| `prepared` | Payable has been prepared (enriched with accounting and supplier information) by an accountant. |\n| `exported` | Payable has been exported to accounting |\n| `failedExport` | Payable has failed to export to accounting via a native Spendesk integrations |\n| `exportedManually` | Payable has been marked as exported manually by the accountant |\n| `unprepared` | Payable has been sent back to Bookkeep>Prepare |\n\"","enum":["created","prepared","exported","exportedManually","unprepared","failedExport"],"title":"bookkeepingStatus","type":"string"},"bulkCreateSupplierCreatedItem":{"additionalProperties":false,"properties":{"outcome":{"enum":["created"],"type":"string"},"supplier":{"$ref":"#/components/schemas/supplierInfoBase"}},"required":["outcome","supplier"],"title":"bulkCreateSupplierCreatedItem","type":"object"},"bulkCreateSupplierErrorItem":{"additionalProperties":false,"properties":{"details":{},"id":{"type":"string"},"outcome":{"enum":["error"],"type":"string"},"reason":{"type":"string"}},"required":["outcome","reason"],"title":"bulkCreateSupplierErrorItem","type":"object"},"bulkCreateSuppliersResponse":{"additionalProperties":false,"properties":{"items":{"description":"Per-supplier outcome for each create (created or error).","items":{"oneOf":[{"$ref":"#/components/schemas/bulkCreateSupplierCreatedItem"},{"$ref":"#/components/schemas/bulkCreateSupplierErrorItem"}]},"type":"array"}},"required":["items"],"title":"bulkCreateSuppliersResponse","type":"object"},"bulkUpdatePayablesBookkeepingStatusFullSuccess":{"properties":{"updatedPayables":{"description":"List of payables with the update outcome","items":{"$ref":"#/components/schemas/updatePayableBookkeepingStatusSuccess"},"type":"array"}},"required":["updatedPayables"],"title":"bulkUpdatePayablesBookkeepingStatusFullSuccess","type":"object","unevaluatedProperties":false},"bulkUpdatePayablesBookkeepingStatusPartialSuccess":{"properties":{"updatedPayables":{"description":"List of payables with the update outcome","items":{"anyOf":[{"$ref":"#/components/schemas/updatePayableBookkeepingStatusSuccess"},{"$ref":"#/components/schemas/updatePayableBookkeepingStatusFailure"}]},"type":"array"}},"required":["updatedPayables"],"title":"bulkUpdatePayablesBookkeepingStatusPartialSuccess","type":"object","unevaluatedProperties":false},"bulkUpdateSettlementsStateFullSuccess":{"additionalProperties":false,"properties":{"updatedSettlements":{"description":"List of settlements with their update outcomes.","items":{"$ref":"#/components/schemas/updateSettlementStateSuccess"},"type":"array"}},"required":["updatedSettlements"],"title":"bulkUpdateSettlementsStateFullSuccess","type":"object"},"bulkUpdateSettlementsStatePartialSuccess":{"additionalProperties":false,"properties":{"updatedSettlements":{"description":"List of settlements with their update outcomes.","items":{"anyOf":[{"$ref":"#/components/schemas/updateSettlementStateSuccess"},{"$ref":"#/components/schemas/updateSettlementStateFailure"}]},"type":"array"}},"required":["updatedSettlements"],"title":"bulkUpdateSettlementsStatePartialSuccess","type":"object"},"bulkUpdateSupplierErrorItem":{"additionalProperties":false,"properties":{"details":{},"id":{"type":"string"},"outcome":{"enum":["error"],"type":"string"},"reason":{"type":"string"}},"required":["outcome","reason"],"title":"bulkUpdateSupplierErrorItem","type":"object"},"bulkUpdateSupplierSuccessItem":{"additionalProperties":false,"properties":{"outcome":{"enum":["success"],"type":"string"},"supplier":{"additionalProperties":false,"properties":{"id":{"type":"string"}},"required":["id"],"type":"object"}},"required":["outcome","supplier"],"title":"bulkUpdateSupplierSuccessItem","type":"object"},"bulkUpdateSuppliersResponse":{"additionalProperties":false,"properties":{"items":{"description":"Per-supplier outcome for each update.","items":{"oneOf":[{"$ref":"#/components/schemas/bulkUpdateSupplierSuccessItem"},{"$ref":"#/components/schemas/bulkUpdateSupplierErrorItem"}]},"type":"array"}},"required":["items"],"title":"bulkUpdateSuppliersResponse","type":"object"},"buyerRef":{"additionalProperties":false,"description":"The internal Spendesk member the invoice is assigned to — the \"buyer\", i.e. the person the spend is for and who is accountable for it. Distinct from the supplier (the external counterparty). This holds however the invoice was created: a member who submitted it, or the member an automatically-ingested invoice (shared mailbox, API) was assigned to. Name and email may be null for service accounts.","properties":{"email":{"format":"email","nullable":true,"type":"string"},"firstName":{"nullable":true,"type":"string"},"id":{"type":"string"},"lastName":{"nullable":true,"type":"string"}},"required":["id","firstName","lastName","email"],"title":"buyerRef","type":"object"},"conflict":{"additionalProperties":false,"description":"Conflict","properties":{"correlationId":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["CONFLICT_ERROR"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"title":"conflict","type":"object"},"costCenter":{"additionalProperties":false,"properties":{"coOwnerIds":{"description":"IDs of the cost center co-owners (viewers)","items":{"type":"string"},"type":"array"},"id":{"description":"Cost center ID","format":"uuid","type":"string"},"isArchived":{"description":"Whether the cost center is archived (soft-deleted, retained for historical analysis)","type":"boolean"},"name":{"description":"Cost center name","type":"string"},"owner":{"description":"Cost center owner ID","type":"string"}},"required":["id","name","owner","coOwnerIds","isArchived"],"title":"costCenter","type":"object"},"costCenterRef":{"additionalProperties":false,"description":"Reference to a cost center (the internal unit that bears the cost).","properties":{"id":{"description":"Cost-center id. Use `GET /v1/cost-centers` to resolve full details.","type":"string"},"name":{"description":"Cost-center display name.","type":"string"}},"required":["id","name"],"title":"costCenterRef","type":"object"},"createApiKeyBody":{"additionalProperties":false,"properties":{"description":{"default":"","type":"string"},"expiredAt":{"$ref":"#/components/schemas/dateTime"},"name":{"type":"string"},"scope":{"type":"string"}},"required":["name","scope","expiredAt"],"title":"createApiKeyBody","type":"object"},"createIntakeFileUploadBody":{"additionalProperties":false,"properties":{"contentLength":{"description":"Exact size of the file in bytes. The presigned upload rejects a file whose size differs from this value. Maximum: 10485760 (10 MB).","maximum":10485760,"minimum":1,"type":"integer"},"mimeType":{"description":"Media type of the file. Allowed types: application/pdf, image/png, image/jpeg, application/xml, text/xml.","minLength":1,"type":"string"}},"required":["mimeType","contentLength"],"title":"createIntakeFileUploadBody","type":"object"},"createIntakeFileUploadResponse":{"additionalProperties":false,"properties":{"upload":{"additionalProperties":false,"properties":{"expiresAt":{"description":"ISO 8601 timestamp when the presigned URL expires. Create a new upload once it has passed.","type":"string"},"fields":{"additionalProperties":{"type":"string"},"description":"Form fields that must all be sent with the file upload, as multipart/form-data. Send them first, then the file itself as a field named `file`.","type":"object"},"method":{"description":"HTTP method to use when uploading the file.","enum":["POST"],"type":"string"},"url":{"description":"Presigned URL where the file must be uploaded. It points to our storage provider rather than the Spendesk API, so send it no access token.","type":"string"}},"required":["method","url","fields","expiresAt"],"type":"object"},"uploadId":{"description":"Unique identifier for the file upload. Use it to poll the upload status once the file has been sent.","type":"string"}},"required":["uploadId","upload"],"title":"createIntakeFileUploadResponse","type":"object"},"createdUserItem":{"additionalProperties":false,"properties":{"outcome":{"enum":["created"],"type":"string"},"user":{"additionalProperties":false,"properties":{"email":{"type":"string"},"id":{"type":"string"},"status":{"description":"Always `pending` until the user accepts their invitation.","enum":["active","archived","pending"],"type":"string"}},"required":["id","email","status"],"type":"object"}},"required":["outcome","user"],"title":"createdUserItem","type":"object"},"currency":{"description":"If the payment was made in a foreign currency, this amount will be the one in the payment currency. Three-letter [ISO currency codes](https://www.iso.org/iso-4217-currency-codes.html).","pattern":"^[A-Z]{3}$","title":"currency","type":"string"},"currencyTotal":{"additionalProperties":false,"description":"Count and amount totals for the matching invoices in a single currency, including `amountDue`, what is still to pay on them.","properties":{"amountDue":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Sum of what is still to pay on the matching invoices in this currency: for each invoice, its gross amount minus its settled payments and the credit notes deducted from it, floored at 0, and 0 for an invoice already paid."},"count":{"description":"Number of matching invoices denominated in this currency.","type":"integer"},"currency":{"$ref":"#/components/schemas/currency"},"grossAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Sum of `grossAmount` over the matching invoices in this currency."},"netAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Sum of `netAmount` over the matching invoices in this currency. Invoices with a null `netAmount` (older invoices with no recorded net amount, and every credit note) add 0, so this is a lower bound and `grossAmount` minus `netAmount` is not the tax total."}},"required":["currency","count","grossAmount","netAmount","amountDue"],"title":"currencyTotal","type":"object"},"date":{"description":"String containing a date expressed in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format like `2023-05-12`.","format":"date","title":"date","type":"string"},"dateTime":{"description":"String containing a UTC datetime expressed in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format like `2023-05-12T14:06:40Z`.","format":"date-time","title":"dateTime","type":"string"},"documentaryEvidenceStatus":{"description":"Status of the supporting document — the supplier's invoice or credit-note file — that justifies the payable for audit and tax purposes. Only meaningful once the invoice has an accounting payable — the invoice's `documentaryEvidenceStatus` field itself is null for invoices that don't have one yet. \n\n| Status | Description |\n| --- | --- |\n| `provided` | A document is attached. |\n| `missing` | No document is attached yet. |\n| `cannotBeProvided` | The buyer declared that no document can be provided; a signed affidavit stands in its place. |\n| `declaredAsInvalid` | An attached document was reviewed and marked invalid (e.g. wrong file or unreadable). |\n\nCertification/compliance details (e.g. the Spanish \"Digitised Paper Receipt\") are intentionally out of scope of this field and will be exposed via a dedicated compliance field once its format is finalised.","enum":["provided","missing","cannotBeProvided","declaredAsInvalid"],"title":"documentaryEvidenceStatus","type":"string"},"entityUpdateResult":{"description":"Result of an individual entity update attempt","oneOf":[{"additionalProperties":false,"properties":{"id":{"description":"ID of the entity","type":"string"},"result":{"description":"Entity was successfully updated","enum":["updated"],"type":"string"}},"required":["id","result"],"type":"object"},{"additionalProperties":false,"properties":{"id":{"description":"ID of the entity","type":"string"},"reason":{"description":"Reason why the entity was skipped","type":"string"},"result":{"description":"Entity was skipped","enum":["skipped"],"type":"string"}},"required":["id","result","reason"],"type":"object"},{"additionalProperties":false,"properties":{"error":{"$ref":"#/components/schemas/errorDetails"},"id":{"description":"ID of the entity","type":"string"},"reason":{"description":"Reason why the entity update failed","type":"string"},"result":{"description":"Entity update failed","enum":["failed"],"type":"string"}},"required":["id","result","reason","error"],"type":"object"}],"title":"entityUpdateResult"},"errorDetails":{"additionalProperties":false,"description":"Error details object","properties":{"message":{"description":"Error message describing the issue","type":"string"},"name":{"description":"Name of the error","type":"string"}},"title":"errorDetails","type":"object"},"expenseCategoryFieldV2":{"additionalProperties":false,"properties":{"archivedAt":{"description":"ISO 8601 UTC timestamp of when the field was archived, or null.","oneOf":[{"$ref":"#/components/schemas/dateTime"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 UTC timestamp of when the field was created, or null.","oneOf":[{"$ref":"#/components/schemas/dateTime"},{"type":"null"}]},"id":{"description":"The expense category field ID.","type":"string"},"isRequired":{"description":"Whether the field is mandatory.","type":"boolean"},"isSplittable":{"description":"Whether the field is configured as splittable (stored setting). Does not indicate whether analytical split is enabled for the company.","nullable":true,"type":"boolean"},"name":{"description":"The expense category field name.","type":"string"},"updatedAt":{"description":"ISO 8601 UTC timestamp of when the field was last updated, or null.","oneOf":[{"$ref":"#/components/schemas/dateTime"},{"type":"null"}]}},"required":["id","name","isRequired","isSplittable","archivedAt","createdAt","updatedAt"],"title":"expenseCategoryFieldV2","type":"object"},"expenseCategoryFieldV2ByIdParams":{"properties":{"fieldId":{"description":"Expense category field ID.","example":"x__8patkcjpdq7","type":"string"}},"required":["fieldId"],"title":"expenseCategoryFieldV2ByIdParams","type":"object"},"expenseCategoryRef":{"additionalProperties":false,"description":"Reference to an expense category — the customer's spend taxonomy (e.g. Software, Travel, Meals) used for accounting and analytics. Distinct from the cost center (which bears the cost) and from analytical fields (free custom dimensions).","properties":{"id":{"description":"Expense-category id. Use `GET /v1/expense-categories` to resolve full details.","type":"string"},"name":{"description":"Expense-category display name.","type":"string"}},"required":["id","name"],"title":"expenseCategoryRef","type":"object"},"expenseCategoryV2":{"additionalProperties":false,"properties":{"costCenters":{"description":"Cost centers the expense category is restricted to. An empty array means it is available to every cost center, not none.","items":{"additionalProperties":false,"properties":{"id":{"description":"The cost center ID.","type":"string"},"name":{"description":"The cost center name.","type":"string"}},"required":["id","name"],"type":"object"},"type":"array"},"id":{"description":"The expense category ID.","type":"string"},"isArchived":{"description":"Whether the expense category is archived.","type":"boolean"},"name":{"description":"The expense category name.","type":"string"}},"required":["id","name","isArchived","costCenters"],"title":"expenseCategoryV2","type":"object"},"expenseCategoryV2ByIdParams":{"properties":{"categoryId":{"description":"Expense category ID.","example":"x__vw4d0eb1t5c","type":"string"},"fieldId":{"description":"Expense category field ID.","example":"x__8patkcjpdq7","type":"string"}},"required":["fieldId","categoryId"],"title":"expenseCategoryV2ByIdParams","type":"object"},"expenseCategoryV2CursorPagination":{"additionalProperties":false,"description":"Forward-only cursor pagination metadata.","properties":{"hasNextPage":{"description":"Whether a further page exists. Equivalent to `nextCursor !== null`.","type":"boolean"},"limit":{"description":"Maximum number of categories requested for this page.","maximum":1000,"minimum":1,"type":"integer"},"nextCursor":{"description":"Cursor to pass as `cursor` to fetch the next page, or null on the last page.","type":["null","string"]},"nextUrl":{"description":"Ready-to-follow URL for the next page (same filters + `cursor`), or null.","type":["null","string"]}},"required":["limit","hasNextPage","nextCursor","nextUrl"],"title":"expenseCategoryV2CursorPagination","type":"object"},"expenseCategoryV2Meta":{"additionalProperties":false,"properties":{"pagination":{"$ref":"#/components/schemas/expenseCategoryV2CursorPagination"}},"required":["pagination"],"title":"expenseCategoryV2Meta","type":"object"},"expenseCategoryV2Query":{"properties":{"cursor":{"description":"Opaque pagination cursor returned as `meta.pagination.nextCursor` by a previous call. Omit to fetch the first page.","type":"string"},"limit":{"default":30,"description":"Maximum number of categories to return.","maximum":1000,"minimum":1,"type":"integer"}},"title":"expenseCategoryV2Query","type":"object","unevaluatedProperties":false},"exportFailed":{"additionalProperties":false,"description":"Unprocessable Entity","properties":{"correlationId":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["EXPORT_FAILED"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"title":"exportFailed","type":"object"},"exportStatus":{"description":"Accounting-export state — whether the invoice has been exported to the customer's accounting system or ERP. Independent of `stage` and `paymentStatus`. The ledger posting date is `accountingDate`; the export timestamp is `exportedAt`. Only meaningful once the invoice has an accounting payable — the invoice's `exportStatus` field itself is null for invoices that don't have one yet. \n\n| Status | Description |\n| --- | --- |\n| `pending` | Not yet exported. |\n| `exported` | Successfully exported to the accounting system. |\n| `failed` | An export attempt failed and needs attention. |","enum":["pending","exported","failed"],"title":"exportStatus","type":"string"},"forbidden":{"additionalProperties":false,"description":"Forbidden","properties":{"correlationId":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["FORBIDDEN_ERROR"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"title":"forbidden","type":"object"},"forbiddenControllerRoleRequired":{"additionalProperties":false,"description":"Forbidden","properties":{"correlationId":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["FORBIDDEN_ERROR","CONTROLLER_ROLE_REQUIRED"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"title":"forbiddenControllerRoleRequired","type":"object"},"getIntakeFileUploadStatusParams":{"additionalProperties":false,"properties":{"companyId":{"description":"The company ID.","type":"string"},"uploadId":{"description":"The upload ID.","type":"string"}},"required":["companyId","uploadId"],"title":"getIntakeFileUploadStatusParams","type":"object"},"getIntakeFileUploadStatusResponse":{"oneOf":[{"additionalProperties":false,"properties":{"status":{"enum":["pending"],"type":"string"},"uploadId":{"type":"string"}},"required":["status","uploadId"],"type":"object"},{"additionalProperties":false,"properties":{"documentId":{"description":"ID of the processed document. Pass it as `documentId` when creating an intake.","type":"string"},"status":{"enum":["ready"],"type":"string"},"uploadId":{"type":"string"}},"required":["status","uploadId","documentId"],"type":"object"},{"additionalProperties":false,"properties":{"reason":{"description":"Why the file could not be processed.","type":"string"},"status":{"enum":["failed"],"type":"string"},"uploadId":{"type":"string"}},"required":["status","uploadId","reason"],"type":"object"}],"title":"getIntakeFileUploadStatusResponse"},"intake":{"additionalProperties":false,"description":"Full representation of an intake, returned by the detail endpoint. A superset of `intakeSummary`, adding the received documents and line items.","properties":{"appUrl":{"description":"Link to this intake in the Spendesk invoice inbox.","example":"https://app.spendesk.com/app/RRbRgeIB7X/requests/inbox/shared/d967b168-0fad-5310-bf96-ca1858ff7da2","type":"string"},"assigneeId":{"description":"Id of the member the intake is assigned to — the person expected to complete and submit it. An id, not a name: resolve it with [Get Users](/reference/v1-get-users), which needs the `user:read` scope in addition to the intake read scope. Null while unassigned.","nullable":true,"type":"string"},"companyId":{"description":"Id of the company entity that received the document.","type":"string"},"correctsIntakeId":{"description":"For a corrective document (e.g. a credit note cancelling or amending an earlier invoice): id of the intake it corrects. Null otherwise.","nullable":true,"type":"string"},"createdAt":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"When the intake was received by Spendesk (ingestion time, not `issueDate`)."},"creditNoteNumber":{"description":"The supplier's credit-note number as printed on the document. Null if not captured or the document is not a credit note.","nullable":true,"type":"string"},"currency":{"description":"Currency the document is denominated in. Null until captured, and also null when the captured value is not a three-letter code.","oneOf":[{"$ref":"#/components/schemas/currency"},{"type":"null"}]},"documents":{"description":"Files received as part of the intake. Empty when no file is available. Download links are short-lived — see `downloadUrl`.","items":{"$ref":"#/components/schemas/intakeDocument"},"type":"array"},"dueDate":{"description":"Date by which the document must be paid, per the supplier's payment terms. Null until captured or when no due date applies.","oneOf":[{"$ref":"#/components/schemas/date"},{"type":"null"}]},"grossAmount":{"description":"Total amount including tax, in `currency`'s smallest unit. Null until captured, and also null, even once captured, whenever `currency` is null or a code Spendesk does not support.","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"id":{"$ref":"#/components/schemas/intakeId"},"invoiceNumber":{"description":"The supplier's invoice number as printed on the document. Null if not captured or the document is not an invoice.","example":"FA17273","nullable":true,"type":"string"},"issueDate":{"description":"Date the supplier issued the document, as printed on it (emission date). Null until captured.","oneOf":[{"$ref":"#/components/schemas/date"},{"type":"null"}]},"lineItems":{"description":"Lines of the invoice, when any are held. Null when none were extracted or supplied, and always null on receipts and on e-invoiced intakes (`source` `eInvoice`): line items are only held for invoices and credit notes received by email or API, so a null there does not mean the document has no lines. Only the detail endpoint returns these — a full page of them would be too large.","items":{"$ref":"#/components/schemas/intakeLineItem"},"type":["null","array"]},"lineItemsSource":{"description":"How the line items were obtained. Null when none are held, or when they predate this field being recorded.","enum":["ocr","facturX","eInvoice","api","userEdited",null],"type":["null","string"]},"netAmount":{"description":"Total amount before tax, in `currency`'s smallest unit. Null until captured, and also null, even once captured, whenever `currency` is null or a code Spendesk does not support.","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"netPayableAmount":{"description":"Amount actually left to pay the supplier after deductions recorded on the document (e.g. an advance already paid, or an applied credit note), in `currency`'s smallest unit. Equals `grossAmount` when there are none. Only ever populated for intakes ingested through e-invoicing: it is always null for intakes created through this API and for intakes forwarded by email, where the null is permanent rather than capture-pending.","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"payableId":{"description":"Id of the accounting payable the intake ultimately produced, resolvable via the payables API. Null whenever none is known, which is common even at `stage: processed` — that stage also holds refused and deleted intakes, which never produce one. On [List intakes](/reference/v2-list-company-intakes) a null is \"unknown\" rather than \"none\"; [Get an intake](/reference/v2-get-company-intake) is authoritative, except at `status: auto_linked` or `manually_linked`, where it is always null because a linked receipt carries no request.","example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","format":"uuid","nullable":true,"pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"purchaseOrderId":{"description":"Id of the purchase order the intake is matched against. Null when none.","nullable":true,"type":"string"},"resultingDocument":{"description":"The document the intake produced or was linked to. Null while the intake is in progress, and stays null for an intake that ends `refused` or `deleted` without producing one. Always null at `status: processed`, which records a controller clearing the to-process queue rather than a document being produced. A null can also mean the lookup failed rather than that none exists, on both List intakes and Get an intake.","oneOf":[{"$ref":"#/components/schemas/intakeResultingDocument"},{"type":"null"}]},"source":{"description":"How the document reached Spendesk, or null when not recorded.","oneOf":[{"$ref":"#/components/schemas/intakeSource"},{"type":"null"}]},"stage":{"$ref":"#/components/schemas/intakeStage"},"status":{"$ref":"#/components/schemas/intakeStatus"},"supplier":{"description":"The supplier that issued the document. Null when no supplier has been identified yet.","oneOf":[{"$ref":"#/components/schemas/intakeSupplier"},{"type":"null"}]},"type":{"$ref":"#/components/schemas/intakeType"},"updatedAt":{"description":"When any field on the intake last changed. Null when never updated.","oneOf":[{"$ref":"#/components/schemas/dateTime"},{"type":"null"}]}},"required":["id","companyId","type","source","status","stage","supplier","assigneeId","invoiceNumber","creditNoteNumber","currency","grossAmount","netAmount","netPayableAmount","issueDate","dueDate","resultingDocument","payableId","purchaseOrderId","correctsIntakeId","appUrl","createdAt","updatedAt","documents","lineItems","lineItemsSource"],"title":"intake","type":"object"},"intakeDocument":{"additionalProperties":false,"description":"A file received as part of the intake (the invoice, credit note or receipt itself, or a companion file). Unlike invoice attachments, documents carry no `id` — the underlying storage exposes no stable per-file identifier.","properties":{"downloadUrl":{"description":"Time-limited pre-signed URL to download the file. Expires at most 3 hours after the response is issued — download promptly and do not persist the URL (re-fetch the intake for a fresh one).","format":"uri","type":"string"},"fileName":{"description":"Filename of the document, and the name it saves as when downloaded via `downloadUrl`. This is the original filename when one was captured at ingestion; otherwise a generated identifier with an extension derived from the mime type. Not guaranteed unique within this array.","type":"string"},"mimeType":{"description":"MIME type of the file (e.g. `application/pdf`, `application/xml` for e-invoices).","example":"application/pdf","type":"string"}},"required":["fileName","mimeType","downloadUrl"],"title":"intakeDocument","type":"object"},"intakeId":{"description":"Opaque unique identifier of an intake.","example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","title":"intakeId","type":"string"},"intakeLineItem":{"additionalProperties":false,"description":"A single line of the invoice. Amounts are decimals in the intake's `currency`, not minor units, because they are transcribed as they appear on the document.","properties":{"description":{"description":"Line description.","type":"string"},"quantity":{"description":"Quantity.","type":["null","number"]},"taxAmount":{"description":"Tax amount.","type":["null","number"]},"taxRate":{"description":"Tax rate, as a percentage between 0 and 100.","type":["null","number"]},"totalAmountWithoutTax":{"description":"Line total, excluding tax.","type":["null","number"]},"unitPriceWithoutTax":{"description":"Unit price, excluding tax.","type":["null","number"]}},"required":["description"],"title":"intakeLineItem","type":"object"},"intakeResultingDocument":{"additionalProperties":false,"description":"The document the intake produced or was linked to once processing completed. Use `type` to pick the API to resolve `id` against. `invoice` and `creditNote` ids both resolve through the invoice detail endpoint, which returns credit notes with `type` `creditNote`; a `creditNote` id can occasionally return 404 — then list credit notes on the invoices endpoint with `type` `creditNote`.","properties":{"id":{"description":"Id of the resulting document.","type":"string"},"type":{"description":"Kind of resulting document. \n\n| Type | Description |\n| --- | --- |\n| `invoice` | A supplier invoice to pay. |\n| `creditNote` | A supplier credit note. |\n| `expenseClaim` | An employee expense claim. |\n| `cardPayment` | An existing card payment the document was attached to as its receipt. |","enum":["invoice","creditNote","expenseClaim","cardPayment"],"type":"string"}},"required":["type","id"],"title":"intakeResultingDocument","type":"object"},"intakeSource":{"description":"How the document reached Spendesk. \n\n| Source | Description |\n| --- | --- |\n| `eInvoice` | Delivered through an e-invoicing network (e.g. Peppol or a French PDP). |\n| `email` | Sent or forwarded to the company's invoice inbox email address. |\n| `api` | Created programmatically via this API. |","enum":["eInvoice","email","api"],"title":"intakeSource","type":"string"},"intakeStage":{"description":"Coarse lifecycle stage of the intake, derived from `status`. \n\n| Stage | Statuses | Description |\n| --- | --- | --- |\n| `inInbox` | `received`, `assigned`, `disputed`, `assignation_rejected`, `supplier_disputed`, `validating` | Awaiting action in the invoice inbox, or submitted and still under review. |\n| `linked` | `auto_linked`, `manually_linked` | Done — it was attached to an existing document as its receipt (see `resultingDocument`). |\n| `processed` | `validated`, `refused`, `deleted`, `processed` | Terminal — it was refused, deleted, or finished processing (see `resultingDocument`; status `processed` itself never sets one). |","enum":["inInbox","linked","processed"],"title":"intakeStage","type":"string"},"intakeStatus":{"description":"Fine-grained processing status of the intake — the raw underlying status values, exposed verbatim (hence the snake_case). For most integrations the coarser `stage` is easier to work with. \n\n| Status | Description |\n| --- | --- |\n| `received` | Landed in the invoice inbox, not yet assigned to a member. |\n| `assigned` | Assigned to a member (see `assigneeId`) who must complete and submit it. |\n| `supplier_disputed` | The intake was contested with the supplier and awaits their response. |\n| `assignation_rejected` | The assignee rejected the assignment; the intake is back in the inbox for reassignment. |\n| `disputed` | Legacy predecessor of `assignation_rejected`; may still appear on historical records. |\n| `validating` | Submitted and going through review. |\n| `validated` | Review complete; about to produce its resulting document. |\n| `processed` | Done — a controller cleared it from the to-process queue (e-invoicing only); it does not produce a document, so `resultingDocument` is always null. |\n| `auto_linked` | Done — automatically matched and attached to an existing document. |\n| `manually_linked` | Done — manually attached to an existing document. |\n| `refused` | Rejected by the company; it will not be processed. |\n| `deleted` | Removed from the inbox. |\n\nNew statuses may be added over time — treat unknown values defensively.","enum":["received","assigned","disputed","refused","deleted","validating","validated","processed","auto_linked","manually_linked","assignation_rejected","supplier_disputed"],"title":"intakeStatus","type":"string"},"intakeSummary":{"additionalProperties":false,"description":"A received supplier document (invoice, credit note or receipt) being reviewed and processed — compact representation returned by the list endpoint. Fields extracted from the document (amounts, dates, numbers, supplier) are null until captured. New fields may be added over time.","properties":{"appUrl":{"description":"Link to this intake in the Spendesk invoice inbox.","example":"https://app.spendesk.com/app/RRbRgeIB7X/requests/inbox/shared/d967b168-0fad-5310-bf96-ca1858ff7da2","type":"string"},"assigneeId":{"description":"Id of the member the intake is assigned to — the person expected to complete and submit it. An id, not a name: resolve it with [Get Users](/reference/v1-get-users), which needs the `user:read` scope in addition to the intake read scope. Null while unassigned.","nullable":true,"type":"string"},"companyId":{"description":"Id of the company entity that received the document.","type":"string"},"correctsIntakeId":{"description":"For a corrective document (e.g. a credit note cancelling or amending an earlier invoice): id of the intake it corrects. Null otherwise.","nullable":true,"type":"string"},"createdAt":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"When the intake was received by Spendesk (ingestion time, not `issueDate`)."},"creditNoteNumber":{"description":"The supplier's credit-note number as printed on the document. Null if not captured or the document is not a credit note.","nullable":true,"type":"string"},"currency":{"description":"Currency the document is denominated in. Null until captured, and also null when the captured value is not a three-letter code.","oneOf":[{"$ref":"#/components/schemas/currency"},{"type":"null"}]},"dueDate":{"description":"Date by which the document must be paid, per the supplier's payment terms. Null until captured or when no due date applies.","oneOf":[{"$ref":"#/components/schemas/date"},{"type":"null"}]},"grossAmount":{"description":"Total amount including tax, in `currency`'s smallest unit. Null until captured, and also null, even once captured, whenever `currency` is null or a code Spendesk does not support.","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"id":{"$ref":"#/components/schemas/intakeId"},"invoiceNumber":{"description":"The supplier's invoice number as printed on the document. Null if not captured or the document is not an invoice.","example":"FA17273","nullable":true,"type":"string"},"issueDate":{"description":"Date the supplier issued the document, as printed on it (emission date). Null until captured.","oneOf":[{"$ref":"#/components/schemas/date"},{"type":"null"}]},"netAmount":{"description":"Total amount before tax, in `currency`'s smallest unit. Null until captured, and also null, even once captured, whenever `currency` is null or a code Spendesk does not support.","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"netPayableAmount":{"description":"Amount actually left to pay the supplier after deductions recorded on the document (e.g. an advance already paid, or an applied credit note), in `currency`'s smallest unit. Equals `grossAmount` when there are none. Only ever populated for intakes ingested through e-invoicing: it is always null for intakes created through this API and for intakes forwarded by email, where the null is permanent rather than capture-pending.","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"payableId":{"description":"Id of the accounting payable the intake ultimately produced, resolvable via the payables API. Null whenever none is known, which is common even at `stage: processed` — that stage also holds refused and deleted intakes, which never produce one. On [List intakes](/reference/v2-list-company-intakes) a null is \"unknown\" rather than \"none\"; [Get an intake](/reference/v2-get-company-intake) is authoritative, except at `status: auto_linked` or `manually_linked`, where it is always null because a linked receipt carries no request.","example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","format":"uuid","nullable":true,"pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"purchaseOrderId":{"description":"Id of the purchase order the intake is matched against. Null when none.","nullable":true,"type":"string"},"resultingDocument":{"description":"The document the intake produced or was linked to. Null while the intake is in progress, and stays null for an intake that ends `refused` or `deleted` without producing one. Always null at `status: processed`, which records a controller clearing the to-process queue rather than a document being produced. A null can also mean the lookup failed rather than that none exists, on both List intakes and Get an intake.","oneOf":[{"$ref":"#/components/schemas/intakeResultingDocument"},{"type":"null"}]},"source":{"description":"How the document reached Spendesk, or null when not recorded.","oneOf":[{"$ref":"#/components/schemas/intakeSource"},{"type":"null"}]},"stage":{"$ref":"#/components/schemas/intakeStage"},"status":{"$ref":"#/components/schemas/intakeStatus"},"supplier":{"description":"The supplier that issued the document. Null when no supplier has been identified yet.","oneOf":[{"$ref":"#/components/schemas/intakeSupplier"},{"type":"null"}]},"type":{"$ref":"#/components/schemas/intakeType"},"updatedAt":{"description":"When any field on the intake last changed. Null when never updated.","oneOf":[{"$ref":"#/components/schemas/dateTime"},{"type":"null"}]}},"required":["id","companyId","type","source","status","stage","supplier","assigneeId","invoiceNumber","creditNoteNumber","currency","grossAmount","netAmount","netPayableAmount","issueDate","dueDate","resultingDocument","payableId","purchaseOrderId","correctsIntakeId","appUrl","createdAt","updatedAt"],"title":"intakeSummary","type":"object"},"intakeSupplier":{"additionalProperties":false,"description":"The supplier (counterparty) that issued the document, as identified on the intake. `id` and `name` are independently nullable — the object may be present with either field null.","properties":{"id":{"description":"Supplier id, resolvable via `GET /v1/suppliers/{id}`. Null when the supplier named on the document has not been matched to a supplier record yet.","nullable":true,"type":"string"},"name":{"description":"Supplier name as identified on the document. Null when no name has been captured yet.","nullable":true,"type":"string"}},"required":["id","name"],"title":"intakeSupplier","type":"object"},"intakeType":{"description":"Kind of document the intake carries. \n\n| Type | Description |\n| --- | --- |\n| `invoice` | A supplier invoice: an amount the company owes the supplier for goods or services. |\n| `creditNote` | A supplier credit note: a document that reduces an amount owed to the supplier (a refund, cancellation, or correction of a prior invoice). |\n| `receipt` | A receipt for a payment already made (e.g. a card payment), to be linked to that payment as documentary evidence. |\n\nForwarded documents are folded into their base type — a forwarded invoice is `invoice` and a forwarded credit note is `creditNote`; how the document arrived is expressed by `source`.","enum":["invoice","creditNote","receipt"],"title":"intakeType","type":"string"},"intakesCursorPagination":{"additionalProperties":false,"description":"Forward-only cursor pagination metadata.","properties":{"hasNextPage":{"description":"Whether more results exist after this page. Convenience for `nextCursor != null`.","type":"boolean"},"limit":{"description":"Page size that was applied.","maximum":100,"minimum":1,"type":"integer"},"nextCursor":{"description":"Cursor for the next page, or null when there are no more results.","type":["null","string"]},"nextUrl":{"description":"Ready-to-follow URL for the next page (same filters + `cursor`), or null.","format":"uri","type":["null","string"]}},"required":["limit","hasNextPage","nextCursor","nextUrl"],"title":"intakesCursorPagination","type":"object"},"intakesFileUploadParams":{"additionalProperties":false,"properties":{"companyId":{"description":"The company ID.","type":"string"}},"required":["companyId"],"title":"intakesFileUploadParams","type":"object"},"intakesListQuery":{"additionalProperties":false,"properties":{"createdAfter":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"Only intakes with `createdAt` at or after this instant. An ISO 8601 date-time, e.g. `2026-08-01T09:30:00Z` — not a plain `YYYY-MM-DD`.","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:[0-5]\\d(\\.\\d+)?(Z|[+-]\\d{2}:?\\d{2})$","type":"string"},"createdBefore":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"Only intakes with `createdAt` at or before this instant. An ISO 8601 date-time, e.g. `2026-08-31T23:59:59Z` — not a plain `YYYY-MM-DD`.","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:[0-5]\\d(\\.\\d+)?(Z|[+-]\\d{2}:?\\d{2})$","type":"string"},"cursor":{"description":"Opaque pagination cursor returned as `meta.pagination.nextCursor` by a previous call. Omit to fetch the first page.","type":"string"},"dueAfter":{"allOf":[{"$ref":"#/components/schemas/date"}],"description":"Only intakes with `dueDate` on or after this date. A calendar date, `YYYY-MM-DD`, e.g. `2026-08-01` — not a date-time."},"dueBefore":{"allOf":[{"$ref":"#/components/schemas/date"}],"description":"Only intakes with `dueDate` on or before this date, the whole day included. A calendar date, `YYYY-MM-DD`, e.g. `2026-08-31` — not a date-time."},"ids":{"description":"Fetch a known set of intakes by id.","items":{"$ref":"#/components/schemas/intakeId"},"maxItems":50,"type":"array"},"issuedAfter":{"allOf":[{"$ref":"#/components/schemas/date"}],"description":"Only intakes with `issueDate` on or after this date. A calendar date, `YYYY-MM-DD`, e.g. `2026-08-01` — not a date-time."},"issuedBefore":{"allOf":[{"$ref":"#/components/schemas/date"}],"description":"Only intakes with `issueDate` on or before this date, the whole day included. A calendar date, `YYYY-MM-DD`, e.g. `2026-08-31` — not a date-time."},"limit":{"default":20,"description":"Maximum number of intakes to return in one page.","maximum":100,"minimum":1,"type":"integer"},"stage":{"description":"Filter by lifecycle stage. Each stage matches its underlying statuses (see `stage`). Combined with `status` the two filters intersect.","items":{"$ref":"#/components/schemas/intakeStage"},"type":"array"},"status":{"description":"Filter by fine-grained status.","items":{"$ref":"#/components/schemas/intakeStatus"},"type":"array"},"updatedAfter":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"Only intakes with `updatedAt` at or after this instant. An ISO 8601 date-time, e.g. `2026-08-01T09:30:00Z` — not a plain `YYYY-MM-DD`.","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:[0-5]\\d(\\.\\d+)?(Z|[+-]\\d{2}:?\\d{2})$","type":"string"},"updatedBefore":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"Only intakes with `updatedAt` at or before this instant. An ISO 8601 date-time, e.g. `2026-08-31T23:59:59Z` — not a plain `YYYY-MM-DD`.","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:[0-5]\\d(\\.\\d+)?(Z|[+-]\\d{2}:?\\d{2})$","type":"string"}},"title":"intakesListQuery","type":"object"},"intakesMeta":{"additionalProperties":false,"description":"Meta object describing the intake list pagination.","properties":{"pagination":{"$ref":"#/components/schemas/intakesCursorPagination"}},"required":["pagination"],"title":"intakesMeta","type":"object"},"internalServerError":{"additionalProperties":false,"description":"Internal Server Error","properties":{"correlationId":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["INTERNAL_SERVER_ERROR"],"type":"string"},"detail":{"enum":["Sorry, something has gone wrong at our end. If this persists please contact support."],"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"title":"internalServerError","type":"object"},"invoice":{"additionalProperties":false,"description":"Full representation of an invoice, returned by the detail endpoint. A superset of `invoiceSummary`, adding line items, the tax breakdown, currency conversion (FX), the payment history, the approval chain, accounting links, attachments and custom fields.","properties":{"accountingDate":{"description":"Posting date — the date the invoice is booked in the accounting ledger, which fixes the fiscal period it falls into. May differ from `issueDate`. Null until the invoice has an accounting payable (see `payableId`). Not the export date; see `exportedAt`.","oneOf":[{"$ref":"#/components/schemas/date"},{"type":"null"}]},"amountDue":{"description":"Outstanding balance still to be settled (`grossAmount` minus `amountPaid` minus any credit notes deducted from the invoice, floored at 0), in `currency`'s smallest unit. Zero when fully paid, including when the invoice is marked paid. On credit notes it equals their negative `grossAmount`. Null when `grossAmount` is not known yet (draft/incomplete).","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"amountPaid":{"description":"Amount settled so far, in `currency`'s smallest unit: Spendesk's stored total of settled payments in the invoice `currency`, not a sum of `payments` (returned payments and payments in another currency are excluded, and a transfer returned late can leave a negative `paid` row that this total ignores). When `payments` is empty, it comes from the stored payment status instead: `grossAmount` if `paid`, otherwise 0 (even when `partiallyPaid`). Always 0 on credit notes, which have no stored payment status and never aggregate `payments`. When `grossAmount` is not known yet, it is null if it comes from the stored status (empty `payments`, or a credit note), but still comes from the stored total when `payments` are recorded.","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"analyticalSplits":{"description":"Allocation of the invoice total across cost centers and analytical-field values. Empty when the invoice is not split. Set independently of `costCenter`, so a split can name a different cost center.","items":{"$ref":"#/components/schemas/invoiceAnalyticalSplit"},"type":"array"},"approval":{"$ref":"#/components/schemas/approval"},"attachments":{"description":"Supporting files. Any without a download link is omitted, so may be partial.","items":{"$ref":"#/components/schemas/invoiceAttachment"},"type":"array"},"buyer":{"description":"The internal member the invoice is assigned to (the buyer), or null.","oneOf":[{"$ref":"#/components/schemas/buyerRef"},{"type":"null"}]},"cancelledAt":{"description":"When the invoice was cancelled/voided, or null if it is still active.","oneOf":[{"$ref":"#/components/schemas/dateTime"},{"type":"null"}]},"costCenter":{"description":"Cost center the invoice is coded to, or null when none is set. Set independently of `analyticalSplits`: the two are not reconciled and can disagree.","oneOf":[{"$ref":"#/components/schemas/costCenterRef"},{"type":"null"}]},"createdAt":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"When the invoice record was created in Spendesk (ingest/submission time, not the issue date)."},"currency":{"description":"Null only on a draft (`stage` `pendingApproval`) with no currency set yet. Every amount on the invoice is then null too, because an amount can't be stated without its currency.","oneOf":[{"$ref":"#/components/schemas/currency"},{"type":"null"}]},"description":{"description":"Free-text description/purpose of the invoice.","nullable":true,"type":"string"},"dispute":{"description":"Always null today, even if disputed (`stage` then shows `disputed`).","oneOf":[{"$ref":"#/components/schemas/invoiceDispute"},{"type":"null"}]},"documentaryEvidenceStatus":{"description":"Null until the invoice has an accounting payable (see `payableId`) — there is nothing to attach evidence to yet for an invoice pending approval.","oneOf":[{"$ref":"#/components/schemas/documentaryEvidenceStatus"},{"type":"null"}]},"dueDate":{"description":"Date by which the invoice must be paid, per the supplier's payment terms. Null when no due date is known.","oneOf":[{"$ref":"#/components/schemas/date"},{"type":"null"}]},"expenseCategories":{"description":"Expense categories the invoice is coded to, sorted by name. Empty when none is set. A split invoice can carry several, one per split. These ids are the ones the `expenseCategoryId` filter matches. Only the company's current expense-category field counts: if it is changed or removed, past invoices follow the new setting. A deleted category still shows on the invoices coded to it.","items":{"$ref":"#/components/schemas/expenseCategoryRef"},"type":"array"},"exportStatus":{"description":"Null until the invoice has an accounting payable (see `payableId`) — an invoice pending approval has nothing to export yet, which is distinct from `pending` (a payable exists but hasn't been exported).","oneOf":[{"$ref":"#/components/schemas/exportStatus"},{"type":"null"}]},"exportedAt":{"description":"When the invoice was exported to the accounting system, or null if not exported.","oneOf":[{"$ref":"#/components/schemas/dateTime"},{"type":"null"}]},"functionalAmount":{"description":"`grossAmount` converted into the company entity's functional currency, in that currency's smallest unit. For accounting/reporting only — the supplier is paid `grossAmount` in `currency`, not this. Equal to `grossAmount` when the invoice is already in the functional currency. Null until the invoice has an accounting payable (see `payableId`) — this is not known before then, regardless of currency.","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"functionalCurrency":{"description":"The company entity's functional currency — its primary currency for accounting and reporting. Equals `currency` when no conversion is needed. Null until the invoice has an accounting payable (see `payableId`).","oneOf":[{"$ref":"#/components/schemas/currency"},{"type":"null"}]},"functionalExchangeRate":{"description":"Rate used to convert `currency` into `functionalCurrency`, applied as `functionalAmount` is approximately `grossAmount x functionalExchangeRate`. 1 when both currencies match. Null until the invoice has an accounting payable (see `payableId`).","nullable":true,"type":"number"},"grossAmount":{"description":"Total amount including tax (`netAmount` + `taxAmount`), in `currency`'s smallest unit. Positive for invoices (owed to the supplier); negative for credit notes (owed to the company). Null when the invoice has no gross amount yet (draft/incomplete).","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"id":{"$ref":"#/components/schemas/invoiceId"},"invoiceNumber":{"description":"Supplier's invoice/credit-note number. Null if not captured.","example":"FA17273","nullable":true,"type":"string"},"issueDate":{"description":"Date the supplier issued the invoice, as printed on the document (emission date). Null only on a draft (`stage` `pendingApproval`) with no issue date set yet.","oneOf":[{"$ref":"#/components/schemas/date"},{"type":"null"}]},"lineItems":{"description":"The invoice's line items — always at least one. A non-itemised invoice is represented as a single line covering the whole amount. Lines carry no accounting coding (see `costCenter` and `analyticalSplits`); line `netAmount`/`taxAmount` sum to the header totals, except when the header total itself is null (draft/incomplete) while real captured line items exist.","items":{"$ref":"#/components/schemas/lineItem"},"minItems":1,"type":"array"},"netAmount":{"description":"Total before tax, in `currency`'s smallest unit. Can be null in any state, not only draft/incomplete: always for credit notes, and for older invoices whose net amount was never recorded.","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"payableId":{"description":"Id of the accounting payable this invoice produced, resolvable via the payables API. Null until the invoice has passed approval/controller validation and a payable has been created — not merely \"not yet booked\" in the accounting sense. One invoice maps to exactly one payable — line items and cost/analytical splits are allocations within that payable, not separate payables; a credit note is a separate document with its own payable.","example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","format":"uuid","nullable":true,"pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"paymentStatus":{"$ref":"#/components/schemas/paymentStatus"},"payments":{"description":"The payment history/plan. Empty until payments exist, and for older invoices not yet backfilled. `paymentStatus` and `amountPaid` aggregate these entries, except when this array is empty, where they come from the stored payment status (`amountDue` also deducts credit notes applied to the invoice), and on credit notes, which have no stored payment status and always report `unpaid`.","items":{"$ref":"#/components/schemas/payment"},"type":"array"},"purchaseOrders":{"description":"Purchase orders this invoice is matched against (two/three-way match). Empty when the invoice references no PO. May hold several when one invoice consolidates multiple POs.","items":{"$ref":"#/components/schemas/purchaseOrderRef"},"type":"array"},"review":{"description":"Finance/controller review, or null if none has been recorded.","oneOf":[{"$ref":"#/components/schemas/review"},{"type":"null"}]},"stage":{"$ref":"#/components/schemas/invoiceStage"},"supplier":{"description":"Null only on a draft (`stage` `pendingApproval`) with no supplier set yet.","oneOf":[{"$ref":"#/components/schemas/supplierRef"},{"type":"null"}]},"taxAmount":{"description":"Total tax, in `currency`'s smallest unit, derived as `grossAmount - netAmount` (not summed from `lineItems`). For the tax-by-rate breakdown (VAT-return view), group the line items by `taxRate`. Null whenever `netAmount` or `grossAmount` is null, so in any state for credit notes and older invoices with no recorded net amount.","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"type":{"$ref":"#/components/schemas/invoiceType"},"updatedAt":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"When any field on the invoice record last changed."}},"required":["id","invoiceNumber","type","description","stage","paymentStatus","exportStatus","dispute","cancelledAt","supplier","purchaseOrders","buyer","costCenter","analyticalSplits","expenseCategories","lineItems","netAmount","taxAmount","grossAmount","amountPaid","amountDue","currency","functionalAmount","functionalCurrency","functionalExchangeRate","issueDate","dueDate","accountingDate","payments","approval","review","exportedAt","documentaryEvidenceStatus","payableId","attachments","createdAt","updatedAt"],"title":"invoice","type":"object"},"invoiceAnalyticalSplit":{"additionalProperties":false,"description":"One allocation of the whole invoice to a cost center and/or analytical-field values, as a share of its total. Splits apply to the invoice as a whole, not to individual line items.","properties":{"analyticalProperties":{"description":"Analytical-field values set on this split.","items":{"$ref":"#/components/schemas/analyticalProperty"},"type":"array"},"costCenter":{"description":"Cost center this share is allocated to, or null when the split only sets analytical-field values.","oneOf":[{"$ref":"#/components/schemas/costCenterRef"},{"type":"null"}]},"percentage":{"description":"Percentage of the invoice allocated to this split, from 0 to 100 (e.g. `25` means 25%). The splits of an invoice add up to 100.","example":25,"type":"number"}},"required":["costCenter","percentage","analyticalProperties"],"title":"invoiceAnalyticalSplit","type":"object"},"invoiceAttachment":{"additionalProperties":false,"description":"A file supporting the invoice (documentary evidence). An invoice may have several.","properties":{"downloadUrl":{"description":"Pre-signed URL to download the file, valid for at most 3 hours from when it was generated. Invoice responses are cached, so a re-fetch shortly after may return the same URL — download promptly and do not persist it.","format":"uri","type":"string"},"fileName":{"type":"string"},"id":{"type":"string"},"mimeType":{"description":"MIME type of the file (e.g. `application/pdf`, `application/xml` for e-invoices).","example":"application/pdf","type":"string"}},"required":["id","fileName","mimeType","downloadUrl"],"title":"invoiceAttachment","type":"object"},"invoiceDispute":{"additionalProperties":false,"description":"Details of a dispute on the invoice (contested amount, duplicate, goods/services not received, quality issue…), overlaying whatever approval/payment state the invoice holds. Not populated yet: the invoice `dispute` field is always null for now, even on an invoice in dispute with the supplier (which reports `stage` `disputed`).","properties":{"disputedAt":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"When the dispute was raised."},"disputedBy":{"description":"Member who raised the dispute.","type":"string"},"reason":{"description":"Human-readable reason/comment for the dispute, if recorded.","nullable":true,"type":"string"},"reasonCode":{"description":"Machine-readable reason the invoice is disputed (e.g. a standard dispute-reason code). Not enumerated — treat as an opaque, extensible code. Null when only a free-text reason exists.","nullable":true,"type":"string"}},"required":["reasonCode","reason","disputedBy","disputedAt"],"title":"invoiceDispute","type":"object"},"invoiceId":{"description":"Opaque unique identifier of an invoice.","example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","title":"invoiceId","type":"string"},"invoiceStage":{"description":"Where the invoice or credit note is in its lifecycle; exactly one value at a time. `paymentStatus` and `exportStatus` move in parallel. \n\n| Stage | Description |\n| --- | --- |\n| `pendingApproval` | Awaiting a decision in the approval workflow. |\n| `inReview` | Approved, waiting for the controller review. |\n| `disputed` | Approved, then put in dispute with the supplier. Invoices only. |\n| `toSettle` | Reviewed. An invoice is waiting for payment, fully or in part (`paymentStatus` tells which); a credit note is partially allocated. |\n| `settled` | An invoice is fully paid; a credit note is fully allocated or reimbursed. |\n| `rejected` | Declined by an approver, rejected in controller review, or expired. |\n| `cancelled` | Withdrawn by the company: archived after a supplier dispute, or replaced by a corrective invoice. Invoices withdrawn by their submitter are never returned. |","enum":["pendingApproval","inReview","disputed","toSettle","settled","rejected","cancelled"],"title":"invoiceStage","type":"string"},"invoiceSummary":{"additionalProperties":false,"description":"Compact representation of an invoice, returned by the list endpoint.","properties":{"amountDue":{"description":"Placeholder on this list endpoint, not the actual outstanding balance: it is derived from `paymentStatus` only, 0 when `paid`, otherwise the full `grossAmount`, so a `partiallyPaid` invoice reports its whole gross. Never treat or sum it as the outstanding balance. Null when `grossAmount` is not known yet (draft/incomplete).","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"analyticalSplits":{"description":"Allocation of the invoice total across cost centers and analytical-field values. Empty when the invoice is not split. Set independently of `costCenter`, so a split can name a different cost center.","items":{"$ref":"#/components/schemas/invoiceAnalyticalSplit"},"type":"array"},"costCenter":{"description":"Cost center the invoice is coded to, or null when none is set. Set independently of `analyticalSplits`: the two are not reconciled and can disagree.","oneOf":[{"$ref":"#/components/schemas/costCenterRef"},{"type":"null"}]},"createdAt":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"When the invoice record was created in Spendesk (ingest/submission time, not the issue date)."},"currency":{"$ref":"#/components/schemas/currency"},"description":{"description":"Free-text description/purpose of the invoice.","nullable":true,"type":"string"},"dispute":{"description":"Not populated yet: always null, even on a disputed invoice.","oneOf":[{"$ref":"#/components/schemas/invoiceDispute"},{"type":"null"}]},"dueDate":{"description":"Date by which the invoice must be paid, per the supplier's payment terms. Null when no due date is known.","oneOf":[{"$ref":"#/components/schemas/date"},{"type":"null"}]},"expenseCategories":{"description":"Expense categories the invoice is coded to, sorted by name. Empty when none is set. A split invoice can carry several, one per split. These ids are the ones the `expenseCategoryId` filter matches. Only the company's current expense-category field counts: if it is changed or removed, past invoices follow the new setting. A deleted category still shows on the invoices coded to it.","items":{"$ref":"#/components/schemas/expenseCategoryRef"},"type":"array"},"grossAmount":{"description":"Total amount including tax (`netAmount` + `taxAmount`), in `currency`'s smallest unit. Positive for invoices (owed to the supplier); negative for credit notes (owed to the company). Null when the invoice has no gross amount yet (draft/incomplete).","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"id":{"$ref":"#/components/schemas/invoiceId"},"invoiceNumber":{"description":"Supplier's invoice/credit-note number. Null if not captured.","example":"FA17273","nullable":true,"type":"string"},"issueDate":{"allOf":[{"$ref":"#/components/schemas/date"}],"description":"Date the supplier issued the invoice, as printed on the document (emission date)."},"netAmount":{"description":"Total before tax, in `currency`'s smallest unit. Can be null in any state, not only draft/incomplete: always for credit notes, and for older invoices whose net amount was never recorded.","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"paymentStatus":{"$ref":"#/components/schemas/paymentStatus"},"purchaseOrders":{"description":"Purchase orders this invoice is matched against. Empty when the invoice references no PO.","items":{"$ref":"#/components/schemas/purchaseOrderRef"},"type":"array"},"stage":{"$ref":"#/components/schemas/invoiceStage"},"supplier":{"$ref":"#/components/schemas/supplierRef"},"taxAmount":{"description":"Total tax, in `currency`'s smallest unit. Null whenever `netAmount` or `grossAmount` is null, so in any state for credit notes and older invoices with no recorded net amount.","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"type":{"$ref":"#/components/schemas/invoiceType"},"updatedAt":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"When any field on the invoice record last changed."}},"required":["id","invoiceNumber","type","description","stage","paymentStatus","dispute","supplier","purchaseOrders","costCenter","analyticalSplits","expenseCategories","netAmount","taxAmount","grossAmount","amountDue","currency","issueDate","dueDate","createdAt","updatedAt"],"title":"invoiceSummary","type":"object"},"invoiceType":{"description":"Kind of document the record represents. \n\n| Type | Description |\n| --- | --- |\n| `invoice` | A supplier invoice: an amount the company owes the supplier for goods or services. Amounts are positive. |\n| `creditNote` | A supplier credit note: a document from the same supplier that reduces an amount owed (a refund, cancellation, or correction of a prior invoice). Amounts are negative. |","enum":["invoice","creditNote"],"title":"invoiceType","type":"string"},"invoicesCursorPagination":{"additionalProperties":false,"description":"Forward-only cursor pagination metadata.","properties":{"hasNextPage":{"description":"Whether more results exist after this page. Convenience for `nextCursor != null`.","type":"boolean"},"limit":{"description":"Page size that was applied.","maximum":100,"minimum":1,"type":"integer"},"nextCursor":{"description":"Cursor for the next page, or null when there are no more results.","type":["null","string"]},"nextUrl":{"description":"Ready-to-follow URL for the next page (same filters + `cursor`), or null.","format":"uri","type":["null","string"]}},"required":["limit","hasNextPage","nextCursor","nextUrl"],"title":"invoicesCursorPagination","type":"object"},"invoicesListQuery":{"additionalProperties":false,"dependentSchemas":{"maxGrossAmount":{"errorMessage":"currency must be provided when maxGrossAmount is provided","required":["currency"]},"minGrossAmount":{"errorMessage":"currency must be provided when minGrossAmount is provided","required":["currency"]}},"properties":{"buyerId":{"items":{"type":"string"},"maxItems":50,"type":"array"},"costCenterId":{"items":{"type":"string"},"maxItems":50,"type":"array"},"createdAfter":{"$ref":"#/components/schemas/dateTime"},"createdBefore":{"$ref":"#/components/schemas/dateTime"},"currency":{"$ref":"#/components/schemas/currency"},"cursor":{"description":"Opaque pagination cursor returned as `meta.pagination.nextCursor` by a previous call. Omit to fetch the first page.","type":"string"},"documentaryEvidenceStatus":{"items":{"$ref":"#/components/schemas/documentaryEvidenceStatus"},"type":"array"},"dueAfter":{"$ref":"#/components/schemas/date"},"dueBefore":{"$ref":"#/components/schemas/date"},"expenseCategoryId":{"description":"Filter by expense category, matching the ids in the invoice `expenseCategories`. A split invoice matches if any of its categories does. Known gap: fully paid invoices (stage `settled`) are not matched by this filter, so they are left out of the result.","items":{"type":"string"},"maxItems":50,"type":"array"},"exportStatus":{"items":{"$ref":"#/components/schemas/exportStatus"},"type":"array"},"ids":{"items":{"$ref":"#/components/schemas/invoiceId"},"maxItems":50,"type":"array"},"invoiceNumber":{"description":"Filter by the supplier's invoice number (case-insensitive exact match). Ignored with type=creditNote; use search to find a credit note by its number.","type":"string"},"isDisputed":{"description":"`true`: only invoices currently in dispute with the supplier, the same as `stage` `disputed`; `false`: all others. Combined with `stage`, both must match. An invoice archived after a dispute is `cancelled`, not disputed, and credit notes are never returned as disputed.","type":"boolean"},"issuedAfter":{"$ref":"#/components/schemas/date"},"issuedBefore":{"$ref":"#/components/schemas/date"},"limit":{"default":20,"description":"Maximum number of invoices to return in one page.","maximum":100,"minimum":1,"type":"integer"},"maxGrossAmount":{"type":"integer"},"minGrossAmount":{"type":"integer"},"paymentMethod":{"description":"Not applied yet: results are not filtered by payment method.","items":{"$ref":"#/components/schemas/paymentMethod"},"type":"array"},"paymentSource":{"description":"Not applied yet: results are not filtered by payment source.","items":{"$ref":"#/components/schemas/paymentSource"},"type":"array"},"paymentStatus":{"items":{"$ref":"#/components/schemas/paymentStatus"},"type":"array"},"purchaseOrderId":{"items":{"type":"string"},"maxItems":50,"type":"array"},"search":{"type":"string"},"sort":{"default":"desc","description":"Sort direction.","enum":["asc","desc"],"type":"string"},"sortBy":{"default":"createdAt","description":"Field to sort by. Combined with `sort` to set direction.","enum":["createdAt","updatedAt","issueDate","dueDate","grossAmount"],"type":"string"},"stage":{"description":"Filter by stage; any of the listed values matches. When omitted, every stage except `cancelled` is returned; pass `cancelled` to get cancelled invoices. Draft and incomplete invoices are never listed here, not even under `pendingApproval`; fetch one by ID instead, which fails while it still lacks a supplier, issue date or currency. A credit note in dispute with the supplier is never returned or counted, under any stage.","items":{"$ref":"#/components/schemas/invoiceStage"},"type":"array"},"supplierId":{"items":{"type":"string"},"maxItems":50,"type":"array"},"type":{"$ref":"#/components/schemas/invoiceType"},"updatedAfter":{"$ref":"#/components/schemas/dateTime"},"updatedBefore":{"$ref":"#/components/schemas/dateTime"}},"title":"invoicesListQuery","type":"object"},"invoicesMeta":{"additionalProperties":false,"description":"Meta object describing the invoice list pagination.","properties":{"pagination":{"$ref":"#/components/schemas/invoicesCursorPagination"}},"required":["pagination"],"title":"invoicesMeta","type":"object"},"invoicesQuery":{"additionalProperties":false,"dependentSchemas":{"maxGrossAmount":{"errorMessage":"currency must be provided when maxGrossAmount is provided","required":["currency"]},"minGrossAmount":{"errorMessage":"currency must be provided when minGrossAmount is provided","required":["currency"]}},"properties":{"buyerId":{"items":{"type":"string"},"maxItems":50,"type":"array"},"costCenterId":{"items":{"type":"string"},"maxItems":50,"type":"array"},"createdAfter":{"$ref":"#/components/schemas/dateTime"},"createdBefore":{"$ref":"#/components/schemas/dateTime"},"currency":{"$ref":"#/components/schemas/currency"},"documentaryEvidenceStatus":{"items":{"$ref":"#/components/schemas/documentaryEvidenceStatus"},"type":"array"},"dueAfter":{"$ref":"#/components/schemas/date"},"dueBefore":{"$ref":"#/components/schemas/date"},"expenseCategoryId":{"description":"Filter by expense category, matching the ids in the invoice `expenseCategories`. A split invoice matches if any of its categories does. Known gap: fully paid invoices (stage `settled`) are not matched by this filter, so they are left out of the result.","items":{"type":"string"},"maxItems":50,"type":"array"},"exportStatus":{"items":{"$ref":"#/components/schemas/exportStatus"},"type":"array"},"invoiceNumber":{"description":"Filter by the supplier's invoice number (case-insensitive exact match). Ignored with type=creditNote; use search to find a credit note by its number.","type":"string"},"isDisputed":{"description":"`true`: only invoices currently in dispute with the supplier, the same as `stage` `disputed`; `false`: all others. Combined with `stage`, both must match. An invoice archived after a dispute is `cancelled`, not disputed, and credit notes are never returned as disputed.","type":"boolean"},"issuedAfter":{"$ref":"#/components/schemas/date"},"issuedBefore":{"$ref":"#/components/schemas/date"},"maxGrossAmount":{"type":"integer"},"minGrossAmount":{"type":"integer"},"paymentMethod":{"description":"Not applied yet: results are not filtered by payment method.","items":{"$ref":"#/components/schemas/paymentMethod"},"type":"array"},"paymentSource":{"description":"Not applied yet: results are not filtered by payment source.","items":{"$ref":"#/components/schemas/paymentSource"},"type":"array"},"paymentStatus":{"items":{"$ref":"#/components/schemas/paymentStatus"},"type":"array"},"purchaseOrderId":{"items":{"type":"string"},"maxItems":50,"type":"array"},"search":{"type":"string"},"stage":{"description":"Filter by stage; any of the listed values matches. When omitted, every stage except `cancelled` is returned; pass `cancelled` to get cancelled invoices. Draft and incomplete invoices are never listed here, not even under `pendingApproval`; fetch one by ID instead, which fails while it still lacks a supplier, issue date or currency. A credit note in dispute with the supplier is never returned or counted, under any stage.","items":{"$ref":"#/components/schemas/invoiceStage"},"type":"array"},"supplierId":{"items":{"type":"string"},"maxItems":50,"type":"array"},"type":{"$ref":"#/components/schemas/invoiceType"},"updatedAfter":{"$ref":"#/components/schemas/dateTime"},"updatedBefore":{"$ref":"#/components/schemas/dateTime"}},"title":"invoicesQuery","type":"object"},"invoicesSummary":{"additionalProperties":false,"description":"Aggregate figures over all invoices matching the filters, returned by `GET /v2/companies/:companyId/invoices/summary`.","properties":{"count":{"description":"Total number of matching invoices, across all currencies.","type":"integer"},"totalsByCurrency":{"description":"Amount totals broken down by currency — one entry per currency present in the matching set. Amounts are never summed across currencies. Empty when nothing matches.","items":{"$ref":"#/components/schemas/currencyTotal"},"type":"array"}},"required":["count","totalsByCurrency"],"title":"invoicesSummary","type":"object"},"lineItem":{"additionalProperties":false,"description":"A single line of the invoice, with its amounts and tax. Accounting coding is set on the whole invoice (see the invoice `costCenter`, `analyticalSplits` and `expenseCategories`), not per line.","properties":{"analyticalProperties":{"description":"Always empty: analytical-field values are set on the whole invoice, see the invoice `analyticalSplits`.","items":{"$ref":"#/components/schemas/analyticalProperty"},"type":"array"},"costCenter":{"description":"Always null: cost centers are set on the whole invoice, see the invoice `costCenter` and `analyticalSplits`.","oneOf":[{"$ref":"#/components/schemas/costCenterRef"},{"type":"null"}]},"description":{"description":"What the line is for.","type":"string"},"expenseCategory":{"description":"Always null: expense categories are set on the whole invoice, see the invoice `expenseCategories`.","oneOf":[{"$ref":"#/components/schemas/expenseCategoryRef"},{"type":"null"}]},"grossAmount":{"description":"Line amount including tax (`netAmount` + `taxAmount`), in `currency`'s smallest unit. Null when the invoice has no gross amount yet (draft/incomplete).","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"netAmount":{"description":"Line amount before tax (`quantity` x `unitPrice`), in `currency`'s smallest unit. Null when no net amount was captured, which can happen in any state (e.g. the single header-derived line of a credit note or of an older invoice whose net was never recorded).","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"quantity":{"description":"Quantity billed (may be fractional).","type":"number"},"taxAmount":{"description":"Tax charged on this line, in `currency`'s smallest unit. Null when no net amount was captured, which can happen in any state (e.g. the single header-derived line of a credit note or of an older invoice whose net was never recorded), or when the gross amount is not known yet.","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]},"taxRate":{"$ref":"#/components/schemas/taxRate"},"unitPrice":{"description":"Price per unit before tax, in `currency`'s smallest unit. Null when no net amount was captured, which can happen in any state (e.g. the single header-derived line of a credit note or of an older invoice whose net was never recorded).","oneOf":[{"$ref":"#/components/schemas/priceAmount"},{"type":"null"}]}},"required":["description","quantity","unitPrice","netAmount","taxRate","taxAmount","grossAmount","costCenter","expenseCategory","analyticalProperties"],"title":"lineItem","type":"object"},"meta":{"description":"Meta object describing pagination","properties":{"pagination":{"allOf":[{"$ref":"#/components/schemas/pagination"}],"type":"object","unevaluatedProperties":false}},"required":["pagination"],"title":"meta","type":"object"},"notAcceptable":{"additionalProperties":false,"description":"Not Acceptable","properties":{"correlationId":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["NOT_ACCEPTABLE_ERROR","EMPTY_JSON_BODY_ERROR"],"type":"string"},"detail":{"enum":["The requested resource is only capable of generating content not acceptable according to the headers sent in the request.","You are not sending a body while defining a content-type as application/json. Please, either remove the header, or pass an empty object as a body."],"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"title":"notAcceptable","type":"object"},"notAllowed":{"additionalProperties":false,"description":"Not Allowed","properties":{"correlationId":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["METHOD_NOT_ALLOWED_ERROR"],"type":"string"},"detail":{"enum":["A request was made of a resource using a request method not supported by that resource."],"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"title":"notAllowed","type":"object"},"notFound":{"additionalProperties":false,"description":"Not Found","properties":{"correlationId":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["NOT_FOUND"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"title":"notFound","type":"object"},"pagination":{"properties":{"page":{"default":1,"description":"Page number","minimum":1,"type":"integer"},"pageSize":{"default":30,"description":"Page size","maximum":30,"minimum":1,"type":"integer"},"total":{"description":"Total amount of records for this collection","minimum":0,"type":"integer"}},"required":["page","pageSize","total"],"title":"pagination","type":"object"},"paginationQuery":{"properties":{"page":{"default":1,"description":"Page number","minimum":1,"type":"integer"},"pageSize":{"default":30,"description":"Page size","maximum":30,"minimum":1,"type":"integer"}},"title":"paginationQuery","type":"object"},"payable":{"additionalProperties":false,"description":"A payable is a short-term liability owed by a company to its creditors (suppliers or employees). Several types of payables are supported by Spendesk, e.g. Invoices, Credit Notes, Expense Claims, Physical card purchases, Single Use card purchases, Subscription card purchases, etc.","properties":{"accountingDate":{"description":"This feature is not activated by default.\nIf activated, `accounting date` field allows accountants to override the original expense date.\nIn the `YYYY-MM-DD` format.","format":"date","nullable":true,"type":"string"},"allocations":{"description":"An array of allocations for the payable. An expense payable can have a settlement or a reversal payable allocated to it. A reversal payable can have a settlement or an expense payable allocated to it.","items":{"oneOf":[{"additionalProperties":false,"properties":{"allocatedAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Payable amount allocated to this settlement. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"settlementId":{"description":"The ID of the allocated settlement.","type":"string"},"type":{"enum":["settlement"]}},"required":["type","allocatedAmount","settlementId"],"type":"object"},{"additionalProperties":false,"properties":{"allocatedAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Payable amount allocated to expenses. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"payableId":{"description":"The ID of the Payable","examples":["bc9cef35-401d-4ea4-b384-ed725e6685cf"],"format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"type":{"enum":["expense"]}},"required":["type","allocatedAmount","payableId"],"type":"object"},{"additionalProperties":false,"properties":{"allocatedAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Payable amount allocated to reversals. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"payableId":{"description":"The ID of the Payable","examples":["bc9cef35-401d-4ea4-b384-ed725e6685cf"],"format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"type":{"enum":["reversal"]}},"required":["type","allocatedAmount","payableId"],"type":"object"}]},"type":"array"},"amortisation":{"additionalProperties":false,"description":"Amortisation details for the payable, if applicable.","nullable":true,"properties":{"date":{"additionalProperties":false,"properties":{"from":{"description":"Start date of the amortisation period. In the ISO 8601 date-time format.","format":"date-time","type":"string"},"to":{"description":"End date of the amortisation period. In the ISO 8601 date-time format.","format":"date-time","type":"string"}},"required":["from","to"],"type":"object"}},"required":["date"],"type":"object"},"amount":{"$ref":"#/components/schemas/priceAmount"},"analyticalProperties":{"items":{"$ref":"#/components/schemas/analyticalProperties"},"type":"array"},"appUrl":{"description":"Link to this payable in the Spendesk web app.","example":"https://app.spendesk.com/app/RRbRgeIB7X/payables/bc9cef35-401d-4ea4-b384-ed725e6685cf","type":"string"},"bookkeepingStatus":{"$ref":"#/components/schemas/bookkeepingStatus"},"commitmentCounterparty":{"additionalProperties":false,"description":"The counterparty associated with the spending commitment, or null when unavailable. For expense claims, use its name as the merchant name only when type is supplier. counterparty is the employee being reimbursed; their accountPayable must not be used as a merchant creditor account.","nullable":true,"properties":{"name":{"type":"string"},"type":{"enum":["supplier","employee"],"type":"string"}},"required":["type","name"],"type":"object"},"companyId":{"description":"The ID of the company (this could be a wallet or an entity).","type":"string"},"costCenterId":{"description":"The ID of the cost center, if available.","nullable":true,"type":"string"},"costCenterName":{"description":"The name of the cost center, if available.","nullable":true,"type":"string"},"counterparty":{"additionalProperties":false,"description":"A payable is due to either a supplier or an employee.","properties":{"accountPayable":{"additionalProperties":false,"nullable":true,"properties":{"auxiliaryAccountCode":{"description":"Auxiliary code of the account payable, if available.","nullable":true,"type":"string"},"generalAccountCode":{"description":"Accounting code of the account payable.","type":"string"},"id":{"description":"Internal Spendesk ID of the account payable.","type":"string"}},"required":["id","generalAccountCode","auxiliaryAccountCode"],"type":"object"},"id":{"description":"The ID of this counterparty.","type":"string"},"name":{"description":"The name of this counterparty.","nullable":true,"type":"string"},"type":{"description":"The type of this counterparty.","enum":["supplier","employee"],"type":"string"}},"required":["id","type","name","accountPayable"],"type":"object"},"createdAt":{"description":"The timestamp of the creation of this payable. String containing a UTC datetime expressed in ISO 8601 format like `2023-05-12T14:06:40Z` (source `https://en.wikipedia.org/wiki/ISO_8601`).","format":"date-time","type":"string"},"creditNoteNumber":{"description":"Credit Note number, if available.","nullable":true,"type":"string"},"currency":{"$ref":"#/components/schemas/currency"},"description":{"description":"Description of the payable.","nullable":true,"type":"string"},"exportedAt":{"description":"The date this payable was first exported via an accounting export. In the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date format.","format":"date-time","nullable":true,"type":"string"},"externalIds":{"description":"IDs this payable has in external systems (ERPs), typically the ERP document number, one entry per system. Only present when `externalIds` is requested through `include`; an empty array means the payable has none. Only exported payables carry an ID, and payables exported before external IDs were recorded may have none. `source` reads `public_api` only for IDs written with provider `PublicApi`; an ID written through the API under another provider (e.g. pennylane) reads back as `native_integration`.","items":{"additionalProperties":false,"properties":{"externalId":{"description":"ID of the payable in the external system (e.g. the ERP document number).","type":"string"},"provider":{"description":"The external system the ID belongs to (e.g. Netsuite, Xero).","nullable":true,"type":"string"},"source":{"description":"Who recorded the mapping. `native_integration` means a native ERP sync owns it and keeps it up to date; `public_api` means it was set through the API.","nullable":true,"type":"string"},"timestamp":{"description":"When this ID was last recorded or updated in Spendesk (ISO 8601), not the date of the document in the external system.","format":"date-time","type":"string"}},"required":["externalId","timestamp"],"type":"object"},"type":"array"},"functionalAmount":{"$ref":"#/components/schemas/priceAmount"},"functionalCurrency":{"$ref":"#/components/schemas/currency"},"functionalExchangeRate":{"description":"If the payment was made in a foreign currency, this will be the exchange rate that was applied when the payment was made.","type":"number"},"id":{"description":"The ID of the Payable","example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"invoiceDueDate":{"description":"The date the invoice is due. In the `YYYY-MM-DD` format.","format":"date","nullable":true,"type":"string"},"invoiceNumber":{"description":"Invoice number, if available.","nullable":true,"type":"string"},"lineItems":{"description":"Line items of the payable.","items":{"$ref":"#/components/schemas/payableLineItem"},"type":"array"},"outstandingAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Portion of the payable amount not yet covered by allocations, in the payable currency minor units (e.g. cents for EUR and USD, but yen for JPY). Zero means fully allocated. Absent if allocation tracking is unavailable for this payable."},"outstandingFunctionalAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Same as `outstandingAmount` but expressed in the company's functional currency minor units."},"payableDate":{"description":"For expenses - this is the date of the expense.\nFor reversals - this is the date of the reversal.\nIn the `YYYY-MM-DD` format.","format":"date","type":"string"},"purchaseOrderNumber":{"description":"Purchase order number linked to this invoice payable, if available.","nullable":true,"type":"string"},"referenceInvoiceNumber":{"description":"Invoice number of an invoice that resulted in a credit note, if available.","nullable":true,"type":"string"},"teamId":{"description":"The ID of the team.","nullable":true,"type":"string"},"teamName":{"description":"The name of the team.","nullable":true,"type":"string"},"type":{"description":"Indicates the type of the payable. \n\nType | Description |\n---------|----------|\n `expenseClaim` | An expense claim submitted and approved | \n `invoicePurchase` | An invoice to pay submitted and approved | \n `creditNote` | A credit note submitted and approved |\n  `singlePurchaseCard` | A purchase made with a single-use virtual card |\n  `multiUseCard` | A purchase made with a multi-use virtual card | \n  `subscriptionCard` | A purchase made with a subscription virtual card |\n  `physicalCard` | A purchase made with a physical card |\n  `mileageAllowance` | A mileage expense submitted and approved |\n  `perDiemAllowance` | A per diem expense submitted and approved |\n  `reverseBill` | A refund or a late return (aka cash return) |\"","enum":["expenseClaim","invoicePurchase","creditNote","singlePurchaseCard","multiUseCard","subscriptionCard","physicalCard","mileageAllowance","perDiemAllowance","reverseBill"],"type":"string"},"userId":{"description":"The ID of the Spendesk user who created this payable.","type":"string"},"version":{"description":"The current version of this payable. This is incremented every time the payable is modified.","type":"number"}},"required":["id","version","type","userId","bookkeepingStatus","companyId","teamId","teamName","payableDate","accountingDate","invoiceDueDate","amount","currency","functionalAmount","functionalCurrency","functionalExchangeRate","invoiceNumber","purchaseOrderNumber","creditNoteNumber","referenceInvoiceNumber","description","exportedAt","createdAt","counterparty","lineItems","analyticalProperties","allocations"],"title":"payable","type":"object"},"payableLineItem":{"additionalProperties":false,"properties":{"analyticalProperties":{"description":"Array of analytical properties for this line item.","items":{"$ref":"#/components/schemas/analyticalProperties"},"type":"array"},"costCenterId":{"description":"The ID of the cost center, if available.","nullable":true,"type":"string"},"costCenterName":{"description":"The name of the cost center, if available.","nullable":true,"type":"string"},"expenseAccount":{"additionalProperties":false,"description":"Expense account this line item is allocated to.","nullable":true,"properties":{"code":{"description":"Expense account accounting code.","type":"string"},"description":{"description":"Expense account description.","type":"string"},"id":{"description":"Expense account Spendesk internal ID.","type":"string"}},"required":["id","code","description"],"type":"object"},"financial":{"additionalProperties":false,"description":"Financial amounts of the line item","nullable":true,"properties":{"grossAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Gross amount of the line item (netAmount + vatAmount) Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"netAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Net amount or the line iteam (grossAmount - vatAmount) Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"vatAdjustmentAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Only exists when vatAmount was manually adjusted by the accountant. Is calculated as vatAmount - (netAmount * vatAccount.rate) and can be negative or positive. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"vatAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Amount of VAT calculated automatically or entered manually by the accountant. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."}},"required":["vatAmount","vatAdjustmentAmount","netAmount","grossAmount"],"type":"object"},"reverseChargeAccount":{"additionalProperties":false,"description":"Reverse charge accounts can be used in place of VAT accounts. They always have a rate of 0%.","nullable":true,"properties":{"creditCode":{"description":"Account code used to credit the reverse charge to.","type":"string"},"debitCode":{"description":"Account code used to debit the reverse charge to.","type":"string"},"description":{"description":"Reverse charge account description.","nullable":true,"type":"string"},"id":{"description":"Reverse charge account Spendesk internal ID.","type":"string"}},"required":["id","creditCode","debitCode","description"],"type":"object"},"vatAccount":{"description":"VAT account this line item is allocated to.","nullable":true,"properties":{"code":{"description":"VAT account accounting code.","type":"string"},"description":{"description":"VAT account description.","nullable":true,"type":"string"},"id":{"description":"VAT account Spendesk internal ID.","type":"string"},"rate":{"description":"VAT account rate in percent (e.g. 19.2%).","type":"number"}},"required":["id","code","rate","description"],"type":"object"}},"required":["vatAccount","reverseChargeAccount","financial","expenseAccount","analyticalProperties"],"title":"payableLineItem","type":"object"},"payableQuery":{"additionalProperties":false,"dependentSchemas":{"fromPayableDate":{"errorMessage":"toPayableDate must be provided when fromPayableDate is provided","required":["toPayableDate"]},"toPayableDate":{"errorMessage":"fromPayableDate must be provided when toPayableDate is provided","required":["fromPayableDate"]}},"nullable":true,"properties":{"bookkeepingStatus":{"description":"A list of statuses to filter payables by.","items":{"$ref":"#/components/schemas/bookkeepingStatus"},"type":"array"},"createdFrom":{"description":"Period start date for the creation date.","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"},"createdTo":{"description":"Period end date for the creation date, that will be defaulted to the end of day (so T23:59:59).","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"},"exportedAfter":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"String containing a UTC datetime expressed in ISO 8601 format like `2023-05-12T14:06:40Z` (source `https://en.wikipedia.org/wiki/ISO_8601`). Returns payables exported after the given date."},"fromDueDate":{"description":"Returns payables with a due date on or after the given date.","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"},"fromPayableDate":{"description":"Period start date.","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"},"hasSettlement":{"description":"When true, returns only payables with a settlement. When false, returns only payables without a settlement.","type":"boolean"},"ids":{"description":"A list of payable IDs to filter by.","items":{"description":"A payable ID.","example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"type":"array"},"isOverdue":{"description":"When true, returns only overdue payables. When false, returns only non-overdue payables.","type":"boolean"},"sortBy":{"default":"payableDate","description":"Determines by which field payables are sorted.","enum":["payableDate"],"type":"string"},"sortOrder":{"default":"desc","description":"Determines in which order payables are sorted by.","enum":["asc","desc"],"type":"string"},"supplierIds":{"description":"A list of supplier IDs to filter by.","items":{"type":"string"},"type":"array"},"toDueDate":{"description":"Returns payables with a due date on or before the given date.","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"},"toPayableDate":{"description":"Period end date, no more than 31 days from `fromPayableDate`","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"},"type":{"description":"A list of payable types to filter by.","items":{"enum":["expenseClaim","invoicePurchase","creditNote","singlePurchaseCard","multiUseCard","subscriptionCard","physicalCard","mileageAllowance","perDiemAllowance","reverseBill"],"type":"string"},"type":"array"},"updatedFrom":{"description":"Returns payables modified after a given date.","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},"title":"payableQuery","type":"object"},"payment":{"additionalProperties":false,"description":"A single payment settling (or scheduled to settle) the invoice. An invoice may be settled by one or several payments — a Spendesk instalment plan, or one or more payments recorded as made outside Spendesk. `source` distinguishes the two. A failed/cancelled attempt and its retry appear as separate entries.","properties":{"amount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Amount of this payment, in `currency`'s smallest unit. Settled (`paid`) payments in the invoice `currency` normally sum to the invoice `amountPaid`, but a transfer returned late can leave a negative row that `amountPaid` ignores; on credit notes `amountPaid` is always 0 (null while `grossAmount` is unknown); a single payment may be a partial instalment."},"currency":{"allOf":[{"$ref":"#/components/schemas/currency"}],"description":"Currency this payment is made in — normally the invoice `currency`."},"fees":{"description":"Fees incurred on this payment (transfer, FX, intermediary…). Empty when none.","items":{"$ref":"#/components/schemas/paymentFee"},"type":"array"},"fx":{"description":"Currency conversion applied; null when paid in the payment `currency`.","oneOf":[{"$ref":"#/components/schemas/paymentFx"},{"type":"null"}]},"id":{"description":"Unique identifier of the payment.","type":"string"},"method":{"description":"Means of payment, or null if not yet determined.","oneOf":[{"$ref":"#/components/schemas/paymentMethod"},{"type":"null"}]},"paidDate":{"description":"Date the payment settled, or null if not yet settled.","oneOf":[{"$ref":"#/components/schemas/date"},{"type":"null"}]},"reference":{"description":"Remittance reference sent with this payment so the supplier can reconcile it (often the supplier's payment reference or the invoice number). Null if none.","nullable":true,"type":"string"},"scheduledDate":{"description":"Date the payment is scheduled to be executed. Null for externally-recorded payments that were never scheduled through Spendesk.","oneOf":[{"$ref":"#/components/schemas/date"},{"type":"null"}]},"source":{"$ref":"#/components/schemas/paymentSource"},"status":{"$ref":"#/components/schemas/paymentState"},"statusReason":{"description":"Why the payment failed or was returned; null for other states.","oneOf":[{"$ref":"#/components/schemas/paymentStatusReason"},{"type":"null"}]}},"required":["id","source","method","amount","currency","reference","scheduledDate","paidDate","status","statusReason","fx","fees"],"title":"payment","type":"object"},"paymentFee":{"additionalProperties":false,"description":"A fee incurred on the payment (deducted from the transfer or billed alongside it).","properties":{"amount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Fee amount, in `currency`'s smallest unit."},"currency":{"$ref":"#/components/schemas/currency"},"type":{"description":"Kind of fee — `transfer` (bank/rail fee), `fx` (currency-conversion fee/spread), `intermediary` (correspondent-bank fee on international transfers), or `other`.","enum":["transfer","fx","intermediary","other"],"type":"string"}},"required":["type","amount","currency"],"title":"paymentFee","type":"object"},"paymentFx":{"additionalProperties":false,"description":"Currency conversion for this payment. Present only when the money actually moved in a currency different from the payment `currency`; null otherwise. The payment `amount`/`currency` are the invoice-side figures; these are the settlement side (what actually left the paying account).","properties":{"rate":{"description":"Exchange rate applied, such that `settlementAmount` is approximately `amount x rate` (units of `settlementCurrency` per one unit of the payment `currency`).","type":"number"},"settlementAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Amount actually moved, in `settlementCurrency`'s smallest unit."},"settlementCurrency":{"allOf":[{"$ref":"#/components/schemas/currency"}],"description":"Currency actually debited from the paying account."}},"required":["settlementCurrency","settlementAmount","rate"],"title":"paymentFx","type":"object"},"paymentMethod":{"description":"Means of payment. Extensible — new methods may be added over time, so treat unknown values defensively. `other` is a catch-all.","enum":["wireTransfer","sepa","swift","ach","card","directDebit","check","cash","other"],"title":"paymentMethod","type":"string"},"paymentSource":{"description":"Who executed the payment. \n\n| Source | Description |\n| --- | --- |\n| `spendesk` | Orchestrated and executed through Spendesk (scheduled, confirmed, transferred). |\n| `external` | Happened outside Spendesk (own bank, cash, another tool) and is recorded here for reporting/bookkeeping. External payments have no Spendesk orchestration. |","enum":["spendesk","external"],"title":"paymentSource","type":"string"},"paymentState":{"description":"State of a single payment (see `paymentStatus` for the invoice-level settlement aggregate). Spendesk-executed payments (`source: spendesk`) traverse the full lifecycle; externally-recorded payments (`source: external`) are typically created directly as `paid`. \n\n| State | Description |\n| --- | --- |\n| `scheduled` | Planned for a date but not yet confirmed; no money has moved (Spendesk only). |\n| `confirmed` | Approved for release by the account owner via Strong Customer Authentication (SCA); the transfer is mandated and will be executed on the scheduled date (Spendesk only). |\n| `executing` | The transfer has been sent and is in flight at the bank (Spendesk only). |\n| `paid` | Executed and settled. Not necessarily terminal — a settled payment can later become `returned`. |\n| `failed` | The transfer was rejected or failed before settling; see `statusReason`. A retry is a new payment entry (Spendesk only). |\n| `cancelled` | A scheduled payment was cancelled before execution; no money moved. |\n| `returned` | The payment had settled but the funds were later returned/clawed back by the bank (e.g. an ACH return or recall); see `statusReason`. Its amount is removed from the invoice's `amountPaid`. |","enum":["scheduled","confirmed","executing","paid","failed","cancelled","returned"],"title":"paymentState","type":"string"},"paymentStatus":{"description":"Settlement state, independent of where the money moved (Spendesk or elsewhere) and of `stage`. On a single invoice with `payments`, it is aggregated over settled (`paid`) payments in the invoice `currency` only; on the invoice list, on credit notes (which have no stored payment status, so always report `unpaid`), and when `payments` is empty, it is the stored payment status instead, so the list and the single invoice can disagree and the `amountPaid` conditions below hold only for the aggregated case. Scheduling and per-transfer failures are visible on individual payments, not here. \n\n| Status | Description |\n| --- | --- |\n| `unpaid` | Nothing has settled (`amountPaid` equals 0). |\n| `partiallyPaid` | Some but not all has settled (`amountPaid > 0` and `amountDue > 0`). |\n| `paid` | Fully settled (`amountDue` equals 0), by any means. |\n\nA `returned` payment reduces `amountPaid`, so this can move back from `paid` to `partiallyPaid` or `unpaid`.","enum":["unpaid","partiallyPaid","paid"],"title":"paymentStatus","type":"string"},"paymentStatusReason":{"additionalProperties":false,"description":"Why a payment failed or was returned. Present for those states; null otherwise.","properties":{"code":{"description":"Machine-readable reason/return code (e.g. an ACH return code like `R01`, or a bank rejection code). Opaque and extensible; null when only a message is available.","nullable":true,"type":"string"},"message":{"description":"Human-readable explanation (e.g. \"Rejected\", \"Insufficient funds\", \"Invalid IBAN\").","type":"string"}},"required":["code","message"],"title":"paymentStatusReason","type":"object"},"priceAmount":{"description":"If the payment was made in a foreign currency, this amount will be the one in the payment currency.\nCan contain a negative value in case of refunds.\nExpressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY).","title":"priceAmount","type":"number"},"purchaseOrderRef":{"additionalProperties":false,"description":"Reference to a purchase order the invoice is matched against (two/three-way match).","properties":{"id":{"description":"Purchase-order id.","type":"string"}},"required":["id"],"title":"purchaseOrderRef","type":"object"},"reverseChargeAccount":{"allOf":[{"$ref":"#/components/schemas/taxAccount"},{"properties":{"codeCredit":{"type":"string"},"codeDebit":{"type":"string"},"type":{"enum":["reverseCharge"],"type":"string"}},"required":["type","codeDebit","codeCredit"],"type":"object"}],"title":"reverseChargeAccount","type":"object","unevaluatedProperties":false},"review":{"additionalProperties":false,"description":"Finance/controller review that validates the invoice's data (amounts, coding, documentary evidence) for accounting. Distinct from `approval`, which authorises the spend — this checks the booking data. Null on the invoice when no review has been recorded.","properties":{"validatedAt":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"When the review was completed."},"validatedBy":{"description":"Member who validated the invoice.","type":"string"}},"required":["validatedBy","validatedAt"],"title":"review","type":"object"},"searchPayable":{"anyOf":[{"additionalProperties":false,"description":"An expense payable (kind = \"expense\").","properties":{"accountPayableId":{"description":"Linked accounts-payable entry ID.","format":"uuid","type":"string"},"accountingDate":{"description":"Date used for the accounting period.","format":"date-time","type":"string"},"allocations":{"description":"Allocations linked to this expense. `settlement` entries are cash paid; `reversal` entries are a credit note or card refund applied document-to-document, not money moved.","items":{"additionalProperties":false,"properties":{"allocationId":{"type":"string"},"amount":{"$ref":"#/components/schemas/searchPayableMoney"},"entityId":{"type":"string"},"entityType":{"enum":["reversal","settlement"],"type":"string"}},"required":["allocationId","amount","entityId","entityType"],"type":"object"},"type":"array"},"amortisation":{"additionalProperties":false,"description":"Prepaid-expense amortisation schedule.","properties":{"date":{"additionalProperties":false,"properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"],"type":"object"}},"required":["date"],"type":"object"},"amount":{"allOf":[{"$ref":"#/components/schemas/searchPayableMoney"}],"description":"Original transaction amount in currency minor units."},"commitmentCounterparty":{"anyOf":[{"additionalProperties":false,"properties":{"supplierId":{"type":"string"},"type":{"enum":["supplier"],"type":"string"}},"required":["type","supplierId"],"type":"object"},{"additionalProperties":false,"properties":{"memberId":{"type":"string"},"type":{"enum":["employee"],"type":"string"}},"required":["type","memberId"],"type":"object"}],"description":"The spending commitment counterparty, when available. For expense claims, a supplier reference identifies the merchant while counterparty identifies the employee being reimbursed. The merchant name is available from the payable detail response; never use the employee accountPayable as a merchant creditor account."},"counterparty":{"anyOf":[{"additionalProperties":false,"properties":{"supplierId":{"type":"string"},"type":{"enum":["supplier"],"type":"string"}},"required":["type","supplierId"],"type":"object"},{"additionalProperties":false,"properties":{"memberId":{"type":"string"},"type":{"enum":["employee"],"type":"string"}},"required":["type","memberId"],"type":"object"}],"description":"The supplier or employee counterparty for this expense."},"creationDate":{"description":"Issue date of the payable — the date on the underlying document: a supplier invoice's issue date, or for card purchases the transaction's settlement date. This is the payable's accounting-relevant business date and the default basis for placing it in an accounting period. It is set during the request/review flow, is editable by controllers, and can be backdated, so it does NOT reflect when the record entered Spendesk (see firstCreatedAt for that). When the optional accounting-date override is enabled, accountingDate takes precedence for the booking period; otherwise accountingDate defaults to this date. To filter payables by this date, use the payableDate date-filter field (this same value is returned here as creationDate) — not firstCreatedAt, which is the system-entry timestamp.","format":"date-time","type":"string"},"currency":{"description":"ISO 4217 currency code of the transaction amount.","type":"string"},"description":{"description":"Free-text description of the payable.","type":"string"},"documentaryEvidence":{"anyOf":[{"additionalProperties":false,"properties":{"compliances":{"$ref":"#/components/schemas/searchPayableCompliances"},"invoiceNumber":{"type":"string"},"type":{"enum":["invoice"],"type":"string"},"validity":{"$ref":"#/components/schemas/searchPayableValidity"}},"required":["validity","type"],"type":"object"},{"additionalProperties":false,"properties":{"compliances":{"$ref":"#/components/schemas/searchPayableCompliances"},"invoiceNumber":{"type":"string"},"type":{"enum":["declarationOfMissingInvoice"],"type":"string"},"validity":{"$ref":"#/components/schemas/searchPayableValidity"}},"required":["validity","type"],"type":"object"},{"additionalProperties":false,"properties":{"compliances":{"$ref":"#/components/schemas/searchPayableCompliances"},"invoiceNumber":{"type":"string"},"type":{"enum":["mileageEntry"],"type":"string"},"validity":{"$ref":"#/components/schemas/searchPayableValidity"}},"required":["validity","type"],"type":"object"},{"additionalProperties":false,"properties":{"compliances":{"$ref":"#/components/schemas/searchPayableCompliances"},"invoiceNumber":{"type":"string"},"type":{"enum":["perDiemEntry"],"type":"string"},"validity":{"$ref":"#/components/schemas/searchPayableValidity"}},"required":["validity","type"],"type":"object"}],"description":"Attached documentary evidence (invoice, declaration of missing invoice, mileage or per-diem entry)."},"documentaryEvidenceCannotBeProvided":{"allOf":[{"$ref":"#/components/schemas/searchPayableDocEvidenceCannotBeProvided"}],"description":"Present when the member declared that documentary evidence cannot be provided."},"dueDate":{"description":"Payment due date, when applicable (e.g. invoices).","format":"date-time","type":"string"},"externalIds":{"description":"IDs this payable has in external systems (ERPs), typically the ERP document number, one entry per system. Only present when `externalIds` is requested through `include`; an empty array means the payable has none. Only exported payables carry an ID, and payables exported before external IDs were recorded may have none. `source` reads `public_api` only for IDs written with provider `PublicApi`; an ID written through the API under another provider (e.g. pennylane) reads back as `native_integration`.","items":{"additionalProperties":false,"properties":{"externalId":{"description":"ID of the payable in the external system (e.g. the ERP document number).","type":"string"},"provider":{"description":"The external system the ID belongs to (e.g. Netsuite, Xero).","nullable":true,"type":"string"},"source":{"description":"Who recorded the mapping. `native_integration` means a native ERP sync owns it and keeps it up to date; `public_api` means it was set through the API.","nullable":true,"type":"string"},"timestamp":{"description":"When this ID was last recorded or updated in Spendesk (ISO 8601), not the date of the document in the external system.","format":"date-time","type":"string"}},"required":["externalId","timestamp"],"type":"object"},"type":"array"},"firstCreatedAt":{"description":"Original creation timestamp (preserved across bookkeeping resets).","format":"date-time","type":"string"},"firstExportedAt":{"description":"Timestamp of the first export to an accounting system.","format":"date-time","type":"string"},"functionalAmount":{"allOf":[{"$ref":"#/components/schemas/searchPayableMoney"}],"description":"Amount in the company's functional currency, in minor units."},"functionalCurrency":{"description":"ISO 4217 currency code of the functional amount.","type":"string"},"functionalExchangeRate":{"allOf":[{"$ref":"#/components/schemas/searchPayableRate"}],"description":"Exchange rate from transaction currency to functional currency."},"id":{"description":"Unique payable identifier.","examples":["bc9cef35-401d-4ea4-b384-ed725e6685cf"],"format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"itemLines":{"description":"Accounting line items with VAT breakdown.","items":{"$ref":"#/components/schemas/searchPayableItemLine"},"type":"array"},"kind":{"description":"Discriminator. Always \"expense\" for this variant.","enum":["expense"],"type":"string"},"memberId":{"description":"ID of the team member who owns this payable.","type":"string"},"outstandingAmount":{"allOf":[{"$ref":"#/components/schemas/searchPayableMoney"}],"description":"Portion of the payable amount not yet covered by allocations, in the payable native currency minor units. Zero means fully allocated. Absent if allocation tracking is unavailable for that payable."},"outstandingFunctionalAmount":{"allOf":[{"$ref":"#/components/schemas/searchPayableMoney"}],"description":"Same as outstandingAmount but in the company's functional currency minor units."},"spendingAmount":{"allOf":[{"$ref":"#/components/schemas/searchPayableMoney"}],"description":"Amount in the spending (card) currency, in minor units."},"spendingCurrency":{"description":"ISO 4217 currency code of the spending (card) amount.","type":"string"},"spendingExchangeRate":{"allOf":[{"$ref":"#/components/schemas/searchPayableRate"}],"description":"Exchange rate from spending (card) currency to transaction currency."},"state":{"description":"Bookkeeping lifecycle state of the payable.","enum":["toPrepare","toExport","exported"],"type":"string"},"subType":{"description":"Payment method or expense origin.","enum":["expense","invoice","creditNote","singlePurchase","subscription","multiUseCard","physical","mileageAllowance","perDiemAllowance"],"type":"string"},"type":{"description":"Expense type: bill, claimedBill (employee-submitted), mileageExpense or perDiemExpense.","enum":["bill","claimedBill","mileageExpense","perDiemExpense"],"type":"string"},"version":{"description":"The current version of this payable. This is incremented every time the payable is modified.","type":"number"}},"required":["id","state","amount","currency","functionalAmount","functionalCurrency","creationDate","memberId","version","kind","subType","description","firstCreatedAt","type","allocations","itemLines","functionalExchangeRate","spendingExchangeRate","counterparty"],"type":"object"},{"additionalProperties":false,"description":"A reversal payable (kind = \"reversal\"), e.g. a credit note.","properties":{"accountPayableId":{"description":"Linked accounts-payable entry ID.","format":"uuid","type":"string"},"accountingDate":{"description":"Date used for the accounting period.","format":"date-time","type":"string"},"allocations":{"description":"Allocations linked to this reversal. `settlement` entries are cash refunded; `expense` entries are this credit note or card refund applied document-to-document to an invoice, not money moved. Amounts are negative, matching the payable.","items":{"additionalProperties":false,"properties":{"allocationId":{"type":"string"},"amount":{"$ref":"#/components/schemas/searchPayableMoney"},"entityId":{"type":"string"},"entityType":{"enum":["expense","settlement"],"type":"string"}},"required":["allocationId","amount","entityId","entityType"],"type":"object"},"type":"array"},"amortisation":{"additionalProperties":false,"description":"Prepaid-expense amortisation schedule.","properties":{"date":{"additionalProperties":false,"properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"],"type":"object"}},"required":["date"],"type":"object"},"amount":{"allOf":[{"$ref":"#/components/schemas/searchPayableMoney"}],"description":"Original transaction amount in currency minor units."},"counterparty":{"anyOf":[{"additionalProperties":false,"properties":{"supplierId":{"type":"string"},"type":{"enum":["supplier"],"type":"string"}},"required":["type","supplierId"],"type":"object"},{"additionalProperties":false,"properties":{"memberId":{"type":"string"},"type":{"enum":["employee"],"type":"string"}},"required":["type","memberId"],"type":"object"}],"description":"The supplier or employee counterparty for this reversal."},"creationDate":{"description":"Issue date of the payable — the date on the underlying document: a supplier invoice's issue date, or for card purchases the transaction's settlement date. This is the payable's accounting-relevant business date and the default basis for placing it in an accounting period. It is set during the request/review flow, is editable by controllers, and can be backdated, so it does NOT reflect when the record entered Spendesk (see firstCreatedAt for that). When the optional accounting-date override is enabled, accountingDate takes precedence for the booking period; otherwise accountingDate defaults to this date. To filter payables by this date, use the payableDate date-filter field (this same value is returned here as creationDate) — not firstCreatedAt, which is the system-entry timestamp.","format":"date-time","type":"string"},"currency":{"description":"ISO 4217 currency code of the transaction amount.","type":"string"},"description":{"description":"Free-text description of the payable.","type":"string"},"documentaryEvidence":{"anyOf":[{"additionalProperties":false,"properties":{"compliances":{"$ref":"#/components/schemas/searchPayableCompliances"},"creditNoteNumber":{"type":"string"},"referenceInvoiceNumber":{"type":"string"},"type":{"enum":["creditNote"],"type":"string"},"validity":{"$ref":"#/components/schemas/searchPayableValidity"}},"required":["validity","type"],"type":"object"},{"additionalProperties":false,"properties":{"compliances":{"$ref":"#/components/schemas/searchPayableCompliances"},"type":{"enum":["declarationOfMissingCreditNote"],"type":"string"},"validity":{"$ref":"#/components/schemas/searchPayableValidity"}},"required":["validity","type"],"type":"object"}],"description":"Attached documentary evidence (credit note or declaration of missing credit note)."},"documentaryEvidenceCannotBeProvided":{"allOf":[{"$ref":"#/components/schemas/searchPayableDocEvidenceCannotBeProvided"}],"description":"Present when the member declared that documentary evidence cannot be provided."},"dueDate":{"description":"Payment due date, when applicable.","format":"date-time","type":"string"},"externalIds":{"description":"IDs this payable has in external systems (ERPs), typically the ERP document number, one entry per system. Only present when `externalIds` is requested through `include`; an empty array means the payable has none. Only exported payables carry an ID, and payables exported before external IDs were recorded may have none. `source` reads `public_api` only for IDs written with provider `PublicApi`; an ID written through the API under another provider (e.g. pennylane) reads back as `native_integration`.","items":{"additionalProperties":false,"properties":{"externalId":{"description":"ID of the payable in the external system (e.g. the ERP document number).","type":"string"},"provider":{"description":"The external system the ID belongs to (e.g. Netsuite, Xero).","nullable":true,"type":"string"},"source":{"description":"Who recorded the mapping. `native_integration` means a native ERP sync owns it and keeps it up to date; `public_api` means it was set through the API.","nullable":true,"type":"string"},"timestamp":{"description":"When this ID was last recorded or updated in Spendesk (ISO 8601), not the date of the document in the external system.","format":"date-time","type":"string"}},"required":["externalId","timestamp"],"type":"object"},"type":"array"},"firstCreatedAt":{"description":"Original creation timestamp (preserved across bookkeeping resets).","format":"date-time","type":"string"},"firstExportedAt":{"description":"Timestamp of the first export to an accounting system.","format":"date-time","type":"string"},"functionalAmount":{"allOf":[{"$ref":"#/components/schemas/searchPayableMoney"}],"description":"Amount in the company's functional currency, in minor units."},"functionalCurrency":{"description":"ISO 4217 currency code of the functional amount.","type":"string"},"functionalExchangeRate":{"allOf":[{"$ref":"#/components/schemas/searchPayableRate"}],"description":"Exchange rate from transaction currency to functional currency."},"id":{"description":"Unique payable identifier.","examples":["bc9cef35-401d-4ea4-b384-ed725e6685cf"],"format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"itemLines":{"description":"Accounting line items with VAT breakdown.","items":{"$ref":"#/components/schemas/searchPayableItemLine"},"type":"array"},"kind":{"description":"Discriminator. Always \"reversal\" for this variant.","enum":["reversal"],"type":"string"},"memberId":{"description":"ID of the team member who owns this payable.","type":"string"},"outstandingAmount":{"allOf":[{"$ref":"#/components/schemas/searchPayableMoney"}],"description":"Portion of the payable amount not yet covered by allocations, in the payable native currency minor units. Zero means fully allocated. Absent if allocation tracking is unavailable for that payable."},"outstandingFunctionalAmount":{"allOf":[{"$ref":"#/components/schemas/searchPayableMoney"}],"description":"Same as outstandingAmount but in the company's functional currency minor units."},"state":{"description":"Bookkeeping lifecycle state of the payable.","enum":["toPrepare","toExport","exported"],"type":"string"},"subType":{"description":"Payment method or expense origin of the reversed payable.","enum":["expense","invoice","creditNote","singlePurchase","subscription","multiUseCard","physical","mileageAllowance","perDiemAllowance"],"type":"string"},"type":{"description":"Always \"reverseBill\" for reversal payables.","enum":["reverseBill"],"type":"string"},"version":{"description":"The current version of this payable. This is incremented every time the payable is modified.","type":"number"}},"required":["id","state","amount","currency","functionalAmount","functionalCurrency","creationDate","memberId","version","kind","subType","description","firstCreatedAt","type","allocations","itemLines","functionalExchangeRate","counterparty"],"type":"object"}],"description":"A payable returned by the search endpoint. Discriminated union: either an expense or a reversal, identified by the kind field.","example":{"allocations":[],"amount":1500,"counterparty":{"supplierId":"sup_xyz","type":"supplier"},"creationDate":"2024-06-15T10:30:00.000Z","currency":"EUR","description":"Office supplies Q2","firstCreatedAt":"2024-06-15T10:30:00.000Z","functionalAmount":1500,"functionalCurrency":"EUR","functionalExchangeRate":1,"id":"bc9cef35-401d-4ea4-b384-ed725e6685cf","itemLines":[{"analyticalFieldAssociations":[],"grossAmount":1500,"netAmount":1250,"vatAdjustment":0,"vatAmount":250,"vatRate":20}],"kind":"expense","memberId":"usr_001","spendingExchangeRate":1,"state":"toExport","subType":"invoice","type":"bill","version":1},"title":"searchPayable"},"searchPayableAmountComparisonOperand":{"description":"Amount filter with a single comparison operator.","properties":{"operator":{"enum":["=","!=","<",">","<=",">="],"type":"string"},"value":{"type":"number"}},"required":["operator","value"],"title":"searchPayableAmountComparisonOperand","type":"object"},"searchPayableAmountFieldFilter":{"allOf":[{"properties":{"field":{"enum":["grossAmount","netAmount","vatAmount"],"type":"string"}},"required":["field"],"type":"object"},{"$ref":"#/components/schemas/searchPayableAmountOperand"}],"description":"Filter payables by an amount field. `grossAmount` is the payable's total. `netAmount` and `vatAmount` are not totals: each item line is tested on its own and a payable matches when ANY one line meets the condition (so `netAmount > 5000` misses a payable with two 3,000 lines, and payables with no item lines never match); for a threshold on a payable's net or VAT total, sum itemLines[].netAmount / vatAmount client-side (they are in the payable's own currency, not the functional currency). `value` is a DECIMAL amount in MAJOR units of the company's functional currency (the currency of functionalAmount), NOT the minor-unit coefficient returned in money objects and NOT the payable's own currency: for payables over EUR 5,000.00 use `{ \"field\": \"grossAmount\", \"operator\": \">\", \"value\": 5000 }`, not 500000.","title":"searchPayableAmountFieldFilter"},"searchPayableAmountOperand":{"anyOf":[{"$ref":"#/components/schemas/searchPayableAmountComparisonOperand"},{"$ref":"#/components/schemas/searchPayableAmountRangeOperand"}],"title":"searchPayableAmountOperand"},"searchPayableAmountRangeOperand":{"description":"Amount filter with a range operator (between or notBetween).","properties":{"operator":{"enum":["between","notBetween"],"type":"string"},"value":{"additionalProperties":false,"properties":{"from":{"type":"number"},"to":{"type":"number"}},"required":["from","to"],"type":"object"}},"required":["operator","value"],"title":"searchPayableAmountRangeOperand","type":"object"},"searchPayableAnalyticalFieldAssociation":{"additionalProperties":false,"description":"Association between an item line and an analytical field (cost center or custom field).","properties":{"fieldEntityId":{"type":"string"},"fieldEntityValueId":{"type":"string"},"fieldKind":{"enum":["costCenter","customField"],"type":"string"}},"required":["fieldKind","fieldEntityId","fieldEntityValueId"],"title":"searchPayableAnalyticalFieldAssociation","type":"object"},"searchPayableBody":{"additionalProperties":false,"description":"Search body for querying payables. Combine leaf filters or compound (and/or) filter groups with cursor-based pagination.","example":{"filters":{"field":"bookkeepingStatus","operator":"=","value":["toExport"]}},"properties":{"cursor":{"description":"Opaque pagination cursor returned in the previous response’s nextCursor field. Omit for the first page.","type":"string"},"externalIds":{"description":"Return only payables carrying one of these IDs in an external system (ERP), exact match. Resolved against the external-reference registry, so payables without an exported ID are excluded. Combined with `filters` using AND. From 1 to 50 per request; omit it rather than send an empty list. Send it again with every `cursor`, like `filters`. The placeholder values `unknown` and `invoiceAlreadyPaid` are rejected with a 400.","items":{"minLength":1,"type":"string"},"maxItems":50,"minItems":1,"type":"array"},"filters":{"allOf":[{"$ref":"#/components/schemas/searchPayableFilter"}],"description":"A single value filter or a compound filter group. Omit to return all payables."},"include":{"description":"Extra data to embed in the response. `externalIds` costs one additional lookup per request, so it is opt-in.","items":{"enum":["externalIds"],"type":"string"},"type":"array"},"limit":{"description":"Maximum number of payables to return per page, from 1 to 1000. Defaults to 1000.","maximum":1000,"minimum":1,"type":"integer"},"provider":{"description":"Restrict the `externalIds` filter to one external system (e.g. Netsuite, pennylane). Ignored without that filter, and it does not narrow the `externalIds` include, which returns the IDs from every system (read `provider` on each entry).","minLength":1,"type":"string"},"sort":{"description":"Sort order by creation date. Defaults to ascending.","enum":["asc","desc"],"type":"string"}},"title":"searchPayableBody","type":"object"},"searchPayableBookkeepingStatusFilter":{"allOf":[{"properties":{"field":{"enum":["bookkeepingStatus"],"type":"string"}},"required":["field"],"type":"object"},{"properties":{"operator":{"enum":["=","!="],"type":"string"},"value":{"anyOf":[{"type":"null"},{"items":{"enum":["toPrepare","toExport","exported"],"type":"string"},"minItems":1,"type":"array"},{"enum":["any"],"type":"string"}]}},"required":["operator","value"],"type":"object"}],"description":"Filter payables by bookkeeping status.","title":"searchPayableBookkeepingStatusFilter"},"searchPayableBooleanFieldFilter":{"additionalProperties":false,"description":"Filter payables by the withBookkeepingStartDate boolean. When true, excludes payables dated before the company's bookkeeping start date (the onboarding/migration cutover), keeping only those whose creationDate is on or after it — or all payables when the company has no start date configured. When false, the filter is a no-op and returns everything.","properties":{"field":{"enum":["withBookkeepingStartDate"],"type":"string"},"operator":{"enum":["="],"type":"string"},"value":{"type":"boolean"}},"required":["field","operator","value"],"title":"searchPayableBooleanFieldFilter","type":"object"},"searchPayableCompliances":{"additionalProperties":false,"description":"Country-specific compliance information (e.g. Spain e-receipt).","properties":{"spainEreceipt":{"additionalProperties":false,"properties":{"closure":{"additionalProperties":false,"properties":{"closedAt":{"type":"string"},"closingPeriod":{"type":"string"},"error":{"additionalProperties":false,"properties":{"details":{},"kind":{"type":"string"}},"required":["kind"],"type":"object"}},"required":["closedAt","closingPeriod"],"type":"object"},"receipt":{"additionalProperties":false,"properties":{"path":{"type":"string"},"uniqueId":{"type":"string"}},"required":["path","uniqueId"],"type":"object"}},"type":"object"}},"title":"searchPayableCompliances","type":"object"},"searchPayableCompoundFilter":{"additionalProperties":false,"properties":{"operator":{"enum":["and","or"],"type":"string"},"subfilters":{"anyOf":[{"items":{"$ref":"#/components/schemas/searchPayableFilter"},"type":"array"},{"items":{"$ref":"#/components/schemas/searchPayableValueFilter"},"type":"array"}]}},"required":["operator","subfilters"],"title":"searchPayableCompoundFilter","type":"object"},"searchPayableCustomFieldFilter":{"allOf":[{"properties":{"field":{"enum":["customField"],"type":"string"}},"required":["field"],"type":"object"},{"properties":{"operator":{"enum":["=","!="],"type":"string"},"value":{"additionalProperties":false,"properties":{"key":{"type":"string"},"value":{"$ref":"#/components/schemas/searchPayableIdOperandValue"}},"required":["key","value"],"type":"object"}},"required":["operator","value"],"type":"object"}],"description":"Filter payables by an analytical (custom) field. `value.key` is the analytical field ID and `value.value` is an array of that field's value IDs (from get_analytical_fields and get_analytical_field_values on the MCP server, or the analytical-fields endpoints on the REST API); `any` instead matches payables with any value of that field, and null those with none. Field names and value labels never match and raise no error: with `=` they return no payables, and with `!=` (or `=` null) they return every payable.","title":"searchPayableCustomFieldFilter"},"searchPayableDateBetweenOperand":{"description":"Date filter with between operator specifying a from/to range.","properties":{"operator":{"enum":["between"],"type":"string"},"value":{"additionalProperties":false,"properties":{"from":{"$ref":"#/components/schemas/searchPayableDateOperand"},"to":{"$ref":"#/components/schemas/searchPayableDateOperand"}},"required":["from","to"],"type":"object"}},"required":["operator","value"],"title":"searchPayableDateBetweenOperand","type":"object"},"searchPayableDateEqualsOperand":{"description":"Date filter with equality operator. Value can be a date literal or null.","properties":{"operator":{"enum":["="],"type":"string"},"value":{"anyOf":[{"$ref":"#/components/schemas/searchPayableDateOperand"},{"type":"null"}]}},"required":["operator","value"],"title":"searchPayableDateEqualsOperand","type":"object"},"searchPayableDateFieldFilter":{"allOf":[{"properties":{"field":{"enum":["payableDate","firstCreatedAt","firstExportedAt","lastUpdatedAt","dueDate","accountingDate"],"type":"string"}},"required":["field"],"type":"object"},{"$ref":"#/components/schemas/searchPayableDateFieldOperand"}],"description":"Filter payables by a date field (payableDate, firstCreatedAt, firstExportedAt, lastUpdatedAt, dueDate, accountingDate).","title":"searchPayableDateFieldFilter"},"searchPayableDateFieldOperand":{"anyOf":[{"$ref":"#/components/schemas/searchPayableDateEqualsOperand"},{"$ref":"#/components/schemas/searchPayableDateRelativeOperand"},{"$ref":"#/components/schemas/searchPayableDateBetweenOperand"},{"$ref":"#/components/schemas/searchPayableDateInLastOperand"}],"title":"searchPayableDateFieldOperand"},"searchPayableDateInLastOperand":{"description":"Date filter with inLast operator specifying a relative time window.","properties":{"operator":{"enum":["inLast"],"type":"string"},"value":{"additionalProperties":false,"properties":{"amount":{"type":"number"},"timeUnit":{"enum":["days","months","years"],"type":"string"}},"required":["timeUnit","amount"],"type":"object"}},"required":["operator","value"],"title":"searchPayableDateInLastOperand","type":"object"},"searchPayableDateOperand":{"anyOf":[{"format":"date-time","type":"string"},{"enum":["today"],"type":"string"},{"enum":["yesterday"],"type":"string"},{"enum":["thisMonth"],"type":"string"},{"enum":["lastMonth"],"type":"string"}],"title":"searchPayableDateOperand"},"searchPayableDateRelativeOperand":{"description":"Date filter with before or after operator.","properties":{"operator":{"enum":["before","after"],"type":"string"},"value":{"$ref":"#/components/schemas/searchPayableDateOperand"}},"required":["operator","value"],"title":"searchPayableDateRelativeOperand","type":"object"},"searchPayableDocEvidenceCannotBeProvided":{"anyOf":[{"additionalProperties":false,"properties":{"reason":{"type":"string"},"reportMethod":{"enum":["manual"],"type":"string"},"reporterId":{"type":"string"}},"required":["reason","reportMethod","reporterId"],"type":"object"},{"additionalProperties":false,"properties":{"reason":{"type":"string"},"reportMethod":{"enum":["automatic"],"type":"string"}},"required":["reason","reportMethod"],"type":"object"}],"description":"Explanation for why documentary evidence (receipt/invoice) cannot be provided.","title":"searchPayableDocEvidenceCannotBeProvided"},"searchPayableDocEvidenceStatusFilter":{"allOf":[{"properties":{"field":{"enum":["documentaryEvidenceStatus"],"type":"string"}},"required":["field"],"type":"object"},{"properties":{"operator":{"enum":["=","!="],"type":"string"},"value":{"anyOf":[{"type":"null"},{"items":{"enum":["provided","providedAndDpr","missing","cannotBeProvided","declaredAsInvalid","hasDprError","hasDpr"],"type":"string"},"minItems":1,"type":"array"},{"enum":["any"],"type":"string"}]}},"required":["operator","value"],"type":"object"}],"description":"Filter payables by documentary evidence status. `provided`/`providedAndDpr` mean a file is attached (user-set) — they do NOT certify that the document is a valid or compliant invoice; for actual validation read the payable's `documentaryEvidence.validity` field. `missing` and `declaredAsInvalid` indicate the receipt still needs follow-up.","title":"searchPayableDocEvidenceStatusFilter"},"searchPayableFilter":{"anyOf":[{"$ref":"#/components/schemas/searchPayableValueFilter"},{"$ref":"#/components/schemas/searchPayableCompoundFilter"}],"title":"searchPayableFilter"},"searchPayableIdFilter":{"allOf":[{"properties":{"field":{"enum":["supplier","requestor","accountPayable","costCenter","paymentId","requestId"],"type":"string"}},"required":["field"],"type":"object"},{"properties":{"operator":{"enum":["=","!="],"type":"string"},"value":{"$ref":"#/components/schemas/searchPayableIdOperandValue"}},"required":["operator","value"],"type":"object"}],"description":"Filter payables by an ID field (supplier, requestor, accountPayable, costCenter, paymentId, requestId).","title":"searchPayableIdFilter"},"searchPayableIdOperandValue":{"anyOf":[{"type":"null"},{"items":{"minLength":1,"type":"string"},"minItems":1,"type":"array"},{"enum":["any"],"type":"string"}],"title":"searchPayableIdOperandValue"},"searchPayableItemLine":{"additionalProperties":false,"description":"An accounting line item with net/gross/VAT breakdown and analytical field associations.","properties":{"analyticalFieldAssociations":{"items":{"$ref":"#/components/schemas/searchPayableAnalyticalFieldAssociation"},"type":"array"},"expenseAccountId":{"type":"string"},"functionalGrossAmount":{"allOf":[{"$ref":"#/components/schemas/searchPayableMoney"}],"description":"Gross amount for this line in the company functional currency. Optional during rollout; when absent, consumers fall back to grossAmount."},"grossAmount":{"$ref":"#/components/schemas/searchPayableMoney"},"netAmount":{"$ref":"#/components/schemas/searchPayableMoney"},"taxAccountId":{"type":"string"},"vatAdjustment":{"$ref":"#/components/schemas/searchPayableMoney"},"vatAmount":{"$ref":"#/components/schemas/searchPayableMoney"},"vatRate":{"$ref":"#/components/schemas/searchPayableRate"}},"required":["netAmount","grossAmount","vatAmount","vatAdjustment","analyticalFieldAssociations","vatRate"],"title":"searchPayableItemLine","type":"object"},"searchPayableMoney":{"description":"Amount expressed in the smallest unit of the currency (e.g. cents for EUR, yen for JPY).","title":"searchPayableMoney","type":"number"},"searchPayablePayableIdFilter":{"description":"Filter payables by payable ID.","properties":{"field":{"enum":["id"],"type":"string"},"operator":{"enum":["=","!="],"type":"string"},"value":{"$ref":"#/components/schemas/searchPayablePayableIdOperandValue"}},"required":["field","operator","value"],"title":"searchPayablePayableIdFilter","type":"object"},"searchPayablePayableIdOperandValue":{"anyOf":[{"type":"null"},{"items":{"description":"The ID of the Payable","examples":["bc9cef35-401d-4ea4-b384-ed725e6685cf"],"format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"minItems":1,"type":"array"},{"enum":["any"],"type":"string"}],"title":"searchPayablePayableIdOperandValue"},"searchPayablePayableTypeFilter":{"allOf":[{"properties":{"field":{"enum":["payableType"],"type":"string"}},"required":["field"],"type":"object"},{"properties":{"operator":{"enum":["=","!="],"type":"string"},"value":{"anyOf":[{"type":"null"},{"items":{"enum":["invoicePurchase","creditNote","mileageAllowance","perDiemAllowance","singleCardPurchase","physicalCardPurchase","multiUseCardPurchase","subscription","cardRefund","expenseClaim"],"type":"string"},"minItems":1,"type":"array"},{"enum":["any"],"type":"string"}]}},"required":["operator","value"],"type":"object"}],"description":"Filter payables by payable type.","title":"searchPayablePayableTypeFilter"},"searchPayablePaymentStatusFilter":{"allOf":[{"properties":{"field":{"enum":["paymentStatus"],"type":"string"}},"required":["field"],"type":"object"},{"properties":{"operator":{"enum":["=","!="],"type":"string"},"value":{"anyOf":[{"type":"null"},{"items":{"enum":["toPay","paid"],"type":"string"},"minItems":1,"type":"array"},{"enum":["any"],"type":"string"}]}},"required":["operator","value"],"type":"object"}],"description":"Filter payables by payment status. `toPay` means any outstanding balance remains — it INCLUDES partially-paid invoices and does NOT mean 'fully unpaid'. `paid` means the allocations on the payable sum to its full amount, leaving zero outstanding (settlements and/or credit notes, so a credit note alone can make an invoice `paid`); it EXCLUDES partially-paid invoices, which are classified as `toPay`. Payment status is not returned on the payable, and the amount fields are always the full invoice value, never reduced by partial payments. So: to size true outstanding AP, sum `outstandingFunctionalAmount` (the authoritative server-computed remainder, in the company's functional currency; `outstandingAmount` is the same figure in each payable's own currency and is therefore NOT summable across currencies) rather than summing `amount` over `toPay` payables, and fall back to `amount` minus `allocations[]` only on payables where those fields are absent. To size total cash paid out, use get_settlements rather than summing `amount` over `paid` payables (which omits the partial payments already made on still-open `toPay` invoices) — do NOT aggregate `allocations[]` for cash: only `entityType: 'settlement'` entries are money moved, while `reversal` (on an expense) and `expense` (on a credit note) entries are credit notes or card refunds applied document-to-document, so an invoice fully covered by a credit note reports `paid` with `outstandingAmount` 0 and zero cash paid; allocation amounts also carry the sign of the payable they sit on, so allocations on credit-note payables are negative.","title":"searchPayablePaymentStatusFilter"},"searchPayableRate":{"description":"Exchange rate as a decimal number.","title":"searchPayableRate","type":"number"},"searchPayableStringEqualityOperand":{"description":"String filter with equality operator (= or !=).","properties":{"operator":{"enum":["=","!="],"type":"string"},"value":{"type":["string","null"]}},"required":["operator","value"],"title":"searchPayableStringEqualityOperand","type":"object"},"searchPayableStringFieldFilter":{"allOf":[{"properties":{"field":{"enum":["description","documentaryEvidenceNumber"],"type":"string"}},"required":["field"],"type":"object"},{"$ref":"#/components/schemas/searchPayableStringOperand"}],"description":"Filter payables by a string field (description or documentaryEvidenceNumber).","title":"searchPayableStringFieldFilter"},"searchPayableStringOperand":{"anyOf":[{"$ref":"#/components/schemas/searchPayableStringEqualityOperand"},{"$ref":"#/components/schemas/searchPayableStringPatternOperand"}],"title":"searchPayableStringOperand"},"searchPayableStringPatternOperand":{"description":"String filter with pattern-matching operator.","properties":{"operator":{"enum":["contains","notContains","startsWith","endsWith"],"type":"string"},"value":{"type":"string"}},"required":["operator","value"],"title":"searchPayableStringPatternOperand","type":"object"},"searchPayableValidity":{"anyOf":[{"additionalProperties":false,"properties":{"valid":{"enum":[true],"type":"boolean"}},"required":["valid"],"type":"object"},{"additionalProperties":false,"properties":{"reason":{"type":"string"},"valid":{"enum":[false],"type":"boolean"}},"required":["valid"],"type":"object"}],"description":"Validation status of documentary evidence. When invalid, might include a reason.","title":"searchPayableValidity"},"searchPayableValueFilter":{"anyOf":[{"$ref":"#/components/schemas/searchPayablePayableIdFilter"},{"$ref":"#/components/schemas/searchPayableIdFilter"},{"$ref":"#/components/schemas/searchPayableCustomFieldFilter"},{"$ref":"#/components/schemas/searchPayableDocEvidenceStatusFilter"},{"$ref":"#/components/schemas/searchPayablePaymentStatusFilter"},{"$ref":"#/components/schemas/searchPayableBookkeepingStatusFilter"},{"$ref":"#/components/schemas/searchPayablePayableTypeFilter"},{"$ref":"#/components/schemas/searchPayableStringFieldFilter"},{"$ref":"#/components/schemas/searchPayableAmountFieldFilter"},{"$ref":"#/components/schemas/searchPayableDateFieldFilter"},{"$ref":"#/components/schemas/searchPayableBooleanFieldFilter"}],"title":"searchPayableValueFilter","type":"object","unevaluatedProperties":false},"serviceUnavailableError":{"additionalProperties":false,"description":"Service Unavailable","properties":{"correlationId":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["SERVICE_UNAVAILABLE_ERROR"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"title":"serviceUnavailableError","type":"object"},"settlement":{"additionalProperties":false,"properties":{"allocations":{"description":"Allocations this settlement is part of, with at most one entry per payableId: if a settlement has several allocations to the same payable only one is returned, so allocation amounts may not add up to the settlement amount.","items":{"additionalProperties":false,"properties":{"amount":{"$ref":"#/components/schemas/priceAmount"},"currency":{"$ref":"#/components/schemas/currency"},"externalIds":{"description":"IDs this allocation has in external systems (ERPs), typically the ERP payment reference, one entry per system. Only present when `externalIds` is requested through `include`; an empty array means the allocation has none. When several allocations to the same payable are collapsed into this entry, their IDs are merged here (the amount is still the kept allocation's only). IDs are recorded per allocation, because settlements are exported per allocation. Only exported allocations carry an ID, and allocations exported before external IDs were recorded may have none. Some integrations record no settlement ID at all (Xero bank fees, QuickBooks settlements, native DATEV settlements and wallet loads), and Xero already-paid settlements carry the literal ID `unknown`. `source` reads `public_api` only for IDs written with provider `PublicApi`; an ID written through the API under another provider (e.g. pennylane) reads back as `native_integration`.","items":{"additionalProperties":false,"properties":{"externalId":{"description":"ID of the allocation in the external system (e.g. the ERP payment reference).","type":"string"},"provider":{"description":"The external system the ID belongs to (e.g. Netsuite, Xero).","nullable":true,"type":"string"},"source":{"description":"Who recorded the mapping. `native_integration` means a native ERP sync owns it and keeps it up to date; `public_api` means it was set through the API.","nullable":true,"type":"string"},"timestamp":{"description":"When this ID was last recorded or updated in Spendesk (ISO 8601), not the date of the document in the external system.","format":"date-time","type":"string"}},"required":["externalId","timestamp"],"type":"object"},"type":"array"},"payableId":{"allOf":[{"$ref":"#/components/schemas/payable/properties/id"}],"description":"The ID of the associated payable."}},"required":["amount","currency","payableId"],"type":"object"},"type":"array"},"amount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"If the payment was made in a foreign currency, this amount is in the foreign currency. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY). Contains negative values for refunds."},"billingAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Amount is in the account's currency. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"billingCurrency":{"$ref":"#/components/schemas/currency"},"billingExchangeRate":{"description":"If the payment was made in a foreign currency, this is the exchange rate between the two currencies at the time of the payment.","type":"number"},"clearedAt":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"Time and date that the transaction cleared. In the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date format."},"currency":{"$ref":"#/components/schemas/currency"},"exportedAt":{"description":"The date and time the settlement was exported at.","oneOf":[{"$ref":"#/components/schemas/dateTime"},{"nullable":true,"type":"object"}]},"id":{"description":"The ID of the settlement.","minLength":1,"type":"string"},"medium":{"description":"The medium as through which this settlement is processed.","enum":["card","wiretransfer"],"type":"string"},"paidFrom":{"description":"The bank account the wire transfer is emitted from (Spendesk or external). For card payments the value is always `spendeskAccount`.","enum":["spendeskAccount","externalAccount"],"type":"string"},"state":{"description":"Indicates the current state of the settlement: created, exported, or failed to export. \n\nType | Description |\n---------|----------|\n `created` | Created but not exported | \n `exported` | Exported | \n `failedToExport` | Tried to export but failed |\"","enum":["created","exported","failedToExport"],"type":"string"},"statusUpdatedAt":{"description":"The date and time the settlement status was updated.","oneOf":[{"$ref":"#/components/schemas/dateTime"},{"nullable":true,"type":"object"}]},"transactionDescription":{"description":"Description of the transaction.","type":"string"},"type":{"description":"Indicates the type of the settlement. \n\nType | Description |\n---------|----------|\n `payment` | A payment to a supplier | \n `reimbursement` | A payment to an employee | \n `refund` | A refund |\n  `advance` | A cash advance |\n  `cashReturn` | A cash return |\n  `chargeback` | A card disputes/chargeback |\"","enum":["payment","refund","advance","cashReturn","chargeback","reimbursement"],"type":"string"},"version":{"description":"Version of the settlement.","type":"number"}},"required":["id","version","type","medium","paidFrom","transactionDescription","clearedAt","amount","currency","billingAmount","billingCurrency","billingExchangeRate","state","exportedAt","statusUpdatedAt","allocations"],"title":"settlement","type":"object"},"settlementQuery":{"allOf":[{"$ref":"#/components/schemas/paginationQuery"},{"properties":{"clearedFrom":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/date"}],"description":"Start date of the requested period. String containing a date expressed in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format like `2023-05-12`."},{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"Start date of the requested period. String containing a UTC datetime expressed in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format like `2023-05-12T14:06:40Z`."}]},"clearedTo":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/date"}],"description":"End date of the requested period. String containing a date expressed in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format like `2023-05-12`."},{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"End date of the requested period. String containing a UTC datetime expressed in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format like `2023-05-12T14:06:40Z`."}]},"exportedAfter":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"The date and time the settlement first got exported to accounting, with timezone offset (use `Z` for UTC)."},"exportedBefore":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"The date and time before which the settlement was first exported to accounting, with timezone offset (use `Z` for UTC)."},"externalIds":{"description":"Return only settlements with at least one allocation carrying one of these IDs in an external system (ERP), exact match, exploded `(externalIds=A&externalIds=B)`. Resolved against the external-reference registry, so settlements without an exported allocation ID are excluded. Combined with every other filter, including `ids`, using AND. From 1 to 50 per request. Rejected with a 400 when the IDs match more than 100 settlements before the other filters apply; narrow with `provider`, `ids` or more specific IDs (date and state filters do not reduce that count). The placeholder values `unknown` and `invoiceAlreadyPaid` are rejected with a 400.","items":{"minLength":1,"type":"string"},"maxItems":50,"minItems":1,"type":"array"},"ids":{"description":"An array of settlement IDs, exploded `(ids=1&ids=2)`.","items":{"$ref":"#/components/schemas/settlement/properties/id"},"minItems":1,"type":"array","uniqueItems":true},"include":{"description":"Extra data to embed in the response. `externalIds` adds `allocations[].externalIds` and costs one additional lookup per request, so it is opt-in.","items":{"enum":["externalIds"],"type":"string"},"type":"array"},"paidFrom":{"description":"Payment account used for the settlement. Card settlements are always `spendeskAccount`; `externalAccount` matches only wire transfers emitted from an external bank account.","items":{"enum":["externalAccount","spendeskAccount"],"type":"string"},"type":"array"},"provider":{"description":"Restrict the `externalIds` filter to one external system (e.g. Netsuite, pennylane). Ignored without that filter, and it does not narrow the `externalIds` include, which returns the IDs from every system (read `provider` on each entry).","minLength":1,"type":"string"},"state":{"items":{"allOf":[{"$ref":"#/components/schemas/settlement/properties/state"}],"description":"Status of settlements to filter by."},"type":"array"},"supplierId":{"description":"The ID of the supplier to filter settlements by.","type":"string"},"transactionDescription":{"description":"Filter settlements by transaction description.","type":"string"},"types":{"description":"Filter settlements by type.","items":{"$ref":"#/components/schemas/settlement/properties/type"},"type":"array"}},"type":"object"}],"title":"settlementQuery","type":"object","unevaluatedProperties":false},"supplier":{"additionalProperties":false,"properties":{"accountPayable":{"additionalProperties":false,"description":"Account payable assigned to the supplier (if exists)","nullable":true,"properties":{"auxiliaryAccountCode":{"description":"Auxiliary code of the account payable; empty string (never null) if unset","nullable":true,"type":"string"},"externalId":{"description":"ERP ID of the account payable, if available; supplier ERP IDs: externalIds","nullable":true,"type":"string"},"generalAccountCode":{"description":"Accounting code of the account payable","type":"string"},"id":{"description":"Internal Spendesk ID of the account payable","type":"string"}},"required":["id","generalAccountCode"],"type":"object"},"address":{"additionalProperties":false,"description":"Supplier's address","properties":{"city":{"description":"City","nullable":true,"type":"string"},"country":{"description":"Country as entered at supplier creation time","nullable":true,"type":"string"},"line1":{"description":"Full street address as free text","nullable":true,"type":"string"},"line2":{"description":"Always null; street is in line1","nullable":true,"type":"string"},"postalCode":{"description":"Postal/ZIP code","nullable":true,"type":"string"},"stateOrCounty":{"description":"Always null (not stored)","nullable":true,"type":"string"}},"required":["line1","line2","city","postalCode","stateOrCounty","country"],"type":"object"},"bankCountry":{"description":"Supplier's bank account ISO alpha-2 country code (for GET endpoints, backward compatibility)","nullable":true,"type":"string"},"bankDetailsUpdatedAt":{"description":"Date and time when bank details were last updated (ISO 8601)","nullable":true,"type":"string"},"bankDetailsUpdatedBy":{"description":"Id of the user who last updated the bank details","nullable":true,"type":"string"},"bankInfo":{"additionalProperties":false,"description":"Bank information for the supplier (for POST/PATCH endpoints)","nullable":true,"properties":{"accountHolderName":{"description":"Name of the account holder","nullable":true,"type":"string"},"accountNumber":{"description":"Bank account number","nullable":true,"type":"string"},"bankCountry":{"description":"Country where the bank is located","nullable":true,"type":"string"},"bic":{"description":"Supplier's bank account BIC","nullable":true,"type":"string"},"iban":{"description":"Supplier's bank account IBAN","nullable":true,"type":"string"},"routingNumber":{"description":"Bank routing number (US)","nullable":true,"type":"string"},"sortCode":{"description":"Bank sort code (UK)","nullable":true,"type":"string"}},"type":"object"},"bic":{"description":"Supplier's bank account BIC (for GET endpoints, backward compatibility)","nullable":true,"type":"string"},"createdAt":{"$ref":"#/components/schemas/dateTime"},"createdBy":{"description":"Id of the user that created the supplier (If available)","nullable":true,"type":"string"},"externalIds":{"description":"IDs this supplier has in external systems (ERPs), one entry per system. Only present when `externalIds` is requested through `include`. Not to be confused with `accountPayable.externalId`, which is the external ID of the account payable rather than of the supplier itself.","items":{"additionalProperties":false,"properties":{"externalId":{"description":"ID of the supplier in the external system.","type":"string"},"provider":{"description":"The external system the ID belongs to (e.g. Netsuite, Xero).","nullable":true,"type":"string"},"source":{"description":"Who recorded the mapping. `native_integration` means a native ERP sync owns it and keeps it up to date; `public_api` means it was set through the API.","nullable":true,"type":"string"},"timestamp":{"description":"When this ID was last recorded or updated in Spendesk (ISO 8601), not the date of the document in the external system.","format":"date-time","type":"string"}},"required":["externalId","timestamp"],"type":"object"},"type":"array"},"iban":{"description":"Supplier's bank account IBAN (for GET endpoints, backward compatibility)","nullable":true,"type":"string"},"id":{"description":"Supplier ID in Spendesk","type":"string"},"isArchived":{"description":"Indicates if supplier is archived. Archiving suppliers is a feature that needs to be activated in Spendesk.","type":"boolean"},"legalName":{"description":"Legal name of the supplier","nullable":true,"type":"string"},"name":{"description":"Supplier name","type":"string"},"registrationNo":{"description":"Tax registration number of the supplier","nullable":true,"type":"string"},"updatedAt":{"$ref":"#/components/schemas/dateTime"},"updatedBy":{"description":"Id of the user that updated the supplier (If available)","nullable":true,"type":"string"},"vatNo":{"description":"VAT number of the supplier","nullable":true,"type":"string"}},"required":["id","name","isArchived","address","legalName","registrationNo","vatNo","createdAt","updatedAt"],"title":"supplier","type":"object"},"supplierInfoBase":{"additionalProperties":false,"properties":{"companyId":{"description":"Company ID the supplier belongs to.","type":"string"},"id":{"description":"Supplier ID in Spendesk","type":"string"},"name":{"description":"Supplier name","type":"string"},"primaryEmail":{"description":"Primary email of the supplier.","type":"string"}},"required":["id","name","companyId"],"title":"supplierInfoBase","type":"object"},"supplierRef":{"additionalProperties":false,"description":"Reference to the supplier (counterparty) of the invoice.","properties":{"id":{"description":"Supplier id. Fetch full supplier details from `GET /v1/suppliers/{id}`.","type":"string"},"name":{"description":"Supplier's current display name.","type":"string"}},"required":["id","name"],"title":"supplierRef","type":"object"},"supplierResponse":{"additionalProperties":false,"properties":{"data":{"description":"List of suppliers matching the given criteria.","items":{"$ref":"#/components/schemas/supplier"},"type":"array"},"meta":{"allOf":[{"$ref":"#/components/schemas/meta"}],"type":"object","unevaluatedProperties":false}},"required":["data","meta"],"title":"supplierResponse","type":"object"},"supplierStatusUpdateSuccessResponse":{"description":"Response for the PATCH suppliers/status endpoint","properties":{"entityUpdateResults":{"description":"Per-entity outcome of the bulk update","items":{"$ref":"#/components/schemas/entityUpdateResult"},"type":"array"},"failedCount":{"description":"Number of entities whose update failed","type":"integer"},"skippedCount":{"description":"Number of entities that were skipped","type":"integer"},"updatedCount":{"description":"Number of successfully updated entities","type":"integer"}},"required":["updatedCount","skippedCount","failedCount","entityUpdateResults"],"title":"supplierStatusUpdateSuccessResponse","type":"object"},"supplierToCreate":{"additionalProperties":false,"properties":{"bankInfo":{"additionalProperties":false,"properties":{"accountHolderName":{"description":"The account holder name of the supplier.","type":"string"},"accountNumber":{"description":"The account number of the supplier.","type":"string"},"bankCountry":{"description":"The bank country of the supplier.","type":"string"},"bic":{"description":"The BIC of the supplier.","type":"string"},"iban":{"description":"The IBAN of the supplier.","type":"string"},"routingNumber":{"description":"The routing number of the supplier.","type":"string"},"sortCode":{"description":"The sort code of the supplier.","type":"string"}},"type":"object"},"name":{"description":"The name of the supplier.","type":"string"},"primaryEmail":{"description":"The primary email of the supplier.","type":"string"},"supplierDetails":{"additionalProperties":false,"properties":{"address":{"description":"The address of the supplier.","type":"string"},"city":{"description":"The city of the supplier.","type":"string"},"country":{"description":"The country of the supplier.","type":"string"},"legalName":{"description":"The legal name of the supplier.","type":"string"},"registrationNumber":{"description":"The registration number of the supplier.","type":"string"},"vatNumber":{"description":"The VAT number of the supplier.","type":"string"},"zipcode":{"description":"The zipcode of the supplier.","type":"string"}},"required":["legalName"],"type":"object"}},"required":["name","supplierDetails"],"title":"supplierToCreate","type":"object"},"supplierToUpdateBulk":{"additionalProperties":false,"properties":{"bankInfo":{"additionalProperties":false,"properties":{"accountHolderName":{"description":"The account holder name of the supplier.","type":"string"},"accountNumber":{"description":"The account number of the supplier.","type":"string"},"bankCountry":{"description":"The bank country of the supplier.","type":"string"},"bic":{"description":"The BIC of the supplier.","type":"string"},"iban":{"description":"The IBAN of the supplier.","type":"string"},"routingNumber":{"description":"The routing number of the supplier.","type":"string"},"sortCode":{"description":"The sort code of the supplier.","type":"string"}},"type":"object"},"id":{"description":"The ID of the supplier to update.","type":"string"},"name":{"description":"The name of the supplier.","type":"string"},"primaryEmail":{"description":"The primary email of the supplier.","type":"string"},"supplierDetails":{"additionalProperties":false,"properties":{"address":{"description":"The address of the supplier.","type":"string"},"city":{"description":"The city of the supplier.","type":"string"},"country":{"description":"The country of the supplier.","type":"string"},"legalName":{"description":"The legal name of the supplier.","type":"string"},"registrationNumber":{"description":"The registration number of the supplier.","type":"string"},"vatNumber":{"description":"The VAT number of the supplier.","type":"string"},"zipcode":{"description":"The zipcode of the supplier.","type":"string"}},"type":"object"}},"required":["id"],"title":"supplierToUpdateBulk","type":"object"},"supplierToUpdateSingle":{"additionalProperties":false,"properties":{"bankInfo":{"additionalProperties":false,"properties":{"accountHolderName":{"description":"The account holder name of the supplier.","type":"string"},"accountNumber":{"description":"The account number of the supplier.","type":"string"},"bankCountry":{"description":"The bank country of the supplier.","type":"string"},"bic":{"description":"The BIC of the supplier.","type":"string"},"iban":{"description":"The IBAN of the supplier.","type":"string"},"routingNumber":{"description":"The routing number of the supplier.","type":"string"},"sortCode":{"description":"The sort code of the supplier.","type":"string"}},"type":"object"},"name":{"description":"The name of the supplier.","type":"string"},"primaryEmail":{"description":"The primary email of the supplier.","type":"string"},"supplierDetails":{"additionalProperties":false,"properties":{"address":{"description":"The address of the supplier.","type":"string"},"city":{"description":"The city of the supplier.","type":"string"},"country":{"description":"The country of the supplier.","type":"string"},"legalName":{"description":"The legal name of the supplier.","type":"string"},"registrationNumber":{"description":"The registration number of the supplier.","type":"string"},"vatNumber":{"description":"The VAT number of the supplier.","type":"string"},"zipcode":{"description":"The zipcode of the supplier.","type":"string"}},"type":"object"}},"title":"supplierToUpdateSingle","type":"object"},"suppliersQuery":{"allOf":[{"$ref":"#/components/schemas/paginationQuery"},{"properties":{"bankCountry":{"description":"ISO alpha-2 code of the bank country","pattern":"^[A-Z]{2}$","type":"string"},"createdAfter":{"$ref":"#/components/schemas/dateTime"},"createdBefore":{"$ref":"#/components/schemas/dateTime"},"externalIds":{"description":"Return only suppliers carrying one of these IDs in an external system (ERP), exact match, exploded `(externalIds=A&externalIds=B)`. Resolved against the external-reference registry, so unmapped suppliers are excluded. Up to 50 per request.","items":{"type":"string"},"maxItems":50,"type":"array"},"iban":{"description":"Supplier IBAN","type":"string"},"ids":{"description":"Supplier IDs to filter by.","items":{"type":"string"},"type":"array"},"include":{"description":"Extra data to embed in the response. `externalIds` costs one additional lookup per request, so it is opt-in.","items":{"enum":["externalIds"],"type":"string"},"type":"array"},"isArchived":{"description":"Selects one archive state and is not additive: true returns ONLY archived suppliers, false ONLY active ones. Omit it to get both — every row carries isArchived.","enum":["true","false"],"type":"string"},"provider":{"description":"Restrict the `externalIds` filter to one external system (e.g. Netsuite, Xero). Worth setting when a company has been connected to more than one ERP, since the same external ID string can exist in each. Ignored without that filter, and it does not narrow the `externalIds` include, which returns the IDs from every system (read `provider` on each entry).","minLength":1,"type":"string"},"search":{"description":"Free-text supplier search, for example by supplier name.","type":"string"},"sort":{"description":"Sort direction.","enum":["asc","desc"],"type":"string"},"sortBy":{"description":"Field to sort suppliers by.","enum":["name","created_at","updated_at"],"type":"string"},"updatedAfter":{"$ref":"#/components/schemas/dateTime"},"updatedBefore":{"$ref":"#/components/schemas/dateTime"},"vatNumber":{"description":"Supplier VAT number","type":"string"}},"type":"object"}],"title":"suppliersQuery"},"taxAccount":{"properties":{"companyId":{"type":"string"},"description":{"type":"string"},"id":{"type":"string"},"isArchived":{"type":"boolean"},"name":{"type":"string"}},"required":["id","name","description","companyId","isArchived"],"title":"taxAccount","type":"object"},"taxRate":{"description":"Tax rate as a percentage — e.g. `20` means 20%, `5.5` means 5.5%. Null when no rate applies or it is unknown.","example":20,"nullable":true,"title":"taxRate","type":"number"},"token":{"description":"This token allows access the endpoints protected by `scope`.","minLength":1,"title":"token","type":"string"},"tooLarge":{"additionalProperties":false,"description":"Payload Too Large","properties":{"correlationId":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["LARGE_BODY_ERROR"],"type":"string"},"detail":{"enum":["The request is too large for this endpoint: send a smaller body or a smaller file."],"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"title":"tooLarge","type":"object"},"tooManyRequests":{"additionalProperties":false,"description":"Too Many Requests","properties":{"correlationId":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["TOO_MANY_REQUESTS"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"title":"tooManyRequests","type":"object"},"unauthorized":{"additionalProperties":false,"description":"Unauthorized","properties":{"correlationId":{"type":"string"},"errors":{"items":{"properties":{"code":{"enum":["AUTHENTICATION_ERROR"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"title":"unauthorized","type":"object"},"unprocessableEntity":{"additionalProperties":false,"description":"Unprocessable Entity","properties":{"correlationId":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["UNPROCESSABLE_ENTITY"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"title":"unprocessableEntity","type":"object"},"unsupportedMediaType":{"additionalProperties":false,"description":"Unsupported Media Type","properties":{"correlationId":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["UNSUPPORTED_MEDIA_TYPE_ERROR"],"type":"string"},"detail":{"enum":["The Content-Type of the request is not supported: send application/json, or application/x-www-form-urlencoded where the endpoint documents it."],"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"title":"unsupportedMediaType","type":"object"},"updatePayableBookkeepingStatusFailure":{"properties":{"id":{"example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","type":"string"},"outcome":{"enum":["notUpdated"],"example":"notUpdated","type":"string"},"reason":{"description":"The reason for the failure\n- 'notFound': The Payable was not found\n- 'invalidState': The Payable is in an invalid state for this operation\n- 'wrongVersion': The Payable version is not the latest\n- 'updateInProgress': The Payable is already being updated\n- 'nothingToUpdate': The Payable has no changes to apply","enum":["notFound","invalidState","wrongVersion","updateInProgress","nothingToUpdate"],"example":"wrongVersion","type":"string"}},"required":["id","outcome","reason"],"title":"updatePayableBookkeepingStatusFailure","type":"object","unevaluatedProperties":false},"updatePayableBookkeepingStatusSuccess":{"properties":{"id":{"example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","type":"string"},"outcome":{"enum":["updated"],"example":"updated","type":"string"}},"required":["id","outcome"],"title":"updatePayableBookkeepingStatusSuccess","type":"object","unevaluatedProperties":false},"updateSettlementStateFailure":{"additionalProperties":false,"properties":{"id":{"description":"The ID of the settlement.","minLength":1,"type":"string"},"outcome":{"enum":["notUpdated"],"example":"notUpdated","type":"string"},"reason":{"description":"The settlement or its accounting export state could not be found.","enum":["notFound"],"example":"notFound","type":"string"}},"required":["id","outcome","reason"],"title":"updateSettlementStateFailure","type":"object"},"updateSettlementStateSuccess":{"additionalProperties":false,"properties":{"id":{"description":"The ID of the settlement.","minLength":1,"type":"string"},"outcome":{"enum":["updated"],"example":"updated","type":"string"}},"required":["id","outcome"],"title":"updateSettlementStateSuccess","type":"object"},"user":{"additionalProperties":false,"properties":{"companyId":{"type":"string"},"costCenter":{"additionalProperties":false,"description":"The user's default cost center. Present only when requested via `include=costCenter` and the cost centers feature is enabled (the field is omitted otherwise); `null` when enabled but none is set.","nullable":true,"properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},"email":{"format":"email","nullable":true,"type":"string"},"firstName":{"nullable":true,"type":"string"},"id":{"type":"string"},"lastName":{"nullable":true,"type":"string"},"manager":{"additionalProperties":false,"description":"The user's direct manager. Present only when requested via `include=manager` and the reporting managers feature is enabled (the field is omitted otherwise); `null` when enabled but no manager is set.","nullable":true,"properties":{"email":{"nullable":true,"type":"string"},"id":{"type":"string"}},"required":["id","email"],"type":"object"},"roles":{"description":"Roles held by the user in the company. Always returned.","items":{"enum":["requester","controller","admin","accountOwner","travelManager"],"type":"string"},"type":"array"},"spendingPolicy":{"additionalProperties":false,"description":"The user's spending (approval) policy. Present only when requested via `include=spendingPolicy` and the spending policies feature is enabled (the field is omitted otherwise); `null` when enabled but none is set.","nullable":true,"properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},"status":{"description":"Lifecycle status of the user in the company.","enum":["active","archived","pending"],"type":"string"},"teams":{"description":"Teams the user belongs to. Present only when requested via `include=teams`; an empty array means the user is in no team.","items":{"additionalProperties":false,"properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},"type":"array"}},"required":["id","companyId","firstName","lastName","email","status","roles"],"title":"user","type":"object"},"userCreationErrorItem":{"additionalProperties":false,"properties":{"details":{"additionalProperties":false,"properties":{"email":{"type":"string"}},"required":["email"],"type":"object"},"outcome":{"enum":["error"],"type":"string"},"reason":{"description":"- `emailUnavailable`: the email already belongs to a Spendesk user. If they are a member of the company, read them with the list of users (their id is not returned). Otherwise, this email cannot be used.\n- `managerNotFound`: the manager is not a member of the company.\n- `duplicateInBatch`: the email appears earlier in the same request.\n- `costCentersDisabled` / `approvalPoliciesDisabled`: the company cannot use cost centers / spending policies.\n- `invalidCostCenter` / `invalidApprovalPolicy`: no cost center / spending policy of the company has this name.\n- `seatLimitReached` / `companyChurned`: the company changed during the request.\n- `internalError`: the user was not created, and can be retried.\n- `partiallyCreated`: the creation failed and could not be undone. The user may exist without its full setup, and a retry returns `emailUnavailable`.","enum":["emailUnavailable","managerNotFound","duplicateInBatch","costCentersDisabled","approvalPoliciesDisabled","invalidCostCenter","invalidApprovalPolicy","seatLimitReached","companyChurned","internalError","partiallyCreated"],"type":"string"}},"required":["outcome","reason","details"],"title":"userCreationErrorItem","type":"object"},"userToCreate":{"additionalProperties":false,"properties":{"costCenter":{"description":"Name of an existing cost center of the company, set as the user default.","minLength":1,"type":"string"},"email":{"description":"Work email of the user. It must not belong to any Spendesk user yet.","format":"email","type":"string"},"firstName":{"minLength":1,"type":"string"},"lastName":{"minLength":1,"type":"string"},"manager":{"description":"Email of an existing member of the company, set as the user manager.","format":"email","type":"string"},"role":{"description":"Role of the user in the company. Defaults to `requester`.","enum":["requester","controller"],"type":"string"},"spendingPolicy":{"description":"Name of an existing spending (approval) policy of the company.","minLength":1,"type":"string"}},"required":["email","firstName","lastName"],"title":"userToCreate","type":"object"},"usersQuery":{"allOf":[{"$ref":"#/components/schemas/paginationQuery"},{"properties":{"ids":{"description":"User IDs to filter by.","items":{"type":"string"},"type":"array"},"include":{"description":"Extra related data to embed on each user. Each value costs one additional lookup per request, so it is opt-in. Repeat the parameter for multiple values (e.g. `include=manager&include=teams`).","items":{"enum":["manager","costCenter","teams","spendingPolicy"],"type":"string"},"type":"array"},"status":{"default":"active","description":"The user status to filter for.","enum":["active","archived","pending"],"type":"string"}},"type":"object"}],"title":"usersQuery","type":"object"},"vatAccount":{"allOf":[{"$ref":"#/components/schemas/taxAccount"},{"properties":{"code":{"type":"string"},"isDefault":{"type":"boolean"},"rate":{"type":"number"},"type":{"enum":["vat"],"type":"string"}},"required":["type","code","rate"],"type":"object"}],"title":"vatAccount","type":"object","unevaluatedProperties":false},"walletLoad":{"additionalProperties":false,"properties":{"amount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Amount of the wallet load. Always in wallet currency. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"bankName":{"description":"The name of the payment institution holding the account.","enum":["sfs","adyen","other"],"type":"string"},"createdAt":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"The date the banking provider booked the wallet load (accounting date on SFS EEA accounts, value date on SFS GBP accounts, entry date on legacy accounts), not a record-creation timestamp."},"currency":{"$ref":"#/components/schemas/currency"},"id":{"description":"Wallet load ID","type":"string"},"type":{"description":"The type of wallet load.","enum":["card","wireTransfer"],"type":"string"}},"required":["id","amount","currency","createdAt","type"],"title":"walletLoad","type":"object"},"walletSummary":{"additionalProperties":false,"properties":{"allocatedOnCards":{"additionalProperties":false,"properties":{"physicalAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Amount allocated on card to physical. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"singlePurchaseAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Amount allocated on card to single purchase. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"subscriptionAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Amount allocated on card to subscription. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"totalAllocatedAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Total amount allocated on card. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."}},"required":["subscriptionAmount","physicalAmount","singlePurchaseAmount","totalAllocatedAmount"],"type":"object"},"currency":{"$ref":"#/components/schemas/currency"},"id":{"description":"The wallet ID.","type":"string"},"name":{"description":"The wallet name.","type":"string"},"scheduledTransfersAmount":{"additionalProperties":false,"properties":{"scheduledExpenseClaimsAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Amount allocated to scheduled transfers. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"scheduledInvoicesAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Amount allocated to scheduled transfers. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"totalScheduledTransferAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"Amount allocated to scheduled transfers. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."}},"required":["scheduledExpenseClaimsAmount","scheduledInvoicesAmount","totalScheduledTransferAmount"],"type":"object"},"status":{"description":"The status of the wallet.","enum":["active"],"type":"string"},"totalAllocatedAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"The total amount allocated on cards & scheduled transfers. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"totalAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"The total amount currently loaded on the wallet. Card settlements can be delayed in which case totalAmount may differ from (wallet loads - sum of settlements). Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."},"totalAvailableAmount":{"allOf":[{"$ref":"#/components/schemas/priceAmount"}],"description":"The total amount currently available for spend. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."}},"required":["id","name","status","currency","totalAmount","totalAvailableAmount","totalAllocatedAmount","allocatedOnCards","scheduledTransfersAmount"],"title":"walletSummary","type":"object"},"webhook":{"additionalProperties":false,"properties":{"companyId":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/dateTime"},"deletedAt":{"oneOf":[{"$ref":"#/components/schemas/dateTime"},{"type":"null"}]},"enabled":{"type":"boolean"},"entity":{"$ref":"#/components/schemas/webhookEntity"},"eventType":{"$ref":"#/components/schemas/webhookEvent"},"id":{"format":"uuid","type":"string"},"liveMode":{"type":"boolean"},"updatedAt":{"$ref":"#/components/schemas/dateTime"},"url":{"format":"uri","type":"string"},"version":{"type":"integer"}},"required":["id","companyId","enabled","eventType","entity","liveMode","url","version","createdAt","updatedAt"],"title":"webhook","type":"object"},"webhookEntity":{"enum":["payables","settlements"],"title":"webhookEntity","type":"string"},"webhookEvent":{"enum":["created","prepared","updated"],"title":"webhookEvent","type":"string"},"webhookPayable":{"additionalProperties":false,"properties":{"data":{"additionalProperties":false,"properties":{"companyId":{"type":"string"},"id":{"format":"uuid","type":"string"},"version":{"type":"integer"}},"required":["id","companyId","version"],"type":"object"},"event":{"additionalProperties":false,"properties":{"entity":{"$ref":"#/components/schemas/webhookEntity"},"eventType":{"enum":["created","prepared"],"type":"string"},"id":{"format":"uuid","type":"string"},"timestamp":{"$ref":"#/components/schemas/dateTime"}},"required":["entity","eventType","id","timestamp"],"type":"object"}},"required":["event","data"],"title":"webhookPayable","type":"object"},"webhookSettlement":{"additionalProperties":false,"properties":{"data":{"additionalProperties":false,"properties":{"companyId":{"type":"string"},"id":{"format":"uuid","type":"string"},"version":{"type":"integer"}},"required":["id","companyId","version"],"type":"object"},"event":{"additionalProperties":false,"properties":{"entity":{"$ref":"#/components/schemas/webhookEntity"},"eventType":{"enum":["created"],"type":"string"},"id":{"format":"uuid","type":"string"},"timestamp":{"$ref":"#/components/schemas/dateTime"}},"required":["entity","eventType","id","timestamp"],"type":"object"}},"required":["event","data"],"title":"webhookSettlement","type":"object"}},"securitySchemes":{"Authentication":{"description":"A company-level token acts on the company it was issued for. An organisation-level token (experimental) acts on the companies of an organisation: send the target company in the `X-Company-Id` header on every call, except on `GET /v2/companies` and on `/v2/companies/{companyId}/…` routes, which carry the company in the path. See [Organisation-level access](/reference/organisation-level-access).","flows":{"authorizationCode":{"authorizationUrl":"/v1/oauth2/authorize","scopes":{"analytical-field:read":"Analytical Fields (Read)","bank-fee:read":"Spending Bank Fees (Read)","cost-center:manage":"Cost Center (Manage)","cost-center:read":"Cost Center (Read)","expense-category:read":"Expense Category (Read)","experimental:accounting-export:read":"Accounting exports (Read)","experimental:accounting-export:write":"Accounting exports (Write)","experimental:accounting:update":"Accounting (Update)","experimental:analytical-field-v2:read":"Analytical Fields v2 (Read)","experimental:analytical-field-v2:write":"Analytical Fields v2 (Write)","experimental:card:read":"Cards (Read)","experimental:card:write":"Cards (Write)","experimental:chart-of-accounts:read":"Chart of Accounts (Read)","experimental:chart-of-accounts:write":"Chart of Accounts (Write)","experimental:company:read":"Companies (Read)","experimental:expense-category-v2:read":"Expense Category Fields v2 (Read)","experimental:expense-category-v2:write":"Expense Category Fields v2 (Write)","experimental:external-reference:read":"External References (Read)","experimental:external-reference:write":"External References (Write)","experimental:intake:read":"Intakes (Read)","experimental:intake:write":"Intakes (Write)","experimental:invoice:read":"Invoices (Read) - experimental","experimental:payable-attachment:write":"Payable Attachments (Write)","experimental:payable-search:read":"Payable Search (Read)","experimental:purchase-order:read":"Purchase Orders (Read)","experimental:purchase-order:write":"Purchase Orders (Write)","experimental:request:read":"Requests (Read)","experimental:supplier:manage":"Suppliers (Manage)","experimental:transaction:read":"Transactions (Read)","experimental:user:manage":"Users (Manage)","experimental:user:role:manage":"User roles (Manage)","experimental:webhooks:read":"Webhooks (Read)","experimental:webhooks:write":"Webhooks (Write)","payable-attachment:read":"Spending Payable Attachments (Read)","payable:read":"Spending Payables (Read)","settlement:read":"Spending Settlements (Read)","supplier:read":"Suppliers (Read)","user:read":"Users (Read)","wallet-load:read":"Spending Wallet Loads (Read)","wallet-summary:read":"Spending Wallet Summary (Read)"},"tokenUrl":"/v1/oauth2/token/create"},"clientCredentials":{"scopes":{"analytical-field:read":"Analytical Fields (Read)","bank-fee:read":"Spending Bank Fees (Read)","cost-center:manage":"Cost Center (Manage)","cost-center:read":"Cost Center (Read)","expense-category:read":"Expense Category (Read)","experimental:accounting-export:read":"Accounting exports (Read)","experimental:accounting-export:write":"Accounting exports (Write)","experimental:accounting:update":"Accounting (Update)","experimental:analytical-field-v2:read":"Analytical Fields v2 (Read)","experimental:analytical-field-v2:write":"Analytical Fields v2 (Write)","experimental:card:read":"Cards (Read)","experimental:card:write":"Cards (Write)","experimental:chart-of-accounts:read":"Chart of Accounts (Read)","experimental:chart-of-accounts:write":"Chart of Accounts (Write)","experimental:company:read":"Companies (Read)","experimental:expense-category-v2:read":"Expense Category Fields v2 (Read)","experimental:expense-category-v2:write":"Expense Category Fields v2 (Write)","experimental:external-reference:read":"External References (Read)","experimental:external-reference:write":"External References (Write)","experimental:intake:read":"Intakes (Read)","experimental:intake:write":"Intakes (Write)","experimental:invoice:read":"Invoices (Read) - experimental","experimental:payable-attachment:write":"Payable Attachments (Write)","experimental:payable-search:read":"Payable Search (Read)","experimental:purchase-order:read":"Purchase Orders (Read)","experimental:purchase-order:write":"Purchase Orders (Write)","experimental:request:read":"Requests (Read)","experimental:supplier:manage":"Suppliers (Manage)","experimental:transaction:read":"Transactions (Read)","experimental:user:manage":"Users (Manage)","experimental:user:role:manage":"User roles (Manage)","experimental:webhooks:read":"Webhooks (Read)","experimental:webhooks:write":"Webhooks (Write)","payable-attachment:read":"Spending Payable Attachments (Read)","payable:read":"Spending Payables (Read)","settlement:read":"Spending Settlements (Read)","supplier:read":"Suppliers (Read)","user:read":"Users (Read)","wallet-load:read":"Spending Wallet Loads (Read)","wallet-summary:read":"Spending Wallet Summary (Read)"},"tokenUrl":"/v1/auth/token"}},"type":"oauth2"}}},"info":{"contact":{"email":"support-public-api@spendesk.com","name":"Spendesk for Developers","url":"https://developer.spendesk.com/"},"description":"Spendesk Public API","summary":"Spendesk Public API","termsOfService":"https://www.spendesk.com/en/legals/terms/api-agreement","title":"Spendesk Public API","version":"1.0"},"openapi":"3.1.0","paths":{"/.well-known/oauth-authorization-server":{"get":{"description":"Returns OAuth2 authorization server metadata as defined by RFC 8414. Used by MCP clients to discover endpoints for authorization, token exchange, and dynamic registration.","operationId":"mcp-authorization-server-metadata","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"authorization_endpoint":{"description":"URL for the authorization endpoint.","type":"string"},"authorization_response_iss_parameter_supported":{"description":"RFC 9207: every authorization response carries an iss parameter equal to issuer. Only advertised when issuer is the configured, non-local base URL.","type":"boolean"},"code_challenge_methods_supported":{"description":"Supported PKCE code challenge methods.","items":{"type":"string"},"type":"array"},"grant_types_supported":{"description":"Supported grant types.","items":{"type":"string"},"type":"array"},"issuer":{"description":"The authorization server issuer URL.","type":"string"},"registration_endpoint":{"description":"URL for the dynamic client registration endpoint.","type":"string"},"response_types_supported":{"description":"Supported response types.","items":{"type":"string"},"type":"array"},"scopes_supported":{"description":"Supported OAuth2 scopes.","items":{"type":"string"},"type":"array"},"token_endpoint":{"description":"URL for the token endpoint.","type":"string"},"token_endpoint_auth_methods_supported":{"description":"Supported token endpoint authentication methods.","items":{"type":"string"},"type":"array"}},"type":"object"}}},"description":"Default Response"}},"summary":"Authorization Server Metadata","tags":["Authentication"]}},"/.well-known/oauth-protected-resource/v1/mcp":{"get":{"description":"Returns OAuth2 protected resource metadata scoped to the MCP resource path, as defined by RFC 9728.","operationId":"mcp-protected-resource-metadata-mcp","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"authorization_servers":{"description":"List of authorization server URLs.","items":{"type":"string"},"type":"array"},"resource":{"description":"The MCP resource identifier.","type":"string"},"scopes_supported":{"description":"Supported OAuth2 scopes.","items":{"type":"string"},"type":"array"}},"type":"object"}}},"description":"Default Response"}},"summary":"MCP Protected Resource Metadata","tags":["Authentication"]}},"/v1/analytical-fields":{"get":{"description":"**Allowed Scopes**: _`analytical-field:read`_\n\nReturns analytical fields existing (or archived) in the Spendesk entity (company). Analytical fields data are cached for up to 24 hours. Changes, including those made through the API, can take up to 24 hours to appear.","operationId":"v1-get-analytical-fields","parameters":[{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"Page size","in":"query","name":"pageSize","required":false,"schema":{"default":30,"maximum":30,"minimum":1,"type":"integer"}},{"description":"Include deleted fields","in":"query","name":"includeArchived","required":false,"schema":{"default":false,"type":"boolean"}},{"description":"Field IDs, exploded `(ids=1&ids=2)`","in":"query","name":"ids","required":false,"schema":{"items":{"type":"string"},"type":"array"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"data":{"description":"Analytical fields list","items":{"additionalProperties":false,"properties":{"id":{"type":"string"},"isArchived":{"type":"boolean"},"name":{"type":"string"}},"required":["id","name","isArchived"],"type":"object"},"type":"array"},"meta":{"$ref":"#/components/schemas/meta"}},"required":["meta","data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["analytical-field:read"]}],"summary":"Get Analytical Fields","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]}},"/v1/analytical-fields/{fieldId}/values":{"get":{"description":"**Allowed Scopes**: _`analytical-field:read`_\n\nReturns values of the specified analytical field. Analytical field values data are cached for up to 24 hours. Changes, including those made through the API, can take up to 24 hours to appear.","operationId":"v1-get-analytical-field-values","parameters":[{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"Page size","in":"query","name":"pageSize","required":false,"schema":{"default":30,"maximum":30,"minimum":1,"type":"integer"}},{"description":"Include archived values (retained for historical payables, not deleted)","in":"query","name":"includeArchived","required":false,"schema":{"default":false,"type":"boolean"}},{"description":"Analytical field ID","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"description":"Analytical field values list","items":{"additionalProperties":false,"properties":{"id":{"type":"string"},"isArchived":{"type":"boolean"},"value":{"type":"string"}},"required":["id","value","isArchived"],"type":"object"},"type":"array"},"meta":{"$ref":"#/components/schemas/meta"}},"required":["meta","data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["analytical-field:read"]}],"summary":"Get Analytical Values","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]}},"/v1/auth/token":{"post":{"description":"Create an access token for Public API credentials.\n\nUse this endpoint for server-to-server integrations that were issued Public API credentials. Send `Authorization: Basic base64(client_id:client_secret)` and either an empty JSON body or `{\"grant_type\":\"client_credentials\"}`.\n\nDo not use this endpoint for OAuth app credentials. OAuth apps must use the PKCE flow with [Request Authorization](/reference/v1-request-authorization) and [OAuth2 Token Endpoint](/reference/v1-create-oauth2-token).","operationId":"v1-create-auth-token","parameters":[{"description":"Should contain \"Basic \" followed by base64 encoded Public API `client_id:client_secret`.","in":"header","name":"authorization","required":true,"schema":{"minLength":1,"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"Optional body. You can omit it entirely or send `grant_type=client_credentials`. Use `scope` only if you want to narrow the token scope.","nullable":true,"properties":{"grant_type":{"default":"client_credentials","description":"Optional. Defaults to `client_credentials` when omitted.","enum":["client_credentials"],"type":"string"},"scope":{"description":"Optional field to restrict the scope of the token. The default scope will match the scope defined in the front end when generating your API client id and secret.\n\nSee [available scopes](/reference/scopes) for more information.","type":"string"}},"type":"object"}}},"description":"Optional body. You can omit it entirely or send `grant_type=client_credentials`. Use `scope` only if you want to narrow the token scope.","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"access_token":{"$ref":"#/components/schemas/token"},"expires_in":{"default":3600,"description":"Amount of seconds until the given token expires","exclusiveMinimum":0,"type":"integer"},"token_type":{"enum":["Bearer"],"type":"string"}},"required":["access_token","token_type","expires_in"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"Bad request","properties":{"correlationId":{"type":"string"},"error":{"enum":["invalid_request","invalid_client","invalid_grant","invalid_scope"],"type":"string"},"error_description":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["BAD_REQUEST_INCORRECT_OR_MISSING_FIELD","RESPONSE_TOO_LARGE"],"type":"string"},"detail":{"type":"string"},"source":{"type":"string"}},"required":["code","detail","source"],"type":"object"},"type":"array"}},"required":["errors"],"type":"object"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"Unauthorized","properties":{"correlationId":{"type":"string"},"error":{"enum":["invalid_request","invalid_client","invalid_grant","invalid_scope"],"type":"string"},"error_description":{"type":"string"},"errors":{"items":{"properties":{"code":{"enum":["AUTHENTICATION_ERROR"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"type":"object"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"Forbidden","properties":{"correlationId":{"type":"string"},"error":{"enum":["invalid_request","invalid_client","invalid_grant","invalid_scope"],"type":"string"},"error_description":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["FORBIDDEN_ERROR"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"type":"object"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"summary":"Create Access Token (Public API credentials)","tags":["Authentication"]}},"/v1/bank-fees":{"get":{"description":"**Allowed Scopes**: _`bank-fee:read`_\n\nReturns bank fees. For more information about bank fees, see [this guide](/reference/how-to-use-spend-data). Bank fees data are cached for up to 24 hours. Changes, including those made through the API, can take up to 24 hours to appear.","operationId":"v1-get-bank-fees","parameters":[{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"Page size","in":"query","name":"pageSize","required":false,"schema":{"default":30,"maximum":30,"minimum":1,"type":"integer"}},{"description":"Start date of the requested period, with timezone offset (`Z` for UTC).","in":"query","name":"from","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/dateTime"}]}},{"description":"End date of the requested period, with timezone offset (`Z` for UTC).","in":"query","name":"to","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/dateTime"}]}},{"description":"An array of settlement IDs, exploded `(settlementIds=1&settlementIds=2)`.","in":"query","name":"settlementIds","required":false,"schema":{"items":{"type":"string"},"type":"array"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"description":"The list of bank fees.","items":{"$ref":"#/components/schemas/bankFee"},"type":"array"},"meta":{"$ref":"#/components/schemas/meta"}},"required":["data","meta"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["bank-fee:read"]}],"summary":"Get Bank Fees","tags":["Settlements and wallet"],"x-roles":["controller","admin","accountOwner"]}},"/v1/cards":{"get":{"description":"**Allowed Scopes**: _`experimental:card:read`_\n\nReturns cards for the authenticated company. Lost, stolen, damaged, expired and cancelled cards are not listed.","operationId":"v1-get-cards","parameters":[{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"Page size","in":"query","name":"pageSize","required":false,"schema":{"default":30,"maximum":30,"minimum":1,"type":"integer"}},{"description":"Filter by card type.","in":"query","name":"type","required":false,"schema":{"enum":["single_purchase","subscription","physical","multi_use"],"type":"string"}},{"description":"Filter by card status label, case-sensitive: `Active`, `Blocked`, `New`, `Ready`, `Pre-activated`, `Hidden`, `Unknown` or `Aborted`. The legacy raw code (for example `ACT` or `BLO`) also matches. Lost, stolen, damaged, expired and cancelled cards are never listed, so filtering on those statuses returns no cards.","in":"query","name":"status","required":false,"schema":{"type":"string"}},{"description":"Filter by card owner user ID.","in":"query","name":"userId","required":false,"schema":{"type":"string"}},{"description":"Return cards created on or after this date (YYYY-MM-DD, UTC).","in":"query","name":"createdAfter","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"Return cards created on or before this date (YYYY-MM-DD, UTC).","in":"query","name":"createdBefore","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"data":{"description":"List of cards","items":{"properties":{"availableBalance":{"description":"What the card can spend right now, in `currency`, as a decimal in major units (12.5 means 12.50), not minor units.","type":"number"},"blockingReason":{"description":"The single highest-priority reason this card is blocked — a card can hold several blocking reasons at once, so clearing this one may leave it blocked; do not present it as the only reason or as a complete unblocking instruction. Who/what has it blocked: user (a teammate — see userId/firstName/lastName), support (Spendesk support, identity never disclosed), controlRule (a company-configured spending control rule — could require a receipt, description, supplier, cost center, or custom fields depending on the company's rules; which rule and requirement is unmet is not exposed here), scheduledDeactivation (a recurring deactivation schedule configured for this physical card — reactivates automatically per that schedule), automatic (an automated process, no further detail exposed), or internal (an internal reason with no disclosable detail — contact the Spendesk support team for more information). Only populated while status is Blocked; null or absent otherwise. Use GET /v1/cards/:cardId/blocking-history for every reason on the card, active and past.","properties":{"createdAt":{"type":"string"},"firstName":{"type":["null","string"]},"initiator":{"enum":["user","support","scheduledDeactivation","automatic","controlRule","internal"],"type":"string"},"lastName":{"type":["null","string"]},"userId":{"type":["null","string"]}},"required":["initiator","createdAt"],"type":["null","object"]},"cardOrder":{"description":"Physical card order/shipping info: state, city/country (not the full address), trackingLink, dates, consideredAsLost, estimatedReceivedAt. Only populated for physical cards while pre-activated (status Pre-activated); null or absent otherwise — this does not mean the order info no longer exists after activation, see GET /v1/cards/:cardId/order for the status-independent lookup.","properties":{"cardId":{"type":"string"},"city":{"type":["null","string"]},"consideredAsLost":{"description":"Computed at read time, not stored: true when receivedAt is null and the order was placed more than 30 days ago. receivedAt is not reliably recorded, so this is only a possible delivery-delay signal while the card is still Pre-activated; ignore it once the card is Active, Blocked or Ready. Not the card's own Lost status — never report the card as lost or the shipment as delayed from it; read the card's status for that.","type":"boolean"},"country":{"type":["null","string"]},"createdAt":{"type":"string"},"estimatedReceivedAt":{"type":["null","string"]},"id":{"type":"string"},"receivedAt":{"type":["null","string"]},"shippedAt":{"type":["null","string"]},"state":{"enum":["to_pickup","to_ship","shipped"],"type":"string"},"trackingLink":{"type":["null","string"]}},"required":["id","cardId","state","createdAt","consideredAsLost"],"type":["null","object"]},"company":{"properties":{"id":{"type":"string"},"label":{"type":"string"}},"required":["id","label"],"type":["null","object"]},"costCenter":{"properties":{"id":{"type":"string"},"label":{"type":"string"}},"required":["id","label"],"type":["null","object"]},"createdAt":{"type":"string"},"currency":{"type":"string"},"expiryDate":{"description":"Expiry date printed on the card, set by the card provider. For multi-use cards this is NOT the date the card stops working — use multiUseCardExpiryDate instead.","type":["null","string"]},"id":{"type":"string"},"lastFourDigits":{"type":["null","string"]},"lastSuccessfulPaymentTime":{"description":"Timestamp of the last settled card payment. Explicit null means confirmed: the card has never had one. The field being absent from the response instead means the lookup temporarily failed and the status is unknown — do not treat a missing field as null.","type":["null","string"]},"multiUseCardExpiryDate":{"description":"Expiration date of a multi-use card (ISO 8601 datetime): the end date chosen by the requester when the card was requested. Choosing an end date is mandatory when requesting a multi-use card, so this is set on every card of type multi_use; it is absent on all other card types. For multi-use cards it is the single source of truth for expiration — the date the card actually stops being usable — and always takes precedence over expiryDate.","type":"string"},"owner":{"properties":{"id":{"type":"string"},"label":{"type":"string"}},"required":["id","label"],"type":["null","object"]},"recurrence":{"description":"Payment recurrence of the subscription, normally null for non-subscription cards. MONTHLY is also the fallback when the recurrence could not be resolved (no linked request, no interval on it, or a failed lookup), so it is not a confirmed cadence.","enum":["MONTHLY","YEARLY","WEEKLY","QUARTERLY",null],"type":["null","string"]},"request":{"description":"The originating request behind this virtual card: id, label, and the amount/currency the requester declared when creating it. amount and currency are in the requester's chosen (declared) currency, which may differ from the card's top-level currency and availableBalance — those are always in the company's currency. amount is a decimal in major units (12.5 means 12.50), not minor units. Null when the card has no linked request or when the request lookup failed — the two are not distinguished, and a failed lookup also nulls supplier and costCenter.","properties":{"amount":{"type":"number"},"currency":{"type":"string"},"id":{"type":"string"},"label":{"type":"string"}},"required":["id","label","amount","currency"],"type":["null","object"]},"spendingLimit":{"description":"The card's monthly budget, in `currency`, as a decimal in major units (12.5 means 12.50), not minor units. Null when no monthly budget is set.","type":["null","number"]},"status":{"description":"Card status label: `Active`, `Blocked`, `New`, `Ready`, `Pre-activated`, `Hidden`, `Unknown`, `Aborted`, `Lost`, `Stolen`, `Damaged`, `Expired` or `Cancelled`. A status code with no label is returned as the raw code, so treat unknown values as possible.","type":"string"},"subscriptionBudget":{"description":"The subscription's remaining budget as shown on the card in the product: budgetAmount (the declared budget), spentAmount (current billing period spend only, capped at budgetAmount), availableAmount (what is left of this period's budget; 0 when at or over budget), and spentPercent (rounded whole number 0–100; 100 can also mean just under budget). When the declared currency differs from the company's and the period's spend in the company currency, FX fees included, exceeds the budget, spentAmount, availableAmount and spentPercent are all 0, which means over budget, not unused. Use the card's transactions for actual spend. Amounts are in the subscription's own declared currency (the currency field here), which may differ from the card's top-level currency and availableBalance — those are always in the company's currency. All amounts are decimals in major units (12.5 means 12.50), not minor units. Only populated for subscription cards; null or absent otherwise.","properties":{"availableAmount":{"type":"number"},"budgetAmount":{"type":"number"},"currency":{"type":"string"},"spentAmount":{"type":"number"},"spentPercent":{"type":"number"}},"required":["currency","budgetAmount","availableAmount","spentAmount","spentPercent"],"type":["null","object"]},"supplier":{"properties":{"id":{"type":"string"},"label":{"type":"string"}},"required":["id","label"],"type":["null","object"]},"type":{"type":"string"}},"required":["id","type","status","currency","availableBalance","createdAt"],"type":"object"},"type":"array"},"meta":{"$ref":"#/components/schemas/meta"}},"required":["meta","data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:card:read"]}],"summary":"Get Cards","tags":["Cards"],"x-roles":["controller","admin","accountOwner"]}},"/v1/cards/{cardId}":{"get":{"description":"**Allowed Scopes**: _`experimental:card:read`_\n\nReturns a single card by ID.","operationId":"v1-get-card","parameters":[{"description":"The ID of the card to retrieve.","in":"path","name":"cardId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"data":{"properties":{"availableBalance":{"description":"What the card can spend right now, in `currency`, as a decimal in major units (12.5 means 12.50), not minor units.","type":"number"},"blockingReason":{"description":"The single highest-priority reason this card is blocked — a card can hold several blocking reasons at once, so clearing this one may leave it blocked; do not present it as the only reason or as a complete unblocking instruction. Who/what has it blocked: user (a teammate — see userId/firstName/lastName), support (Spendesk support, identity never disclosed), controlRule (a company-configured spending control rule — could require a receipt, description, supplier, cost center, or custom fields depending on the company's rules; which rule and requirement is unmet is not exposed here), scheduledDeactivation (a recurring deactivation schedule configured for this physical card — reactivates automatically per that schedule), automatic (an automated process, no further detail exposed), or internal (an internal reason with no disclosable detail — contact the Spendesk support team for more information). Only populated while status is Blocked; null or absent otherwise. Use GET /v1/cards/:cardId/blocking-history for every reason on the card, active and past.","properties":{"createdAt":{"type":"string"},"firstName":{"type":["null","string"]},"initiator":{"enum":["user","support","scheduledDeactivation","automatic","controlRule","internal"],"type":"string"},"lastName":{"type":["null","string"]},"userId":{"type":["null","string"]}},"required":["initiator","createdAt"],"type":["null","object"]},"cardOrder":{"description":"Physical card order/shipping info: state, city/country (not the full address), trackingLink, dates, consideredAsLost, estimatedReceivedAt. Only populated for physical cards while pre-activated (status Pre-activated); null or absent otherwise — this does not mean the order info no longer exists after activation, see GET /v1/cards/:cardId/order for the status-independent lookup.","properties":{"cardId":{"type":"string"},"city":{"type":["null","string"]},"consideredAsLost":{"description":"Computed at read time, not stored: true when receivedAt is null and the order was placed more than 30 days ago. receivedAt is not reliably recorded, so this is only a possible delivery-delay signal while the card is still Pre-activated; ignore it once the card is Active, Blocked or Ready. Not the card's own Lost status — never report the card as lost or the shipment as delayed from it; read the card's status for that.","type":"boolean"},"country":{"type":["null","string"]},"createdAt":{"type":"string"},"estimatedReceivedAt":{"type":["null","string"]},"id":{"type":"string"},"receivedAt":{"type":["null","string"]},"shippedAt":{"type":["null","string"]},"state":{"enum":["to_pickup","to_ship","shipped"],"type":"string"},"trackingLink":{"type":["null","string"]}},"required":["id","cardId","state","createdAt","consideredAsLost"],"type":["null","object"]},"company":{"properties":{"id":{"type":"string"},"label":{"type":"string"}},"required":["id","label"],"type":["null","object"]},"costCenter":{"properties":{"id":{"type":"string"},"label":{"type":"string"}},"required":["id","label"],"type":["null","object"]},"createdAt":{"type":"string"},"currency":{"type":"string"},"expiryDate":{"description":"Expiry date printed on the card, set by the card provider. For multi-use cards this is NOT the date the card stops working — use multiUseCardExpiryDate instead.","type":["null","string"]},"id":{"type":"string"},"lastFourDigits":{"type":["null","string"]},"lastSuccessfulPaymentTime":{"description":"Timestamp of the last settled card payment. Explicit null means confirmed: the card has never had one. The field being absent from the response instead means the lookup temporarily failed and the status is unknown — do not treat a missing field as null.","type":["null","string"]},"multiUseCardExpiryDate":{"description":"Expiration date of a multi-use card (ISO 8601 datetime): the end date chosen by the requester when the card was requested. Choosing an end date is mandatory when requesting a multi-use card, so this is set on every card of type multi_use; it is absent on all other card types. For multi-use cards it is the single source of truth for expiration — the date the card actually stops being usable — and always takes precedence over expiryDate.","type":"string"},"owner":{"properties":{"id":{"type":"string"},"label":{"type":"string"}},"required":["id","label"],"type":["null","object"]},"recurrence":{"description":"Payment recurrence of the subscription, normally null for non-subscription cards. MONTHLY is also the fallback when the recurrence could not be resolved (no linked request, no interval on it, or a failed lookup), so it is not a confirmed cadence.","enum":["MONTHLY","YEARLY","WEEKLY","QUARTERLY",null],"type":["null","string"]},"request":{"description":"The originating request behind this virtual card: id, label, and the amount/currency the requester declared when creating it. amount and currency are in the requester's chosen (declared) currency, which may differ from the card's top-level currency and availableBalance — those are always in the company's currency. amount is a decimal in major units (12.5 means 12.50), not minor units. Null when the card has no linked request or when the request lookup failed — the two are not distinguished, and a failed lookup also nulls supplier and costCenter.","properties":{"amount":{"type":"number"},"currency":{"type":"string"},"id":{"type":"string"},"label":{"type":"string"}},"required":["id","label","amount","currency"],"type":["null","object"]},"spendingLimit":{"description":"The card's monthly budget, in `currency`, as a decimal in major units (12.5 means 12.50), not minor units. Null when no monthly budget is set.","type":["null","number"]},"status":{"description":"Card status label: `Active`, `Blocked`, `New`, `Ready`, `Pre-activated`, `Hidden`, `Unknown`, `Aborted`, `Lost`, `Stolen`, `Damaged`, `Expired` or `Cancelled`. A status code with no label is returned as the raw code, so treat unknown values as possible.","type":"string"},"subscriptionBudget":{"description":"The subscription's remaining budget as shown on the card in the product: budgetAmount (the declared budget), spentAmount (current billing period spend only, capped at budgetAmount), availableAmount (what is left of this period's budget; 0 when at or over budget), and spentPercent (rounded whole number 0–100; 100 can also mean just under budget). When the declared currency differs from the company's and the period's spend in the company currency, FX fees included, exceeds the budget, spentAmount, availableAmount and spentPercent are all 0, which means over budget, not unused. Use the card's transactions for actual spend. Amounts are in the subscription's own declared currency (the currency field here), which may differ from the card's top-level currency and availableBalance — those are always in the company's currency. All amounts are decimals in major units (12.5 means 12.50), not minor units. Only populated for subscription cards; null or absent otherwise.","properties":{"availableAmount":{"type":"number"},"budgetAmount":{"type":"number"},"currency":{"type":"string"},"spentAmount":{"type":"number"},"spentPercent":{"type":"number"}},"required":["currency","budgetAmount","availableAmount","spentAmount","spentPercent"],"type":["null","object"]},"supplier":{"properties":{"id":{"type":"string"},"label":{"type":"string"}},"required":["id","label"],"type":["null","object"]},"type":{"type":"string"}},"required":["id","type","status","currency","availableBalance","createdAt"],"type":"object"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:card:read"]}],"summary":"Get a Card","tags":["Cards"],"x-roles":["controller","admin","accountOwner"]}},"/v1/cards/{cardId}/blocking-history":{"get":{"description":"**Allowed Scopes**: _`experimental:card:read`_\n\nReturns the full block/unblock history for a card, regardless of its current status — every reason on the card, active and past, not just the current one. `endedAt` null means the reason is still active; several entries can carry a null `endedAt` at the same time, because a card can be blocked for several reasons at once. An empty history is a normal 200 with an empty array, not a 404.","operationId":"v1-get-card-blocking-history","parameters":[{"description":"The ID of the card.","in":"path","name":"cardId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"data":{"items":{"properties":{"blockerId":{"type":["null","string"]},"createdAt":{"type":"string"},"endedAt":{"type":["null","string"]},"id":{"type":"string"},"initiator":{"enum":["user","support","scheduledDeactivation","automatic","controlRule","internal"],"type":"string"}},"required":["id","initiator","blockerId","createdAt","endedAt"],"type":"object"},"type":"array"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:card:read"]}],"summary":"Get a Card Blocking History","tags":["Cards"],"x-roles":["controller","admin","accountOwner"]}},"/v1/cards/{cardId}/order":{"get":{"description":"**Allowed Scopes**: _`experimental:card:read`_\n\nReturns physical card order/shipping info for a card, regardless of its current status. 404 when no order is on file (always the case for a virtual card), but also when the card does not exist, belongs to another company, or is not visible to the caller.","operationId":"v1-get-card-order","parameters":[{"description":"The ID of the card.","in":"path","name":"cardId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"data":{"properties":{"cardId":{"type":"string"},"city":{"type":["null","string"]},"consideredAsLost":{"description":"Computed at read time, not stored: true when receivedAt is null and the order was placed more than 30 days ago. receivedAt is not reliably recorded, so this is only a possible delivery-delay signal while the card is still Pre-activated; ignore it once the card is Active, Blocked or Ready. Not the card's own Lost status — never report the card as lost or the shipment as delayed from it; read the card's status for that.","type":"boolean"},"country":{"type":["null","string"]},"createdAt":{"type":"string"},"estimatedReceivedAt":{"type":["null","string"]},"id":{"type":"string"},"receivedAt":{"type":["null","string"]},"shippedAt":{"type":["null","string"]},"state":{"enum":["to_pickup","to_ship","shipped"],"type":"string"},"trackingLink":{"type":["null","string"]}},"required":["id","cardId","state","createdAt","consideredAsLost"],"type":"object"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:card:read"]}],"summary":"Get a Card Order","tags":["Cards"],"x-roles":["controller","admin","accountOwner"]}},"/v1/cost-centers":{"get":{"description":"**Allowed Scopes**: _`cost-center:read`_\n\nReturns cost centers of the Spendesk entity (company). Cost centers data are cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear.","operationId":"v1-get-cost-centers","parameters":[{"description":"Cost center IDs to filter by.","in":"query","name":"ids","required":false,"schema":{"items":{"format":"uuid","type":"string"},"type":"array"}},{"description":"Whether to include archived cost centers in the response. Defaults to `false`.","in":"query","name":"includeArchived","required":false,"schema":{"default":false,"type":"boolean"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"items":{"additionalProperties":false,"properties":{"coOwnerIds":{"description":"Cost center co-owner ID","items":{"type":"string"},"type":"array"},"id":{"description":"Cost center ID","format":"uuid","type":"string"},"isArchived":{"description":"Whether the cost center is archived","type":"boolean"},"name":{"description":"Cost center name","type":"string"},"owner":{"description":"Cost center owner ID","type":"string"}},"required":["id","name","owner","coOwnerIds","isArchived"],"type":"object"},"type":"array"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["cost-center:read"]}],"summary":"Get Cost Centers","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]},"post":{"description":"**Allowed Scopes**: _`cost-center:manage`_\n\nCreate a new cost center.","operationId":"v1-create-cost-centers","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"coOwnerIds":{"description":"The IDs of the users who will be co-owners of the cost center.","items":{"type":"string"},"type":"array"},"name":{"description":"The name of the cost center.","type":"string"},"owner":{"description":"The ID of the user who will own the cost center.","type":"string"}},"required":["name","owner","coOwnerIds"],"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"coOwnerIds":{"description":"The IDs of the users who will be co-owners of the cost center.","items":{"type":"string"},"type":"array"},"id":{"description":"The ID of the newly created cost center.","type":"string"},"name":{"description":"The name of the cost center.","type":"string"},"owner":{"description":"The ID of the user who will own the cost center.","type":"string"}},"required":["id","name","owner","coOwnerIds"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"properties":{"outcome":{"enum":["notCreated"],"example":"notCreated","type":"string"},"reason":{"enum":["nameAlreadyExists"],"example":"nameAlreadyExists","type":"string"}},"required":["outcome","reason"],"type":"object"}}},"description":"Default Response"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"422":{"content":{"application/json":{"schema":{"properties":{"outcome":{"enum":["notCreated"],"example":"notCreated","type":"string"},"reason":{"enum":["duplicateCoOwners"],"example":"duplicateCoOwners","type":"string"}},"required":["outcome","reason"],"type":"object"}}},"description":"Default Response"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["cost-center:manage"]}],"summary":"Create Cost Centers","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]}},"/v1/cost-centers/{costCenterId}":{"delete":{"description":"**Allowed Scopes**: _`cost-center:manage`_\n\nDelete an existing cost center.","operationId":"v1-delete-cost-centers","parameters":[{"description":"ID of the cost center to delete.","in":"path","name":"costCenterId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"204":{"content":{"application/json":{"schema":{}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["cost-center:manage"]}],"summary":"Delete Cost Centers","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]},"put":{"description":"**Allowed Scopes**: _`cost-center:manage`_\n\nUpdate an existing cost center.","operationId":"v1-update-cost-centers","parameters":[{"description":"ID of the cost center to update.","in":"path","name":"costCenterId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"coOwnerIds":{"description":"The IDs of the users who will be co-owners of the cost center.","items":{"type":"string"},"type":"array"},"name":{"description":"The name of the cost center.","type":"string"},"owner":{"description":"The ID of the user who will own the cost center.","type":"string"}},"required":["name","owner","coOwnerIds"],"type":"object"}}},"required":true},"responses":{"204":{"content":{"application/json":{"schema":{}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"properties":{"outcome":{"enum":["notUpdated"],"example":"notUpdated","type":"string"},"reason":{"enum":["nameAlreadyExists"],"example":"nameAlreadyExists","type":"string"}},"required":["outcome","reason"],"type":"object"}}},"description":"Default Response"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"422":{"content":{"application/json":{"schema":{"properties":{"outcome":{"enum":["notUpdated"],"example":"notUpdated","type":"string"},"reason":{"enum":["duplicateCoOwners"],"example":"duplicateCoOwners","type":"string"}},"required":["outcome","reason"],"type":"object"}}},"description":"Default Response"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["cost-center:manage"]}],"summary":"Update Cost Centers","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]}},"/v1/expense-categories":{"get":{"description":"**Allowed Scopes**: _`expense-category:read`_\n\nReturns expense categories of the Spendesk entity (company). Expense category and cost center data are cached for up to 24 hours. Changes, including those made through the API, can take up to 24 hours to appear.","operationId":"v1-get-expense-categories","parameters":[{"description":"Expense category IDs to filter by.","in":"query","name":"ids","required":false,"schema":{"items":{"type":"string"},"type":"array"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"items":{"additionalProperties":false,"properties":{"costCenters":{"description":"Array of cost centers","items":{"additionalProperties":false,"properties":{"id":{"description":"Cost center ID","format":"uuid","type":"string"},"name":{"description":"Name of cost center","type":"string"}},"required":["id","name"],"type":"object"},"type":"array"},"id":{"description":"Expense category ID","type":"string"},"name":{"description":"Name of expense category","type":"string"}},"required":["id","name","costCenters"],"type":"object"},"type":"array"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["expense-category:read"]}],"summary":"Get Expense Categories","tags":["Expense categories"],"x-roles":["controller","admin","accountOwner"]}},"/v1/experimental/accounts":{"get":{"description":"**Allowed Scopes**: _`experimental:chart-of-accounts:read`_\n\nReturns accounts from accounting integrations. Account data is cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear.","operationId":"v1-get-accounts","parameters":[{"in":"query","name":"type","required":false,"schema":{"anyOf":[{"enum":["bank","expense","tax","supplier","employee","reverseCharge"],"type":"string"},{"items":{"enum":["bank","expense","tax","supplier","employee","reverseCharge"],"type":"string"},"minItems":1,"type":"array"}]}},{"in":"query","name":"includeArchived","required":false,"schema":{"type":"boolean"}},{"in":"query","name":"searchTerm","required":false,"schema":{"type":"string"}},{"description":"Deprecated. Use searchTerm instead.","in":"query","name":"code","required":false,"schema":{"type":"string"}},{"in":"query","name":"offset","required":false,"schema":{"default":0,"minimum":0,"type":"integer"}},{"in":"query","name":"after","required":false,"schema":{"format":"uuid","type":"string"}},{"in":"query","name":"fetch","required":false,"schema":{"minimum":0,"type":"integer"}},{"description":"Deprecated. Use fetch instead.","in":"query","name":"limit","required":false,"schema":{"default":100,"minimum":0,"type":"integer"}},{"in":"query","name":"taxRate","required":false,"schema":{"type":"number"}},{"in":"query","name":"purpose","required":false,"schema":{"anyOf":[{"enum":["company","spendesk","bankFees"],"type":"string"},{"items":{"enum":["company","spendesk","bankFees"],"type":"string"},"minItems":1,"type":"array"}]}},{"in":"query","name":"isAvailable","required":false,"schema":{"type":"boolean"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"currentFetch":{"type":"number"},"currentOffset":{"type":"number"},"data":{"items":{"additionalProperties":false,"properties":{"auxiliaryCode":{"nullable":true,"type":"string"},"code":{"nullable":true,"type":"string"},"companyId":{"type":"string"},"createdAt":{"type":"string"},"creditCode":{"nullable":true,"type":"string"},"currency":{"nullable":true,"type":"string"},"defaultFor":{"enum":["employee","invoiceSupplier","cardSupplier","tax","expense"],"nullable":true,"type":"string"},"description":{"nullable":true,"type":"string"},"externalId":{"nullable":true,"type":"string"},"id":{"format":"uuid","type":"string"},"isArchived":{"type":"boolean"},"isAvailable":{"type":"boolean"},"name":{"type":"string"},"purpose":{"enum":["company","spendesk","bankFees"],"nullable":true,"type":"string"},"taxRate":{"nullable":true,"type":"number"},"type":{"enum":["bank","expense","tax","supplier","employee","reverseCharge"],"type":"string"}},"required":["id","name","description","type","code","creditCode","auxiliaryCode","externalId","purpose","taxRate","currency","isAvailable","isArchived","companyId","defaultFor"],"type":"object"},"type":"array"},"totalResults":{"type":"number"}},"required":["data","totalResults","currentOffset","currentFetch"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:chart-of-accounts:read"]}],"summary":"Get accounts","tags":["Chart of accounts"],"x-roles":["controller","admin","accountOwner"]},"patch":{"description":"**Allowed Scopes**: _`experimental:chart-of-accounts:write`_\n\nPartially updates one or more existing accounts by id. Validation is all-or-nothing: if any item has no field to update (400) or any id is not found (404), the request fails and nothing is written. Once validated, each account is patched independently: successful updates are returned in `accounts`, and per-item failures are returned in `failed` so callers can retry only the failed ids. Use PUT /v1/experimental/accounts for bulk upsert by type and PUT /v1/experimental/accounts/set-purpose to assign account purposes.","operationId":"v1-patch-accounts","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"accounts":{"items":{"additionalProperties":false,"properties":{"auxiliaryCode":{"nullable":true,"type":"string"},"code":{"nullable":true,"type":"string"},"creditCode":{"nullable":true,"type":"string"},"currency":{"nullable":true,"type":"string"},"description":{"nullable":true,"type":"string"},"externalId":{"nullable":true,"type":"string"},"id":{"format":"uuid","type":"string"},"isArchived":{"type":"boolean"},"name":{"type":"string"},"taxRate":{"nullable":true,"type":"number"}},"required":["id"],"type":"object"},"maxItems":100,"minItems":1,"type":"array"}},"required":["accounts"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"accounts":{"items":{"additionalProperties":false,"properties":{"auxiliaryCode":{"nullable":true,"type":"string"},"code":{"nullable":true,"type":"string"},"companyId":{"type":"string"},"createdAt":{"type":"string"},"creditCode":{"nullable":true,"type":"string"},"currency":{"nullable":true,"type":"string"},"description":{"nullable":true,"type":"string"},"externalId":{"nullable":true,"type":"string"},"id":{"format":"uuid","type":"string"},"isArchived":{"type":"boolean"},"isAvailable":{"type":"boolean"},"name":{"type":"string"},"purpose":{"enum":["company","spendesk","bankFees"],"nullable":true,"type":"string"},"taxRate":{"nullable":true,"type":"number"},"type":{"enum":["bank","expense","tax","supplier","employee","reverseCharge"],"type":"string"}},"required":["id","name","description","type","code","creditCode","auxiliaryCode","externalId","purpose","taxRate","currency","isAvailable","isArchived","companyId"],"type":"object"},"type":"array"},"failed":{"items":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"reason":{"type":"string"},"statusCode":{"type":"number"}},"required":["id","reason"],"type":"object"},"type":"array"}},"required":["accounts","failed"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:chart-of-accounts:write"]}],"summary":"Bulk patch accounts","tags":["Chart of accounts"],"x-roles":["controller","admin","accountOwner"]},"post":{"description":"**Allowed Scopes**: _`experimental:chart-of-accounts:write`_\n\nCreates a new account for the selected account type. If the account has a code, is not archived, and a non-archived account of the same type has the same code, purpose, auxiliaryCode and taxRate (for reverseCharge: the same name, code and creditCode), that account is updated instead: every field you omit is cleared to null.","operationId":"v1-create-account","parameters":[{"in":"query","name":"type","required":true,"schema":{"enum":["bank","expense","tax","supplier","employee","reverseCharge"],"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"auxiliaryCode":{"nullable":true,"type":"string"},"code":{"description":"Required unless externalId is set.","nullable":true,"type":"string"},"creditCode":{"nullable":true,"type":"string"},"currency":{"nullable":true,"type":"string"},"description":{"nullable":true,"type":"string"},"externalId":{"description":"Required unless code is set.","nullable":true,"type":"string"},"isArchived":{"type":"boolean"},"isAvailable":{"deprecated":true,"description":"Ignored: new accounts are always available, and writes never change availability.","type":"boolean"},"name":{"type":"string"},"purpose":{"enum":["company","spendesk","bankFees"],"nullable":true,"type":"string"},"taxRate":{"nullable":true,"type":"number"}},"required":["name"],"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"item":{"additionalProperties":false,"properties":{"auxiliaryCode":{"nullable":true,"type":"string"},"code":{"nullable":true,"type":"string"},"companyId":{"type":"string"},"createdAt":{"type":"string"},"creditCode":{"nullable":true,"type":"string"},"currency":{"nullable":true,"type":"string"},"description":{"nullable":true,"type":"string"},"externalId":{"nullable":true,"type":"string"},"id":{"format":"uuid","type":"string"},"isArchived":{"type":"boolean"},"isAvailable":{"type":"boolean"},"name":{"type":"string"},"purpose":{"enum":["company","spendesk","bankFees"],"nullable":true,"type":"string"},"taxRate":{"nullable":true,"type":"number"},"type":{"enum":["bank","expense","tax","supplier","employee","reverseCharge"],"type":"string"}},"required":["id","name","description","type","code","creditCode","auxiliaryCode","externalId","purpose","taxRate","currency","isAvailable","isArchived","companyId"],"type":"object"}},"required":["item"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:chart-of-accounts:write"]}],"summary":"Create account","tags":["Chart of accounts"],"x-roles":["controller","admin","accountOwner"]},"put":{"description":"**Allowed Scopes**: _`experimental:chart-of-accounts:write`_\n\nBulk syncs (creates or upserts) accounts for the selected account type. Each item replaces the stored account: an omitted description, code, creditCode, auxiliaryCode, externalId, purpose, taxRate or currency is cleared to null (an omitted externalId removes the ERP link). An item that carries the id of an archived account un-archives it unless it sets isArchived to true. An item without id that has a code and does not set isArchived to true updates the non-archived account of the same type with the same code, purpose, auxiliaryCode and taxRate (for reverseCharge: the same name, code and creditCode), if there is one. Items without id never match an archived account. For partial updates to existing accounts, use PATCH /v1/experimental/accounts.","operationId":"v1-sync-accounts","parameters":[{"in":"query","name":"type","required":true,"schema":{"enum":["bank","expense","tax","supplier","employee","reverseCharge"],"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"accounts":{"items":{"additionalProperties":false,"properties":{"auxiliaryCode":{"nullable":true,"type":"string"},"code":{"description":"Required unless externalId is set.","nullable":true,"type":"string"},"creditCode":{"nullable":true,"type":"string"},"currency":{"nullable":true,"type":"string"},"description":{"nullable":true,"type":"string"},"externalId":{"description":"Required unless code is set.","nullable":true,"type":"string"},"id":{"format":"uuid","type":"string"},"isArchived":{"type":"boolean"},"isAvailable":{"deprecated":true,"description":"Ignored: new accounts are always available, and writes never change availability.","type":"boolean"},"name":{"type":"string"},"purpose":{"enum":["company","spendesk","bankFees"],"nullable":true,"type":"string"},"taxRate":{"nullable":true,"type":"number"}},"required":["name"],"type":"object"},"maxItems":500,"minItems":1,"type":"array"}},"required":["accounts"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"auxiliaryCode":{"nullable":true,"type":"string"},"code":{"nullable":true,"type":"string"},"companyId":{"type":"string"},"createdAt":{"type":"string"},"creditCode":{"nullable":true,"type":"string"},"currency":{"nullable":true,"type":"string"},"description":{"nullable":true,"type":"string"},"externalId":{"nullable":true,"type":"string"},"id":{"format":"uuid","type":"string"},"isArchived":{"type":"boolean"},"isAvailable":{"type":"boolean"},"name":{"type":"string"},"purpose":{"enum":["company","spendesk","bankFees"],"nullable":true,"type":"string"},"taxRate":{"nullable":true,"type":"number"},"type":{"enum":["bank","expense","tax","supplier","employee","reverseCharge"],"type":"string"}},"required":["id","name","description","type","code","creditCode","auxiliaryCode","externalId","purpose","taxRate","currency","isAvailable","isArchived","companyId"],"type":"object"},"type":"array"}},"required":["items"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:chart-of-accounts:write"]}],"summary":"Bulk update accounts","tags":["Chart of accounts"],"x-roles":["controller","admin","accountOwner"]}},"/v1/experimental/accounts/creditors":{"put":{"description":"**Allowed Scopes**: _`experimental:chart-of-accounts:write`_\n\nAssigns creditors to accounts.","operationId":"v1-assign-creditors-to-accounts","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"accounts":{"items":{"additionalProperties":false,"properties":{"accountId":{"format":"uuid","type":"string"},"creditorId":{"type":"string"}},"required":["accountId","creditorId"],"type":"object"},"minItems":1,"type":"array"}},"required":["accounts"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"result":{"enum":["Creditor accounts set"],"type":"string"}},"required":["result"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:chart-of-accounts:write"]}],"summary":"Assign creditors to accounts","tags":["Chart of accounts"],"x-roles":["controller","admin","accountOwner"]}},"/v1/experimental/accounts/creditors/remove-from-accounts":{"put":{"description":"**Allowed Scopes**: _`experimental:chart-of-accounts:write`_\n\nRemoves creditor assignments from accounts.","operationId":"v1-remove-creditors-from-accounts","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"anyOf":[{"required":["accounts"]},{"required":["accountIds"]}],"properties":{"accountIds":{"items":{"format":"uuid","type":"string"},"minItems":1,"type":"array"},"accounts":{"items":{"format":"uuid","type":"string"},"minItems":1,"type":"array"},"creditorIds":{"items":{"type":"string"},"type":"array"},"creditors":{"items":{"type":"string"},"minItems":1,"type":"array"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"result":{"enum":["Creditors removed from accounts"],"type":"string"}},"required":["result"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:chart-of-accounts:write"]}],"summary":"Remove creditors from accounts","tags":["Chart of accounts"],"x-roles":["controller","admin","accountOwner"]}},"/v1/experimental/accounts/creditors/search":{"post":{"description":"**Allowed Scopes**: _`experimental:chart-of-accounts:read`_\n\nSearches creditor to account assignments. Creditor account assignment data is cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear.","operationId":"v1-search-creditor-account-assignments","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"accountIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"accounts":{"items":{"format":"uuid","type":"string"},"minItems":1,"type":"array"},"creditorIds":{"items":{"type":"string"},"type":"array"},"creditors":{"items":{"type":"string"},"minItems":1,"type":"array"},"filter":{"additionalProperties":false,"properties":{"includeArchived":{"type":"boolean"},"isAvailable":{"type":"boolean"},"purpose":{"enum":["company","spendesk","bankFees"],"type":"string"},"searchTerm":{"type":"string"},"taxRate":{"type":"number"},"type":{"enum":["bank","expense","tax","supplier","employee","reverseCharge"],"type":"string"}},"type":"object"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"items":{"additionalProperties":false,"properties":{"accountId":{"format":"uuid","type":"string"},"creditorId":{"type":"string"}},"required":["accountId","creditorId"],"type":"object"},"type":"array"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:chart-of-accounts:read"]}],"summary":"Search creditor account assignments","tags":["Chart of accounts"],"x-roles":["controller","admin","accountOwner"]}},"/v1/experimental/accounts/set-purpose":{"put":{"description":"**Allowed Scopes**: _`experimental:chart-of-accounts:write`_\n\nSets the purpose for one or more accounts.","operationId":"v1-set-account-purpose","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"accounts":{"items":{"additionalProperties":false,"properties":{"accountId":{"format":"uuid","type":"string"},"purpose":{"enum":["company","spendesk","bankFees"],"type":"string"}},"required":["accountId","purpose"],"type":"object"},"minItems":1,"type":"array"}},"required":["accounts"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"auxiliaryCode":{"nullable":true,"type":"string"},"code":{"nullable":true,"type":"string"},"companyId":{"type":"string"},"createdAt":{"type":"string"},"creditCode":{"nullable":true,"type":"string"},"currency":{"nullable":true,"type":"string"},"description":{"nullable":true,"type":"string"},"externalId":{"nullable":true,"type":"string"},"id":{"format":"uuid","type":"string"},"isArchived":{"type":"boolean"},"isAvailable":{"type":"boolean"},"name":{"type":"string"},"purpose":{"enum":["company","spendesk","bankFees"],"nullable":true,"type":"string"},"taxRate":{"nullable":true,"type":"number"},"type":{"enum":["bank","expense","tax","supplier","employee","reverseCharge"],"type":"string"}},"required":["id","name","description","type","code","creditCode","auxiliaryCode","externalId","purpose","taxRate","currency","isAvailable","isArchived","companyId"],"type":"object"},"type":"array"}},"required":["items"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:chart-of-accounts:write"]}],"summary":"Set account purpose","tags":["Chart of accounts"],"x-roles":["controller","admin","accountOwner"]}},"/v1/experimental/accounts/{accountId}":{"delete":{"description":"**Allowed Scopes**: _`experimental:chart-of-accounts:write`_\n\nArchives an existing account. Neither the account lookup used before archiving nor the archive call is cached.","operationId":"v1-delete-account","parameters":[{"in":"path","name":"accountId","required":true,"schema":{"format":"uuid","type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"204":{"content":{"application/json":{"schema":{}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:chart-of-accounts:write"]}],"summary":"Archive account","tags":["Chart of accounts"],"x-roles":["controller","admin","accountOwner"]},"get":{"description":"**Allowed Scopes**: _`experimental:chart-of-accounts:read`_\n\nReturns a single account by id. Account data is cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear.","operationId":"v1-get-account-by-id","parameters":[{"in":"path","name":"accountId","required":true,"schema":{"format":"uuid","type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"auxiliaryCode":{"nullable":true,"type":"string"},"code":{"nullable":true,"type":"string"},"companyId":{"type":"string"},"createdAt":{"type":"string"},"creditCode":{"nullable":true,"type":"string"},"currency":{"nullable":true,"type":"string"},"description":{"nullable":true,"type":"string"},"externalId":{"nullable":true,"type":"string"},"id":{"format":"uuid","type":"string"},"isArchived":{"type":"boolean"},"isAvailable":{"type":"boolean"},"name":{"type":"string"},"purpose":{"enum":["company","spendesk","bankFees"],"nullable":true,"type":"string"},"taxRate":{"nullable":true,"type":"number"},"type":{"enum":["bank","expense","tax","supplier","employee","reverseCharge"],"type":"string"}},"required":["id","name","description","type","code","creditCode","auxiliaryCode","externalId","purpose","taxRate","currency","isAvailable","isArchived","companyId"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:chart-of-accounts:read"]}],"summary":"Get account by id","tags":["Chart of accounts"],"x-roles":["controller","admin","accountOwner"]}},"/v1/experimental/external-references":{"get":{"description":"**Allowed Scopes**: _`experimental:external-reference:read`_\n\n  Returns the IDs Spendesk entities have in an external system (ERP), as one entry per\n  (entity, external ID) pair. Filter by `entityIds` to get the external IDs of entities you\n  already know, or by `externalIds` to resolve external IDs back to Spendesk entities — at\n  least one of the two is required.\n\n  Where the reference is stored is an implementation detail. Reference entities (`supplier`,\n  `employee`, `analyticalField`, `analyticalFieldValue`, `costCenter`, `expenseCategory`,\n  `customField`) are served from the entity registry; exportable entities (`payable`,\n  `settlementAllocation`, `walletLoad`, `bankFee`, `documentaryEvidenceAttachment`,\n  `creditNoteAllocation`) from the export state, where only exported entities carry an external\n  ID; and the account kinds from the chart of accounts.\n\n  The chart of accounts is addressed one account type at a time — `bankAccount`,\n  `expenseAccount`, `taxAccount`, `supplierAccount`, `employeeAccount` or\n  `reverseChargeAccount` — each returning only accounts of that type. An account's type is\n  part of what identifies it, so there is no unqualified spelling. The suffix is required\n  because `supplier` and `employee` already name reference entities. For these, `entityId` is the\n  account id and `externalName` is the account name; archived accounts and accounts without an\n  external ID are never returned, and `provider` and `source` are always null because an\n  account row records no provenance — so filtering by either returns no accounts.\n\n  `source` tells you who recorded the mapping: `native_integration` means a native ERP sync\n  owns it and keeps it up to date, `public_api` means it was set through this API.\n\n  Cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear.","operationId":"v1-get-external-references","parameters":[{"description":"Kind of Spendesk entity. Reference entities: `supplier`, `employee`, `analyticalField`, `analyticalFieldValue`, `costCenter`, `expenseCategory`, `customField`. Chart of accounts, one account type at a time: `bankAccount`, `expenseAccount`, `taxAccount`, `supplierAccount`, `employeeAccount`, `reverseChargeAccount` — each also asserts the target account's own type. Exportable entities: `payable`, `settlementAllocation`, `walletLoad`, `bankFee`, `documentaryEvidenceAttachment`, `creditNoteAllocation`.","in":"query","name":"entityType","required":true,"schema":{"enum":["supplier","employee","analyticalField","analyticalFieldValue","costCenter","expenseCategory","customField","bankAccount","expenseAccount","taxAccount","supplierAccount","employeeAccount","reverseChargeAccount","payable","settlementAllocation","walletLoad","bankFee","documentaryEvidenceAttachment","creditNoteAllocation"],"type":"string"}},{"description":"Filter by Spendesk entity ids (comma-separated).","in":"query","name":"entityIds","required":false,"schema":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}]}},{"description":"Filter by external ids (comma-separated).","in":"query","name":"externalIds","required":false,"schema":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}]}},{"description":"Filter by external system.","in":"query","name":"provider","required":false,"schema":{"minLength":1,"type":"string"}},{"description":"Filter by who recorded the mapping.","in":"query","name":"source","required":false,"schema":{"enum":["native_integration","public_api"],"type":"string"}},{"description":"Cap the number of returned references. Not a paging cursor.","in":"query","name":"first","required":false,"schema":{"minimum":1,"type":"integer"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"items":{"additionalProperties":false,"properties":{"componentId":{"description":"Set only for exportable entities addressed per component, such as a documentary-evidence attachment.","type":["null","string"]},"entityId":{"type":"string"},"entityType":{"type":"string"},"externalId":{"type":"string"},"externalName":{"description":"Null for exportable entities — the export state records no name.","type":["null","string"]},"provider":{"type":["null","string"]},"source":{"type":["null","string"]},"updatedAt":{"type":["null","string"]}},"required":["entityType","entityId","externalId"],"type":"object"},"type":"array"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:external-reference:read"]}],"summary":"Get external references","tags":["External references"],"x-roles":["controller","admin","accountOwner"]},"post":{"description":"**Allowed Scopes**: _`experimental:external-reference:write`_\n\n  Records the ID a Spendesk entity has in an external system (ERP), namespaced by `provider`.\n  Re-sending the same `(entityType, provider, externalId)` updates the existing record.\n\n  **Recording an external ID for an exportable entity** (payable, settlementAllocation,\n  walletLoad, bankFee, documentaryEvidenceAttachment, creditNoteAllocation) **also records that\n  entity as exported** to the given provider, and it will then appear under\n  `GET /v1/experimental/integrations/export-status?status=exported`. Use it when you have\n  genuinely exported the entity to your own system. For reference entities (`supplier`,\n  `employee`, `analyticalField`, `analyticalFieldValue`, `costCenter`, `expenseCategory`,\n  `customField`) the write only stores the mapping and has no export side effect.\n\n  **For the account kinds** the external ID is set on the account itself, so `entityId` is the\n  account id — never the id of the supplier or employee an account of that type points at — and\n  `provider`, `externalName` and `componentId` are ignored, since an account row has nowhere\n  to keep them. `provider` is still required because the other kinds need it; send any non-empty\n  value. The account kinds are `bankAccount`, `expenseAccount`, `taxAccount`,\n  `supplierAccount`, `employeeAccount` and `reverseChargeAccount`; each asserts the target\n  account's own type, and the write is refused if it disagrees rather than applied to the wrong\n  account. There is no unqualified spelling, since an account's type is part of what identifies\n  it. An external ID must identify a\n  single account, so a write is also refused when another active account of the same type and\n  purpose already holds the value, and when a second reference in the same request gives one\n  account a different external ID.\n\n  Companies whose ERP is connected through a **native** integration cannot set external IDs at all:\n  Spendesk talks to that ERP directly and owns the mappings end to end. For accounts that is what\n  keeps the chart of accounts safe — it is synced from the ERP, and `externalId` is the ERP's own\n  key, so an API value there would be overwritten by the next sync.\n\n  Two exportable cases behave differently. While a **native** integration is mid-export for the\n  entity the write is refused: that integration owns the export it is running and records its own\n  external ID when the ERP answers. While a **file-based** export is mid-flight the external ID is\n  stored but the export state is left untouched, since that export is not ours to complete.\n\n  A native integration always takes precedence, and an API write never overwrites a value it owns.\n  For a reference entity the write is refused when a native sync already records an external ID for\n  that entity under the same `provider`, or when the external ID itself already belongs to a\n  natively synced entity — a different `provider` is still accepted, since references are\n  namespaced per ERP. For an exportable entity the write is refused whenever a native external ID\n  is already recorded, whatever `provider` you send, because there is a single external ID per\n  entity and component. Values you recorded through this API can be corrected freely.\n\n  Purchase orders are not accepted: `externalPONumber` is set on the purchase order itself at\n  creation time, so a second copy here would compete with it.\n\n  Each reference gets its own `outcome`, in request order — `exported` when the entity is now\n  recorded as exported, `recorded` when the external ID was stored but the export state was left\n  alone, `mapped` for a reference-entity or account write, and `failed` with a `reason`\n  otherwise. A batch may\n  mix entity kinds, so it can partially succeed: check every entry rather than the status code alone.","operationId":"v1-upsert-external-references","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"references":{"items":{"additionalProperties":false,"properties":{"componentId":{"description":"Exportable entities only. Required when an entity has more than one exportable component, such as a documentary-evidence attachment, otherwise the write is refused as ambiguous.","minLength":1,"type":"string"},"entityId":{"description":"The Spendesk entity id the external ID maps to.","minLength":1,"type":"string"},"entityType":{"description":"Kind of Spendesk entity. Reference entities: `supplier`, `employee`, `analyticalField`, `analyticalFieldValue`, `costCenter`, `expenseCategory`, `customField`. Chart of accounts, one account type at a time: `bankAccount`, `expenseAccount`, `taxAccount`, `supplierAccount`, `employeeAccount`, `reverseChargeAccount` — each also asserts the target account's own type. Exportable entities: `payable`, `settlementAllocation`, `walletLoad`, `bankFee`, `documentaryEvidenceAttachment`, `creditNoteAllocation`.","enum":["supplier","employee","analyticalField","analyticalFieldValue","costCenter","expenseCategory","customField","bankAccount","expenseAccount","taxAccount","supplierAccount","employeeAccount","reverseChargeAccount","payable","settlementAllocation","walletLoad","bankFee","documentaryEvidenceAttachment","creditNoteAllocation"],"type":"string"},"externalId":{"description":"The ID of the entity in the external system.","minLength":1,"type":"string"},"externalName":{"description":"Human-readable name of the external entity. Reference entities only; defaults to `externalId`.","type":"string"},"provider":{"description":"The external system the external ID belongs to (e.g. Netsuite, Xero).","minLength":1,"type":"string"}},"required":["entityType","entityId","provider","externalId"],"type":"object"},"maxItems":500,"minItems":1,"type":"array"}},"required":["references"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"items":{"additionalProperties":false,"properties":{"entityId":{"type":"string"},"entityType":{"type":"string"},"externalId":{"type":"string"},"outcome":{"enum":["exported","recorded","mapped","failed"],"type":"string"},"reason":{"description":"Set when `outcome` is `failed`.","type":"string"}},"required":["entityType","entityId","externalId","outcome"],"type":"object"},"type":"array"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:external-reference:write"]}],"summary":"Upsert external references","tags":["External references"],"x-roles":["controller","admin","accountOwner"]}},"/v1/experimental/integrations/export-status":{"get":{"description":"Returns entity IDs filtered by export status within the given date range. A maximum date range of 1 year is allowed. Export status data is cached for up to 24 hours. Changes, including those made through the API, can take up to 24 hours to appear.\n\nPass `include=externalIds` to also get the ID each exported entity received in the external system (ERP), such as the ERP document number. It is opt-in and comes from the same lookup, so it shares the cache above. Only entities exported with an ID returned by the external system appear: file-based exports, and entities exported before external IDs were recorded, have none. Some native integrations do not record one either (Xero bank fees, QuickBooks settlements, DATEV settlements and wallet loads), and Xero settlements that were already paid carry the literal ID `unknown`. `source` reads `public_api` only for IDs written with provider `PublicApi`; an ID written through the API under another provider (e.g. pennylane) reads back as `native_integration`.","operationId":"v1-get-integrations-export-status","parameters":[{"in":"query","name":"entityType","required":true,"schema":{"enum":["payable","settlementAllocation","walletLoad","bankFee"],"type":"string"}},{"description":"Start of the date range (ISO 8601). Defaults to now minus 2 months, or 2 months before `to` if `to` is provided.","in":"query","name":"from","required":false,"schema":{"format":"date-time","type":"string"}},{"description":"End of the date range (ISO 8601). Defaults to now.","in":"query","name":"to","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"status","required":true,"schema":{"enum":["exported","notExported"],"type":"string"}},{"description":"Extra data to embed in the response. `externalIds` adds the top-level `externalIds` list; it is opt-in.","in":"query","name":"include","required":false,"schema":{"items":{"enum":["externalIds"],"type":"string"},"type":"array"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"entityIds":{"items":{"type":"string"},"type":"array"},"entityType":{"enum":["payable","settlementAllocation","walletLoad","bankFee"],"type":"string"},"externalIds":{"description":"IDs the exported entities received in external systems (ERPs), one entry per exported record that has one; match them to `entityIds` through `entityId`. Entities without an ID have no entry. For `settlementAllocation`, IDs are recorded per allocation: `entityId` is the settlement ID and a settlement has one entry per exported allocation. Always empty for `status=notExported`. Only present when `externalIds` is requested through `include`.","items":{"additionalProperties":false,"properties":{"entityId":{"description":"ID of the entity, as listed in `entityIds`.","type":"string"},"externalId":{"description":"ID of the entity in the external system.","type":"string"},"provider":{"description":"The external system the ID belongs to (e.g. Netsuite, Xero).","nullable":true,"type":"string"},"source":{"description":"Who recorded the ID. `native_integration` means a native ERP export recorded it; `public_api` means it was set through the API.","enum":["native_integration","public_api"],"type":"string"},"timestamp":{"description":"When this ID was last recorded or updated in Spendesk (ISO 8601), not the date of the document in the external system.","format":"date-time","type":"string"}},"required":["entityId","externalId","provider","source","timestamp"],"type":"object"},"type":"array"}},"required":["entityType","entityIds"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:accounting-export:read"]}],"summary":"Get entity export status","tags":["Accounting exports"],"x-roles":["controller","admin","accountOwner"]}},"/v1/experimental/integrations/refresh-settings":{"post":{"description":"**Allowed Scopes**: _`experimental:chart-of-accounts:write`_\n\nTriggers a refresh of the company's accounting integration settings, pulling accounts, tax accounts, analytical fields, suppliers, employees and currencies from the connected accounting software.\n\nThe refresh runs asynchronously: a 202 means it was accepted, not that the refreshed data is available yet. Refreshes are throttled per company, so a second call made shortly after a successful one returns 429 with a `Retry-After` header. Accounting integrations that have no settings synchronisation return 409.","operationId":"v1-post-experimental-integrations-refresh-settings","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"202":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"outcome":{"description":"The refresh has been accepted and runs asynchronously.","enum":["refreshTriggered"],"type":"string"}},"required":["outcome"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds left on the refresh cooldown. Present when the accounting integration reports the remaining delay.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:chart-of-accounts:write"]}],"summary":"Refresh accounting integration settings","tags":["Chart of accounts"],"x-roles":["controller","accountOwner"]}},"/v1/experimental/journals":{"post":{"description":"**Allowed Scopes**: _`experimental:accounting-export:read`_ or _`experimental:accounting-export:write`_\n\nEither scope is accepted today. With `markEntriesAsExported: true`, the exported entries are marked as exported in Spendesk; in a future release, that will require the `experimental:accounting-export:write` scope.","operationId":"v1-create-journal","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/accountingExportQuery"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"key":{"format":"uuid","type":"string"},"query":{"$ref":"#/components/schemas/accountingExportQuery"}},"required":["query","key"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:accounting-export:read"]},{"Authentication":["experimental:accounting-export:write"]}],"summary":"Create an accounting export","tags":["Accounting exports"],"x-roles":["controller","admin","accountOwner"]}},"/v1/experimental/journals/templates":{"get":{"description":"**Allowed Scopes**: _`experimental:accounting-export:read`_\n\nReturns available journal templates. Accounting software and journal template data are cached for up to 24 hours. Changes, including those made through the API, can take up to 24 hours to appear.","operationId":"v1-get-journal-templates","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"additionalProperties":false,"properties":{"id":{"format":"uuid","nullable":false,"type":"string"},"name":{"nullable":false,"type":"string"},"type":{"enum":["purchase","bank"],"nullable":false,"type":"string"}},"type":"object"},"type":"array"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:accounting-export:read"]}],"summary":"Get available journal templates","tags":["Accounting exports"],"x-roles":["controller","admin","accountOwner"]}},"/v1/experimental/journals/{key}":{"get":{"description":"**Allowed Scopes**: _`experimental:accounting-export:read`_\n\nReturns the requested journal CSV content. Journal content data is cached for up to 24 hours. Changes, including those made through the API, can take up to 24 hours to appear.","operationId":"v1-get-journal","parameters":[{"in":"query","name":"journalType","required":true,"schema":{"enum":["purchase","bank"],"type":"string"}},{"description":"Request UUID","in":"path","name":"key","required":true,"schema":{"format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"text/csv":{"schema":{"format":"binary","type":"string"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/exportFailed"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:accounting-export:read"]}],"summary":"Get a journal CSV content","tags":["Accounting exports"],"x-roles":["controller","admin","accountOwner"]}},"/v1/experimental/suppliers/status":{"patch":{"description":"**Allowed Scopes**: _`experimental:supplier:manage`_\n\nArchives or unarchives suppliers.","operationId":"v1-patch-suppliers-status","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"isArchived":{"description":"Indicates new status of the supplier. `true` to archive, `false` to unarchive.","type":"boolean"},"supplierIds":{"description":"Supplier IDs to update. When omitted, the action applies to all company suppliers.","items":{"type":"string"},"maxItems":100,"minItems":1,"type":"array"}},"required":["isArchived"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/supplierStatusUpdateSuccessResponse"}}},"description":"Response for the PATCH suppliers/status endpoint"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:supplier:manage"]}],"summary":"Archive/Unarchive Suppliers","tags":["Suppliers"],"x-roles":["controller","accountOwner"]}},"/v1/experimental/suppliers/{id}/status":{"patch":{"description":"**Allowed Scopes**: _`experimental:supplier:manage`_\n\nArchives or unarchives supplier by id.","operationId":"v1-patch-supplier-status","parameters":[{"description":"ID of the supplier to update.","in":"path","name":"id","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"isArchived":{"description":"Indicates new status of the supplier. `true` to archive, `false` to unarchive.","type":"boolean"}},"required":["isArchived"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/supplierStatusUpdateSuccessResponse"}}},"description":"Response for the PATCH suppliers/status endpoint"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:supplier:manage"]}],"summary":"Archive/Unarchive Supplier","tags":["Suppliers"],"x-roles":["controller","accountOwner"]}},"/v1/experimental/webhooks":{"get":{"description":"**Allowed Scopes**: _`experimental:webhooks:read`_\n\n  Returns zero or more configured webhook instances for the company in question.\n\n  Webhook instances are disabled either manually by API requests or by Spendesk if third level retries are exhausted. \n  If the instance is re-enabled, it will resume handling events from the point it was re-enabled. \n  Any changes that happened inside this window can only be fetched from the resource in question directly.\n\n  `liveMode` indicates if the event came from the production environment. \n  This can be useful if the same endpoints are used to handle both non-prod and prod webhooks. \n  In the case of this being `false` the event can be considered as a test event if integrations wish to do so.\n\n  Max of 50 webhook instances can be configured per company. \n  ","operationId":"v1-get-webhook","parameters":[{"description":"Filter by enabled status","in":"query","name":"enabled","required":false,"schema":{"type":"boolean"}},{"description":"Filter by deleted status","in":"query","name":"isDeleted","required":false,"schema":{"type":"boolean"}},{"description":"Filter by live mode","in":"query","name":"liveMode","required":false,"schema":{"type":"boolean"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"items":{"$ref":"#/components/schemas/webhook"},"type":"array"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:webhooks:read"]}],"summary":"Get all webhook instances ordered by creation date.","tags":["Webhooks"],"x-roles":["controller","admin","accountOwner"]},"post":{"description":"**Allowed Scopes**: _`experimental:webhooks:write`_\n\n  Creates one or multiple webhook instances. Each instance will be linked to a company and a specific event.\n\n  Maximum of 50 instances can be configured per company. \n\n  Be prepared to handle the same event multiple times. Clients should perform de-duplication on their side to avoid\n   processing the same event multiple times.\n  \n  Spendesk will retry sending the event until it receives a 2xx response from the webhook endpoint.\n\n  Upon failure the webhook instance will be retried immediately. If this retry fails second level retries will begin,\n  followed by third level retries if necessary. \n  Finally if webhook instance is still failing the instance will be disabled. \n\n  - 1st level retry - ASAP.\n  - 2nd level retry - every 10 minutes for 1 hour.\n  - 3rd level retry - every 2 hours for 3 days.\n\n  Spendesk will follow this retry policy on a best-effort basis but exact execution timestamps are not guaranteed. The \n  payload will include a unique `event.id` that can be used to deduplicate events. The `event.timestamp` will be the\n  time the event published and can also be used to determine if an event has been processed before or is out of order.\n\n  Events have lightweight payloads carrying the id of the resource in question. Events should be consumed in real-time\n  by performing a corresponding GET on the resource in question, ensuring the most up-to-date data is used.\n  \n  Events will be published to the URL specified in the payload. If you need to allow-list incoming http requests from \n  Spendesk, you can find the list of IP addresses in \"Using webhooks\" guide.\n    \n  Events contain a signature in the header `x-spendesk-webhook-signature`. It is a HMAC SHA256 hash of the payload\n  using the secret provided when creating the webhook instance. \n  This can be used to verify the authenticity of the event. When creating a webhook instance, the secret can be provided\n  or a random one will be generated for you (it will be returned in the response only once). \n  If this secret needs to be changed, the webhook instance will need to be recreated to use the new secret. \n  We suggest using a secret of at least 32 characters long and recommend Spendesk generate this for you.\n  ","operationId":"v1-create-webhook","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"events":{"additionalProperties":false,"properties":{"payables":{"description":"Events related to payables","items":{"description":"Created: When a payable is created at version `1`. Prepared: When a payable is prepared.","enum":["created","prepared"],"type":"string"},"type":"array"},"settlements":{"description":"Events related to settlements","items":{"description":"Created - When a settlement is created at version 1","enum":["created"],"type":"string"},"type":"array"}},"type":"object"},"secret":{"description":"A secret key to sign the webhook events","minLength":32,"type":"string"},"url":{"description":"The URL of the webhook endpoint","format":"uri","type":"string"}},"required":["events","url"],"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"properties":{"ids":{"items":{"format":"uuid","minLength":1,"type":"string"},"type":"array"},"secret":{"minLength":32,"type":"string"}},"required":["ids","secret"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:webhooks:write"]}],"summary":"Create a webhook instance","tags":["Webhooks"],"x-roles":["controller","admin","accountOwner"]}},"/v1/experimental/webhooks/{id}":{"delete":{"description":"**Allowed Scopes**: _`experimental:webhooks:write`_\n\n  Delete a webhook instance for the company in question.\n\n  If the webhook instance is no longer needed or the max number of instances \n  has been exceeded delete one or more instances by id.\n  ","operationId":"v1-delete-webhook","parameters":[{"description":"The id of the webhook instance","in":"path","name":"id","required":true,"schema":{"format":"uuid","minLength":1,"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"204":{"content":{"application/json":{"schema":{}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:webhooks:write"]}],"summary":"Delete a webhook instance","tags":["Webhooks"],"x-roles":["controller","admin","accountOwner"]},"get":{"description":"**Allowed Scopes**: _`experimental:webhooks:read`_\n\n  Get a single webhook instance for the company in question.\n\n  Webhook instances are disabled either manually by API requests or by Spendesk if third level retries are exhausted. \n  If the instance is re-enabled it will resume handling webhooks from the point it was re-enabled. \n  Any events in between this window should be fetched from the resource in question directly.\n\n  `liveMode` indicates if the event came from the production environment. \n  This can be useful if the same endpoints are used to handle both non-prod and prod webhooks. \n  In the case of this being `false` the event can be considered as a test event if integrations wish to do so.\n  ","operationId":"v1-get-webhook-by-id","parameters":[{"description":"The id of the webhook instance","in":"path","name":"id","required":true,"schema":{"format":"uuid","minLength":1,"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/webhook"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:webhooks:read"]}],"summary":"Get a webhook instance by id.","tags":["Webhooks"],"x-roles":["controller","admin","accountOwner"]},"put":{"description":"**Allowed Scopes**: _`experimental:webhooks:write`_\n\n  Update a webhook instance for the company in question.\n\n  Use this resource to re-enable a webhook if this has been disabled due to failing the retry policy.\n  ","operationId":"v1-update-webhook","parameters":[{"description":"The id of the webhook instance","in":"path","name":"id","required":true,"schema":{"format":"uuid","minLength":1,"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"enabled":{"description":"Whether the webhook is enabled or not","type":"boolean"},"url":{"description":"The URL of the webhook endpoint","format":"uri","type":"string"}},"type":"object"}}},"required":true},"responses":{"204":{"content":{"application/json":{"schema":{}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:webhooks:write"]}],"summary":"Update a webhook instance","tags":["Webhooks"],"x-roles":["controller","admin","accountOwner"]}},"/v1/mcp":{"delete":{"operationId":"v1-delete-mcp","responses":{"200":{"description":"Default Response"}},"security":[{"Authentication":["experimental:company:read"]},{"Authentication":["wallet-summary:read"]},{"Authentication":["wallet-load:read"]},{"Authentication":["settlement:read"]},{"Authentication":["payable-attachment:read"]},{"Authentication":["payable:read"]},{"Authentication":["experimental:purchase-order:read"]},{"Authentication":["supplier:read"]},{"Authentication":["analytical-field:read"]},{"Authentication":["experimental:analytical-field-v2:write"]},{"Authentication":["cost-center:read"]},{"Authentication":["cost-center:manage"]},{"Authentication":["expense-category:read"]},{"Authentication":["experimental:expense-category-v2:read"]},{"Authentication":["experimental:expense-category-v2:write"]},{"Authentication":["experimental:supplier:manage"]},{"Authentication":["user:read"]},{"Authentication":["experimental:user:manage"]},{"Authentication":["experimental:request:read"]},{"Authentication":["experimental:chart-of-accounts:read"]},{"Authentication":["experimental:chart-of-accounts:write"]},{"Authentication":["experimental:card:read"]},{"Authentication":["experimental:card:write"]},{"Authentication":["experimental:transaction:read"]},{"Authentication":["experimental:accounting:update"]},{"Authentication":["experimental:purchase-order:write"]},{"Authentication":["experimental:payable-attachment:write"]},{"Authentication":["experimental:accounting-export:write"]},{"Authentication":["experimental:invoice:read"]},{"Authentication":["experimental:intake:read"]}],"summary":"End an MCP session","tags":["MCP"],"x-roles":["controller","accountOwner"]},"get":{"operationId":"v1-get-mcp","responses":{"200":{"description":"Default Response"}},"security":[{"Authentication":["experimental:company:read"]},{"Authentication":["wallet-summary:read"]},{"Authentication":["wallet-load:read"]},{"Authentication":["settlement:read"]},{"Authentication":["payable-attachment:read"]},{"Authentication":["payable:read"]},{"Authentication":["experimental:purchase-order:read"]},{"Authentication":["supplier:read"]},{"Authentication":["analytical-field:read"]},{"Authentication":["experimental:analytical-field-v2:write"]},{"Authentication":["cost-center:read"]},{"Authentication":["cost-center:manage"]},{"Authentication":["expense-category:read"]},{"Authentication":["experimental:expense-category-v2:read"]},{"Authentication":["experimental:expense-category-v2:write"]},{"Authentication":["experimental:supplier:manage"]},{"Authentication":["user:read"]},{"Authentication":["experimental:user:manage"]},{"Authentication":["experimental:request:read"]},{"Authentication":["experimental:chart-of-accounts:read"]},{"Authentication":["experimental:chart-of-accounts:write"]},{"Authentication":["experimental:card:read"]},{"Authentication":["experimental:card:write"]},{"Authentication":["experimental:transaction:read"]},{"Authentication":["experimental:accounting:update"]},{"Authentication":["experimental:purchase-order:write"]},{"Authentication":["experimental:payable-attachment:write"]},{"Authentication":["experimental:accounting-export:write"]},{"Authentication":["experimental:invoice:read"]},{"Authentication":["experimental:intake:read"]}],"summary":"Open the MCP event stream","tags":["MCP"],"x-roles":["controller","accountOwner"]},"post":{"description":"Use tools/list to discover available tools and their input schemas. Read-only tools expose an optional arguments.liveRead boolean; set it to true to bypass the Public API response cache for that call and retrieve the latest data available from the underlying service. Live reads use much stricter rate limits and can be rejected with HTTP 429 even at low volume: set liveRead only when freshness matters, send live calls one at a time at least a second apart, and on a 429 wait for Retry-After or make a normal read and say the data may be cached; liveRead defaults to false. Write tools do not expose liveRead.","operationId":"v1-post-mcp","responses":{"200":{"description":"Default Response"}},"security":[{"Authentication":["experimental:company:read"]},{"Authentication":["wallet-summary:read"]},{"Authentication":["wallet-load:read"]},{"Authentication":["settlement:read"]},{"Authentication":["payable-attachment:read"]},{"Authentication":["payable:read"]},{"Authentication":["experimental:purchase-order:read"]},{"Authentication":["supplier:read"]},{"Authentication":["analytical-field:read"]},{"Authentication":["experimental:analytical-field-v2:write"]},{"Authentication":["cost-center:read"]},{"Authentication":["cost-center:manage"]},{"Authentication":["expense-category:read"]},{"Authentication":["experimental:expense-category-v2:read"]},{"Authentication":["experimental:expense-category-v2:write"]},{"Authentication":["experimental:supplier:manage"]},{"Authentication":["user:read"]},{"Authentication":["experimental:user:manage"]},{"Authentication":["experimental:request:read"]},{"Authentication":["experimental:chart-of-accounts:read"]},{"Authentication":["experimental:chart-of-accounts:write"]},{"Authentication":["experimental:card:read"]},{"Authentication":["experimental:card:write"]},{"Authentication":["experimental:transaction:read"]},{"Authentication":["experimental:accounting:update"]},{"Authentication":["experimental:purchase-order:write"]},{"Authentication":["experimental:payable-attachment:write"]},{"Authentication":["experimental:accounting-export:write"]},{"Authentication":["experimental:invoice:read"]},{"Authentication":["experimental:intake:read"]}],"summary":"Send MCP messages","tags":["MCP"],"x-roles":["controller","accountOwner"]}},"/v1/oauth2/authorize":{"get":{"description":"Start the PKCE authorization-code flow for an OAuth app.\n\nUse this endpoint only for OAuth app credentials that require a Spendesk user to authorize access. Do not use it with Public API credentials; server-to-server Public API credentials should request a bearer token from [Create Access Token](/reference/v1-create-auth-token).","operationId":"v1-request-authorization","parameters":[{"description":"Always `code`.","in":"query","name":"response_type","required":true,"schema":{"enum":["code"],"type":"string"}},{"description":"OAuth app `client_id` provided by Spendesk.","in":"query","name":"client_id","required":true,"schema":{"format":"uuid","minLength":1,"type":"string"}},{"description":"URI to redirect the user after connection is authorized. If successful, the redirect URL will look like: `{redirect_uri}?code={auth_code}&state={state}&iss={issuer}`, where `iss` is the authorization server issuer (RFC 9207), `code` is the `authorization` code to be used in the [Request Access Token endpoint](/public/reference/v1-create-oauth2-token), and `state` allows you to verify the integrity of the connection.","in":"query","name":"redirect_uri","required":true,"schema":{"format":"uri","minLength":1,"type":"string"}},{"description":"Optional field to restrict the scope of the token. The default scope will match the scope defined in the front end when generating your API client id and secret.\n\nSee [available scopes](/reference/scopes) for more information.","in":"query","name":"scope","required":true,"schema":{"type":"string"}},{"description":"This string will be sent back at the end of the OAuth2 flow, so that whoever starts the flow can double-check that the same variable is being returned (and there has been no tampering).","in":"query","name":"state","required":false,"schema":{"type":"string"}},{"description":"The client should locally generate a `secret` (AKA `code_verifier`), that at this initial stage of the OAuth2 flow should be passed as a `code_challenge` in the format of `base64url(sha256(secret))`. You can find an example about that [here](https://www.oauth.com/playground/authorization-code-with-pkce.html).","in":"query","name":"code_challenge","required":true,"schema":{"minLength":1,"type":"string"}},{"description":"Always `S256`.","in":"query","name":"code_challenge_method","required":false,"schema":{"default":"S256","enum":["S256"],"type":"string"}},{"description":"Optional RFC 8707 resource indicator. Ignored for standard OAuth clients — any value (including an empty string) is accepted and never read. For public MCP dynamic client registration clients it must match the MCP resource URL when supplied and is required except for Microsoft Copilot Studio; that check is enforced in business logic once the client is resolved.","in":"query","name":"resource","required":false,"schema":{"type":"string"}}],"responses":{"302":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"On success: redirect to the Spendesk consent page `{spendesk_frontend}?id={token_id}&code={consent_handle}`; `consent_handle` is not an authorization code and cannot be exchanged for tokens. On a validated-client error: redirect to `{redirect_uri}?error={code}&error_description={msg}&state={state}&iss={issuer}` (RFC 6749 §4.1.2.1, RFC 9207). On an unverifiable client or redirect_uri: redirect to the Spendesk error page `/auth/oauth2/error?error={code}`.","type":"object"}}},"description":"On success: redirect to the Spendesk consent page `{spendesk_frontend}?id={token_id}&code={consent_handle}`; `consent_handle` is not an authorization code and cannot be exchanged for tokens. On a validated-client error: redirect to `{redirect_uri}?error={code}&error_description={msg}&state={state}&iss={issuer}` (RFC 6749 §4.1.2.1, RFC 9207). On an unverifiable client or redirect_uri: redirect to the Spendesk error page `/auth/oauth2/error?error={code}`."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"summary":"Request Authorization (OAuth app PKCE)","tags":["Authentication"]}},"/v1/oauth2/register":{"post":{"description":"Registers an MCP OAuth2 client using the RFC 7591 Dynamic Client Registration flow.","operationId":"v1-register-oauth2-client","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"properties":{"client_name":{"maxLength":64,"minLength":1,"type":"string"},"client_uri":{"format":"uri","maxLength":2048,"minLength":1,"type":"string"},"contacts":{"items":{"maxLength":320,"minLength":1,"type":"string"},"maxItems":5,"type":"array"},"grant_types":{"items":{"maxLength":64,"minLength":1,"type":"string"},"maxItems":2,"minItems":1,"type":"array"},"logo_uri":{"format":"uri","maxLength":2048,"minLength":1,"type":"string"},"policy_uri":{"format":"uri","maxLength":2048,"minLength":1,"type":"string"},"redirect_uris":{"description":"OAuth redirect URIs registered for this dynamic client.","items":{"format":"uri","maxLength":2048,"minLength":1,"type":"string"},"maxItems":3,"minItems":1,"type":"array"},"response_types":{"items":{"maxLength":64,"minLength":1,"type":"string"},"maxItems":1,"minItems":1,"type":"array"},"scope":{"maxLength":4096,"minLength":1,"type":"string"},"software_id":{"maxLength":64,"minLength":1,"type":"string"},"software_version":{"maxLength":64,"minLength":1,"type":"string"},"token_endpoint_auth_method":{"maxLength":64,"minLength":1,"type":"string"},"tos_uri":{"format":"uri","maxLength":2048,"minLength":1,"type":"string"}},"required":["redirect_uris","client_name"],"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"client_id":{"format":"uuid","type":"string"},"client_id_issued_at":{"type":"integer"},"client_name":{"type":"string"},"client_uri":{"type":"string"},"grant_types":{"items":{"type":"string"},"type":"array"},"logo_uri":{"type":"string"},"redirect_uris":{"items":{"type":"string"},"type":"array"},"response_types":{"items":{"type":"string"},"type":"array"},"scope":{"type":"string"},"token_endpoint_auth_method":{"enum":["none"],"type":"string"}},"required":["client_id","client_id_issued_at","redirect_uris","grant_types","response_types","token_endpoint_auth_method","client_name","scope"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"summary":"Dynamic Client Registration","tags":["Authentication"]}},"/v1/oauth2/token/create":{"post":{"description":"Standard OAuth2 token endpoint for OAuth app credentials. Use `grant_type=authorization_code` to exchange an authorization code for access and refresh tokens after [Request Authorization](/reference/v1-request-authorization). Use `grant_type=refresh_token` on this same endpoint to rotate tokens and keep the connection alive.\n\nOAuth token requests should be sent as `application/x-www-form-urlencoded`, as specified by OAuth 2.0. JSON requests remain accepted for backwards compatibility.\n\nDo not use this endpoint with Public API credentials issued for server-to-server access. Those credentials must call [Create Access Token](/reference/v1-create-auth-token) on `/v1/auth/token`.\n\nThe legacy [Refresh token endpoint](/reference/v1-refresh-oauth2-token) remains available temporarily for backwards compatibility.\n\nIf a refresh fails:\n- 401 \"Provided secret does not match the client\", \"client_secret is required for this client\" or \"The requested token does not belong to the provided client\": the `client_id`/`client_secret` you sent are wrong (for example another environment's app). Fix them and retry with the same refresh token, which was not consumed.\n- 401 \"No active OAuth2 client found for provided credentials\": the client is unknown, disabled or expired. Check `client_id`, or register or re-enable the client; retrying with the same credentials will not help. The refresh token was not consumed, but it only works with the client it was issued to.\n- Any other 401, and a 403: this refresh token can no longer be used (expired, revoked or already rotated). Discard it and ask the user to reconnect.\n- 400: the request is malformed. 5xx: temporary, retry later with the same refresh token.","operationId":"v1-create-oauth2-token","requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"additionalProperties":false,"properties":{"client_id":{"description":"The OAuth app `client_id` received from Spendesk.","format":"uuid","minLength":1,"type":"string"},"client_secret":{"description":"The OAuth app `client_secret` received from Spendesk. Required for confidential clients using client_secret_post; omit for public PKCE clients using token_endpoint_auth_method=none.","minLength":1,"type":"string"},"code":{"description":"The authorization code set on the redirect URI on the way back from connecting to Spendesk.","minLength":1,"type":"string"},"code_verifier":{"description":"This is the `secret` that was used to generate `code_challenge` you sent when starting the OAuth2 PCKE flow.","maxLength":128,"minLength":43,"type":"string"},"grant_type":{"description":"Use the authorization code grant to exchange an auth code for tokens in the OAuth app PKCE flow.","enum":["authorization_code"],"type":"string"},"redirect_uri":{"description":"This URI must match the URI used in the [Request Authorization endpoint](/reference/v1-request-authorization).","minLength":1,"type":"string"},"resource":{"description":"Optional RFC 8707 resource indicator. Ignored for standard OAuth clients — any value (including an empty string) is accepted and never read. For public MCP dynamic client registration clients it must match the MCP resource URL when supplied and is required except for Microsoft Copilot Studio; that check is enforced in business logic once the client is resolved.","type":"string"},"scope":{"description":"Optional interoperability field accepted from OAuth clients. It is ignored during token exchange; the issued token retains the scope approved during authorization.","type":"string"}},"required":["grant_type","client_id","redirect_uri","code","code_verifier"],"type":"object"},{"additionalProperties":false,"properties":{"client_id":{"description":"The `client_id` received from Spendesk.","format":"uuid","minLength":1,"type":"string"},"client_secret":{"description":"The `client_secret` received from Spendesk. Required for confidential clients using client_secret_post; omit for public PKCE clients using token_endpoint_auth_method=none.","minLength":1,"type":"string"},"grant_type":{"description":"Use the refresh token grant to obtain a new access token pair.","enum":["refresh_token"],"type":"string"},"refresh_token":{"$ref":"#/components/schemas/token"},"resource":{"description":"Optional RFC 8707 resource indicator. Ignored for standard OAuth clients — any value (including an empty string) is accepted and never read. For public MCP dynamic client registration clients it must match the MCP resource URL when supplied and is required except for Microsoft Copilot Studio; that check is enforced in business logic once the client is resolved.","type":"string"},"scope":{"description":"Optional, accepted for RFC 6749 section 6 compatibility and ignored: the refreshed token keeps the scope granted at authorization, returned in `scope`.","type":"string"}},"required":["grant_type","refresh_token","client_id"],"type":"object"}]}},"application/x-www-form-urlencoded":{"schema":{"oneOf":[{"additionalProperties":false,"properties":{"client_id":{"description":"The OAuth app `client_id` received from Spendesk.","format":"uuid","minLength":1,"type":"string"},"client_secret":{"description":"The OAuth app `client_secret` received from Spendesk. Required for confidential clients using client_secret_post; omit for public PKCE clients using token_endpoint_auth_method=none.","minLength":1,"type":"string"},"code":{"description":"The authorization code set on the redirect URI on the way back from connecting to Spendesk.","minLength":1,"type":"string"},"code_verifier":{"description":"This is the `secret` that was used to generate `code_challenge` you sent when starting the OAuth2 PCKE flow.","maxLength":128,"minLength":43,"type":"string"},"grant_type":{"description":"Use the authorization code grant to exchange an auth code for tokens in the OAuth app PKCE flow.","enum":["authorization_code"],"type":"string"},"redirect_uri":{"description":"This URI must match the URI used in the [Request Authorization endpoint](/reference/v1-request-authorization).","minLength":1,"type":"string"},"resource":{"description":"Optional RFC 8707 resource indicator. Ignored for standard OAuth clients — any value (including an empty string) is accepted and never read. For public MCP dynamic client registration clients it must match the MCP resource URL when supplied and is required except for Microsoft Copilot Studio; that check is enforced in business logic once the client is resolved.","type":"string"},"scope":{"description":"Optional interoperability field accepted from OAuth clients. It is ignored during token exchange; the issued token retains the scope approved during authorization.","type":"string"}},"required":["grant_type","client_id","redirect_uri","code","code_verifier"],"type":"object"},{"additionalProperties":false,"properties":{"client_id":{"description":"The `client_id` received from Spendesk.","format":"uuid","minLength":1,"type":"string"},"client_secret":{"description":"The `client_secret` received from Spendesk. Required for confidential clients using client_secret_post; omit for public PKCE clients using token_endpoint_auth_method=none.","minLength":1,"type":"string"},"grant_type":{"description":"Use the refresh token grant to obtain a new access token pair.","enum":["refresh_token"],"type":"string"},"refresh_token":{"$ref":"#/components/schemas/token"},"resource":{"description":"Optional RFC 8707 resource indicator. Ignored for standard OAuth clients — any value (including an empty string) is accepted and never read. For public MCP dynamic client registration clients it must match the MCP resource URL when supplied and is required except for Microsoft Copilot Studio; that check is enforced in business logic once the client is resolved.","type":"string"},"scope":{"description":"Optional, accepted for RFC 6749 section 6 compatibility and ignored: the refreshed token keeps the scope granted at authorization, returned in `scope`.","type":"string"}},"required":["grant_type","refresh_token","client_id"],"type":"object"}]}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"access_token":{"$ref":"#/components/schemas/token"},"expires_in":{"default":3600,"description":"Amount of seconds until the given access token expires","exclusiveMinimum":0,"type":"integer"},"refresh_token":{"$ref":"#/components/schemas/token"},"scope":{"description":"Optional field to restrict the scope of the token. The default scope will match the scope defined in the front end when generating your API client id and secret.\n\nSee [available scopes](/reference/scopes) for more information.","type":"string"},"token_type":{"default":"Bearer","description":"The type of token generated.","enum":["Bearer"],"type":"string"}},"required":["token_type","access_token","expires_in","refresh_token","scope"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"Bad request","properties":{"correlationId":{"type":"string"},"error":{"enum":["invalid_request","invalid_client","invalid_grant","invalid_scope"],"type":"string"},"error_description":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["BAD_REQUEST_INCORRECT_OR_MISSING_FIELD","RESPONSE_TOO_LARGE"],"type":"string"},"detail":{"type":"string"},"source":{"type":"string"}},"required":["code","detail","source"],"type":"object"},"type":"array"}},"required":["errors"],"type":"object"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"Unauthorized","properties":{"correlationId":{"type":"string"},"error":{"enum":["invalid_request","invalid_client","invalid_grant","invalid_scope"],"type":"string"},"error_description":{"type":"string"},"errors":{"items":{"properties":{"code":{"enum":["AUTHENTICATION_ERROR"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"type":"object"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"Forbidden","properties":{"correlationId":{"type":"string"},"error":{"enum":["invalid_request","invalid_client","invalid_grant","invalid_scope"],"type":"string"},"error_description":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["FORBIDDEN_ERROR"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"type":"object"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"summary":"OAuth2 Token Endpoint (OAuth app PKCE)","tags":["Authentication"]}},"/v1/oauth2/token/refresh":{"post":{"deprecated":true,"description":"Deprecated compatibility endpoint. Prefer the [OAuth2 token endpoint](/reference/v1-create-oauth2-token) with `grant_type=refresh_token`.\n\nOAuth token requests should be sent as `application/x-www-form-urlencoded`, as specified by OAuth 2.0. JSON requests remain accepted for backwards compatibility.\n\nRequest new access and refresh tokens. Upon requesting new tokens, both old `access_token` and `refresh_token` values will be invalidated - make sure you update the `refresh_token` in your database every time you call this endpoint.\nNew refresh tokens should be requested at least once every 30 days (daily or weekly is fine) in order to keep the connection alive.\n\nIf a refresh fails:\n- 401 \"Provided secret does not match the client\", \"client_secret is required for this client\" or \"The requested token does not belong to the provided client\": the `client_id`/`client_secret` you sent are wrong (for example another environment's app). Fix them and retry with the same refresh token, which was not consumed.\n- 401 \"No active OAuth2 client found for provided credentials\": the client is unknown, disabled or expired. Check `client_id`, or register or re-enable the client; retrying with the same credentials will not help. The refresh token was not consumed, but it only works with the client it was issued to.\n- Any other 401, and a 403: this refresh token can no longer be used (expired, revoked or already rotated). Discard it and ask the user to reconnect.\n- 400: the request is malformed. 5xx: temporary, retry later with the same refresh token.","operationId":"v1-refresh-oauth2-token","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"client_id":{"description":"The `client_id` received from Spendesk.","format":"uuid","minLength":1,"type":"string"},"client_secret":{"description":"The `client_secret` received from Spendesk. Required for confidential clients using client_secret_post; omit for public PKCE clients using token_endpoint_auth_method=none.","minLength":1,"type":"string"},"grant_type":{"description":"Use the refresh token grant to obtain a new access token pair.","enum":["refresh_token"],"type":"string"},"refresh_token":{"$ref":"#/components/schemas/token"},"resource":{"description":"Optional RFC 8707 resource indicator. Ignored for standard OAuth clients — any value (including an empty string) is accepted and never read. For public MCP dynamic client registration clients it must match the MCP resource URL when supplied and is required except for Microsoft Copilot Studio; that check is enforced in business logic once the client is resolved.","type":"string"},"scope":{"description":"Optional, accepted for RFC 6749 section 6 compatibility and ignored: the refreshed token keeps the scope granted at authorization, returned in `scope`.","type":"string"}},"required":["grant_type","refresh_token","client_id"],"type":"object"}},"application/x-www-form-urlencoded":{"schema":{"additionalProperties":false,"properties":{"client_id":{"description":"The `client_id` received from Spendesk.","format":"uuid","minLength":1,"type":"string"},"client_secret":{"description":"The `client_secret` received from Spendesk. Required for confidential clients using client_secret_post; omit for public PKCE clients using token_endpoint_auth_method=none.","minLength":1,"type":"string"},"grant_type":{"description":"Use the refresh token grant to obtain a new access token pair.","enum":["refresh_token"],"type":"string"},"refresh_token":{"$ref":"#/components/schemas/token"},"resource":{"description":"Optional RFC 8707 resource indicator. Ignored for standard OAuth clients — any value (including an empty string) is accepted and never read. For public MCP dynamic client registration clients it must match the MCP resource URL when supplied and is required except for Microsoft Copilot Studio; that check is enforced in business logic once the client is resolved.","type":"string"},"scope":{"description":"Optional, accepted for RFC 6749 section 6 compatibility and ignored: the refreshed token keeps the scope granted at authorization, returned in `scope`.","type":"string"}},"required":["grant_type","refresh_token","client_id"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"access_token":{"$ref":"#/components/schemas/token"},"expires_in":{"default":3600,"description":"Amount of seconds until the given access token expires","exclusiveMinimum":0,"type":"integer"},"refresh_token":{"$ref":"#/components/schemas/token"},"scope":{"description":"Optional field to restrict the scope of the token. The default scope will match the scope defined in the front end when generating your API client id and secret.\n\nSee [available scopes](/reference/scopes) for more information.","type":"string"},"token_type":{"default":"Bearer","description":"The type of token generated.","enum":["Bearer"],"type":"string"}},"required":["token_type","access_token","expires_in","refresh_token","scope"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"Bad request","properties":{"correlationId":{"type":"string"},"error":{"enum":["invalid_request","invalid_client","invalid_grant","invalid_scope"],"type":"string"},"error_description":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["BAD_REQUEST_INCORRECT_OR_MISSING_FIELD","RESPONSE_TOO_LARGE"],"type":"string"},"detail":{"type":"string"},"source":{"type":"string"}},"required":["code","detail","source"],"type":"object"},"type":"array"}},"required":["errors"],"type":"object"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"Unauthorized","properties":{"correlationId":{"type":"string"},"error":{"enum":["invalid_request","invalid_client","invalid_grant","invalid_scope"],"type":"string"},"error_description":{"type":"string"},"errors":{"items":{"properties":{"code":{"enum":["AUTHENTICATION_ERROR"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"type":"object"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"Forbidden","properties":{"correlationId":{"type":"string"},"error":{"enum":["invalid_request","invalid_client","invalid_grant","invalid_scope"],"type":"string"},"error_description":{"type":"string"},"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["FORBIDDEN_ERROR"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"type":"object"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"summary":"Refresh Token (Deprecated)","tags":["Authentication"]}},"/v1/payables/bookkeeping-status":{"put":{"description":"**Allowed Scopes**: _`experimental:accounting:update`_\n\nUpdate the accounting status for multiple Payables.\n\nThe user associated with the token must have the Controller role in the company. Otherwise, the request fails with a `403` and the `CONTROLLER_ROLE_REQUIRED` error code.","operationId":"v1-put-payables-bookkeeping-status","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"payables":{"description":"Payables to update","example":{"payables":[{"id":"bc9cef35-401d-4ea4-b384-ed725e6685cf","status":"exportedManually","version":1}]},"items":{"discriminator":{"propertyName":"status"},"oneOf":[{"additionalProperties":false,"properties":{"id":{"description":"The ID of the Payable","examples":["bc9cef35-401d-4ea4-b384-ed725e6685cf"],"format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"status":{"description":"The new bookkeeping status to set for the Payable","enum":["exportedManually"],"examples":["exportedManually"],"type":"string"},"version":{"description":"The version of the Payable to update","examples":[1],"type":"number"}},"required":["id","version","status"]},{"additionalProperties":false,"properties":{"id":{"description":"The ID of the Payable","examples":["bc9cef35-401d-4ea4-b384-ed725e6685cf"],"format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"message":{"description":"The reason for the failure","examples":["Failed to export due to missing information"],"type":"string"},"status":{"description":"The new bookkeeping status to set for the Payable","enum":["failedExport"],"examples":["failedExport"],"type":"string"},"version":{"description":"The version of the Payable to update","examples":[1],"type":"number"}},"required":["id","version","status"]}],"type":"object"},"maxItems":50,"minItems":1,"type":"array"},"status":{"deprecated":true,"description":"The new bookkeeping status to set for the Payables","enum":["exportedManually"],"example":"exportedManually","type":"string"}},"required":["payables"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/bulkUpdatePayablesBookkeepingStatusFullSuccess"}}},"description":"Default Response"},"207":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/bulkUpdatePayablesBookkeepingStatusPartialSuccess"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbiddenControllerRoleRequired"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:accounting:update"]}],"summary":"Update Payables bookkeeping status","tags":["Payables"],"x-roles":["controller","admin","accountOwner"]}},"/v1/payables/search":{"post":{"description":"**Allowed Scopes**: _`experimental:payable-search:read`_\n\nSearches payables using filters with cursor-based pagination. With an organisation-level token, each search covers the company in `X-Company-Id` only, and results carry no company ID: send one search per company. Payables search data is cached for up to 24 hours, or up to 5 minutes when the filters include `documentaryEvidenceStatus`. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to the same duration to appear.\n\nPass `include: [\"externalIds\"]` to embed the IDs each payable has in external systems (ERPs), such as the ERP document number, and `externalIds` (optionally with `provider`) to return only the payables carrying one of those IDs. Both are opt-in because they cost an additional lookup; external IDs are cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear.\n\nAccounting fields, such as the item lines' `taxAccountId`, `vatRate` and `vatAmount`, return the values saved on the payable. Values that Spendesk only suggests in Bookkeep > Prepare (from default accounts or automation rules) are not returned until an accountant prepares the payable. So a payable in state `toPrepare` can return `vatAmount` 0 while Spendesk displays a VAT amount for it. For final accounting data, filter on `bookkeepingStatus` `toExport` or `exported`.","operationId":"v1-search-payables","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/searchPayableBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"nextCursor":{"type":["null","string"]},"payables":{"items":{"$ref":"#/components/schemas/searchPayable"},"type":"array"},"referencesToRetry":{"items":{"type":"string"},"type":"array"}},"required":["nextCursor","referencesToRetry","payables"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:payable-search:read"]}],"summary":"Search Payables","tags":["Payables"],"x-roles":["controller","admin","accountOwner"]}},"/v1/payables/{id}":{"get":{"description":"**Allowed Scopes**: _`payable:read`_\n\nRetrieves a single payable by its ID. Payable data is cached for up to 20 minutes. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 20 minutes to appear.\n\nPass `include=externalIds` to embed the IDs this payable has in external systems (ERPs), such as the ERP document number. It is opt-in because it costs an additional lookup. External IDs are cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear.\n\nFor accounting export use cases, each line item's net amount is available as `lineItems[].financial.netAmount`. Amounts are expressed in the smallest unit of the payable currency, for example cents for EUR and USD, pence for GBP, and yen for JPY.\n\nAccounting fields, such as the line items' VAT account and amounts, return the values saved on the payable. Values that Spendesk only suggests in Bookkeep > Prepare (from default accounts or automation rules) are not returned until an accountant prepares the payable. So a `created` or `unprepared` payable can return `vatAmount` 0 while Spendesk displays a VAT amount for it. For final accounting data, read payables whose `bookkeepingStatus` is `prepared`, `exported` or `exportedManually`.","operationId":"v1-get-payable-by-id","parameters":[{"description":"Extra data to embed in the response. `externalIds` costs one additional lookup per request, so it is opt-in.","in":"query","name":"include","required":false,"schema":{"items":{"enum":["externalIds"],"type":"string"},"type":"array"}},{"description":"ID of the payable to retrieve.","example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","in":"path","name":"id","required":true,"schema":{"format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/payable"}}},"description":"A payable is a short-term liability owed by a company to its creditors (suppliers or employees). Several types of payables are supported by Spendesk, e.g. Invoices, Credit Notes, Expense Claims, Physical card purchases, Single Use card purchases, Subscription card purchases, etc."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["payable:read"]}],"summary":"Get Payable by ID","tags":["Payables"],"x-roles":["controller","admin","accountOwner"]},"patch":{"description":"**Allowed Scopes**: _`experimental:accounting:update`_\n\nUpdates accounting fields for one Payable with optimistic locking.\n\nThe user associated with the token must have the Controller role in the company. Otherwise, the request fails with a `403` and the `CONTROLLER_ROLE_REQUIRED` error code.","operationId":"v1-patch-payable-accounting-fields","parameters":[{"description":"The ID of the Payable","example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","in":"path","name":"id","required":true,"schema":{"format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"errorMessage":{"minProperties":"must include at least one of description, accountPayableId, accountingDate, lineItems or amortisation"},"minProperties":2,"properties":{"accountPayableId":{"description":"Account payable to apply to the Payable.","example":"00886d31-f27d-5366-8b05-cd287dc0f43d","format":"uuid","type":"string"},"accountingDate":{"description":"Date in the `YYYY-MM-DD` format.","format":"date","type":"string"},"amortisation":{"additionalProperties":false,"description":"Prepaid-expense amortisation period to apply to the Payable.","properties":{"endDate":{"description":"Date in the `YYYY-MM-DD` format.","format":"date","type":"string"},"startDate":{"description":"Date in the `YYYY-MM-DD` format.","format":"date","type":"string"}},"required":["startDate","endDate"],"type":"object"},"description":{"description":"Description to apply to the Payable.","example":"Team offsite lunch","type":"string"},"lineItems":{"description":"Complete replacement for the payable line items. To preserve a line returned by GET /v1/payables/{id}, map financial.grossAmount.amount to grossAmount, expenseAccount.id to expenseAccountId, vatAccount.id or reverseChargeAccount.id to taxAccountId, costCenterId directly, and analyticalProperties fieldId/valueId pairs to analyticalFieldValues; use null only when an account or cost center should remain unassigned. A null taxAccountId is not a tax-exempt, zero-rated, or reverse-charge treatment; changing tax treatment requires the matching company tax account ID. Gross amounts must sum to the payable amount. Tax amounts are recalculated from taxAccountId, clearing manual VAT adjustments. Replacing lines also clears lineNature and exemptionReasonCode on every line, which this endpoint cannot read or set.","items":{"additionalProperties":false,"properties":{"analyticalFieldValues":{"description":"Complete analytical field value set; an empty array clears it. All lines must use the same set when analytical splitting is disabled.","items":{"additionalProperties":false,"properties":{"fieldId":{"description":"ID of the analytical field.","example":"field_001","type":"string"},"valueId":{"description":"ID of the analytical field value.","example":"val_abc","type":"string"}},"required":["fieldId","valueId"],"type":"object"},"type":"array"},"costCenterId":{"description":"Cost center ID, or null to clear it. All lines must use the same value when analytical splitting is disabled.","example":"cc_789","nullable":true,"type":"string"},"expenseAccountId":{"description":"Expense account ID, or null to leave the line unassigned.","example":"exp_acc_123","nullable":true,"type":"string"},"grossAmount":{"description":"Gross amount of this line in the payable currency smallest unit (for example cents for EUR and USD, or yen for JPY).","example":12000,"maximum":9007199254740991,"minimum":-9007199254740991,"type":"integer"},"taxAccountId":{"description":"Tax or reverse-charge account ID. Use null only to leave the line without an assigned tax account. Null does not mean tax-exempt, zero-rated, or reverse charge; those treatments require the matching company tax account ID.","example":"tax_acc_456","nullable":true,"type":"string"}},"required":["grossAmount","expenseAccountId","taxAccountId","costCenterId","analyticalFieldValues"],"type":"object"},"minItems":1,"type":"array"},"version":{"description":"The current version of the Payable to update.","example":3,"type":"number"}},"required":["version"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"item":{"additionalProperties":false,"properties":{"bookkeepingStatus":{"description":"The updated bookkeeping status of the Payable.","type":"string"},"id":{"description":"The ID of the Payable","example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"version":{"description":"The updated Payable version.","type":"number"}},"required":["id","version","bookkeepingStatus"],"type":"object"}},"required":["item"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbiddenControllerRoleRequired"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"422":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"reason":{"description":"The payable state is incompatible with this update.","example":"invalidState","type":"string"}},"required":["reason"],"type":"object"}}},"description":"Default Response"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:accounting:update"]}],"summary":"Update Payable accounting fields","tags":["Payables"],"x-roles":["controller","accountOwner"]}},"/v1/payables/{id}/mark-as-ready":{"post":{"description":"**Allowed Scopes**: _`experimental:accounting:update`_\n\nValidates a Payable and marks it as ready for accounting export when all required bookkeeping information is present.\n\nThe user associated with the token must have the Controller role in the company. Otherwise, the request fails with a `403` and the `CONTROLLER_ROLE_REQUIRED` error code.","operationId":"v1-post-payable-mark-as-ready","parameters":[{"description":"The ID of the Payable","example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","in":"path","name":"id","required":true,"schema":{"format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"version":{"description":"The current version of the Payable to mark as ready.","example":1,"type":"number"}},"required":["version"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"id":{"description":"The ID of the Payable","example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"status":{"description":"The updated bookkeeping status of the Payable.","enum":["prepared"],"type":"string"}},"required":["id","status"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbiddenControllerRoleRequired"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:accounting:update"]}],"summary":"Mark Payable as ready","tags":["Payables"],"x-roles":["controller","accountOwner"]}},"/v1/payables/{payableId}/attachments":{"get":{"description":"**Allowed Scopes**: _`payable-attachment:read`_\n\nReturns attachments for a given payable as short lived URLs. Download and save downloaded files in your long term storage. Payable attachment data is not cached, so a file uploaded a moment ago already shows up.","operationId":"v1-get-payable-attachments","parameters":[{"description":"The ID of the Payable","example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","in":"path","name":"payableId","required":true,"schema":{"format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"items":{"additionalProperties":false,"properties":{"attachedAt":{"description":"The date the attachment was added.","format":"date","type":"string"},"checksum":{"description":"A file checksum is like a unique digital fingerprint that helps ensure a file hasn’t been tampered with during transfer or storage, providing data integrity and security assurance.","type":"string"},"mimeType":{"description":"Media type of the attachment.","type":"string"},"url":{"description":"A short-lived URL to download the attachment.","type":"string"}},"required":["mimeType","url"],"type":"object"},"type":"array"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["payable-attachment:read"]}],"summary":"Get Payable Attachments","tags":["Payables"],"x-roles":["controller","admin","accountOwner"]},"post":{"description":"**Allowed Scopes**: _`experimental:payable-attachment:write`_\n\nCreates a presigned upload target for a receipt attachment on a payable. This first version supports card transaction payables only. Upload the file using the returned method, URL, and form fields, then poll `GET /v1/payables/:payableId/attachments` until the attachment appears.","operationId":"v1-create-payable-attachment-upload","parameters":[{"description":"The ID of the Payable","example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","in":"path","name":"payableId","required":true,"schema":{"format":"uuid","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"contentLength":{"description":"Attachment size in bytes.","minimum":1,"type":"integer"},"mimeType":{"description":"Media type of the attachment.","minLength":1,"type":"string"}},"required":["mimeType","contentLength"],"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"fields":{"additionalProperties":{"type":"string"},"description":"Form fields to send with the attachment upload.","type":"object"},"method":{"description":"HTTP method to use when uploading the attachment.","enum":["POST"],"type":"string"},"url":{"description":"Presigned URL where the attachment must be uploaded.","type":"string"}},"required":["method","url","fields"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["UNSUPPORTED_MEDIA_TYPE"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"type":"object"}}},"description":"Default Response"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:payable-attachment:write"]}],"summary":"Create Payable Attachment Upload","tags":["Payables"],"x-roles":["controller","admin","accountOwner"]}},"/v1/purchase-orders":{"get":{"description":"**Allowed Scopes**: _`experimental:purchase-order:read`_\n\nReturns purchase orders. Purchase order data is cached for up to 2 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 2 hours to appear.","operationId":"v1-get-purchase-orders","parameters":[{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"Page size","in":"query","name":"pageSize","required":false,"schema":{"default":30,"maximum":30,"minimum":1,"type":"integer"}},{"description":"Whether to include line items in the response","in":"query","name":"withItems","required":false,"schema":{"type":"boolean"}},{"description":"Filter by supplier IDs","in":"query","name":"supplierIds","required":false,"schema":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}]}},{"description":"Filter by purchase order status","in":"query","name":"status","required":false,"schema":{"anyOf":[{"enum":["open","closed","cancelled"],"type":"string"},{"items":{"enum":["open","closed","cancelled"],"type":"string"},"type":"array"}]}},{"description":"Filter by company IDs","in":"query","name":"companyIds","required":false,"schema":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"maxItems":100,"type":"array"}]}},{"description":"Filter purchase orders created from this date (YYYY-MM-DD)","in":"query","name":"createdFrom","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"Filter purchase orders created until this date (YYYY-MM-DD)","in":"query","name":"createdTo","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"Filter purchase orders with start date from this date (YYYY-MM-DD)","in":"query","name":"startDateFrom","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"Filter purchase orders with start date until this date (YYYY-MM-DD)","in":"query","name":"startDateTo","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"Filter purchase orders with end date from this date (YYYY-MM-DD)","in":"query","name":"endDateFrom","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"Filter purchase orders with end date until this date (YYYY-MM-DD)","in":"query","name":"endDateTo","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"data":{"description":"List of purchase orders","items":{"properties":{"amount":{"properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":"object"},"billedAmount":{"properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":"object"},"billing":{"type":"string"},"billingOverDeliveryStatus":{"type":"string"},"billingStatus":{"type":"string"},"companyId":{"type":"string"},"costCenterId":{"type":"string"},"customFields":{"items":{"properties":{"field":{"properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},"value":{"properties":{"id":{"type":"string"},"value":{"type":"string"}},"required":["id","value"],"type":"object"}},"required":["field","value"],"type":"object"},"type":"array"},"deliveredAmount":{"properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":"object"},"deliveryStatus":{"type":"string"},"description":{"type":"string"},"endDate":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"},"id":{"type":"string"},"invoices":{"items":{"properties":{"amount":{"properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":"object"},"invoiceNumber":{"type":"string"},"invoiceRequestId":{"type":"string"},"latestPaymentId":{"type":"string"},"paymentToScheduleId":{"type":"string"},"requestId":{"type":"string"},"status":{"enum":["pending-approval","in-review","to-schedule","paid"],"type":"string"}},"required":["invoiceRequestId","invoiceNumber","amount","status"],"type":"object"},"type":"array"},"items":{"items":{"properties":{"currency":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"description":"Price of one unit, in `currency`, as a decimal in major units (12.5 means 12.50). Unlike the `{amount, currency, precision}` objects on the purchase order, this is a plain decimal.","type":"number"},"vatRate":{"type":["null","number"]}},"required":["name","quantity","unitPrice","currency","vatRate"],"type":"object"},"type":"array"},"netAmount":{"properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":"object"},"purchaseOrderNumber":{"type":"number"},"requestId":{"type":"string"},"requesterId":{"type":"string"},"spendingCommitmentId":{"type":"string"},"startDate":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"},"status":{"description":"Status of the purchase order","enum":["open","closed","cancelled"],"type":"string"},"supplierId":{"type":"string"},"teamId":{"type":["null","string"]},"version":{"type":"number"}},"required":["id","status","version","amount","billedAmount","deliveredAmount","spendingCommitmentId","purchaseOrderNumber","startDate","endDate","supplierId","requesterId","invoices","companyId","requestId"],"type":"object"},"type":"array"},"meta":{"$ref":"#/components/schemas/meta"}},"required":["meta","data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:purchase-order:read"]}],"summary":"Get Purchase Orders","tags":["Purchase orders"],"x-roles":["controller","admin","accountOwner"]},"post":{"description":"**Allowed Scopes**: _`experimental:purchase-order:write`_\n\nCreate a purchase order.","operationId":"v1-create-purchase-order","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"allOf":[{"properties":{"amount":{"properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":"object"},"analyticalSplits":{"default":[],"items":{"properties":{"amount":{"properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":"object"},"costCenterId":{"oneOf":[{"type":"string"},{"type":"null"}]},"customFields":{"items":{"properties":{"customFieldId":{"type":"string"},"customFieldValueId":{"oneOf":[{"type":"string"},{"type":"null"}]},"value":{"oneOf":[{"type":"string"},{"type":"boolean"},{"type":"null"}]}},"required":["customFieldId"],"type":"object"},"type":"array"},"percentage":{"type":"number"}},"required":["amount","percentage"],"type":"object"},"type":"array"},"costCenterId":{"type":"string"},"customFieldAssociations":{"items":{"properties":{"customFieldId":{"type":"string"},"customFieldValueId":{"oneOf":[{"type":"string"},{"type":"null"}]},"value":{"oneOf":[{"type":"string"},{"type":"boolean"},{"type":"null"}]}},"required":["customFieldId"],"type":"object"},"type":"array"},"deliveryNotesExpected":{"type":"boolean"},"description":{"maxLength":255,"type":"string"},"endDate":{"format":"date-time","type":"string"},"externalPONumber":{"type":"string"},"items":{"default":[],"items":{"properties":{"name":{"maxLength":255,"type":"string"},"quantity":{"exclusiveMinimum":0,"type":"number"},"unitPrice":{"properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":"object"},"vatRate":{"oneOf":[{"minimum":0,"type":"number"}]}},"required":["name","quantity","unitPrice"],"type":"object"},"type":"array"},"netAmount":{"properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":"object"},"startDate":{"format":"date-time","type":"string"},"teamId":{"type":"string"},"userId":{"type":"string"}},"required":["userId","amount","netAmount","costCenterId","startDate","endDate","customFieldAssociations"],"type":"object"},{"anyOf":[{"properties":{"supplierId":{"type":"string"}},"required":["supplierId"],"type":"object"},{"properties":{"supplierName":{"type":"string"}},"required":["supplierName"],"type":"object"}]}]}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:purchase-order:write"]}],"summary":"Create a purchase order","tags":["Purchase orders"],"x-roles":["controller","admin","accountOwner"]}},"/v1/purchase-orders/{purchaseOrderId}":{"get":{"description":"**Allowed Scopes**: _`experimental:purchase-order:read`_\n\nReturns a purchase order by ID. Purchase order data is cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear.","operationId":"v1-get-purchase-order","parameters":[{"description":"Whether to include line items in the response","in":"query","name":"withItems","required":false,"schema":{"type":"boolean"}},{"description":"The ID of the purchase order to retrieve","in":"path","name":"purchaseOrderId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"data":{"properties":{"amount":{"properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":"object"},"billedAmount":{"properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":"object"},"billing":{"type":"string"},"billingOverDeliveryStatus":{"type":"string"},"billingStatus":{"type":"string"},"companyId":{"type":"string"},"costCenterId":{"type":"string"},"customFields":{"items":{"properties":{"field":{"properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},"value":{"properties":{"id":{"type":"string"},"value":{"type":"string"}},"required":["id","value"],"type":"object"}},"required":["field","value"],"type":"object"},"type":"array"},"deliveredAmount":{"properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":"object"},"deliveryStatus":{"type":"string"},"description":{"type":"string"},"endDate":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"},"id":{"type":"string"},"invoices":{"items":{"properties":{"amount":{"properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":"object"},"invoiceNumber":{"type":"string"},"invoiceRequestId":{"type":"string"},"latestPaymentId":{"type":"string"},"paymentToScheduleId":{"type":"string"},"requestId":{"type":"string"},"status":{"enum":["pending-approval","in-review","to-schedule","paid"],"type":"string"}},"required":["invoiceRequestId","invoiceNumber","amount","status"],"type":"object"},"type":"array"},"items":{"items":{"properties":{"currency":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"description":"Price of one unit, in `currency`, as a decimal in major units (12.5 means 12.50). Unlike the `{amount, currency, precision}` objects on the purchase order, this is a plain decimal.","type":"number"},"vatRate":{"type":["null","number"]}},"required":["name","quantity","unitPrice","currency","vatRate"],"type":"object"},"type":"array"},"netAmount":{"properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":"object"},"purchaseOrderNumber":{"type":"number"},"requestId":{"type":"string"},"requesterId":{"type":"string"},"spendingCommitmentId":{"type":"string"},"startDate":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"},"status":{"description":"Status of the purchase order","enum":["open","closed","cancelled"],"type":"string"},"supplierId":{"type":"string"},"teamId":{"type":["null","string"]},"version":{"type":"number"}},"required":["id","status","version","amount","billedAmount","deliveredAmount","spendingCommitmentId","purchaseOrderNumber","startDate","endDate","supplierId","requesterId","invoices","companyId","requestId"],"type":"object"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:purchase-order:read"]}],"summary":"Get a purchase order by ID","tags":["Purchase orders"],"x-roles":["controller","admin","accountOwner"]}},"/v1/purchase-orders/{purchaseOrderId}/cancel":{"post":{"description":"**Allowed Scopes**: _`experimental:purchase-order:write`_\n\nCancel an existing purchase order by ID.","operationId":"v1-cancel-purchase-order","parameters":[{"description":"Ignored. The response only reports the outcome, not the purchase order or its line items.","in":"query","name":"withItems","required":false,"schema":{"type":"boolean"}},{"description":"The ID of the purchase order to cancel","in":"path","name":"purchaseOrderId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"description":"Purchase order cancellation result","properties":{"data":{"properties":{"outcome":{"enum":["cancelled"],"type":"string"}},"type":"object"}},"type":"object"}}},"description":"Purchase order cancellation result"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request. A refused cancel also returns 400, with one of these reasons in `detail`: purchaseOrderNotFound, attachedInvoicesExist, forbidden, statusNotOpened, alreadyExists, spendingCommitmentNotFound, hasExpenses."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:purchase-order:write"]}],"summary":"Cancel a purchase order","tags":["Purchase orders"],"x-roles":["controller","admin","accountOwner"]}},"/v1/purchase-orders/{purchaseOrderId}/close":{"post":{"description":"**Allowed Scopes**: _`experimental:purchase-order:write`_\n\nClose an existing purchase order by ID. Closing a purchase order prevents further modifications.","operationId":"v1-close-purchase-order","parameters":[{"description":"Ignored. The response only reports the outcome, not the purchase order or its line items.","in":"query","name":"withItems","required":false,"schema":{"type":"boolean"}},{"description":"The ID of the purchase order to close","in":"path","name":"purchaseOrderId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"description":"Purchase order closure result","properties":{"data":{"properties":{"outcome":{"enum":["closed"],"type":"string"}},"type":"object"}},"type":"object"}}},"description":"Purchase order closure result"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request. A refused close also returns 400, with one of these reasons in `detail`: alreadyExists, cannotAmendCurrencyOnCommitmentWithExistingExpenses, cannotAmendCounterpartyOnCommitmentWithExistingExpenses, forbidden, invalidSegments, invalidCounterparty, noAttachedInvoices, noDataProvided, purchaseOrderNotFound, spendingCommitmentNotFound, spendingCommitmentRevoked, statusNotOpened, unpaidInvoices."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:purchase-order:write"]}],"summary":"Close a purchase order","tags":["Purchase orders"],"x-roles":["controller","admin","accountOwner"]}},"/v1/purchase-orders/{purchaseOrderId}/document":{"get":{"description":"**Allowed Scopes**: _`experimental:purchase-order:read`_\n\nReturns the document for a given purchase order as a short lived URL. Download and save the file in your long term storage. Purchase order document data is cached for up to 55 minutes. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 55 minutes to appear.","operationId":"v1-get-purchase-order-document","parameters":[{"in":"path","name":"purchaseOrderId","required":true,"schema":{"maxLength":36,"minLength":8,"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"additionalProperties":false,"properties":{"mimeType":{"description":"Media type of the document.","type":"string"},"url":{"description":"A short-lived URL to download the document.","type":"string"}},"required":["url","mimeType"],"type":"object"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:purchase-order:read"]}],"summary":"Get Purchase Order Document","tags":["Purchase orders"],"x-roles":["controller","admin","accountOwner"]}},"/v1/requests":{"get":{"description":"**Allowed Scopes**: _`experimental:request:read`_\nReturns card, purchase order, invoice, credit note, travel and claim requests for the authenticated company. Only these request types are listed: `single_purchase`, `subscription`, `subscription_increase`, `multi_use_card`, `multi_use_card_top_up`, `multi_use_card_end_date_change`, `card_load`, `purchase_order`, `invoice`, `credit_note`, `travel_budget`, `travel_booking`, `expense`, `mileage_allowance` and `per_diem_allowance`. `subscription_increase`, `purchase_order`, `invoice`, `credit_note`, `travel_budget` and `travel_booking` requests are returned only when `type` is set to that type, as their amount is the new budget of a subscription, a commitment to a supplier, a supplier document or a trip, not card spend. `purchase_order` requests also need the `experimental:purchase-order:read` scope, and `invoice` and `credit_note` requests the `experimental:invoice:read` scope: without it, none are returned. Claims (`expense`, `mileage_allowance` and `per_diem_allowance`) are returned only to companies with the claims feature enabled, and asking only for claims without it answers 403. Drafts, incomplete and paid claims are never returned.","operationId":"v1-get-requests","parameters":[{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"Page size","in":"query","name":"pageSize","required":false,"schema":{"default":30,"maximum":30,"minimum":1,"type":"integer"}},{"description":"Filter by request type. Without it, every listed type except `subscription_increase`, `purchase_order`, `invoice`, `credit_note`, `travel_budget` and `travel_booking` is returned.","in":"query","name":"type","required":false,"schema":{"enum":["single_purchase","subscription","subscription_increase","multi_use_card","multi_use_card_top_up","multi_use_card_end_date_change","card_load","purchase_order","invoice","credit_note","travel_budget","travel_booking","expense","mileage_allowance","per_diem_allowance"],"type":"string"}},{"description":"Filter by request state.","in":"query","name":"state","required":false,"schema":{"enum":["pending","approved","refused","expired","cancelled","incomplete","draft","rejected_by_controller","supplier_disputed"],"type":"string"}},{"description":"Filters claims (`expense`, `mileage_allowance`, `per_diem_allowance`) only, so combine it with a claim `type`: other types never match it. `true` keeps the claims a controller reviewed, `false` the others. The claims feature is required.","in":"query","name":"reviewed","required":false,"schema":{"type":"boolean"}},{"description":"Filters claims (`expense`, `mileage_allowance`, `per_diem_allowance`) only, so combine it with a claim `type`: other types never match it. Keeps the claims coded to this expense category (the `expenseCategory.id` returned). The claims feature is required.","in":"query","name":"expenseCategoryId","required":false,"schema":{"minLength":1,"type":"string"}},{"description":"Keeps the expenses dated on or after this day (YYYY-MM-DD, UTC, the `expenseDate` returned). Only `expense` requests have a filterable expense date, so `type` must be `expense` alone: any other `type`, or no `type`, answers 400. The claims feature is required.","in":"query","name":"expenseDateFrom","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/date"}]}},{"description":"Keeps the expenses dated on or before this day (YYYY-MM-DD, UTC, included). Same rule as `expenseDateFrom`; a day earlier than `expenseDateFrom` answers 400.","in":"query","name":"expenseDateTo","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/date"}]}},{"description":"Filter by requester user ID.","in":"query","name":"requesterId","required":false,"schema":{"type":"string"}},{"description":"Keeps the requests of this team (the `teamId` returned).","in":"query","name":"teamId","required":false,"schema":{"type":"string"}},{"description":"Keeps the requests of this cost centre (the `costCentreId` returned).","in":"query","name":"costCentreId","required":false,"schema":{"type":"string"}},{"description":"Filter by supplier ID.","in":"query","name":"supplierId","required":false,"schema":{"type":"string"}},{"description":"Return requests created on or after this date (YYYY-MM-DD, UTC).","in":"query","name":"createdAfter","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"Return requests created on or before this date (YYYY-MM-DD, UTC).","in":"query","name":"createdBefore","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"Filter by minimum requested amount, in major units. Compared against the request's amount converted to the company's functional currency using stored exchange rates.","in":"query","name":"minAmount","required":false,"schema":{"type":"number"}},{"description":"Filter by maximum requested amount, in major units. Compared against the request's amount converted to the company's functional currency using stored exchange rates.","in":"query","name":"maxAmount","required":false,"schema":{"type":"number"}},{"description":"Include the `approval` object on each returned request. Off by default because resolving the approval chain costs an extra lookup per page.","in":"query","name":"withApproval","required":false,"schema":{"default":false,"type":"boolean"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"data":{"description":"List of requests","items":{"properties":{"amountToReimburse":{"description":"Only set on claims, in the company currency, as a monetary value whose `amount` is expressed at `precision` decimals. Null until it is set. Unlike `requestedAmount`, it does not use two implied decimals: read `precision` before comparing the two.","properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":["null","object"]},"appUrl":{"description":"Link to this request in the Spendesk web app.","example":"https://app.spendesk.com/app/RRbRgeIB7X/requests/all/SMK6R-5kr","type":"string"},"approval":{"description":"Approval chain for the request. Only present when `withApproval` is enabled. `steps` is ordered and holds only the approvers this request is actually waiting on, has been approved by, or was rejected by — it is empty when the request needed no approval (for example an auto-approved request).","properties":{"autoApprovalReason":{"description":"Reason the request was auto-approved. Null when it was not auto-approved.","type":["null","string"]},"isAutoApproved":{"description":"Whether the request bypassed the approval flow and was approved automatically.","type":"boolean"},"steps":{"items":{"properties":{"approvers":{"description":"Approvers for this step. Always holds at least one approver.","items":{"properties":{"actingUserId":{"description":"The delegate approving in place of `userId`. Null unless `isDelegated` is true.","type":["null","string"]},"isDelegated":{"type":"boolean"},"type":{"enum":["reportingManager","costCenterOwner","accountOwner","user"],"type":"string"},"userId":{"description":"The user the approval flow asks for.","type":"string"}},"required":["type","userId","actingUserId","isDelegated"],"type":"object"},"type":"array"},"decision":{"description":"The decision taken on this step. Null while the step is `current` or `upcoming`, and on a `notRequired` step.","properties":{"at":{"type":"string"},"byUserId":{"description":"The user who approved or rejected, which is the delegate on a delegated step.","type":"string"},"reason":{"description":"Reason given with the decision. Approvers are not asked for one when approving, so this is usually only set on a rejection.","type":["null","string"]}},"required":["byUserId","at","reason"],"type":["null","object"]},"state":{"description":"`current` is the step being waited on, `upcoming` comes after earlier steps approve, `approved`/`rejected` have been decided, `notRequired` was left undecided when the request closed (approved, refused, cancelled or expired).","enum":["approved","current","upcoming","rejected","notRequired"],"type":"string"}},"required":["state","approvers","decision"],"type":"object"},"type":"array"}},"required":["isAutoApproved","autoApprovalReason","steps"],"type":"object"},"cardLoadRequestData":{"properties":{"amount":{"type":"number"},"availableAfter":{"type":"number"},"availableBefore":{"type":"number"},"byUserId":{"type":"string"},"cardId":{"type":"string"},"companyId":{"type":"string"},"createdAt":{"type":"string"},"deletedAt":{"type":["null","string"]},"description":{"type":["null","string"]},"id":{"type":"string"},"organisationId":{"type":"string"},"requestId":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","companyId","organisationId","cardId","requestId","byUserId","amount","availableAfter","availableBefore","description","createdAt","updatedAt","deletedAt"],"type":["null","object"]},"companyId":{"type":"string"},"controllerReview":{"description":"Only set on claims. Latest review of a controller. Null until a controller reviews the claim.","properties":{"at":{"type":["null","string"]},"byUserId":{"type":"string"},"decision":{"enum":["validated","rejected"],"type":"string"},"reason":{"type":["null","string"]}},"required":["decision","byUserId","at","reason"],"type":["null","object"]},"costCentreId":{"type":["null","string"]},"createdAt":{"type":"string"},"creditNoteRequestData":{"description":"Only present on `credit_note` requests, which are returned only to tokens that also hold the `experimental:invoice:read` scope. Null when the credit note record is missing.","properties":{"creditNoteNumber":{"description":"Number the supplier gave the credit note.","type":"string"},"invoiceId":{"description":"Id of the credit note document, served with invoices, which differs from the request id.","type":"string"}},"required":["invoiceId","creditNoteNumber"],"type":["null","object"]},"currency":{"type":["null","string"]},"description":{"type":["null","string"]},"expenseCategory":{"description":"Only set on claims. The expense category the claim is coded to. Null when none is set. Its `id` is the one the `expenseCategoryId` filter matches.","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":["null","object"]},"expenseDate":{"description":"Only set on claims. YYYY-MM-DD, the date the employee says they paid the expense, which budgets and spend limits count as the date of the spend. Differs from `createdAt`, the day the claim was created.","type":["null","string"]},"hasReceipt":{"description":"Only set on `expense` requests: whether at least one receipt is attached. Null on `mileage_allowance` and `per_diem_allowance` requests, which have no receipt, and on other types.","type":["null","boolean"]},"id":{"type":"string"},"invoiceRequestData":{"description":"Only present on `invoice` requests, which are returned only to tokens that also hold the `experimental:invoice:read` scope. Null when the invoice record is missing.","properties":{"dueDate":{"description":"YYYY-MM-DD. Null when not captured yet.","type":["null","string"]},"invoiceId":{"description":"Id of the invoice document, which differs from the request id.","type":"string"},"invoiceNumber":{"description":"Number the supplier gave the invoice. Null when not captured yet.","type":["null","string"]}},"required":["invoiceId","invoiceNumber","dueDate"],"type":["null","object"]},"mileageAllowanceRequestData":{"description":"Only present on `mileage_allowance` requests.","properties":{"distance":{"description":"Distance of the journey, in `distanceUnit`, with 2 decimals at most.","type":"number"},"distanceUnit":{"enum":["km","mi"],"type":"string"}},"required":["distance","distanceUnit"],"type":["null","object"]},"multiUseCardEndDateChangeRequestData":{"properties":{"companyId":{"type":"string"},"id":{"type":"string"},"multiUseCardId":{"type":"string"},"newEndDate":{"type":"string"},"previousEndDate":{"type":"string"},"requestId":{"type":"string"}},"required":["id","companyId","multiUseCardId","newEndDate","previousEndDate","requestId"],"type":["null","object"]},"multiUseCardTopUpRequestData":{"properties":{"companyId":{"type":"string"},"id":{"type":"string"},"multiUseCardId":{"type":"string"},"previousAmount":{"type":"number"},"requestId":{"type":"string"}},"required":["id","companyId","multiUseCardId","previousAmount","requestId"],"type":["null","object"]},"perDiemAllowanceRequestData":{"description":"Only present on `per_diem_allowance` requests.","properties":{"days":{"description":"Number of days the allowance covers.","type":"number"},"mealsProvided":{"description":"Meals the employer provided, counted over the days of the trip, as the employee declared them: the number of days where each meal was provided.","properties":{"breakfast":{"type":"integer"},"dinner":{"type":"integer"},"lunch":{"type":"integer"}},"required":["breakfast","lunch","dinner"],"type":"object"}},"required":["days","mealsProvided"],"type":["null","object"]},"purchaseOrderRequestData":{"description":"Only present on `purchase_order` requests, which are returned only to tokens that also hold the `experimental:purchase-order:read` scope.","properties":{"endDate":{"description":"YYYY-MM-DD.","type":["null","string"]},"netAmount":{"description":"Amount net of taxes, in the currency of the request, as a monetary value whose `amount` is expressed at `precision` decimals. Unlike `requestedAmount`, it does not use two implied decimals: read `precision` before comparing the two.","properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":["null","object"]},"purchaseOrderId":{"description":"The purchase order opened when the request was approved. Null while the request is not approved.","type":["null","string"]},"startDate":{"description":"YYYY-MM-DD.","type":["null","string"]}},"required":["purchaseOrderId","startDate","endDate","netAmount"],"type":"object"},"requestedAmount":{"description":"Amount declared on the request, in `currency`, as an integer with two implied decimals whatever the currency: 1250 is 12.50 EUR and 100000 is 1000 JPY. Divide by 100 to get major units. Null when the request has no amount. On a `subscription_increase` request, this is the new budget asked for the subscription, not the increase. On a `purchase_order` request, this is the amount of the purchase order asked for; `purchaseOrderRequestData.netAmount` is its net of taxes counterpart, in a different encoding. On an `invoice` request, this is the gross amount of the invoice. On a `credit_note` request, it is negative, as the credit note reduces what the company owes the supplier: a credit note may already have been deducted from an invoice or refunded outside Spendesk, so do not net it against invoice amounts. On a `travel_budget` request, this is the budget asked for the trip, not spend.","type":["null","number"]},"requesterId":{"type":["null","string"]},"state":{"type":"string"},"subscriptionIncreaseRequestData":{"description":"Only present on `subscription_increase` requests.","properties":{"subscriptionId":{"description":"The subscription whose budget the request increases.","type":"string"}},"required":["subscriptionId"],"type":["null","object"]},"supplierId":{"type":["null","string"]},"teamId":{"description":"Team the request is attributed to.","type":["null","string"]},"travelBookingRequestData":{"description":"Only present on `travel_booking` requests. Null when the travel booking record is missing.","properties":{"tripId":{"description":"Id of the trip on the travel service.","type":"string"}},"required":["tripId"],"type":["null","object"]},"travelBudgetRequestData":{"description":"Only present on `travel_budget` requests. Null when the travel budget record is missing.","properties":{"endDate":{"description":"Last day of the trip, YYYY-MM-DD.","type":"string"},"multiUseCardId":{"description":"Card issued for the trip. Null until the card is created.","type":["null","string"]},"startDate":{"description":"First day of the trip, YYYY-MM-DD.","type":"string"}},"required":["startDate","endDate","multiUseCardId"],"type":["null","object"]},"type":{"enum":["single_purchase","subscription","subscription_increase","multi_use_card","multi_use_card_top_up","multi_use_card_end_date_change","card_load","purchase_order","invoice","credit_note","travel_budget","travel_booking","expense","mileage_allowance","per_diem_allowance"],"type":"string"}},"required":["id","type","state","requesterId","requestedAmount","currency","supplierId","companyId","costCentreId","description","appUrl","createdAt"],"type":"object"},"type":"array"},"meta":{"$ref":"#/components/schemas/meta"}},"required":["meta","data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:request:read"]}],"summary":"Get Requests","tags":["Requests and transactions"],"x-roles":["controller","admin","accountOwner"]}},"/v1/requests/{requestId}":{"get":{"description":"**Allowed Scopes**: _`experimental:request:read`_\nReturns a single request by ID. Only card, purchase order, invoice, credit note, travel and claim requests are returned: `single_purchase`, `subscription`, `subscription_increase`, `multi_use_card`, `multi_use_card_top_up`, `multi_use_card_end_date_change`, `card_load`, `purchase_order`, `invoice`, `credit_note`, `travel_budget`, `travel_booking`, `expense`, `mileage_allowance` or `per_diem_allowance`. A `purchase_order` request returns 404 unless the token also holds the `experimental:purchase-order:read` scope, and an `invoice` or `credit_note` request unless it holds the `experimental:invoice:read` scope. A claim returns 404 unless the company has the claims feature enabled, and also when it is a draft, incomplete or paid.","operationId":"v1-get-request","parameters":[{"description":"Include the `approval` object on the returned request.","in":"query","name":"withApproval","required":false,"schema":{"default":true,"type":"boolean"}},{"description":"The ID of the request to retrieve.","in":"path","name":"requestId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"data":{"properties":{"amountToReimburse":{"description":"Only set on claims, in the company currency, as a monetary value whose `amount` is expressed at `precision` decimals. Null until it is set. Unlike `requestedAmount`, it does not use two implied decimals: read `precision` before comparing the two.","properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":["null","object"]},"appUrl":{"description":"Link to this request in the Spendesk web app.","example":"https://app.spendesk.com/app/RRbRgeIB7X/requests/all/SMK6R-5kr","type":"string"},"approval":{"description":"Approval chain for the request. Only present when `withApproval` is enabled. `steps` is ordered and holds only the approvers this request is actually waiting on, has been approved by, or was rejected by — it is empty when the request needed no approval (for example an auto-approved request).","properties":{"autoApprovalReason":{"description":"Reason the request was auto-approved. Null when it was not auto-approved.","type":["null","string"]},"isAutoApproved":{"description":"Whether the request bypassed the approval flow and was approved automatically.","type":"boolean"},"steps":{"items":{"properties":{"approvers":{"description":"Approvers for this step. Always holds at least one approver.","items":{"properties":{"actingUserId":{"description":"The delegate approving in place of `userId`. Null unless `isDelegated` is true.","type":["null","string"]},"isDelegated":{"type":"boolean"},"type":{"enum":["reportingManager","costCenterOwner","accountOwner","user"],"type":"string"},"userId":{"description":"The user the approval flow asks for.","type":"string"}},"required":["type","userId","actingUserId","isDelegated"],"type":"object"},"type":"array"},"decision":{"description":"The decision taken on this step. Null while the step is `current` or `upcoming`, and on a `notRequired` step.","properties":{"at":{"type":"string"},"byUserId":{"description":"The user who approved or rejected, which is the delegate on a delegated step.","type":"string"},"reason":{"description":"Reason given with the decision. Approvers are not asked for one when approving, so this is usually only set on a rejection.","type":["null","string"]}},"required":["byUserId","at","reason"],"type":["null","object"]},"state":{"description":"`current` is the step being waited on, `upcoming` comes after earlier steps approve, `approved`/`rejected` have been decided, `notRequired` was left undecided when the request closed (approved, refused, cancelled or expired).","enum":["approved","current","upcoming","rejected","notRequired"],"type":"string"}},"required":["state","approvers","decision"],"type":"object"},"type":"array"}},"required":["isAutoApproved","autoApprovalReason","steps"],"type":"object"},"cardLoadRequestData":{"properties":{"amount":{"type":"number"},"availableAfter":{"type":"number"},"availableBefore":{"type":"number"},"byUserId":{"type":"string"},"cardId":{"type":"string"},"companyId":{"type":"string"},"createdAt":{"type":"string"},"deletedAt":{"type":["null","string"]},"description":{"type":["null","string"]},"id":{"type":"string"},"organisationId":{"type":"string"},"requestId":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","companyId","organisationId","cardId","requestId","byUserId","amount","availableAfter","availableBefore","description","createdAt","updatedAt","deletedAt"],"type":["null","object"]},"companyId":{"type":"string"},"controllerReview":{"description":"Only set on claims. Latest review of a controller. Null until a controller reviews the claim.","properties":{"at":{"type":["null","string"]},"byUserId":{"type":"string"},"decision":{"enum":["validated","rejected"],"type":"string"},"reason":{"type":["null","string"]}},"required":["decision","byUserId","at","reason"],"type":["null","object"]},"costCentreId":{"type":["null","string"]},"createdAt":{"type":"string"},"creditNoteRequestData":{"description":"Only present on `credit_note` requests, which are returned only to tokens that also hold the `experimental:invoice:read` scope. Null when the credit note record is missing.","properties":{"creditNoteNumber":{"description":"Number the supplier gave the credit note.","type":"string"},"invoiceId":{"description":"Id of the credit note document, served with invoices, which differs from the request id.","type":"string"}},"required":["invoiceId","creditNoteNumber"],"type":["null","object"]},"currency":{"type":["null","string"]},"description":{"type":["null","string"]},"expenseCategory":{"description":"Only set on claims. The expense category the claim is coded to. Null when none is set. Its `id` is the one the `expenseCategoryId` filter matches.","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":["null","object"]},"expenseDate":{"description":"Only set on claims. YYYY-MM-DD, the date the employee says they paid the expense, which budgets and spend limits count as the date of the spend. Differs from `createdAt`, the day the claim was created.","type":["null","string"]},"hasReceipt":{"description":"Only set on `expense` requests: whether at least one receipt is attached. Null on `mileage_allowance` and `per_diem_allowance` requests, which have no receipt, and on other types.","type":["null","boolean"]},"id":{"type":"string"},"invoiceRequestData":{"description":"Only present on `invoice` requests, which are returned only to tokens that also hold the `experimental:invoice:read` scope. Null when the invoice record is missing.","properties":{"dueDate":{"description":"YYYY-MM-DD. Null when not captured yet.","type":["null","string"]},"invoiceId":{"description":"Id of the invoice document, which differs from the request id.","type":"string"},"invoiceNumber":{"description":"Number the supplier gave the invoice. Null when not captured yet.","type":["null","string"]}},"required":["invoiceId","invoiceNumber","dueDate"],"type":["null","object"]},"mileageAllowanceRequestData":{"description":"Only present on `mileage_allowance` requests.","properties":{"distance":{"description":"Distance of the journey, in `distanceUnit`, with 2 decimals at most.","type":"number"},"distanceUnit":{"enum":["km","mi"],"type":"string"}},"required":["distance","distanceUnit"],"type":["null","object"]},"multiUseCardEndDateChangeRequestData":{"properties":{"companyId":{"type":"string"},"id":{"type":"string"},"multiUseCardId":{"type":"string"},"newEndDate":{"type":"string"},"previousEndDate":{"type":"string"},"requestId":{"type":"string"}},"required":["id","companyId","multiUseCardId","newEndDate","previousEndDate","requestId"],"type":["null","object"]},"multiUseCardTopUpRequestData":{"properties":{"companyId":{"type":"string"},"id":{"type":"string"},"multiUseCardId":{"type":"string"},"previousAmount":{"type":"number"},"requestId":{"type":"string"}},"required":["id","companyId","multiUseCardId","previousAmount","requestId"],"type":["null","object"]},"perDiemAllowanceRequestData":{"description":"Only present on `per_diem_allowance` requests.","properties":{"days":{"description":"Number of days the allowance covers.","type":"number"},"mealsProvided":{"description":"Meals the employer provided, counted over the days of the trip, as the employee declared them: the number of days where each meal was provided.","properties":{"breakfast":{"type":"integer"},"dinner":{"type":"integer"},"lunch":{"type":"integer"}},"required":["breakfast","lunch","dinner"],"type":"object"}},"required":["days","mealsProvided"],"type":["null","object"]},"purchaseOrderRequestData":{"description":"Only present on `purchase_order` requests, which are returned only to tokens that also hold the `experimental:purchase-order:read` scope.","properties":{"endDate":{"description":"YYYY-MM-DD.","type":["null","string"]},"netAmount":{"description":"Amount net of taxes, in the currency of the request, as a monetary value whose `amount` is expressed at `precision` decimals. Unlike `requestedAmount`, it does not use two implied decimals: read `precision` before comparing the two.","properties":{"amount":{"description":"Amount in the smallest currency unit (e.g., cents for USD)","type":"number"},"currency":{"description":"ISO 4217 currency code (e.g., USD, EUR)","maxLength":3,"minLength":3,"pattern":"^[A-Z]{3}$","type":"string"},"precision":{"description":"Number of decimal places (e.g., 2 for USD)","type":"number"}},"required":["amount","currency","precision"],"type":["null","object"]},"purchaseOrderId":{"description":"The purchase order opened when the request was approved. Null while the request is not approved.","type":["null","string"]},"startDate":{"description":"YYYY-MM-DD.","type":["null","string"]}},"required":["purchaseOrderId","startDate","endDate","netAmount"],"type":"object"},"requestedAmount":{"description":"Amount declared on the request, in `currency`, as an integer with two implied decimals whatever the currency: 1250 is 12.50 EUR and 100000 is 1000 JPY. Divide by 100 to get major units. Null when the request has no amount. On a `subscription_increase` request, this is the new budget asked for the subscription, not the increase. On a `purchase_order` request, this is the amount of the purchase order asked for; `purchaseOrderRequestData.netAmount` is its net of taxes counterpart, in a different encoding. On an `invoice` request, this is the gross amount of the invoice. On a `credit_note` request, it is negative, as the credit note reduces what the company owes the supplier: a credit note may already have been deducted from an invoice or refunded outside Spendesk, so do not net it against invoice amounts. On a `travel_budget` request, this is the budget asked for the trip, not spend.","type":["null","number"]},"requesterId":{"type":["null","string"]},"state":{"type":"string"},"subscriptionIncreaseRequestData":{"description":"Only present on `subscription_increase` requests.","properties":{"subscriptionId":{"description":"The subscription whose budget the request increases.","type":"string"}},"required":["subscriptionId"],"type":["null","object"]},"supplierId":{"type":["null","string"]},"teamId":{"description":"Team the request is attributed to.","type":["null","string"]},"travelBookingRequestData":{"description":"Only present on `travel_booking` requests. Null when the travel booking record is missing.","properties":{"tripId":{"description":"Id of the trip on the travel service.","type":"string"}},"required":["tripId"],"type":["null","object"]},"travelBudgetRequestData":{"description":"Only present on `travel_budget` requests. Null when the travel budget record is missing.","properties":{"endDate":{"description":"Last day of the trip, YYYY-MM-DD.","type":"string"},"multiUseCardId":{"description":"Card issued for the trip. Null until the card is created.","type":["null","string"]},"startDate":{"description":"First day of the trip, YYYY-MM-DD.","type":"string"}},"required":["startDate","endDate","multiUseCardId"],"type":["null","object"]},"type":{"enum":["single_purchase","subscription","subscription_increase","multi_use_card","multi_use_card_top_up","multi_use_card_end_date_change","card_load","purchase_order","invoice","credit_note","travel_budget","travel_booking","expense","mileage_allowance","per_diem_allowance"],"type":"string"}},"required":["id","type","state","requesterId","requestedAmount","currency","supplierId","companyId","costCentreId","description","appUrl","createdAt"],"type":"object"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:request:read"]}],"summary":"Get a Request","tags":["Requests and transactions"],"x-roles":["controller","admin","accountOwner"]}},"/v1/settlements":{"get":{"description":"**Allowed Scopes**: _`settlement:read`_\n\nReturns settlements. For more information about settlements, see [this guide](/reference/how-to-use-spend-data). Settlements data are cached for up to 24 hours. A successful `PUT /v1/settlements/state` clears the cached settlement reads, so the next call is fresh; state changes from accounting exports or made in Spendesk can take up to 24 hours to appear.\n\nThis endpoint uses page-based pagination. Use `page` and `pageSize` to retrieve additional results. The maximum `pageSize` is 30. Continue fetching while `page * pageSize < meta.pagination.total`.\n\nTo filter by settlement status, use `state` (for example, `/v1/settlements?page=1&pageSize=30&state=created`).\n\nSettlements expose allocation links through `allocations[].payableId`. For accounting export use cases that require payable line amounts, retrieve the related payable and read `lineItems[].financial.netAmount`. Amounts are expressed in the smallest unit of the currency.\n\n### External IDs\n\nPass `include=externalIds` to embed, on each entry of `allocations[]`, the IDs that allocation has in external systems (ERPs), such as the ERP payment reference. It is opt-in because it costs an additional lookup; without it the field is absent. IDs are recorded per allocation, because settlements are exported per allocation. Only exported allocations carry an ID, and allocations exported before external IDs were recorded may have none. Some integrations record no settlement ID at all (Xero bank fees, QuickBooks settlements, native DATEV settlements and wallet loads), and Xero already-paid settlements carry the literal ID `unknown`. `source` reads `public_api` only for IDs written with provider `PublicApi`; an ID written through the API under another provider (e.g. pennylane) reads back as `native_integration`. `allocations[]` still holds at most one entry per `payableId` exactly as without `include`: the IDs of collapsed allocations are merged onto the entry that is kept, its amount is unchanged.\n\nPass `externalIds` (exploded, up to 50, exact match) to return only settlements with at least one allocation carrying one of those IDs, optionally restricted to one external system with `provider`. It is combined with every other filter using AND; an ID no settlement carries returns an empty page. External IDs are cached for up to 24 hours; a successful `POST /v1/experimental/external-references` clears them, IDs recorded by an accounting export can take that long to appear.","operationId":"v1-get-settlements","parameters":[{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"Page size","in":"query","name":"pageSize","required":false,"schema":{"default":30,"maximum":30,"minimum":1,"type":"integer"}},{"description":"The date and time the settlement first got exported to accounting, with timezone offset (use `Z` for UTC).","in":"query","name":"exportedAfter","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/dateTime"}]}},{"description":"The date and time before which the settlement was first exported to accounting, with timezone offset (use `Z` for UTC).","in":"query","name":"exportedBefore","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/dateTime"}]}},{"description":"Payment account used for the settlement. Card settlements are always `spendeskAccount`; `externalAccount` matches only wire transfers emitted from an external bank account.","in":"query","name":"paidFrom","required":false,"schema":{"items":{"enum":["externalAccount","spendeskAccount"],"type":"string"},"type":"array"}},{"description":"An array of settlement IDs, exploded `(ids=1&ids=2)`.","in":"query","name":"ids","required":false,"schema":{"items":{"$ref":"#/components/schemas/settlement/properties/id"},"minItems":1,"type":"array","uniqueItems":true}},{"in":"query","name":"state","required":false,"schema":{"items":{"allOf":[{"$ref":"#/components/schemas/settlement/properties/state"}],"description":"Status of settlements to filter by."},"type":"array"}},{"description":"Filter settlements by type.","in":"query","name":"types","required":false,"schema":{"items":{"$ref":"#/components/schemas/settlement/properties/type"},"type":"array"}},{"in":"query","name":"clearedFrom","required":false,"schema":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/date"}],"description":"Start date of the requested period. String containing a date expressed in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format like `2023-05-12`."},{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"Start date of the requested period. String containing a UTC datetime expressed in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format like `2023-05-12T14:06:40Z`."}]}},{"in":"query","name":"clearedTo","required":false,"schema":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/date"}],"description":"End date of the requested period. String containing a date expressed in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format like `2023-05-12`."},{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"description":"End date of the requested period. String containing a UTC datetime expressed in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format like `2023-05-12T14:06:40Z`."}]}},{"description":"The ID of the supplier to filter settlements by.","in":"query","name":"supplierId","required":false,"schema":{"type":"string"}},{"description":"Filter settlements by transaction description.","in":"query","name":"transactionDescription","required":false,"schema":{"type":"string"}},{"description":"Return only settlements with at least one allocation carrying one of these IDs in an external system (ERP), exact match, exploded `(externalIds=A&externalIds=B)`. Resolved against the external-reference registry, so settlements without an exported allocation ID are excluded. Combined with every other filter, including `ids`, using AND. From 1 to 50 per request. Rejected with a 400 when the IDs match more than 100 settlements before the other filters apply; narrow with `provider`, `ids` or more specific IDs (date and state filters do not reduce that count). The placeholder values `unknown` and `invoiceAlreadyPaid` are rejected with a 400.","in":"query","name":"externalIds","required":false,"schema":{"items":{"minLength":1,"type":"string"},"maxItems":50,"minItems":1,"type":"array"}},{"description":"Restrict the `externalIds` filter to one external system (e.g. Netsuite, pennylane). Ignored without that filter, and it does not narrow the `externalIds` include, which returns the IDs from every system (read `provider` on each entry).","in":"query","name":"provider","required":false,"schema":{"minLength":1,"type":"string"}},{"description":"Extra data to embed in the response. `externalIds` adds `allocations[].externalIds` and costs one additional lookup per request, so it is opt-in.","in":"query","name":"include","required":false,"schema":{"items":{"enum":["externalIds"],"type":"string"},"type":"array"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"description":"Settlements list","items":{"$ref":"#/components/schemas/settlement"},"type":"array"},"meta":{"$ref":"#/components/schemas/meta"}},"required":["data","meta"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["settlement:read"]}],"summary":"Get Settlements","tags":["Settlements and wallet"],"x-roles":["controller","admin","accountOwner"]}},"/v1/settlements/state":{"put":{"description":"**Allowed Scopes**: _`experimental:accounting:update`_\n\nMark multiple settlements as manually exported after their accounting entries were created outside Spendesk.","operationId":"v1-put-settlements-state","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"settlements":{"description":"Settlements to update","example":{"settlements":[{"id":"d7b2b353-abcd-4199-ace4-708f28e13ab3","state":"exported","version":1}]},"items":{"additionalProperties":false,"properties":{"id":{"description":"The ID of the settlement to update","example":"bc9cef35-401d-4ea4-b384-ed725e6685cf","minLength":1,"type":"string"},"state":{"description":"The new state to set for the settlement","enum":["exported"],"example":"exported","type":"string"},"version":{"description":"The current version of the settlement","example":1,"type":"number"}},"required":["id","version","state"],"type":"object"},"maxItems":50,"minItems":1,"type":"array"}},"required":["settlements"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/bulkUpdateSettlementsStateFullSuccess"}}},"description":"Default Response"},"207":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/bulkUpdateSettlementsStatePartialSuccess"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:accounting:update"]}],"summary":"Update settlements state","tags":["Settlements and wallet"],"x-roles":["controller","admin","accountOwner"]}},"/v1/snapshots/payables":{"post":{"description":"**Allowed Scopes**: _`payable:read`_\n\nRequest an extract (snapshot) of expenses to be created.\n\nA request to create a snapshot of expenses according to the filters provided will be queued, where a key (of format UUID) will be returned immediately, it being a reference to your request.\n\nThis key can be used to check for the status of this request using the [GET Snapshot Payable](/reference/v1-get-snapshot-payables) API call. Once its status is \"COMPLETE\", the list of payables is returned under the \"result.data\" element of the response.\n\nRequesting snapshots should be done sequentially and cannot be done simultaneously (in parallel). Requesting a new snapshot with exactly the same parameters, as the same user, will return the same key as long as the snapshot exists. Snapshots are typically cached for 10 hours; a completed snapshot that is about to expire is rebuilt under the same key instead of being returned.\n\nThese two APIs ([POST](/reference/v1-create-snapshot-payables) and [GET](/reference/v1-get-snapshot-payables)) are implemented based on the [asynchronous request-response pattern](https://learn.microsoft.com/en-us/azure/architecture/patterns/async-request-reply), decoupling long-running backend jobs from the synchronous nature of REST APIs.\n\nFor more information about payables, see this [guide](/reference/how-to-use-spend-data).","operationId":"v1-create-snapshot-payables","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/payableQuery"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"expireInSeconds":{"description":"The total number of seconds the snapshot of payables is available for.","type":"number"},"key":{"description":"The key that can be used to query the [Get Snapshot Payable](/reference/v1-get-snapshot-payables) endpoint.","format":"uuid","type":"string"},"query":{"$ref":"#/components/schemas/payableQuery"},"remainingSeconds":{"description":"Remaining time to live of the snapshot. Typically 10 hours.","nullable":true,"type":"number"}},"required":["query","key","expireInSeconds"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["payable:read"]}],"summary":"Create a snapshot of payables","tags":["Payables"],"x-roles":["controller","admin","accountOwner"]}},"/v1/snapshots/payables/{key}":{"get":{"description":"**Allowed Scopes**: _`payable:read`_\n\nReturns an extract (snapshot) of payables requested via the [POST API](/reference/v1-create-snapshot-payables). Requires the returned key as a parameter.\n\nDue to its asynchronous nature, we recommend to poll this endpoint ideally after 1 hour, or alternatively every 5 minutes until status is \"COMPLETE\" or \"ERROR\".\n\nThe list of expenses is returned under \"result.data\" when its status is \"COMPLETE\". The response is paginated (30 payables per page), where the current page number is returned under \"result.meta.pagination\". Snapshots are typically cached for 10 hours.\n\nThese two APIs ([POST](/reference/v1-create-snapshot-payables) and [GET](/reference/v1-get-snapshot-payables)) are implemented based on the [asynchronous request-response pattern](https://learn.microsoft.com/en-us/azure/architecture/patterns/async-request-reply), decoupling long-running backend jobs from the synchronous nature of REST APIs.\n\nFor more information about payables, see this [guide](/reference/how-to-use-spend-data).","operationId":"v1-get-snapshot-payables","parameters":[{"in":"query","name":"page","required":false,"schema":{"$ref":"#/components/schemas/paginationQuery/properties/page"}},{"description":"Key received from the response of [Create a Snapshot of Payables](/reference/v1-create-snapshot-payables).","in":"path","name":"key","required":true,"schema":{"format":"uuid","type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"The snapshot status. Once the status is `COMPLETE`, `result.data` holds the requested page of payables.","properties":{"associated":{"additionalProperties":false,"properties":{"companyId":{"description":"The ID of the company for which payables were requested for.","type":"string"},"correlationId":{"description":"ID of the original request.","type":"string"},"userId":{"description":"The user ID that requested the snapshot.","type":"string"}},"required":["companyId","userId","correlationId"],"type":"object"},"query":{"$ref":"#/components/schemas/payableQuery"},"remainingSeconds":{"description":"Remaining time to live of the snapshot.","type":"number"},"result":{"properties":{"data":{"description":"The array of payables","items":{"$ref":"#/components/schemas/payable"},"type":"array"},"meta":{"$ref":"#/components/schemas/meta"}},"type":"object"},"status":{"description":"The current status of the snapshot preparation. In case `ERROR` is returned, the request should be retried.","enum":["IN_PROGRESS","ERROR","COMPLETE"],"type":"string"}},"required":["query","result","associated","status"],"type":"object"}}},"description":"The snapshot status. Once the status is `COMPLETE`, `result.data` holds the requested page of payables."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["payable:read"]}],"summary":"Get a snapshot of payables","tags":["Payables"],"x-roles":["controller","admin","accountOwner"]}},"/v1/suppliers":{"get":{"description":"**Allowed Scopes**: _`supplier:read`_\n\nReturns suppliers existing in the Spendesk entity (company). Supplier data is cached for up to 24 hours; supplier account data (used for `accountPayable`) is cached for up to 20 minutes. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear.\n\nPass `include=externalIds` to embed the IDs each supplier has in external systems (ERPs). It is opt-in because it costs one additional lookup per request.\n\nFilter with `externalIds` to return only the suppliers carrying given external IDs, optionally narrowed to one `provider`. Suppliers with no matching mapping are excluded, so an external ID that matches nothing yields an empty page rather than every supplier.","operationId":"v1-get-suppliers","parameters":[{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"Page size","in":"query","name":"pageSize","required":false,"schema":{"default":30,"maximum":30,"minimum":1,"type":"integer"}},{"description":"Supplier IDs to filter by.","in":"query","name":"ids","required":false,"schema":{"items":{"type":"string"},"type":"array"}},{"description":"Free-text supplier search, for example by supplier name.","in":"query","name":"search","required":false,"schema":{"type":"string"}},{"in":"query","name":"updatedBefore","required":false,"schema":{"$ref":"#/components/schemas/dateTime"}},{"in":"query","name":"updatedAfter","required":false,"schema":{"$ref":"#/components/schemas/dateTime"}},{"in":"query","name":"createdBefore","required":false,"schema":{"$ref":"#/components/schemas/dateTime"}},{"in":"query","name":"createdAfter","required":false,"schema":{"$ref":"#/components/schemas/dateTime"}},{"description":"ISO alpha-2 code of the bank country","in":"query","name":"bankCountry","required":false,"schema":{"pattern":"^[A-Z]{2}$","type":"string"}},{"description":"Supplier IBAN","in":"query","name":"iban","required":false,"schema":{"type":"string"}},{"description":"Supplier VAT number","in":"query","name":"vatNumber","required":false,"schema":{"type":"string"}},{"description":"Selects one archive state and is not additive: true returns ONLY archived suppliers, false ONLY active ones. Omit it to get both — every row carries isArchived.","in":"query","name":"isArchived","required":false,"schema":{"enum":["true","false"],"type":"string"}},{"description":"Return only suppliers carrying one of these IDs in an external system (ERP), exact match, exploded `(externalIds=A&externalIds=B)`. Resolved against the external-reference registry, so unmapped suppliers are excluded. Up to 50 per request.","in":"query","name":"externalIds","required":false,"schema":{"items":{"type":"string"},"maxItems":50,"type":"array"}},{"description":"Restrict the `externalIds` filter to one external system (e.g. Netsuite, Xero). Worth setting when a company has been connected to more than one ERP, since the same external ID string can exist in each. Ignored without that filter, and it does not narrow the `externalIds` include, which returns the IDs from every system (read `provider` on each entry).","in":"query","name":"provider","required":false,"schema":{"minLength":1,"type":"string"}},{"description":"Extra data to embed in the response. `externalIds` costs one additional lookup per request, so it is opt-in.","in":"query","name":"include","required":false,"schema":{"items":{"enum":["externalIds"],"type":"string"},"type":"array"}},{"description":"Field to sort suppliers by.","in":"query","name":"sortBy","required":false,"schema":{"enum":["name","created_at","updated_at"],"type":"string"}},{"description":"Sort direction.","in":"query","name":"sort","required":false,"schema":{"enum":["asc","desc"],"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/supplierResponse"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["supplier:read"]}],"summary":"Get Suppliers","tags":["Suppliers"],"x-roles":["controller","admin","accountOwner"]},"patch":{"description":"**Allowed Scopes**: _`experimental:supplier:manage`_\n\nUpdate multiple suppliers. Accepts an array of supplier update objects (minimum 2 items), each containing an id field. For a single supplier use PATCH /v1/suppliers/:id.","operationId":"v1-update-suppliers","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"description":"Array of suppliers to update (minimum 2 items).","items":{"$ref":"#/components/schemas/supplierToUpdateBulk"},"maxItems":100,"minItems":2,"type":"array"}}},"description":"Array of suppliers to update (minimum 2 items).","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/bulkUpdateSuppliersResponse"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:supplier:manage"]}],"summary":"Update Suppliers","tags":["Suppliers"],"x-roles":["controller","admin","accountOwner"]},"post":{"description":"**Allowed Scopes**: _`experimental:supplier:manage`_\n\nCreate one or multiple suppliers. Send an array of 1 to 100 supplier objects; a single object outside an array is rejected with a 400. A one-item array returns `item`; two or more return `items`. A one-item array whose supplier name is already used in the company returns a 409; names are compared case- and accent-insensitively.","operationId":"v1-create-suppliers","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"description":"Array of suppliers to create (minimum 1 item).","items":{"$ref":"#/components/schemas/supplierToCreate"},"maxItems":100,"minItems":1,"type":"array"}}},"description":"Array of suppliers to create (minimum 1 item).","required":true},"responses":{"201":{"content":{"application/json":{"schema":{"oneOf":[{"additionalProperties":false,"properties":{"item":{"$ref":"#/components/schemas/supplierInfoBase"}},"required":["item"],"type":"object"},{"$ref":"#/components/schemas/bulkCreateSuppliersResponse"}]}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:supplier:manage"]}],"summary":"Create Supplier(s)","tags":["Suppliers"],"x-roles":["controller","admin","accountOwner"]}},"/v1/suppliers/{id}":{"get":{"description":"**Allowed Scopes**: _`supplier:read`_\n\nRetrieves a single supplier by its ID. Supplier data is cached for up to 24 hours; supplier account data (used for `accountPayable`) is cached for up to 20 minutes. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear.\n\nPass `include=externalIds` to embed the IDs this supplier has in external systems (ERPs). It is opt-in because it costs an additional lookup.","operationId":"v1-get-supplier-by-id","parameters":[{"description":"Extra data to embed in the response.","in":"query","name":"include","required":false,"schema":{"items":{"enum":["externalIds"],"type":"string"},"type":"array"}},{"description":"ID of the supplier to retrieve.","in":"path","name":"id","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/supplier"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["supplier:read"]}],"summary":"Get Supplier By Id","tags":["Suppliers"],"x-roles":["controller","admin","accountOwner"]},"patch":{"description":"**Allowed Scopes**: _`experimental:supplier:manage`_\n\nUpdate a single supplier by ID. Renaming a supplier to a name already used in the company returns a 409; names are compared case- and accent-insensitively.","operationId":"v1-update-supplier","parameters":[{"description":"ID of the supplier to update.","in":"path","name":"id","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/supplierToUpdateSingle"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"item":{"$ref":"#/components/schemas/supplierInfoBase"}},"required":["item"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbiddenControllerRoleRequired"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:supplier:manage"]}],"summary":"Update Supplier","tags":["Suppliers"],"x-roles":["controller","admin","accountOwner"]}},"/v1/transactions":{"get":{"deprecated":true,"description":"**Allowed Scopes**: _`experimental:transaction:read`_\nDeprecated compatibility endpoint. Prefer `GET /v1/transactions/successful` and `GET /v1/transactions/failed`, which have distinct, more accurate response shapes.\nReturns card transactions for the authenticated company. Use `status=failed` to retrieve declined transactions (last 30 days when `startDate` is omitted, even when `endDate` is set, so an `endDate` older than 30 days alone returns nothing — pass `startDate` to reach further back, there is no hard window; no pagination). Use `status=successful` to retrieve settled transactions with pagination. Omit `status` to retrieve both; `meta.pagination` reflects successful transactions only and is `null` when only failed transactions are returned.","operationId":"v1-get-transactions","parameters":[{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"Page size","in":"query","name":"pageSize","required":false,"schema":{"default":30,"maximum":30,"minimum":1,"type":"integer"}},{"description":"Filter by transaction status.","in":"query","name":"status","required":false,"schema":{"enum":["failed","successful"],"type":"string"}},{"description":"Return transactions on or after this date (YYYY-MM-DD).","in":"query","name":"startDate","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"Return transactions on or before this date (YYYY-MM-DD).","in":"query","name":"endDate","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"Filter by user ID.","in":"query","name":"userId","required":false,"schema":{"type":"string"}},{"description":"Filter by card ID.","in":"query","name":"cardId","required":false,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"data":{"description":"List of transactions","items":{"description":"Money fields are integers in the smallest unit of their currency (cents for EUR, yen for JPY): amountDeclared is in currencyDeclared; amountBilled, fxFeeAmount and cardBalanceAtTransaction are in currencyBilled.","properties":{"amountBilled":{"type":"number"},"amountDeclared":{"type":"number"},"cardBalanceAtTransaction":{"type":["null","number"]},"cardId":{"type":["null","string"]},"createdAt":{"type":"string"},"currencyBilled":{"type":"string"},"currencyDeclared":{"type":"string"},"fxFeeAmount":{"type":"number"},"id":{"type":"string"},"merchantName":{"type":["null","string"]},"reasonCode":{"type":["null","string"]},"requestId":{"type":["null","string"]},"status":{"enum":["failed","successful"],"type":"string"},"supplier":{"properties":{"name":{"type":"string"},"url":{"type":["null","string"]}},"required":["name"],"type":["null","object"]},"user":{"properties":{"avatar":{"type":["null","string"]},"fullName":{"type":"string"},"id":{"type":"string"}},"required":["id","fullName","avatar"],"type":["null","object"]}},"required":["id","status","amountBilled","amountDeclared","cardId","createdAt","currencyBilled","currencyDeclared","fxFeeAmount","merchantName"],"type":"object"},"type":"array"},"meta":{"oneOf":[{"$ref":"#/components/schemas/meta"},{"type":"null"}]}},"required":["meta","data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:transaction:read"]}],"summary":"Get Transactions (Deprecated)","tags":["Requests and transactions"],"x-roles":["controller","admin","accountOwner"]}},"/v1/transactions/failed":{"get":{"description":"**Allowed Scopes**: _`experimental:transaction:read`_\nReturns declined card transactions for the authenticated company, covering the last 30 days when `startDate` is omitted (even when `endDate` is set — an `endDate` older than 30 days without `startDate` returns nothing) — pass `startDate` to reach further back; there is no hard window. Not paginated: the full matching result set is returned in one call. For settled transactions, use `GET /v1/transactions/successful` instead; for a complete view across both statuses in a period, call both endpoints and merge the results. `merchantName` here is the raw card-network transaction descriptor — it is not directly comparable to `merchantName` on successful transactions, which is derived from the linked supplier instead. `createdAt` reflects when the declined transaction was recorded — unlike on successful transactions, where `createdAt` reflects the settlement date rather than authorization time. CURRENCY WARNING: `amountBilled` is in `currencyBilled`, the currency of the card the payment was attempted on; `amountDeclared` is in `currencyDeclared`, the transaction's own spending currency, which varies per record — avoid summing amounts across records with different currencies.","operationId":"v1-get-failed-transactions","parameters":[{"description":"Return transactions on or after this date (YYYY-MM-DD).","in":"query","name":"startDate","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"Return transactions on or before this date (YYYY-MM-DD), inclusive of the full day.","in":"query","name":"endDate","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"Filter by user ID.","in":"query","name":"userId","required":false,"schema":{"type":"string"}},{"description":"Filter by card ID.","in":"query","name":"cardId","required":false,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"data":{"description":"List of failed transactions","items":{"description":"Money fields are integers in the smallest unit of their currency (cents for EUR, yen for JPY): amountDeclared is in currencyDeclared; amountBilled, fxFeeAmount and cardBalanceAtTransaction are in currencyBilled.","properties":{"amountBilled":{"description":"In currencyBilled, the currency of the card the payment was attempted on, not the transaction's own spending currency (that is currencyDeclared).","type":"number"},"amountDeclared":{"description":"In the transaction's own declared currency (currencyDeclared), not necessarily the company's functional currency.","type":"number"},"cardBalanceAtTransaction":{"type":["null","number"]},"cardId":{"type":"string"},"createdAt":{"description":"When the declined transaction was recorded.","type":"string"},"currencyBilled":{"type":"string"},"currencyDeclared":{"type":"string"},"fxFeeAmount":{"type":"number"},"id":{"type":"string"},"merchantName":{"description":"The raw card-network transaction descriptor — not directly comparable to merchantName on successful transactions, which is derived from the linked supplier instead.","type":["null","string"]},"reason":{"type":"string"},"reasonCode":{"type":"string"},"remediation":{"type":"string"},"requestId":{"type":["null","string"]},"status":{"enum":["failed"],"type":"string"},"supplier":{"properties":{"name":{"type":"string"},"url":{"type":["null","string"]}},"required":["name"],"type":["null","object"]},"user":{"properties":{"avatar":{"type":["null","string"]},"fullName":{"type":"string"},"id":{"type":"string"}},"required":["id","fullName","avatar"],"type":"object"}},"required":["id","status","amountBilled","amountDeclared","cardId","createdAt","currencyBilled","currencyDeclared","fxFeeAmount","merchantName","reasonCode","reason","remediation","requestId","user"],"type":"object"},"type":"array"},"meta":{"type":"null"}},"required":["meta","data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:transaction:read"]}],"summary":"Get Failed Transactions","tags":["Requests and transactions"],"x-roles":["controller","admin","accountOwner"]}},"/v1/transactions/successful":{"get":{"description":"**Allowed Scopes**: _`experimental:transaction:read`_\nReturns successful (settled) card transactions for the authenticated company, with pagination. For declined transactions, use `GET /v1/transactions/failed` instead; for a complete view across both statuses in a period, call both endpoints and merge the results. `merchantName` here is derived from the linked supplier's name, not a raw card-network descriptor — it is not directly comparable to `merchantName` on failed transactions. `createdAt` is the settlement (paid) date, or the payment's creation date when it has no settlement date. `startDate`/`endDate` filter on the settlement date only, so settled payments without a settlement date are excluded from date-filtered results (they are returned only when no date filter is set) — a date-filtered list can undercount a period. CURRENCY WARNING: `amountBilled` and `fxFeeAmount` are in `currencyBilled`, the company's Spendesk account currency — identical on every record, so they can be totalled; `amountDeclared` is in `currencyDeclared`, the merchant's spending currency, which varies per record — avoid summing it across records with different currencies.","operationId":"v1-get-successful-transactions","parameters":[{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"Page size","in":"query","name":"pageSize","required":false,"schema":{"default":30,"maximum":30,"minimum":1,"type":"integer"}},{"description":"Return transactions on or after this date (YYYY-MM-DD). Filters on the payment settlement date (returned as createdAt).","in":"query","name":"startDate","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"Return transactions on or before this date (YYYY-MM-DD), inclusive of the full day. Filters on the payment settlement date (returned as createdAt).","in":"query","name":"endDate","required":false,"schema":{"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"description":"Filter by user ID.","in":"query","name":"userId","required":false,"schema":{"type":"string"}},{"description":"Filter by card ID.","in":"query","name":"cardId","required":false,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"data":{"description":"List of successful transactions","items":{"description":"Money fields are integers in the smallest unit of their currency (cents for EUR, yen for JPY): amountDeclared is in currencyDeclared; amountBilled and fxFeeAmount are in currencyBilled.","properties":{"amountBilled":{"description":"In currencyBilled, the company's Spendesk account currency — the same on every record (normally but not always the functional currency).","type":"number"},"amountDeclared":{"description":"In the transaction's own declared currency (currencyDeclared), not necessarily the company's functional currency.","type":"number"},"cardId":{"type":["null","string"]},"createdAt":{"description":"The settlement (paid) date, or the payment's creation date when it has no settlement date.","type":"string"},"currencyBilled":{"type":"string"},"currencyDeclared":{"type":"string"},"fxFeeAmount":{"type":"number"},"id":{"type":"string"},"merchantName":{"description":"Derived from the linked supplier's name, not a raw card-network descriptor — not directly comparable to merchantName on failed transactions.","type":["null","string"]},"status":{"enum":["successful"],"type":"string"},"supplier":{"properties":{"name":{"type":"string"},"url":{"type":["null","string"]}},"required":["name"],"type":["null","object"]}},"required":["id","status","amountBilled","amountDeclared","cardId","createdAt","currencyBilled","currencyDeclared","fxFeeAmount","merchantName"],"type":"object"},"type":"array"},"meta":{"$ref":"#/components/schemas/meta"}},"required":["meta","data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:transaction:read"]}],"summary":"Get Successful Transactions","tags":["Requests and transactions"],"x-roles":["controller","admin","accountOwner"]}},"/v1/users":{"get":{"description":"**Allowed Scopes**: _`user:read`_\n\nReturns members (users) of the Spendesk entity (company). User data is cached for up to 20 minutes. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 20 minutes to appear.","operationId":"v1-get-users","parameters":[{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"Page size","in":"query","name":"pageSize","required":false,"schema":{"default":30,"maximum":30,"minimum":1,"type":"integer"}},{"description":"User IDs to filter by.","in":"query","name":"ids","required":false,"schema":{"items":{"type":"string"},"type":"array"}},{"description":"The user status to filter for.","in":"query","name":"status","required":false,"schema":{"default":"active","enum":["active","archived","pending"],"type":"string"}},{"description":"Extra related data to embed on each user. Each value costs one additional lookup per request, so it is opt-in. Repeat the parameter for multiple values (e.g. `include=manager&include=teams`).","in":"query","name":"include","required":false,"schema":{"items":{"enum":["manager","costCenter","teams","spendingPolicy"],"type":"string"},"type":"array"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"data":{"description":"List of users matching the given criteria.","items":{"$ref":"#/components/schemas/user"},"type":"array"},"meta":{"$ref":"#/components/schemas/meta"}},"required":["meta","data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["user:read"]}],"summary":"Get Users","tags":["Users"],"x-roles":["controller","admin","accountOwner"]}},"/v1/users/{id}":{"get":{"description":"**Allowed Scopes**: _`user:read`_\n\nRetrieves a member (user) by its ID. User data is cached for up to 20 minutes. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 20 minutes to appear.","operationId":"v1-get-user-by-id","parameters":[{"description":"Extra related data to embed on the user. Each value costs one additional lookup per request, so it is opt-in. Repeat the parameter for multiple values (e.g. `include=manager&include=teams`).","in":"query","name":"include","required":false,"schema":{"items":{"enum":["manager","costCenter","teams","spendingPolicy"],"type":"string"},"type":"array"}},{"description":"ID of the user to retrieve.","in":"path","name":"id","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/user"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["user:read"]}],"summary":"Get User By Id","tags":["Users"],"x-roles":["controller","admin","accountOwner"]}},"/v1/wallet-loads":{"get":{"description":"**Allowed Scopes**: _`wallet-load:read`_\n\nReturns wallet loads of the Spendesk entity (company), either via wiretransfers to Spendesk or via card payments. On GBP wallets `page` is ignored: while `meta.pagination.hasNextPage` is true, follow `meta.pagination.nextUrl` (or send `meta.pagination.nextCursor` as `cursor` with the same `from` and `to`) to get the next page. There, `meta.pagination.total` counts only the rows on the current page, so stop on `hasNextPage`, not on `total`. Wallet loads data are cached for up to 24 hours. Changes, including those made through the API, can take up to 24 hours to appear.","operationId":"v1-get-wallet-loads","parameters":[{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"Page size","in":"query","name":"pageSize","required":false,"schema":{"default":30,"maximum":30,"minimum":1,"type":"integer"}},{"description":"Start date of the requested period, with timezone offset (`Z` for UTC).","in":"query","name":"from","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/dateTime"}]}},{"description":"End date of the requested period, with timezone offset (`Z` for UTC).","in":"query","name":"to","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/dateTime"}]}},{"description":"GBP wallets only: `meta.pagination.nextCursor` from the previous page.","in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"description":"Wallet loads list","items":{"$ref":"#/components/schemas/walletLoad"},"type":"array"},"meta":{"description":"Meta object describing pagination","properties":{"pagination":{"allOf":[{"$ref":"#/components/schemas/pagination"}],"properties":{"hasNextPage":{"type":"boolean"},"nextCursor":{"nullable":true,"type":"string"},"nextUrl":{"nullable":true,"type":"string"}},"type":"object","unevaluatedProperties":false}},"required":["pagination"],"type":"object"}},"required":["meta","data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["wallet-load:read"]}],"summary":"Get Wallet Loads","tags":["Settlements and wallet"],"x-roles":["controller","admin","accountOwner"]}},"/v1/wallet-summary":{"get":{"description":"**Allowed Scopes**: _`wallet-summary:read`_\n\nReturn the details of the wallet (Spendesk entity), such as company name, remaining amounts, etc. Wallet summary data is cached for up to 20 minutes. Changes, including those made through the API, can take up to 20 minutes to appear.","operationId":"v1-get-wallet-summary","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/walletSummary"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["wallet-summary:read"]}],"summary":"Get Wallet Summary","tags":["Settlements and wallet"],"x-roles":["controller","admin","accountOwner"]}},"/v2/analytical-fields":{"get":{"description":"**Allowed Scopes**: _`experimental:analytical-field-v2:read`_\n\nReturns analytical fields for the company, excluding the expense categories field. Analytical fields data are cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear.","operationId":"v2-list-analytical-fields","parameters":[{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"Page size","in":"query","name":"pageSize","required":false,"schema":{"default":30,"maximum":30,"minimum":1,"type":"integer"}},{"description":"Field IDs to filter by.","in":"query","name":"ids","required":false,"schema":{"items":{"examples":["x__8qsgm86n71g"],"type":"string"},"type":"array"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"description":"Analytical fields list.","items":{"$ref":"#/components/schemas/analyticalFieldV2"},"type":"array"},"meta":{"$ref":"#/components/schemas/meta"}},"required":["meta","data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:analytical-field-v2:read"]}],"summary":"List Analytical Fields","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]},"post":{"description":"**Allowed Scopes**: _`experimental:analytical-field-v2:write`_\n\nCreates an analytical field for the company. Returns 409 if the company has reached the maximum number of analytical fields.","operationId":"v2-create-analytical-field","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"isRequired":{"description":"Whether the field is mandatory. Defaults to false.","type":"boolean"},"isSplittable":{"description":"Whether the field is splittable. Defaults to false.","type":"boolean"},"name":{"description":"The analytical field name.","maxLength":255,"minLength":1,"type":"string"}},"required":["name"],"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/analyticalFieldV2"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:analytical-field-v2:write"]}],"summary":"Create Analytical Field","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]}},"/v2/analytical-fields/{fieldId}":{"delete":{"description":"**Allowed Scopes**: _`experimental:analytical-field-v2:write`_\n\nArchives an analytical field by ID: it stays listed with archivedAt set, its values are not archived with it, and later writes or deletes on it return 404. Returns 404 if the field does not exist or if the ID belongs to the expense categories field.","operationId":"v2-delete-analytical-field","parameters":[{"description":"Analytical field ID.","example":"x__8qsgm86n71g","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"204":{"content":{"application/json":{"schema":{}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:analytical-field-v2:write"]}],"summary":"Delete Analytical Field","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]},"get":{"description":"**Allowed Scopes**: _`experimental:analytical-field-v2:read`_\n\nReturns a single analytical field by ID. Returns 404 if the field does not exist or if the ID belongs to the expense categories field. Analytical field data is cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear.","operationId":"v2-get-analytical-field","parameters":[{"description":"Analytical field ID.","example":"x__8qsgm86n71g","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/analyticalFieldV2"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:analytical-field-v2:read"]}],"summary":"Get Analytical Field","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]},"patch":{"description":"**Allowed Scopes**: _`experimental:analytical-field-v2:write`_\n\nPartially updates an analytical field. Returns 404 if the field does not exist or if the ID belongs to the expense categories field.","operationId":"v2-update-analytical-field","parameters":[{"description":"Analytical field ID.","example":"x__8qsgm86n71g","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"isRequired":{"description":"Whether the field is mandatory.","type":"boolean"},"isSplittable":{"description":"Whether the field is splittable.","type":"boolean"},"name":{"description":"The analytical field name.","maxLength":255,"minLength":1,"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/analyticalFieldV2"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:analytical-field-v2:write"]}],"summary":"Update Analytical Field","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]}},"/v2/analytical-fields/{fieldId}/values":{"get":{"description":"**Allowed Scopes**: _`experimental:analytical-field-v2:read`_\n\nReturns values for an analytical field, using forward-only cursor pagination. Returns 404 if the field does not exist or if the ID belongs to the expense categories field. Values are cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear. Archived values are included by default.","operationId":"v2-list-analytical-field-values","parameters":[{"description":"Maximum number of values to return.","in":"query","name":"limit","required":false,"schema":{"default":30,"maximum":1000,"minimum":1,"type":"integer"}},{"description":"Opaque pagination cursor returned as `meta.pagination.nextCursor` by a previous call. Omit to fetch the first page.","in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"description":"Analytical field ID.","example":"x__8qsgm86n71g","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"Analytical field values list.","properties":{"data":{"description":"A page of analytical field values.","items":{"$ref":"#/components/schemas/analyticalFieldV2Value"},"type":"array"},"meta":{"$ref":"#/components/schemas/analyticalFieldV2ValuesMeta"}},"required":["data","meta"],"type":"object"}}},"description":"Analytical field values list."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:analytical-field-v2:read"]}],"summary":"List Analytical Field Values","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]},"post":{"description":"**Allowed Scopes**: _`experimental:analytical-field-v2:write`_\n\nCreates a value for an analytical field. Returns 404 if the field does not exist. Returns 409 if a value with the same name already exists on the field.\n\nDo not use on a yes/no field (`type` `boolean`): its values are fixed to `1` (yes) and `0` (no), and exports print Yes only for the value labelled `1`, so an added value exports as No. The call is not refused yet.","operationId":"v2-create-analytical-field-value","parameters":[{"description":"Analytical field ID.","example":"x__8qsgm86n71g","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"value":{"description":"The value label.","maxLength":255,"minLength":1,"type":"string"}},"required":["value"],"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/analyticalFieldV2Value"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:analytical-field-v2:write"]}],"summary":"Create Analytical Field Value","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]}},"/v2/analytical-fields/{fieldId}/values/{valueId}":{"delete":{"description":"**Allowed Scopes**: _`experimental:analytical-field-v2:write`_\n\nArchives a value of an analytical field by ID: it stays listed with archivedAt set, and later writes or deletes on it return 404. Returns 404 if the field or the value does not exist.\n\nDo not use on a yes/no field (`type` `boolean`): its values are fixed to `1` (yes) and `0` (no) and must not be archived. The call is not refused yet.","operationId":"v2-delete-analytical-field-value","parameters":[{"description":"Analytical field ID.","example":"x__8qsgm86n71g","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"Analytical field value ID.","example":"x__k3jd81ndos5","in":"path","name":"valueId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"204":{"content":{"application/json":{"schema":{}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:analytical-field-v2:write"]}],"summary":"Delete Analytical Field Value","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]},"get":{"description":"**Allowed Scopes**: _`experimental:analytical-field-v2:read`_\n\nReturns a single analytical field value by ID. Returns 404 if the field does not exist, or if the value does not exist or does not belong to the given field. Value data is cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear. Archived values are included.","operationId":"v2-get-analytical-field-value","parameters":[{"description":"Analytical field ID.","example":"x__8qsgm86n71g","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"Analytical field value ID.","example":"x__k3jd81ndos5","in":"path","name":"valueId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/analyticalFieldV2Value"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:analytical-field-v2:read"]}],"summary":"Get Analytical Field Value","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]},"patch":{"description":"**Allowed Scopes**: _`experimental:analytical-field-v2:write`_\n\nPartially updates a value of an analytical field. Returns 404 if the field or the value does not exist. Returns 409 if a value with the same name already exists on the field.\n\nDo not use on a yes/no field (`type` `boolean`): its values are fixed to `1` (yes) and `0` (no), and exports print Yes only for the value labelled `1`, so renaming it exports every yes as No. The call is not refused yet.","operationId":"v2-update-analytical-field-value","parameters":[{"description":"Analytical field ID.","example":"x__8qsgm86n71g","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"Analytical field value ID.","example":"x__k3jd81ndos5","in":"path","name":"valueId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"value":{"description":"The value label.","maxLength":255,"minLength":1,"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/analyticalFieldV2Value"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:analytical-field-v2:write"]}],"summary":"Update Analytical Field Value","tags":["Analytical fields and cost centers"],"x-roles":["controller","admin","accountOwner"]}},"/v2/companies":{"get":{"description":"**Allowed Scopes**: _`experimental:company:read`_\n\nReturns companies (legal entities) in the organisation. Only accessible with an organisation-level token. For OAuth2 (user-consented) tokens, returns only the active companies the authenticated user is a member of; for API-key tokens, returns all active companies in the organisation. Organisation company data is cached for up to 20 minutes. Changes, including those made through the API, can take up to 20 minutes to appear.","operationId":"v2-get-companies","parameters":[{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"Page size","in":"query","name":"pageSize","required":false,"schema":{"default":30,"maximum":30,"minimum":1,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"description":"List of companies in the organisation.","items":{"additionalProperties":false,"properties":{"appUrl":{"description":"Link to this company's home page in the Spendesk web app.","example":"https://app.spendesk.com/app/RRbRgeIB7X/home","type":"string"},"id":{"description":"Company ID.","type":"string"},"name":{"description":"Company name.","type":"string"}},"required":["id","name","appUrl"],"type":"object"},"type":"array"},"meta":{"$ref":"#/components/schemas/meta"}},"required":["data","meta"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:company:read"]}],"summary":"Get Companies","tags":["Companies"]}},"/v2/companies/{companyId}/intakes":{"get":{"description":"**Allowed Scopes**: _`experimental:intake:read`_\n\nReturns the company's intakes — supplier documents (invoices, credit notes, receipts) received by the company and being reviewed and processed — newest `createdAt` first, using forward-only cursor pagination: follow `meta.pagination.nextCursor` (or `nextUrl`) until `hasNextPage` is `false`.\n\nFilter by `ids`, by lifecycle (`stage` for the coarse view, `status` for the fine-grained one), and by created, updated, issued or due date ranges. Filters combine with AND; `stage` and `status` intersect. Deleted intakes only appear when asked for: include `deleted` in `status`, or `processed` in `stage`, which covers it. A combination that cannot match anything, such as `stage=linked` with `status=received`, returns an empty page rather than an error.\n\nThe date filters come in two formats and are not interchangeable:\n\n- `createdAfter`, `createdBefore`, `updatedAfter` and `updatedBefore` select on an instant, so they take a full ISO 8601 date-time such as `2026-08-01T09:30:00Z`.\n- `issuedAfter`, `issuedBefore`, `dueAfter` and `dueBefore` select on a calendar date printed on the document, so they take `YYYY-MM-DD` such as `2026-08-01`, and include the whole of the day at each end.\n\nSending one form where the other is expected fails validation with a 400.\n\nThere is no filter on `type`. To list only invoices, or to leave receipts out, read `type` on each result and filter on your side.\n\nEach result is a summary without the received files. [Get an intake](/reference/v2-get-company-intake) returns the same fields plus `documents`. Intake data is cached for up to 2 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 2 hours to appear.\n\nA 403 means either the token is not for `companyId`, or the Spendesk user the API key was created by is not a Controller, Administrator or Account Owner of that company.","operationId":"v2-list-company-intakes","parameters":[{"description":"Fetch a known set of intakes by id.","in":"query","name":"ids","required":false,"schema":{"items":{"$ref":"#/components/schemas/intakeId"},"maxItems":50,"type":"array"}},{"description":"Filter by lifecycle stage. Each stage matches its underlying statuses (see `stage`). Combined with `status` the two filters intersect.","in":"query","name":"stage","required":false,"schema":{"items":{"$ref":"#/components/schemas/intakeStage"},"type":"array"}},{"description":"Filter by fine-grained status.","in":"query","name":"status","required":false,"schema":{"items":{"$ref":"#/components/schemas/intakeStatus"},"type":"array"}},{"description":"Only intakes with `createdAt` at or after this instant. An ISO 8601 date-time, e.g. `2026-08-01T09:30:00Z` — not a plain `YYYY-MM-DD`.","in":"query","name":"createdAfter","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:[0-5]\\d(\\.\\d+)?(Z|[+-]\\d{2}:?\\d{2})$","type":"string"}},{"description":"Only intakes with `createdAt` at or before this instant. An ISO 8601 date-time, e.g. `2026-08-31T23:59:59Z` — not a plain `YYYY-MM-DD`.","in":"query","name":"createdBefore","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:[0-5]\\d(\\.\\d+)?(Z|[+-]\\d{2}:?\\d{2})$","type":"string"}},{"description":"Only intakes with `updatedAt` at or after this instant. An ISO 8601 date-time, e.g. `2026-08-01T09:30:00Z` — not a plain `YYYY-MM-DD`.","in":"query","name":"updatedAfter","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:[0-5]\\d(\\.\\d+)?(Z|[+-]\\d{2}:?\\d{2})$","type":"string"}},{"description":"Only intakes with `updatedAt` at or before this instant. An ISO 8601 date-time, e.g. `2026-08-31T23:59:59Z` — not a plain `YYYY-MM-DD`.","in":"query","name":"updatedBefore","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/dateTime"}],"pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:[0-5]\\d(\\.\\d+)?(Z|[+-]\\d{2}:?\\d{2})$","type":"string"}},{"description":"Only intakes with `issueDate` on or after this date. A calendar date, `YYYY-MM-DD`, e.g. `2026-08-01` — not a date-time.","in":"query","name":"issuedAfter","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/date"}]}},{"description":"Only intakes with `issueDate` on or before this date, the whole day included. A calendar date, `YYYY-MM-DD`, e.g. `2026-08-31` — not a date-time.","in":"query","name":"issuedBefore","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/date"}]}},{"description":"Only intakes with `dueDate` on or after this date. A calendar date, `YYYY-MM-DD`, e.g. `2026-08-01` — not a date-time.","in":"query","name":"dueAfter","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/date"}]}},{"description":"Only intakes with `dueDate` on or before this date, the whole day included. A calendar date, `YYYY-MM-DD`, e.g. `2026-08-31` — not a date-time.","in":"query","name":"dueBefore","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/date"}]}},{"description":"Maximum number of intakes to return in one page.","in":"query","name":"limit","required":false,"schema":{"default":20,"maximum":100,"minimum":1,"type":"integer"}},{"description":"Opaque pagination cursor returned as `meta.pagination.nextCursor` by a previous call. Omit to fetch the first page.","in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"description":"Company ID.","in":"path","name":"companyId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"description":"A page of intakes.","items":{"$ref":"#/components/schemas/intakeSummary"},"type":"array"},"meta":{"$ref":"#/components/schemas/intakesMeta"}},"required":["data","meta"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:intake:read"]}],"summary":"List intakes","tags":["Invoices and intakes"],"x-roles":["controller","admin","accountOwner"]},"post":{"description":"**Allowed Scopes**: _`experimental:intake:write`_\n\nCreate a new incoming invoice or credit note for a company's invoice inbox. This is step 3 of 3 in creating an intake from a document.\n\n`documentId` is required and comes from an earlier upload: create one with [Create an intake file upload](/reference/v2-create-intake-file-upload), send the file to the presigned URL, then poll [Get an intake file upload status](/reference/v2-get-intake-file-upload-status) until it reports `ready` and returns the `documentId`.\n\n**Idempotent retries.** Send an optional `Idempotency-Key` header, any string of 1 to 255 characters such as your own system or ERP reference, to make a retry safe. Repeating a request with the same key for the same company returns `201` with the original intake and `alreadyExisted: true`, and creates nothing. The key is scoped to the company, so the same key sent by two companies creates two intakes, and it never expires. Once an intake is deleted, its key stays spent: retrying with it returns `409` rather than recreating the intake.\n\nNote that **the request body is ignored when a key is reused**: if you send the same key with a different invoice, you receive the first intake back and the new body is discarded. Use a new key for each genuinely different invoice.","operationId":"v2-post-company-intakes","parameters":[{"description":"Company ID.","in":"path","name":"companyId","required":true,"schema":{"type":"string"}},{"description":"Optional idempotency key. Repeating a request with the same key for the same company returns the original resource instead of creating a second one. Any string of 1 to 255 characters, for example your own system or ERP reference.","in":"header","name":"idempotency-key","required":false,"schema":{"maxLength":255,"minLength":1,"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"additionalProperties":false,"properties":{"assigneeId":{"description":"ID of the user to assign the intake to.","minLength":1,"type":"string"},"costCenterId":{"description":"ID of the cost center to associate with the intake.","type":"string"},"currency":{"description":"Invoice currency.","type":"string"},"customFieldsAssociations":{"description":"Custom field associations to apply to the intake.","items":{"additionalProperties":false,"properties":{"customFieldId":{"description":"Custom field ID.","type":"string"},"customFieldValueId":{"description":"Custom field value ID, or null.","type":["string","null"]},"value":{"description":"Free-text value for the custom field.","type":"string"}},"required":["customFieldId","customFieldValueId"],"type":"object"},"type":"array"},"description":{"description":"Free-text description.","type":"string"},"documentId":{"description":"ID of the uploaded document, returned by a `ready` intake file upload.","type":"string"},"dueDate":{"description":"Invoice due date. In the ISO 8601 date-time format.","format":"date-time","type":"string"},"grossAmount":{"description":"Invoice gross amount, as a decimal in `currency` (12.5 means 12.50), not minor units. Reading the intake back returns it in minor units (or null when `currency` is missing or unsupported).","type":"number"},"invoiceNumber":{"description":"Invoice number.","type":"string"},"issueDate":{"description":"Invoice issue date. In the ISO 8601 date-time format.","format":"date-time","type":"string"},"lineItems":{"description":"Line items extracted from the invoice. Amounts are decimals in `currency`, as they appear on the document, not minor units.","items":{"additionalProperties":false,"properties":{"description":{"description":"Line item description.","maxLength":500,"minLength":1,"type":"string"},"quantity":{"description":"Quantity.","type":["number","null"]},"taxAmount":{"description":"Tax amount.","type":["number","null"]},"taxRate":{"description":"Tax rate, as a percentage between 0 and 100.","maximum":100,"minimum":0,"type":["number","null"]},"totalAmountWithoutTax":{"description":"Total amount, excluding tax.","type":["number","null"]},"unitPriceWithoutTax":{"description":"Unit price, excluding tax.","type":["number","null"]}},"required":["description"],"type":"object"},"maxItems":1000,"type":"array"},"netAmount":{"description":"Net amount, as a decimal in `currency` (12.5 means 12.50), not minor units. Reading the intake back returns it in minor units (or null when `currency` is missing or unsupported).","type":"number"},"purchaseOrderId":{"description":"ID of the purchase order to link. Takes precedence over `purchaseOrderNumber`. The purchase order must exist, be open, and be visible to the assignee, otherwise the request is rejected.","minLength":1,"type":"string"},"purchaseOrderNumber":{"description":"Related purchase order number, in the format: `PO-123` or `123` (case insensitive). Ignored when `purchaseOrderId` is provided.","maxLength":30,"pattern":"^([Pp][Oo]-)?\\d+$","type":"string"},"supplier":{"additionalProperties":false,"properties":{"bic":{"description":"Supplier BIC.","type":"string"},"iban":{"description":"Supplier IBAN.","type":"string"},"name":{"description":"Supplier name.","type":"string"},"registrationNumber":{"description":"Supplier registration number.","type":"string"},"vatNumber":{"description":"Supplier VAT number.","type":"string"}},"required":["name"],"type":"object"},"type":{"enum":["forwarded_invoice"],"type":"string"}},"required":["type","documentId","supplier"],"type":"object"},{"additionalProperties":false,"properties":{"assigneeId":{"description":"ID of the user to assign the intake to.","minLength":1,"type":"string"},"costCenterId":{"description":"ID of the cost center to associate with the intake.","type":"string"},"creditNoteNumber":{"description":"Credit note number.","type":"string"},"currency":{"description":"Credit note currency.","type":"string"},"customFieldsAssociations":{"description":"Custom field associations to apply to the intake.","items":{"additionalProperties":false,"properties":{"customFieldId":{"description":"Custom field ID.","type":"string"},"customFieldValueId":{"description":"Custom field value ID, or null.","type":["string","null"]},"value":{"description":"Free-text value for the custom field.","type":"string"}},"required":["customFieldId","customFieldValueId"],"type":"object"},"type":"array"},"description":{"description":"Free-text description.","type":"string"},"documentId":{"description":"ID of the uploaded document, returned by a `ready` intake file upload.","type":"string"},"grossAmount":{"description":"Credit note gross amount, as a decimal in `currency` (12.5 means 12.50), not minor units. Reading the intake back returns it in minor units (or null when `currency` is missing or unsupported).","type":"number"},"issueDate":{"description":"Credit note issue date. In the ISO 8601 date-time format.","format":"date-time","type":"string"},"netAmount":{"description":"Net amount, as a decimal in `currency` (12.5 means 12.50), not minor units. Reading the intake back returns it in minor units (or null when `currency` is missing or unsupported).","type":"number"},"supplier":{"additionalProperties":false,"properties":{"bic":{"description":"Supplier BIC.","type":"string"},"iban":{"description":"Supplier IBAN.","type":"string"},"name":{"description":"Supplier name.","type":"string"},"registrationNumber":{"description":"Supplier registration number.","type":"string"},"vatNumber":{"description":"Supplier VAT number.","type":"string"}},"required":["name"],"type":"object"},"type":{"enum":["forwarded_credit_note"],"type":"string"}},"required":["type","documentId","supplier"],"type":"object"}]}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"additionalProperties":false,"properties":{"alreadyExisted":{"description":"True when an Idempotency-Key was reused and this intake already existed, so nothing was created. False on every fresh intake.","type":"boolean"},"assigneeId":{"description":"ID of the assigned user, or null if unassigned.","type":["null","string"]},"companyId":{"description":"Company ID.","type":"string"},"id":{"description":"Intake ID.","type":"string"},"purchaseOrderId":{"description":"ID of the linked purchase order, or null if none was linked.","type":["null","string"]},"status":{"description":"Intake status.","type":"string"},"type":{"description":"Intake type.","type":"string"}},"required":["id","companyId","status","type","assigneeId","purchaseOrderId","alreadyExisted"],"type":"object"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:intake:write"]}],"summary":"Create an intake","tags":["Invoices and intakes"],"x-roles":["controller","admin","accountOwner"]}},"/v2/companies/{companyId}/intakes/files/upload":{"post":{"description":"**Allowed Scopes**: _`experimental:intake:write`_\n\nCreates a presigned upload target for an intake file. This is step 1 of 3 in creating an intake from a document:\n\n1. Create an upload with this endpoint to get a presigned URL and an `uploadId`.\n2. Send the file to that URL, then poll [Get an intake file upload status](/reference/v2-get-intake-file-upload-status) until it returns a `documentId`.\n3. Pass that `documentId` to [Create an intake](/reference/v2-post-company-intakes).\n\n`contentLength` must be the exact byte size of the file you are about to send. The presigned policy pins that size, so an approximate value makes the upload in step 2 fail rather than this call.\n\nTo send the file, make a `multipart/form-data` request to `upload.url` using `upload.method`. Include every entry of `upload.fields` as a form field, then add the file itself as a field named `file`, last. The URL points to our storage provider and not to the Spendesk API, so do not send your access token with it. Upload before `upload.expiresAt`; once the URL has expired, call this endpoint again for a fresh one.","operationId":"v2-create-intake-file-upload","parameters":[{"description":"The company ID.","in":"path","name":"companyId","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"contentLength":{"description":"Exact size of the file in bytes. The presigned upload rejects a file whose size differs from this value. Maximum: 10485760 (10 MB).","maximum":10485760,"minimum":1,"type":"integer"},"mimeType":{"description":"Media type of the file. Allowed types: application/pdf, image/png, image/jpeg, application/xml, text/xml.","minLength":1,"type":"string"}},"required":["mimeType","contentLength"],"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"upload":{"additionalProperties":false,"properties":{"expiresAt":{"description":"ISO 8601 timestamp when the presigned URL expires. Create a new upload once it has passed.","type":"string"},"fields":{"additionalProperties":{"type":"string"},"description":"Form fields that must all be sent with the file upload, as multipart/form-data. Send them first, then the file itself as a field named `file`.","type":"object"},"method":{"description":"HTTP method to use when uploading the file.","enum":["POST"],"type":"string"},"url":{"description":"Presigned URL where the file must be uploaded. It points to our storage provider rather than the Spendesk API, so send it no access token.","type":"string"}},"required":["method","url","fields","expiresAt"],"type":"object"},"uploadId":{"description":"Unique identifier for the file upload. Use it to poll the upload status once the file has been sent.","type":"string"}},"required":["uploadId","upload"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"errors":{"items":{"additionalProperties":false,"properties":{"code":{"enum":["UNSUPPORTED_MEDIA_TYPE"],"type":"string"},"detail":{"type":"string"}},"required":["code","detail"],"type":"object"},"type":"array"}},"required":["errors"],"type":"object"}}},"description":"Default Response"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:intake:write"]}],"summary":"Create an intake file upload","tags":["Invoices and intakes"],"x-roles":["controller","admin","accountOwner"]}},"/v2/companies/{companyId}/intakes/files/upload/{uploadId}":{"get":{"description":"**Allowed Scopes**: _`experimental:intake:write`_\n\nReturns the status of an intake file upload. This is step 2 of 3 in creating an intake from a document, after [Create an intake file upload](/reference/v2-create-intake-file-upload).\n\nA file is processed asynchronously once you have sent it to the presigned URL, so poll this endpoint until it leaves the `pending` state:\n\n- `pending`: the file has not been processed yet. Poll again after a few seconds.\n- `ready`: processing succeeded and `documentId` is returned. Pass it to [Create an intake](/reference/v2-post-company-intakes).\n- `failed`: processing failed and `reason` explains why. Create a new upload to try again.\n\n`documentId` is only present on a `ready` upload.","operationId":"v2-get-intake-file-upload-status","parameters":[{"description":"The company ID.","in":"path","name":"companyId","required":true,"schema":{"type":"string"}},{"description":"The upload ID.","in":"path","name":"uploadId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"oneOf":[{"additionalProperties":false,"properties":{"status":{"enum":["pending"],"type":"string"},"uploadId":{"type":"string"}},"required":["status","uploadId"],"type":"object"},{"additionalProperties":false,"properties":{"documentId":{"description":"ID of the processed document. Pass it as `documentId` when creating an intake.","type":"string"},"status":{"enum":["ready"],"type":"string"},"uploadId":{"type":"string"}},"required":["status","uploadId","documentId"],"type":"object"},{"additionalProperties":false,"properties":{"reason":{"description":"Why the file could not be processed.","type":"string"},"status":{"enum":["failed"],"type":"string"},"uploadId":{"type":"string"}},"required":["status","uploadId","reason"],"type":"object"}]}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:intake:write"]}],"summary":"Get an intake file upload status","tags":["Invoices and intakes"],"x-roles":["controller","admin","accountOwner"]}},"/v2/companies/{companyId}/intakes/{id}":{"get":{"description":"**Allowed Scopes**: _`experimental:intake:read`_\n\nReturns a single intake by id: everything [List intakes](/reference/v2-list-company-intakes) returns for it, plus the received files in `documents` — the invoice, credit note or receipt itself, and any companion file that arrived with it. This is the only endpoint that returns `documents`.\n\nEach `downloadUrl` is pre-signed and expires at most 3 hours after the response was issued. Intake data is cached for up to 55 minutes, so a link you receive may already be part-way through those 3 hours. Download promptly, and fetch the intake again for a fresh link rather than storing one. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 55 minutes to appear.\n\nA deleted intake is not a 404: it is still returned, with status `deleted`, and its documents can still be downloaded. A 404 means this company has no intake with that id. A 403 means either the token is not for `companyId`, or the Spendesk user the API key was created by is not a Controller, Administrator or Account Owner of that company.","operationId":"v2-get-company-intake","parameters":[{"description":"Company ID.","in":"path","name":"companyId","required":true,"schema":{"type":"string"}},{"description":"Intake ID.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/intake"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:intake:read"]}],"summary":"Get an intake","tags":["Invoices and intakes"],"x-roles":["controller","admin","accountOwner"]}},"/v2/companies/{companyId}/invoices":{"get":{"description":"**Allowed Scopes**: _`experimental:invoice:read`_\n\nReturns supplier invoices for the company, most-recent first by default, using forward-only cursor pagination. The `createdAfter`, `createdBefore`, `updatedAfter` and `updatedBefore` filters use only the UTC date of the value: After includes that day, Before excludes it. Invoice data is cached for up to 20 minutes. Changes, including those made through the API, can take up to 20 minutes to appear.","operationId":"v2-list-invoices","parameters":[{"in":"query","name":"ids","required":false,"schema":{"items":{"$ref":"#/components/schemas/invoiceId"},"maxItems":50,"type":"array"}},{"description":"Filter by the supplier's invoice number (case-insensitive exact match). Ignored with type=creditNote; use search to find a credit note by its number.","in":"query","name":"invoiceNumber","required":false,"schema":{"type":"string"}},{"in":"query","name":"supplierId","required":false,"schema":{"items":{"type":"string"},"maxItems":50,"type":"array"}},{"in":"query","name":"buyerId","required":false,"schema":{"items":{"type":"string"},"maxItems":50,"type":"array"}},{"in":"query","name":"purchaseOrderId","required":false,"schema":{"items":{"type":"string"},"maxItems":50,"type":"array"}},{"in":"query","name":"costCenterId","required":false,"schema":{"items":{"type":"string"},"maxItems":50,"type":"array"}},{"description":"Filter by expense category, matching the ids in the invoice `expenseCategories`. A split invoice matches if any of its categories does. Known gap: fully paid invoices (stage `settled`) are not matched by this filter, so they are left out of the result.","in":"query","name":"expenseCategoryId","required":false,"schema":{"items":{"type":"string"},"maxItems":50,"type":"array"}},{"in":"query","name":"type","required":false,"schema":{"$ref":"#/components/schemas/invoiceType"}},{"description":"Filter by stage; any of the listed values matches. When omitted, every stage except `cancelled` is returned; pass `cancelled` to get cancelled invoices. Draft and incomplete invoices are never listed here, not even under `pendingApproval`; fetch one by ID instead, which fails while it still lacks a supplier, issue date or currency. A credit note in dispute with the supplier is never returned or counted, under any stage.","in":"query","name":"stage","required":false,"schema":{"items":{"$ref":"#/components/schemas/invoiceStage"},"type":"array"}},{"in":"query","name":"paymentStatus","required":false,"schema":{"items":{"$ref":"#/components/schemas/paymentStatus"},"type":"array"}},{"description":"Not applied yet: results are not filtered by payment source.","in":"query","name":"paymentSource","required":false,"schema":{"items":{"$ref":"#/components/schemas/paymentSource"},"type":"array"}},{"description":"Not applied yet: results are not filtered by payment method.","in":"query","name":"paymentMethod","required":false,"schema":{"items":{"$ref":"#/components/schemas/paymentMethod"},"type":"array"}},{"in":"query","name":"exportStatus","required":false,"schema":{"items":{"$ref":"#/components/schemas/exportStatus"},"type":"array"}},{"in":"query","name":"documentaryEvidenceStatus","required":false,"schema":{"items":{"$ref":"#/components/schemas/documentaryEvidenceStatus"},"type":"array"}},{"description":"`true`: only invoices currently in dispute with the supplier, the same as `stage` `disputed`; `false`: all others. Combined with `stage`, both must match. An invoice archived after a dispute is `cancelled`, not disputed, and credit notes are never returned as disputed.","in":"query","name":"isDisputed","required":false,"schema":{"type":"boolean"}},{"in":"query","name":"currency","required":false,"schema":{"$ref":"#/components/schemas/currency"}},{"in":"query","name":"minGrossAmount","required":false,"schema":{"type":"integer"}},{"in":"query","name":"maxGrossAmount","required":false,"schema":{"type":"integer"}},{"in":"query","name":"issuedAfter","required":false,"schema":{"$ref":"#/components/schemas/date"}},{"in":"query","name":"issuedBefore","required":false,"schema":{"$ref":"#/components/schemas/date"}},{"in":"query","name":"dueAfter","required":false,"schema":{"$ref":"#/components/schemas/date"}},{"in":"query","name":"dueBefore","required":false,"schema":{"$ref":"#/components/schemas/date"}},{"in":"query","name":"createdAfter","required":false,"schema":{"$ref":"#/components/schemas/dateTime"}},{"in":"query","name":"createdBefore","required":false,"schema":{"$ref":"#/components/schemas/dateTime"}},{"in":"query","name":"updatedAfter","required":false,"schema":{"$ref":"#/components/schemas/dateTime"}},{"in":"query","name":"updatedBefore","required":false,"schema":{"$ref":"#/components/schemas/dateTime"}},{"in":"query","name":"search","required":false,"schema":{"type":"string"}},{"description":"Maximum number of invoices to return in one page.","in":"query","name":"limit","required":false,"schema":{"default":20,"maximum":100,"minimum":1,"type":"integer"}},{"description":"Opaque pagination cursor returned as `meta.pagination.nextCursor` by a previous call. Omit to fetch the first page.","in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"description":"Field to sort by. Combined with `sort` to set direction.","in":"query","name":"sortBy","required":false,"schema":{"default":"createdAt","enum":["createdAt","updatedAt","issueDate","dueDate","grossAmount"],"type":"string"}},{"description":"Sort direction.","in":"query","name":"sort","required":false,"schema":{"default":"desc","enum":["asc","desc"],"type":"string"}},{"description":"Company ID.","in":"path","name":"companyId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"description":"A page of invoices.","items":{"$ref":"#/components/schemas/invoiceSummary"},"type":"array"},"meta":{"$ref":"#/components/schemas/invoicesMeta"}},"required":["data","meta"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:invoice:read"]}],"summary":"List invoices","tags":["Invoices and intakes"],"x-roles":["controller","admin","accountOwner"]}},"/v2/companies/{companyId}/invoices/summary":{"get":{"description":"**Allowed Scopes**: _`experimental:invoice:read`_\n\nReturns aggregate figures (count + amount totals by currency) over all invoices matching the filters. With no `type` filter, only invoices are included — credit notes are neither counted nor netted off. The `createdAfter`, `createdBefore`, `updatedAfter` and `updatedBefore` filters use only the UTC date of the value: After includes that day, Before excludes it.\nInvoice summary data is cached for up to 20 minutes. Changes, including those made through the API, can take up to 20 minutes to appear.","operationId":"v2-get-invoices-summary","parameters":[{"description":"Filter by the supplier's invoice number (case-insensitive exact match). Ignored with type=creditNote; use search to find a credit note by its number.","in":"query","name":"invoiceNumber","required":false,"schema":{"type":"string"}},{"in":"query","name":"supplierId","required":false,"schema":{"items":{"type":"string"},"maxItems":50,"type":"array"}},{"in":"query","name":"buyerId","required":false,"schema":{"items":{"type":"string"},"maxItems":50,"type":"array"}},{"in":"query","name":"purchaseOrderId","required":false,"schema":{"items":{"type":"string"},"maxItems":50,"type":"array"}},{"in":"query","name":"costCenterId","required":false,"schema":{"items":{"type":"string"},"maxItems":50,"type":"array"}},{"description":"Filter by expense category, matching the ids in the invoice `expenseCategories`. A split invoice matches if any of its categories does. Known gap: fully paid invoices (stage `settled`) are not matched by this filter, so they are left out of the result.","in":"query","name":"expenseCategoryId","required":false,"schema":{"items":{"type":"string"},"maxItems":50,"type":"array"}},{"in":"query","name":"type","required":false,"schema":{"$ref":"#/components/schemas/invoiceType"}},{"description":"Filter by stage; any of the listed values matches. When omitted, every stage except `cancelled` is returned; pass `cancelled` to get cancelled invoices. Draft and incomplete invoices are never listed here, not even under `pendingApproval`; fetch one by ID instead, which fails while it still lacks a supplier, issue date or currency. A credit note in dispute with the supplier is never returned or counted, under any stage.","in":"query","name":"stage","required":false,"schema":{"items":{"$ref":"#/components/schemas/invoiceStage"},"type":"array"}},{"in":"query","name":"paymentStatus","required":false,"schema":{"items":{"$ref":"#/components/schemas/paymentStatus"},"type":"array"}},{"description":"Not applied yet: results are not filtered by payment source.","in":"query","name":"paymentSource","required":false,"schema":{"items":{"$ref":"#/components/schemas/paymentSource"},"type":"array"}},{"description":"Not applied yet: results are not filtered by payment method.","in":"query","name":"paymentMethod","required":false,"schema":{"items":{"$ref":"#/components/schemas/paymentMethod"},"type":"array"}},{"in":"query","name":"exportStatus","required":false,"schema":{"items":{"$ref":"#/components/schemas/exportStatus"},"type":"array"}},{"in":"query","name":"documentaryEvidenceStatus","required":false,"schema":{"items":{"$ref":"#/components/schemas/documentaryEvidenceStatus"},"type":"array"}},{"description":"`true`: only invoices currently in dispute with the supplier, the same as `stage` `disputed`; `false`: all others. Combined with `stage`, both must match. An invoice archived after a dispute is `cancelled`, not disputed, and credit notes are never returned as disputed.","in":"query","name":"isDisputed","required":false,"schema":{"type":"boolean"}},{"in":"query","name":"currency","required":false,"schema":{"$ref":"#/components/schemas/currency"}},{"in":"query","name":"minGrossAmount","required":false,"schema":{"type":"integer"}},{"in":"query","name":"maxGrossAmount","required":false,"schema":{"type":"integer"}},{"in":"query","name":"issuedAfter","required":false,"schema":{"$ref":"#/components/schemas/date"}},{"in":"query","name":"issuedBefore","required":false,"schema":{"$ref":"#/components/schemas/date"}},{"in":"query","name":"dueAfter","required":false,"schema":{"$ref":"#/components/schemas/date"}},{"in":"query","name":"dueBefore","required":false,"schema":{"$ref":"#/components/schemas/date"}},{"in":"query","name":"createdAfter","required":false,"schema":{"$ref":"#/components/schemas/dateTime"}},{"in":"query","name":"createdBefore","required":false,"schema":{"$ref":"#/components/schemas/dateTime"}},{"in":"query","name":"updatedAfter","required":false,"schema":{"$ref":"#/components/schemas/dateTime"}},{"in":"query","name":"updatedBefore","required":false,"schema":{"$ref":"#/components/schemas/dateTime"}},{"in":"query","name":"search","required":false,"schema":{"type":"string"}},{"description":"Company ID.","in":"path","name":"companyId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/invoicesSummary"}}},"description":"Aggregate figures over all invoices matching the filters, returned by `GET /v2/companies/:companyId/invoices/summary`."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:invoice:read"]}],"summary":"Summarise invoices","tags":["Invoices and intakes"],"x-roles":["controller","admin","accountOwner"]}},"/v2/companies/{companyId}/invoices/{id}":{"get":{"description":"**Allowed Scopes**: _`experimental:invoice:read`_\n\nReturns a single supplier invoice by id. Invoice data is cached for up to 20 minutes. Changes, including those made through the API, can take up to 20 minutes to appear.","operationId":"v2-get-invoice","parameters":[{"description":"Company ID.","in":"path","name":"companyId","required":true,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"$ref":"#/components/schemas/invoiceId"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/invoice"}}},"description":"Full representation of an invoice, returned by the detail endpoint. A superset of `invoiceSummary`, adding line items, the tax breakdown, currency conversion (FX), the payment history, the approval chain, accounting links, attachments and custom fields."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:invoice:read"]}],"summary":"Get an invoice","tags":["Invoices and intakes"],"x-roles":["controller","admin","accountOwner"]}},"/v2/companies/{companyId}/users":{"get":{"description":"**Allowed Scopes**: _`user:read`_\n\nReturns members (users) of the given company. Useful for organisations with multiple companies (entities): a single organisation-level token can list the users of any company it owns by passing its `companyId`. User data is cached for up to 20 minutes. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 20 minutes to appear.\n\nA 403 means the token's organisation does not own `companyId`.","operationId":"v2-get-company-users","parameters":[{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"Page size","in":"query","name":"pageSize","required":false,"schema":{"default":30,"maximum":30,"minimum":1,"type":"integer"}},{"description":"User IDs to filter by.","in":"query","name":"ids","required":false,"schema":{"items":{"type":"string"},"type":"array"}},{"description":"The user status to filter for.","in":"query","name":"status","required":false,"schema":{"default":"active","enum":["active","archived","pending"],"type":"string"}},{"description":"Extra related data to embed on each user. Each value costs one additional lookup per request, so it is opt-in. Repeat the parameter for multiple values (e.g. `include=manager&include=teams`).","in":"query","name":"include","required":false,"schema":{"items":{"enum":["manager","costCenter","teams","spendingPolicy"],"type":"string"},"type":"array"}},{"description":"Company ID.","in":"path","name":"companyId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"data":{"description":"List of users matching the given criteria.","items":{"$ref":"#/components/schemas/user"},"type":"array"},"meta":{"$ref":"#/components/schemas/meta"}},"required":["meta","data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["user:read"]}],"summary":"Get Company Users","tags":["Users"],"x-roles":["controller","admin","accountOwner"]}},"/v2/expense-category-fields":{"get":{"description":"**Allowed Scopes**: _`experimental:expense-category-v2:read`_\n\nReturns the expense category field for the company. The array is empty if the company has no expense category field configured. Expense category field data is cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear.","operationId":"v2-list-expense-category-fields","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"description":"Expense category fields list.","items":{"$ref":"#/components/schemas/expenseCategoryFieldV2"},"type":"array"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:expense-category-v2:read"]}],"summary":"List Expense Category Fields","tags":["Expense categories"],"x-roles":["controller","admin","accountOwner"]},"post":{"description":"**Allowed Scopes**: _`experimental:expense-category-v2:write`_\n\nCreates the company's expense category field. A company can only have one expense category field; creating a second one returns a 409.","operationId":"v2-create-expense-category-field","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"isRequired":{"default":true,"description":"Whether the field is mandatory. Defaults to true.","type":"boolean"},"isSplittable":{"default":false,"description":"Whether the field is splittable. Defaults to false.","type":"boolean"}},"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/expenseCategoryFieldV2"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:expense-category-v2:write"]}],"summary":"Create Expense Category Field","tags":["Expense categories"],"x-roles":["controller","admin","accountOwner"]}},"/v2/expense-category-fields/{fieldId}":{"delete":{"description":"**Allowed Scopes**: _`experimental:expense-category-v2:write`_\n\nDeletes an expense category field by ID. Returns 404 if the field does not exist.","operationId":"v2-delete-expense-category-field","parameters":[{"description":"Expense category field ID.","example":"x__8patkcjpdq7","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"204":{"content":{"application/json":{"schema":{}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:expense-category-v2:write"]}],"summary":"Delete Expense Category Field","tags":["Expense categories"],"x-roles":["controller","admin","accountOwner"]},"get":{"description":"**Allowed Scopes**: _`experimental:expense-category-v2:read`_\n\nReturns a single expense category field by ID. Returns 404 if the field does not exist. Expense category field data is cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear.","operationId":"v2-get-expense-category-field","parameters":[{"description":"Expense category field ID.","example":"x__8patkcjpdq7","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/expenseCategoryFieldV2"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:expense-category-v2:read"]}],"summary":"Get Expense Category Field","tags":["Expense categories"],"x-roles":["controller","admin","accountOwner"]},"patch":{"description":"**Allowed Scopes**: _`experimental:expense-category-v2:write`_\n\nUpdates the company's expense category field. Only the provided properties are changed; omitted properties are left untouched. Returns 404 if the field does not exist.","operationId":"v2-update-expense-category-field","parameters":[{"description":"Expense category field ID.","example":"x__8patkcjpdq7","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"isRequired":{"description":"Whether the field is mandatory.","type":"boolean"},"isSplittable":{"description":"Whether the field is splittable.","type":"boolean"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/expenseCategoryFieldV2"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:expense-category-v2:write"]}],"summary":"Update Expense Category Field","tags":["Expense categories"],"x-roles":["controller","admin","accountOwner"]}},"/v2/expense-category-fields/{fieldId}/categories":{"get":{"description":"**Allowed Scopes**: _`experimental:expense-category-v2:read`_\n\nReturns expense categories for the expense category field, using forward-only cursor pagination. Returns 404 if the field does not exist. Expense categories are cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear. Archived categories are included by default.","operationId":"v2-list-expense-categories","parameters":[{"description":"Maximum number of categories to return.","in":"query","name":"limit","required":false,"schema":{"default":30,"maximum":1000,"minimum":1,"type":"integer"}},{"description":"Opaque pagination cursor returned as `meta.pagination.nextCursor` by a previous call. Omit to fetch the first page.","in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"description":"Expense category field ID.","example":"x__8patkcjpdq7","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"Expense categories list.","properties":{"data":{"description":"A page of expense categories.","items":{"$ref":"#/components/schemas/expenseCategoryV2"},"type":"array"},"meta":{"$ref":"#/components/schemas/expenseCategoryV2Meta"}},"required":["data","meta"],"type":"object"}}},"description":"Expense categories list."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:expense-category-v2:read"]}],"summary":"List Expense Categories","tags":["Expense categories"],"x-roles":["controller","admin","accountOwner"]},"post":{"description":"**Allowed Scopes**: _`experimental:expense-category-v2:write`_\n\nCreates a new expense category for the expense category field. Returns 404 if the field or a cost center in costCenters does not exist. Returns 409 if a category with the same name already exists for the field.","operationId":"v2-create-expense-category","parameters":[{"description":"Expense category field ID.","example":"x__8patkcjpdq7","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"costCenters":{"description":"Cost centers to associate with the expense category.","items":{"additionalProperties":false,"properties":{"id":{"type":"string"}},"required":["id"],"type":"object"},"type":"array"},"name":{"description":"Expense category name.","type":"string"}},"required":["name"],"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/expenseCategoryV2"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:expense-category-v2:write"]}],"summary":"Create Expense Category","tags":["Expense categories"],"x-roles":["controller","admin","accountOwner"]}},"/v2/expense-category-fields/{fieldId}/categories/{categoryId}":{"delete":{"description":"**Allowed Scopes**: _`experimental:expense-category-v2:write`_\n\nArchives an expense category by ID for the expense category field: it stays listed with isArchived set to true, and later updates on it return 404. Returns 404 if the field or the category does not exist.","operationId":"v2-delete-expense-category","parameters":[{"description":"Expense category field ID.","example":"x__8patkcjpdq7","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"Expense category ID.","example":"x__vw4d0eb1t5c","in":"path","name":"categoryId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"204":{"content":{"application/json":{"schema":{}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:expense-category-v2:write"]}],"summary":"Delete Expense Category","tags":["Expense categories"],"x-roles":["controller","admin","accountOwner"]},"get":{"description":"**Allowed Scopes**: _`experimental:expense-category-v2:read`_\n\nReturns a single expense category by ID for the expense category field. Returns 404 if the field or the category does not exist. Expense category data is cached for up to 24 hours. Changes made through the API are returned by subsequent reads; changes made in Spendesk can take up to 24 hours to appear.","operationId":"v2-get-expense-category","parameters":[{"description":"Expense category field ID.","example":"x__8patkcjpdq7","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"Expense category ID.","example":"x__vw4d0eb1t5c","in":"path","name":"categoryId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/expenseCategoryV2"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:expense-category-v2:read"]}],"summary":"Get Expense Category","tags":["Expense categories"],"x-roles":["controller","admin","accountOwner"]},"patch":{"description":"**Allowed Scopes**: _`experimental:expense-category-v2:write`_\n\nPartially updates an existing expense category for the expense category field. Returns 404 if the field, the category or a cost center in costCenters does not exist. Returns 409 if a category with the same name already exists for the field.","operationId":"v2-update-expense-category","parameters":[{"description":"Expense category field ID.","example":"x__8patkcjpdq7","in":"path","name":"fieldId","required":true,"schema":{"type":"string"}},{"description":"Expense category ID.","example":"x__vw4d0eb1t5c","in":"path","name":"categoryId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"costCenters":{"description":"Cost centers to associate with the expense category. An empty array means all cost centers.","items":{"additionalProperties":false,"properties":{"id":{"type":"string"}},"required":["id"],"type":"object"},"type":"array"},"name":{"description":"Expense category name.","type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/expenseCategoryV2"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:expense-category-v2:write"]}],"summary":"Update Expense Category","tags":["Expense categories"],"x-roles":["controller","admin","accountOwner"]}},"/v2/users":{"post":{"description":"**Allowed Scopes**: _`experimental:user:manage`_\n\nCreate users in the company the token resolves to, and send each of them an invitation. Only active admins and account owners can perform this operation, and users can only be created with the `requester` or `controller` role.\n\nSend an array of 1 to 50 users; a single object outside an array is rejected with a 400. Users are created one after the other, and a user that fails does not prevent the others from being created: each one gets its own `outcome` in `items`, in request order, also when the array has a single user.\n\nCreating never updates an existing user. Retrying a request is safe: users created by an earlier attempt come back as `emailUnavailable`, without their id, so read them back with the list of users.\n\nThe whole request is refused, and nobody is created, when the company has no seat left for the users to create (409), or when it is churned or managed by an HRIS integration (403).","operationId":"v2-create-users","parameters":[{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"description":"Array of users to create (1 to 50).","items":{"$ref":"#/components/schemas/userToCreate"},"maxItems":50,"minItems":1,"type":"array"}}},"description":"Array of users to create (1 to 50).","required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"description":"Per-user outcome, in request order.","items":{"oneOf":[{"$ref":"#/components/schemas/createdUserItem"},{"$ref":"#/components/schemas/userCreationErrorItem"}]},"type":"array"}},"required":["items"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooLarge"}}},"description":"Payload Too Large"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unsupportedMediaType"}}},"description":"Unsupported Media Type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:user:manage"]}],"summary":"Create User(s)","tags":["Users"],"x-roles":["admin","accountOwner"]}},"/v2/users/{userId}":{"delete":{"description":"**Allowed Scopes**: _`experimental:user:manage`_\n\nDeactivate (offboard) a user from the company the token resolves to. Only admins and account owners can perform this operation. Scoped to that company: the user's membership, roles and delegations for the company are removed, cards/subscriptions are handled downstream, and the user is fully removed only if this was their last company. Cannot deactivate an organisation or account owner, or a user with pending transfers.","operationId":"v2-deactivate-user","parameters":[{"description":"ID of the user to deactivate.","in":"path","name":"userId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"outcome":{"enum":["deactivated"],"example":"deactivated","type":"string"}},"required":["outcome"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"properties":{"outcome":{"enum":["notDeactivated"],"example":"notDeactivated","type":"string"},"reason":{"enum":["unprocessable"],"example":"unprocessable","type":"string"}},"required":["outcome","reason"],"type":"object"}}},"description":"Default Response"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:user:manage"]}],"summary":"Deactivate User","tags":["Users"],"x-roles":["admin","accountOwner"]},"patch":{"description":"**Allowed Scopes**: _`experimental:user:manage`_\n\nPartially update the profile of a user of the company the token resolves to. Only `firstName` and `lastName` can be updated; changing the email is not supported through the API. Names are shared by every company of the organisation, so the change is visible in all of them, and the user's sessions are kept. Users who are admin, account owner or travel manager in any company of the organisation cannot be updated, and companies whose users are managed by an HRIS integration are refused.","operationId":"v2-update-user","parameters":[{"description":"ID of the user to update.","in":"path","name":"userId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"firstName":{"description":"The user's first name.","maxLength":255,"minLength":1,"type":"string"},"lastName":{"description":"The user's last name.","maxLength":255,"minLength":1,"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/user"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:user:manage"]}],"summary":"Update User","tags":["Users"],"x-roles":["controller","admin","accountOwner"]}},"/v2/users/{userId}/cost-center":{"put":{"description":"**Allowed Scopes**: _`experimental:user:manage`_\n\nSet the default cost center of a user of the company the token resolves to, or clear it with `null`. The cost centers feature must be enabled, and the cost center must be an active cost center of that company. Setting the same cost center again changes nothing, and when several updates of the user's cost center happen at the same time, the last one wins. Users who are admin, account owner or travel manager in the company cannot be updated, and companies whose users are managed by an HRIS integration are refused.","operationId":"v2-update-user-cost-center","parameters":[{"description":"ID of the user to update.","in":"path","name":"userId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"costCenterId":{"description":"ID of the cost center to set as the user's default, or `null` to clear it.","minLength":1,"nullable":true,"type":"string"}},"required":["costCenterId"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"additionalProperties":false,"properties":{"costCenter":{"additionalProperties":false,"description":"The user's default cost center; `null` when it was cleared.","nullable":true,"properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},"id":{"description":"ID of the user.","type":"string"}},"required":["id","costCenter"],"type":"object"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unprocessableEntity"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:user:manage"]}],"summary":"Update User Cost Center","tags":["Users"],"x-roles":["admin","accountOwner"]}},"/v2/users/{userId}/manager":{"put":{"description":"**Allowed Scopes**: _`experimental:user:manage`_\n\nSet the manager of a user of the company the token resolves to, by `managerId` or by `managerEmail` (exactly one of them), or remove it by sending `null`. The reporting managers feature must be enabled, and the manager must be another member of that company. A user has at most one manager: setting a new one replaces the previous one, and setting the same one again changes nothing. When another update of the user's manager happens at the same time and leaves them with a different manager, `409` is returned: read the user again before retrying. Users who are admin, account owner or travel manager in the company cannot be updated, and companies whose users are managed by an HRIS integration are refused.","operationId":"v2-update-user-manager","parameters":[{"description":"ID of the user to update.","in":"path","name":"userId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"maxProperties":1,"minProperties":1,"properties":{"managerEmail":{"description":"Email of the manager, or `null` to remove the manager.","format":"email","nullable":true,"type":"string"},"managerId":{"description":"ID of the manager, or `null` to remove the manager.","minLength":1,"nullable":true,"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"additionalProperties":false,"properties":{"id":{"description":"ID of the user.","type":"string"},"manager":{"additionalProperties":false,"description":"The user's manager; `null` when it was removed.","nullable":true,"properties":{"email":{"nullable":true,"type":"string"},"id":{"type":"string"}},"required":["id","email"],"type":"object"}},"required":["id","manager"],"type":"object"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unprocessableEntity"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:user:manage"]}],"summary":"Update User Manager","tags":["Users"],"x-roles":["admin","accountOwner"]}},"/v2/users/{userId}/role":{"put":{"description":"**Allowed Scopes**: _`experimental:user:role:manage`_\n\nMake a user of the company the token resolves to a `requester` or a `controller` in that company: the user gets that role and loses the other one. Only users whose roles in the company are `requester` and/or `controller` can be changed, and never the user the token acts on behalf of, so the `admin` and `accountOwner` roles are never granted or removed. Companies whose users are managed by an HRIS integration are refused.\n\nSend the user's roles as you last read them (`roles` on the user) in `currentRoles`: the change is only applied if they still are the user's roles. Otherwise, because the roles were changed in the meantime, `409` is returned and nothing changes: read the user again and decide whether to retry. Asking for the role the user already has changes nothing.","operationId":"v2-update-user-role","parameters":[{"description":"ID of the user to update.","in":"path","name":"userId","required":true,"schema":{"type":"string"}},{"description":"ID of the company the request acts on. Required with an organisation-level token; not needed with a company-level token.","in":"header","name":"X-Company-Id","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"currentRoles":{"description":"The user's roles in the company, as you last read them.","items":{"enum":["requester","controller","admin","accountOwner","travelManager"],"type":"string"},"type":"array"},"role":{"description":"The role the user gets in the company.","enum":["requester","controller"],"type":"string"}},"required":["role","currentRoles"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"data":{"additionalProperties":false,"properties":{"id":{"description":"ID of the user.","type":"string"},"roles":{"description":"The user's roles in the company.","items":{"enum":["requester","controller","admin","accountOwner","travelManager"],"type":"string"},"type":"array"}},"required":["id","roles"],"type":"object"}},"required":["data"],"type":"object"}}},"description":"Default Response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/badRequest"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/unauthorized"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/forbidden"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notFound"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conflict"}}},"description":"Conflict"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/tooManyRequests"}}},"description":"Too Many Requests","headers":{"retry-after":{"description":"Seconds to wait before retrying the request.","schema":{"type":"integer"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internalServerError"}}},"description":"Internal Server Error"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/serviceUnavailableError"}}},"description":"Service Unavailable"}},"security":[{"Authentication":["experimental:user:role:manage"]}],"summary":"Update User Role","tags":["Users"],"x-roles":["admin","accountOwner"]}}},"servers":[{"description":"Production","url":"https://public-api.spendesk.com"},{"description":"Sandbox","url":"https://public-api.demo.spendesk.com"}],"tags":[{"description":"How to get an access token: Public API credentials (API keys) exchanged with HTTP Basic authentication, or OAuth 2.0 for partner apps — authorization code with PKCE, the token endpoint (code exchange and refresh), dynamic client registration and discovery metadata. Part of: [How to Authenticate](/reference/how-to-authenticate).","name":"Authentication"},{"description":"The companies (legal entities) of an organisation. Requires an organisation-level token (experimental). Part of: [Organisation-level access](/reference/organisation-level-access).","name":"Companies"},{"description":"Payables — invoices, credit notes, card purchases and expense claims — with their attachments. Retrieve them in bulk through snapshots, search them, read one by ID; experimental endpoints let accounting integrations update accounting fields, mark payables ready and write their bookkeeping status back. Part of: [Retrieving Spend Data](/reference/retrieving-snapshots-of-payables), [Building an accounting integration](/reference/building-an-accounting-integration).","name":"Payables"},{"description":"Money movements on the Spendesk wallet: settlements (payments) and their export state, bank fees, wallet loads and the wallet summary. Part of: [What is Spend Data?](/reference/how-to-use-spend-data), [Building an accounting integration](/reference/building-an-accounting-integration).","name":"Settlements and wallet"},{"description":"Experimental: generate purchase and bank journals from the company's templates, download them, and check which entities are exported. Part of: [Exporting accounting data](/reference/exporting-accounting-data).","name":"Accounting exports"},{"description":"Experimental chart of accounts: read, create, update, bulk-sync and archive accounts, set their purpose, and assign suppliers and employees to their accounts. Part of: [Building an accounting integration](/reference/building-an-accounting-integration).","name":"Chart of accounts"},{"description":"Experimental: store and look up the IDs your ERP gives to Spendesk objects — suppliers, cost centers, expense categories, analytical fields and values, accounts — per provider. Part of: [Building an accounting integration](/reference/building-an-accounting-integration).","name":"External references"},{"description":"Suppliers of a company: read them with `supplier:read`; create, update, archive and unarchive them with `experimental:supplier:manage`. Part of: [Building an accounting integration](/reference/building-an-accounting-integration).","name":"Suppliers"},{"description":"Members of a company: read them with `user:read`; update their name, cost center and manager with `experimental:user:manage`; change their role with `experimental:user:role:manage`.","name":"Users"},{"description":"Cost centers and analytical fields used to categorise spend. The `v1` endpoints read analytical fields and manage cost centers; the experimental `v2` endpoints also create, update and delete analytical fields and their values. Part of: [Building an accounting integration](/reference/building-an-accounting-integration).","name":"Analytical fields and cost centers"},{"description":"Expense categories. `v1` reads them; the experimental `v2` endpoints manage expense category fields and their categories. Part of: [Building an accounting integration](/reference/building-an-accounting-integration).","name":"Expense categories"},{"description":"Experimental purchase orders: list, retrieve, create, cancel and close them, and download a purchase order's document.","name":"Purchase orders"},{"description":"Experimental supplier invoices and invoice intake: send invoices and credit notes to a company's inbox by uploading their file, track the intakes, then list, summarise and retrieve the invoices.","name":"Invoices and intakes"},{"description":"Experimental: cards, their blocking history, and the order of a physical card.","name":"Cards"},{"description":"Experimental: spend requests, and successful and failed card transactions.","name":"Requests and transactions"},{"description":"Experimental webhook instances: subscribe an endpoint to payable and settlement events, and list, update or delete instances. Part of: [Using webhooks](/reference/using-webhooks), [Building an accounting integration](/reference/building-an-accounting-integration).","name":"Webhooks"},{"description":"The Spendesk MCP server (Streamable HTTP transport), for AI assistants connected through OAuth 2.0.","name":"MCP"}],"webhooks":{"payables-created":{"post":{"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/webhookPayable"}}},"description":"Event linking to a newly created payable. Use `/v1/payables/{id}` to get the full details."},"responses":{"200":{"description":"Return a 2xx status to indicate that the data was received successfully"}}}},"payables-prepared":{"post":{"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/webhookPayable"}}},"description":"Event linking to a payable that has been prepared (`eventType` is `prepared`). Use `/v1/payables/{id}` to get the full details."},"responses":{"200":{"description":"Return a 2xx status to indicate that the data was received successfully"}}}},"settlement-created":{"post":{"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/webhookSettlement"}}},"description":"Event linking to a newly created settlement. Use `/v1/settlements` to get the full details by filtering by id."},"responses":{"200":{"description":"Return a 2xx status to indicate that the data was received successfully"}}}}}}