Purchase Documents
The buy side: purchase orders, purchase receipts (goods received) and supplier invoices. Same document engine as the sales side, keyed to a vendor instead of a client.
Use cases: Use these to mirror procurement into Glance, to receive goods into stock, and to reconcile supplier invoices against what was ordered and received.
GET
/purchaseList purchase documents.
A bare array, not an envelope — **this endpoint is not paginated**, and `limit`/`offset`/`page` are ignored. Narrow it with `startDate`/`endDate` or `vendorId` instead. `isOpen`, `remainingAmount` and `coveredAmount` are computed per document, not stored.
Query Parameters
| Name | Type | Description | |
|---|---|---|---|
type | string | Document type: "purchaseOrder", "purchaseReceipt" or "supplierInvoice". Accepts a comma-separated list, or "ALL". An unrecognised value is ignored rather than rejected. | |
startDate | string | Only documents created on or after this date (YYYY-MM-DD). | |
endDate | string | Only documents created on or before this date (YYYY-MM-DD). | |
vendorId | number | Only documents for this vendor (numeric entity id). | |
withRelated | string | "1" for only documents that are linked to another document, "0" for only documents that are not. Anything else is ignored. |
Request
curl -X GET "https://api.glance.co.il/purchase" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Response
Response
[
{
"id": 84990,
"visibleId": "5c2a7e10-9b3d-4e21-8f7a-0c1d2e3f4a5b",
"type": "SUPPLIER_INVOICE",
"number": 318,
"entityId": 8801,
"amount": 12500,
"tax": 2250,
"totalWithTax": 14750,
"creationDate": "2026-08-10T09:00:00.000Z",
"raw": {
"…": "the document body"
},
"vendor": {
"id": 8801,
"name": "ספקי הצפון בע״מ"
},
"url": "https://files.glance.co.il/purchase/318.pdf",
"file": {
"id": 90455,
"remoteUrl": "https://…"
},
"isOpen": true,
"remainingAmount": 14750,
"coveredAmount": 0,
"remainingProducts": [],
"coveredProducts": []
}
]GET
/purchase/id/:visibleIdGet a single purchase document.
Returned flat. `purchaseOrderNumbers` appears only when the document descends from purchase orders. 404 DOCUMENT_NOT_FOUND if the id is unknown.
Path Parameters
| Name | Type | Description | |
|---|---|---|---|
visibleId | string | required | The document's `visibleId`. |
Request
curl -X GET "https://api.glance.co.il/purchase/id/:visibleId" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Response
Response
{
"id": 84990,
"visibleId": "5c2a7e10-9b3d-4e21-8f7a-0c1d2e3f4a5b",
"type": "SUPPLIER_INVOICE",
"number": 318,
"amount": 12500,
"tax": 2250,
"totalWithTax": 14750,
"creationDate": "2026-08-10T09:00:00.000Z",
"raw": {
"…": "the document body, including its line items"
},
"vendor": {
"id": 8801,
"name": "ספקי הצפון בע״מ",
"taxId": "514789632"
},
"url": "https://files.glance.co.il/purchase/318.pdf",
"isOpen": true,
"remainingAmount": 14750,
"coveredAmount": 0,
"remainingProducts": [],
"coveredProducts": [],
"purchaseOrderNumbers": "104, 106"
}POST
/purchase/create/{type}Create a purchase document.
The body is validated strictly: **an unrecognised field is a 400, not a warning**. Send only the fields listed here.
`POST /purchase/preview/{type}` takes the same body and renders the PDF without creating anything.
The response is the created document, flat, with the generated PDF's `fileId`, `fileUrl` and `filePath` added — the same shape as `POST /documents/create/{type}`.
Path Parameters
| Name | Type | Description | |
|---|---|---|---|
type | string | required | One of "purchaseOrder", "purchaseReceipt" or "supplierInvoice". These three are the whole set — there is no purchase-side refund or credit document. |
Body Parameters
| Name | Type | Description | |
|---|---|---|---|
vendorId | number | required | The vendor's numeric entity id — not their `visibleId`. There is no inline-vendor form here: the vendor must exist first. |
products | object[] | required | The line items. At least one is required. |
description | string | required | Line description. |
units | number | required | Quantity. |
price | number | required | Price per unit. |
sku | string | Product SKU, to link the line to your catalogue. | |
typeOfUnit | string | Unit label. | |
discount | number | Discount amount. | |
discountOn | string | "unit" or "row". | |
discountType | string | "absolute" or "percents". | |
warehouseId | number | Warehouse to receive the goods into. | |
categoryId | number | Expense category for this line. | |
currencyCode | string | Three-letter currency for this line. Omit to use the document currency. | |
beforeTax | boolean | Whether the line price is quoted before tax. | |
serialNumbers | string[] | Serial numbers received on this line. | |
customFields | object[] | Per-line custom values, each a `{ label, value }` pair. | |
title | string | Document title. | |
date | string | Document date (YYYY-MM-DD). Defaults to today. | |
payBy | string | Due date (YYYY-MM-DD). Supplier invoices only. | |
customerOrderNumber | string | Your order number at the vendor. | |
currencyCode | string | Three-letter document currency. | |
exchangeRates | object | Manual exchange-rate override, as `{ "USD": 3.62 }`. Omit to use the company's rate policy. | |
tax | number | VAT rate override for the document. | |
isVatExempt | boolean | Issue the document VAT-exempt. | |
discount | number | Document-level discount. | |
discountType | string | "absolute" or "percents". | |
taxMode | string | "beforeTax" (prices exclude VAT) or "includeTax" (prices include it). | |
notes | string | Notes printed on the document. | |
textAboveProducts | string | Free text printed above the line items. | |
language | string | "he" or "en" — the language the PDF is rendered in. | |
relatedDocuments | object[] | Documents this one draws from — a receipt against its orders, an invoice against its receipts. Not accepted on `purchaseOrder`, which starts a chain rather than continuing one. | |
id | number | required | The related document's numeric id. |
amount | number | How much of it this document covers. | |
products | object[] | Which of its lines, as `{ uuid, units }` — for covering a document partially. | |
skipInventoryActions | boolean | Create the document without moving stock. Defaults to false. | |
withSignature | string[] | Which signature blocks to print: "company", "client". | |
signatureFileId | number | Id of an uploaded signature image. | |
producerType | string[] | Who is credited as producing the document: "user", "platform". | |
sendToClient | boolean | Email the document to the vendor. Defaults to false. | |
emailRecipients | string[] | Extra email recipients. | |
categoryId | number | Document-level expense category. Supplier invoices only. |
Request
curl -X POST "https://api.glance.co.il/purchase/create/{type}" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"vendorId": 0,
"products": "example_products",
"title": "example_title",
"date": "example_date",
"payBy": "example_payBy",
"customerOrderNumber": "example_customerOrderNumber",
"currencyCode": "example_currencyCode",
"exchangeRates": {},
"tax": 0,
"isVatExempt": true,
"discount": 0,
"discountType": "example_discountType",
"taxMode": "example_taxMode",
"notes": "example_notes",
"textAboveProducts": "example_textAboveProducts",
"language": "example_language",
"relatedDocuments": "example_relatedDocuments",
"skipInventoryActions": true,
"withSignature": "example_withSignature",
"signatureFileId": 0,
"producerType": "example_producerType",
"sendToClient": true,
"emailRecipients": "example_emailRecipients",
"categoryId": 0
}'Response
Response
{
"id": 84991,
"visibleId": "e1b2c3d4-5678-49ab-8cde-f0123456789a",
"type": "SUPPLIER_INVOICE",
"number": 319,
"amount": 7020,
"tax": 1263.6,
"totalWithTax": 8283.6,
"creationDate": "2026-08-24T14:30:00.000Z",
"fileId": 90456,
"fileUrl": "https://files.glance.co.il/purchase/319.pdf",
"filePath": "purchase/319.pdf"
}POST
/purchase/close/:visibleIdClose a purchase document by hand — mark it settled without a covering document.
Same handler as `POST /documents/close/:visibleId`. Closing is an operational decision, not an accounting one: it does not create a payment or a ledger entry.
Path Parameters
| Name | Type | Description | |
|---|---|---|---|
visibleId | string | required | The document's `visibleId`. |
Request
curl -X POST "https://api.glance.co.il/purchase/close/:visibleId" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Response
Response
{
"success": true,
"message": "המסמך נסגר בהצלחה"
}GET
/purchase/settings/:routeDefaults for a new purchase document of the given type: the VAT rate and the timestamp to start from.
`lastDocumentDate` is the last document of that type plus two seconds — the earliest date a new one may carry, since documents of a type must not go backwards. It is `null` when there is no such document yet. `tax` is the company VAT rate, or 0 for an exempt dealer (PATOOR). No document number is returned; numbering is assigned at creation.
Path Parameters
| Name | Type | Description | |
|---|---|---|---|
route | string | required | "purchaseOrder", "purchaseReceipt" or "supplierInvoice". |
Request
curl -X GET "https://api.glance.co.il/purchase/settings/:route" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Response
Response
{
"lastDocumentDate": "2026-08-10T09:00:02.000Z",
"tax": 18
}GET
/purchase/scan/extract-from-file/:fileIdRead a scanned or photographed supplier document and return the fields found in it.
Nothing is created here — this only reads the file. The extraction is metered: each call counts as one scan against the company's plan, so cache the result rather than calling it twice for the same file. Requires the purchase-scanning module.
Path Parameters
| Name | Type | Description | |
|---|---|---|---|
fileId | number | required | Id of a file already uploaded through `POST /files/upload`. |
Request
curl -X GET "https://api.glance.co.il/purchase/scan/extract-from-file/:fileId" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Response
Response
{
"success": true,
"scanData": {
"vendor": {
"name": "ספקי הצפון בע״מ",
"taxId": "514789632"
},
"documentNumber": "318",
"date": "2026-08-10",
"currencyCode": "ILS",
"total": 14750,
"lineItems": [
{
"description": "Widget Pro",
"quantity": 500,
"unitPrice": 25,
"sku": "NORTH-77"
}
]
},
"documentAIResponse": {
"…": "the raw extraction, to pass back to finalize"
}
}POST
/purchase/scan/finalizeTurn a scan into a real purchase document, after you have corrected whatever the extraction got wrong.
`documentVisibleId` is the one field present whatever `documentType` was — read that, and treat the type-specific keys as extras. `purchaseReceiptVisibleId` appears when `addToInventory` also produced a goods-receipt document. This call is gated by the same module as the extract but is not metered again: one scan is billed once, at extract.
Body Parameters
| Name | Type | Description | |
|---|---|---|---|
fileId | number | required | The same file id that was extracted. |
documentType | string | required | "SUPPLIER_INVOICE" (the default), "PURCHASE_RECEIPT" or "PURCHASE_ORDER". |
vendor | object | required | Which vendor the document belongs to. |
vendorId | number | Numeric entity id, when you already know it. | |
taxId | string | Tax id to match an existing vendor by. | |
name | string | Vendor name. | |
createIfMissing | boolean | Create the vendor when no match is found. Defaults to false, in which case an unknown vendor answers VENDOR_NOT_FOUND. | |
header | object | required | The document's own fields. |
title | string | Document title. | |
date | string | Document date (YYYY-MM-DD). | |
documentNumber | string | The vendor's number for this document. | |
currencyCode | string | Three-letter currency code. | |
tax | number | VAT rate. | |
taxMode | string | "beforeTax" (the default) or "includeTax". | |
payBy | string | Due date (YYYY-MM-DD). | |
notes | string | Notes. | |
categoryId | number | Expense category for the document. | |
lineItems | object[] | required | The corrected line items. Each carries `description`, `quantity` and `unitPrice`, plus optionally `vatRate`, the vendor's `sku`, a `productId` to link to an existing product, or a `newProduct` draft (`name`, `sku`, `manufacturerSku`, `categoryId`, `unitCost`, `unit`) to create one. |
addToInventory | boolean | Receive the lines into stock. Defaults to false. When true, `warehouseId` is required and every line needs a `productId` or a `newProduct`. | |
warehouseId | number | Warehouse to receive into. | |
payment | object | Record payment of the invoice at the same time. Supplier invoices only; omitted or `paid: false` leaves the invoice open. Carries `paid`, `paymentMethod` ("cash", "check", "banktransfer", "creditcard"), and then `ledgerId`, `bankAccountId`, `companyCardId`, `checkNumber`, `dueDate` or `paymentDate` as the method requires. | |
documentAIResponse | object | The raw extraction from the extract call, passed back so the document keeps its provenance. |
Request
curl -X POST "https://api.glance.co.il/purchase/scan/finalize" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"fileId": 0,
"documentType": "example_documentType",
"vendor": {},
"header": {},
"lineItems": "example_lineItems",
"addToInventory": true,
"warehouseId": 0,
"payment": {},
"documentAIResponse": {}
}'Response
Response
{
"success": true,
"documentVisibleId": "e1b2c3d4-5678-49ab-8cde-f0123456789a",
"supplierInvoiceVisibleId": "e1b2c3d4-5678-49ab-8cde-f0123456789a",
"supplierInvoiceId": 84991,
"vendorEntityId": 8801,
"purchaseReceiptVisibleId": "9f8e7d6c-5b4a-4321-8765-43210fedcba9",
"paymentRecorded": true
}