Purchase Orders¶
Endpoints for listing and creating purchase orders documents.
GET /purchase_orders¶
List purchase orders with optional filtering, searching, and pagination.
Request¶
Parameters¶
| Name | In | Type | Required | Description |
|---|---|---|---|---|
nonce |
query | integer (int64) | No | Client-generated unique sequential number |
filterDate |
query | string | No | Filter by date or interval. Format: YYYY-MM-DD or YYYY-MM-DD:YYYY-MM-DD |
searchString |
query | string | No | Search by document number. Example: searchString=123456 |
searchColumn |
query | string | No | Column to search instead of document number |
searchOperator |
query | string | No | Comparison operator: lt, lte, gt, gte, ne; from 7.2.03 also contains |
skip |
query | integer | No | Number of records to skip (pagination) |
limit |
query | integer | No | Max records to return. Max: 1000, default: 50 |
Responses¶
200 — Success¶
Returns an array of supplierDocument objects (empty array if none found).
400 — Invalid input parameters¶
POST /purchase_orders¶
Before 7.2.03
POST /purchase_orders fails: the supplier is looked up among customers and the request is refused with 400 (Clientes: invalid third_party data (record not found ...)). Create purchase orders in Gestix.
Create a new purchase order document.
Request¶
POST /api/{account}/v4.0.0/purchase_orders?nonce={nonce}
Authorization: Bearer <xa-token>
Content-Type: application/json
Parameters¶
| Name | In | Type | Required | Description |
|---|---|---|---|---|
nonce |
query | integer (int64) | Yes | Client-generated unique sequential number |
print |
query | integer | No | Pass 1 to receive the created document as a PDF. Default: 0 |
Request Body¶
A supplierDocument object. Required fields: document_set, seq_number, date, currency, total_amount.
From 7.2.03, send the supplier under supplier, identified by code or email (customer is accepted when supplier is absent). An unknown supplier is refused with 400 (Fornecedores: invalid third_party data (record not found ...)). The document series may require salesperson; without it the request is refused with 400 (Vendedor ...).
{
"document_set": "ENC",
"reference": "PO-2026-0007",
"warehouse": "1",
"currency": "EUR",
"salesperson": "1",
"supplier": {"code": "SUP-COFFEE"},
"items": [
{"item_type": "S", "item_code": "SRV-01", "description": "PO line", "qty": 2, "unit_price": 5.00, "vat": 23}
]
}
Responses¶
202 — Document accepted¶
From 7.2.03. The response has no ID or number: {"status":202,"error":false,"message":"Gestix document accepted"}. Search by your reference to get them.
400 — Invalid input¶
Nothing is stored. See Error Handling for how to read the reason.
409 — Duplicate entry¶
Returned when a document with the same identifier already exists. Nothing is stored. See Error Handling for how to read the reason.