Create a purchase request
Operation ID: createPurchaseRequest
Group: Accounting › Purchase Requests
Open in the interactive reference
POST /accounting/purchase-requests
Retry-safe: A write that accepts Idempotency-Key: repeating a request with the same key replays the stored answer instead of executing twice.
Creates a purchase request. The purchase request is created with its lines, and the response contains only its id. The request starts as 'pendingApproval' and then goes through your tenant's approval policy, which approves it at once when no approvers are configured.
Each line is an item line or an expense line, set by isItem. An item line is priced by quantity times price and uses itemId and unitOfMeasureId. An expense line is priced by editableAmount.
If your tenant makes department required, send departmentId on every line. If it makes any other tag dimension required, this endpoint can't create the request. Either failure returns an error that has no code in the error list.
To stop a purchase request, reject it with POST accounting/purchase-requests/:id/reject.
To see the request, including its purchaseRequestNumber, use GET accounting/purchase-requests/:id.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Api-Version |
header | string · 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. Example: "8f2c1d40-5a6b-4c7d-9e80-1f2a3b4c5d6e". |
currency |
string | yes | The currency of the request. Format ISO 4217, for example 'USD'. Governs every line amount. Example: "EUR". |
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 people/departments/:id. |
description |
string | no | A public-facing description of the request. Example: "Replacement laptops". |
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 |
date | no | The date the goods or services are required by. Use format YYYY-MM-DD. Example: "2026-10-15". |
startDate |
date | no | The date the request starts. Use format YYYY-MM-DD. |
endDate |
date | no | The date the request ends. Use format YYYY-MM-DD. |
lines |
array<object> | yes | The lines this request asks for. At least one is required. Example: [{"isItem":false,"description":"Laptop","editableAmount":"1800.00","priority":"high"}]. |
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 people/departments/:id. |
lines[].quantity |
decimal | no | The requested quantity, as a decimal. |
lines[].price |
decimal | no | The unit price, in the request currency, as a decimal. |
lines[].editableAmount |
decimal | no | The manually entered line amount, in the request currency, as a decimal. |
lines[].needByDate |
date | no | The date this line is needed by. Use format YYYY-MM-DD. |
lines[].deliveryDate |
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<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. |
{
"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. Example: "5f8a2c31-6b07-4d92-a4e8-1c93b0f7d254". |
{
"data": {
"id": "5f8a2c31-6b07-4d92-a4e8-1c93b0f7d254"
},
"diagnostics": [
{
"code": "<code>",
"message": "<message>",
"severity": "error",
"path": [
"<path>"
],
"details": "<details>"
}
]
}
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— The request carries no valid access token.403— 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 requests from this client address. The response has no body and noRetry-Afterheader.500— Internal server error