Creates a purchase request.
POST /accounting/purchase-requests
Group: Accounting › Purchase Requests · Operation ID: createPurchaseRequest
The response contains only the new request's id. Read the record with GET accounting/purchase-requests/:id if you need its stored state, where purchaseRequestNumber appears once assigned. At least one line is required. Each line is either an item line or an expense line, set by isItem: an item line is priced by quantity times price and takes itemId and unitOfMeasureId, and an expense line is priced by editableAmount. The request is created pendingApproval and then put through your tenant's approval policy, which may resolve it at once when no approvers are configured. Where your tenant marks a tag dimension required, omitting it fails the write with an untyped platform error rather than a declared code. There is no delete endpoint. Retire a request by rejecting it.
Open in the interactive reference
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Api-Version |
header | "v1" |
yes | The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version v1. |
Idempotency-Key |
header | string | no | An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with 400 IDEMPOTENCY_NOT_SUPPORTED rather than silently ignored. |
Request body
Required, application/json: createPurchaseRequestInput.
| Field | Type | Required | Description |
|---|---|---|---|
entityId |
string | yes | The legal entity that owns the request. See id on GET base/entities. |
currency |
string | yes | The currency of the request. Format ISO 4217, for example 'USD'. Governs every line amount. |
vendorId |
string | no | The vendor the request is aimed at, when one is known. See id on GET accounting/vendors/:id. |
departmentId |
string | no | The department the request is raised for. See id on GET departments/:id. |
description |
string | no | A public-facing description of the request. |
internalDescription |
string | no | An internal description, visible only to internal users. |
externalMemo |
string | no | A memo carried onto vendor-facing documents. |
paymentTerms |
string | no | The payment-terms key requested for the resulting order, for example 'net30'. These are tenant data, not a fixed list of values. |
externalId |
string | no | The identifier this request has in the upstream system that produced it. |
needByDate |
string (date) | no | The date the goods or services are required by. Use format YYYY-MM-DD. |
startDate |
string (date) | no | The date the request starts. Use format YYYY-MM-DD. |
endDate |
string (date) | no | The date the request ends. Use format YYYY-MM-DD. |
lines |
array of object | yes | The lines this request asks for. At least one is required. |
lines[].isItem |
boolean | no | True for an item line, priced by quantity times price. False for an expense line, priced by editableAmount. |
lines[].description |
string | no | A description of what is being requested. |
lines[].itemId |
string | no | The item being requested. See id on GET inventory/items/:id. |
lines[].unitOfMeasureId |
string | no | The unit the quantity is expressed in. See id on GET inventory/unit-of-measures/:id. |
lines[].departmentId |
string | no | The department this line is allocated to. See id on GET departments/:id. |
lines[].quantity |
string (decimal) | no | The requested quantity, as a decimal. |
lines[].price |
string (decimal) | no | The unit price, in the request currency, as a decimal. |
lines[].editableAmount |
string (decimal) | no | The manually entered line amount, in the request currency, as a decimal. |
lines[].needByDate |
string (date) | no | The date this line is needed by. Use format YYYY-MM-DD. |
lines[].deliveryDate |
string (date) | no | The expected delivery date for this line. Use format YYYY-MM-DD. |
lines[].priority |
string | no | The urgency of this line. Accepted values: 'high', 'medium', 'low'. |
attachments |
array of object | no | Files to attach to the request. Each names an already-uploaded file by its id. |
attachments[].fileName |
string | yes | The display name of the attached file. |
attachments[].fileId |
string | yes | The identifier of the already-uploaded file. There is no endpoint for it. |
Example:
{
"entityId": "8f2c1d40-5a6b-4c7d-9e80-1f2a3b4c5d6e",
"currency": "EUR",
"vendorId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"departmentId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"description": "Replacement laptops",
"internalDescription": "<internalDescription>",
"externalMemo": "<externalMemo>",
"paymentTerms": "<paymentTerms>",
"externalId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"needByDate": "2026-10-15",
"startDate": "2026-01-15",
"endDate": "2026-01-15",
"lines": [
{
"isItem": false,
"description": "Laptop",
"editableAmount": "1800.00",
"priority": "high"
}
],
"attachments": [
{
"fileName": "<fileName>",
"fileId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
]
}
Response
200 Success
Under data (createPurchaseRequestOutput):
| Field | Type | Required | Description |
|---|---|---|---|
id |
string | yes | The unique identifier for the created purchase request. |
Response headers
Idempotency-Replayed— Present andtrueonly when this response replays a previously stored one for the same Idempotency-Key, rather than reflecting a live execution. Absent on a live response - never sent asfalse.
Errors
| Code | Status |
|---|---|
REFERENCE_NOT_FOUND |
400 |
TOO_MANY_LINES |
400 |
IDEMPOTENCY_KEY_CONFLICT |
409 |
IDEMPOTENCY_PAYLOAD_MISMATCH |
422 |
Statuses
400— Invalid request or business failure. Codes: REFERENCE_NOT_FOUND, TOO_MANY_LINES401— Missing or invalid access token403— Not authorized404— Not found409— The Idempotency-Key is still being processed by another request.422— The Idempotency-Key was already used with a different request payload.429— Too many requests500— Internal server error