Purchase Documents

Create and manage purchase-side documents: purchase orders, purchase receipts, and supplier invoices.

Use cases: Use purchase documents to manage your procurement workflow, from PO creation through to supplier invoice reconciliation.
GET/purchase

List purchase documents.

Query Parameters

NameTypeDescription
type
stringPurchase document type: "purchaseOrder", "purchaseReceipt", or "supplierInvoice".
page
numberPage number (default 1).
limit
numberItems per page (default 50).

Request

curl -X GET "https://api.glance.co.il/purchase" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response

Response
{
  "data": [
    {
      "visibleId": 501,
      "type": "purchaseOrder",
      "vendor": {
        "visibleId": 1,
        "name": "Supplier Co"
      },
      "total": 12500,
      "date": "2024-03-10",
      "status": "open",
      "createdAt": "2024-03-10T09:00:00Z"
    }
  ],
  "pagination": {
    "total": 35,
    "limit": 50,
    "offset": 0,
    "hasMore": false
  }
}
GET/purchase/id/:visibleId

Get a single purchase document with full details.

Path Parameters

NameTypeDescription
visibleId
numberrequiredThe purchase document visible ID.

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
{
  "data": {
    "visibleId": 501,
    "type": "purchaseOrder",
    "vendor": {
      "visibleId": 1,
      "name": "Supplier Co",
      "taxId": "514000000"
    },
    "products": [
      {
        "description": "Widget Pro - Bulk Order",
        "units": 500,
        "price": 25,
        "sku": "WDG-001"
      }
    ],
    "subtotal": 12500,
    "tax": 2125,
    "total": 14625,
    "date": "2024-03-10",
    "status": "open",
    "createdAt": "2024-03-10T09:00:00Z"
  }
}
POST/purchase/create/{type}

Create a new purchase document.

Path Parameters

NameTypeDescription
type
stringrequiredPurchase document type: "purchaseOrder", "purchaseReceipt", or "supplierInvoice".

Body Parameters

NameTypeDescription
vendorId
numberVisible ID of the vendor.
title
stringDocument title.
products
object[]Array of line items (same structure as sales documents).
description
stringrequiredLine item description.
units
numberrequiredQuantity.
price
numberrequiredPrice per unit.
sku
stringProduct SKU.
date
stringDocument date (YYYY-MM-DD).
tax
numberTax rate override.
notes
stringNotes.
relatedDocuments
object[]Related documents to link.
id
numberRelated document visible ID.
amount
numberAmount from the related document.

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,
  "title": "example_title",
  "products": "example_products",
  "date": "example_date",
  "tax": 0,
  "notes": "example_notes",
  "relatedDocuments": "example_relatedDocuments"
}'

Response

Response
{
  "data": {
    "visibleId": 502,
    "type": "purchaseOrder",
    "vendor": {
      "visibleId": 1,
      "name": "Supplier Co"
    },
    "total": 7020,
    "date": "2024-03-20",
    "status": "open",
    "createdAt": "2024-03-20T14:30:00Z"
  }
}
POST/purchase/close/:visibleId

Close / finalize a purchase document.

Path Parameters

NameTypeDescription
visibleId
numberrequiredThe purchase document visible ID.

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
{
  "data": {
    "visibleId": 501,
    "status": "closed"
  }
}
GET/purchase/settings/:route

Get settings for a purchase document type.

Path Parameters

NameTypeDescription
route
stringrequiredThe purchase document type route (e.g. purchaseOrder).

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
{
  "data": {
    "lastDate": "2024-03-19",
    "taxRate": 17,
    "nextNumber": 503
  }
}