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/purchase

List 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

NameTypeDescription
type
stringDocument type: "purchaseOrder", "purchaseReceipt" or "supplierInvoice". Accepts a comma-separated list, or "ALL". An unrecognised value is ignored rather than rejected.
startDate
stringOnly documents created on or after this date (YYYY-MM-DD).
endDate
stringOnly documents created on or before this date (YYYY-MM-DD).
vendorId
numberOnly 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/:visibleId

Get 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

NameTypeDescription
visibleId
stringrequiredThe 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

NameTypeDescription
type
stringrequiredOne of "purchaseOrder", "purchaseReceipt" or "supplierInvoice". These three are the whole set — there is no purchase-side refund or credit document.

Body Parameters

NameTypeDescription
vendorId
numberrequiredThe vendor's numeric entity id — not their `visibleId`. There is no inline-vendor form here: the vendor must exist first.
products
object[]requiredThe line items. At least one is required.
description
stringrequiredLine description.
units
numberrequiredQuantity.
price
numberrequiredPrice per unit.
sku
stringProduct SKU, to link the line to your catalogue.
typeOfUnit
stringUnit label.
discount
numberDiscount amount.
discountOn
string"unit" or "row".
discountType
string"absolute" or "percents".
warehouseId
numberWarehouse to receive the goods into.
categoryId
numberExpense category for this line.
currencyCode
stringThree-letter currency for this line. Omit to use the document currency.
beforeTax
booleanWhether 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
stringDocument title.
date
stringDocument date (YYYY-MM-DD). Defaults to today.
payBy
stringDue date (YYYY-MM-DD). Supplier invoices only.
customerOrderNumber
stringYour order number at the vendor.
currencyCode
stringThree-letter document currency.
exchangeRates
objectManual exchange-rate override, as `{ "USD": 3.62 }`. Omit to use the company's rate policy.
tax
numberVAT rate override for the document.
isVatExempt
booleanIssue the document VAT-exempt.
discount
numberDocument-level discount.
discountType
string"absolute" or "percents".
taxMode
string"beforeTax" (prices exclude VAT) or "includeTax" (prices include it).
notes
stringNotes printed on the document.
textAboveProducts
stringFree 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
numberrequiredThe related document's numeric id.
amount
numberHow much of it this document covers.
products
object[]Which of its lines, as `{ uuid, units }` — for covering a document partially.
skipInventoryActions
booleanCreate the document without moving stock. Defaults to false.
withSignature
string[]Which signature blocks to print: "company", "client".
signatureFileId
numberId of an uploaded signature image.
producerType
string[]Who is credited as producing the document: "user", "platform".
sendToClient
booleanEmail the document to the vendor. Defaults to false.
emailRecipients
string[]Extra email recipients.
categoryId
numberDocument-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/:visibleId

Close 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

NameTypeDescription
visibleId
stringrequiredThe 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/:route

Defaults 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

NameTypeDescription
route
stringrequired"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/:fileId

Read 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

NameTypeDescription
fileId
numberrequiredId 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/finalize

Turn 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

NameTypeDescription
fileId
numberrequiredThe same file id that was extracted.
documentType
stringrequired"SUPPLIER_INVOICE" (the default), "PURCHASE_RECEIPT" or "PURCHASE_ORDER".
vendor
objectrequiredWhich vendor the document belongs to.
vendorId
numberNumeric entity id, when you already know it.
taxId
stringTax id to match an existing vendor by.
name
stringVendor name.
createIfMissing
booleanCreate the vendor when no match is found. Defaults to false, in which case an unknown vendor answers VENDOR_NOT_FOUND.
header
objectrequiredThe document's own fields.
title
stringDocument title.
date
stringDocument date (YYYY-MM-DD).
documentNumber
stringThe vendor's number for this document.
currencyCode
stringThree-letter currency code.
tax
numberVAT rate.
taxMode
string"beforeTax" (the default) or "includeTax".
payBy
stringDue date (YYYY-MM-DD).
notes
stringNotes.
categoryId
numberExpense category for the document.
lineItems
object[]requiredThe 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
booleanReceive the lines into stock. Defaults to false. When true, `warehouseId` is required and every line needs a `productId` or a `newProduct`.
warehouseId
numberWarehouse to receive into.
payment
objectRecord 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
objectThe 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
}

Last updated