BillOS v1
Console llms.txt OpenAPI
PATCH/businesses/{bid}/documents/{id}

Update a draft

PATCH /businesses/{bid}/documents/{id}

Requires the documents scope.

Drafts only. An issued document answers 409 not_draft; it is immutable at the database engine.

Path parameters

NameTypeDescription
bidstringrequiredBusiness id, from POST /businesses.
idstringrequiredDocument id.

Body

FieldTypeDescription
docTypeintegerrequired305 / 320 / 400. A 330 is created only through the credit-note endpoint. One of: 305, 320, 400.
partyobject{partyId} to reference a saved party, or an inline {name, taxId?, phone?, email?, address?}. Omit entirely for an anonymous cash receipt.
party.partyIdstring
party.namestring
party.taxIdstring
party.phonestring
party.emailstring
party.addressstring
priceModestringnet (the default: line prices are ex-VAT) or gross (line prices include VAT; the total anchors to the gross sum and VAT is derived). Gross is what a consumer-facing price list wants. One of: net, gross. Default net.
linesarray of DocumentLineRequired for 305/320.
paymentsarray of PaymentRequired for 320/400.
notestring≤500 chars.
documentDatestringDefaults to today, Asia/Jerusalem.
valueDatestringDefaults to today.
discountAmountintegerDocument-level discount. Integer agorot (₪1 = 100).
withholdingAmountintegerניכוי במקור. Integer agorot (₪1 = 100).
allocationNumberstringמספר הקצאה, when you already hold one.
externalRefstringIdempotency key, interchangeable with the Idempotency-Key header.

Response

200: { "ok": true, … }

FieldTypeDescription
okbooleanrequired
documentDocumentrequiredA draft is freely mutable. An issued document is immutable forever, blocked at the database engine, not merely in application code.

Errors: 400, 401, 403, 404, 409, 429. Every failure answers { "error": …, "reason": … }. Branch on reason.

PATCH /businesses/{bid}/documents/{id}
curl -X PATCH "$BASE/businesses/$BID/documents/$DOC_ID" \
  -H "X-Api-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "docType": 320,
    "party": {
      "name": "דנה לוי",
      "taxId": "514667426",
      "phone": "0521111111",
      "email": "dana@example.com",
      "address": "הרצל 12, תל אביב"
    },
    "priceMode": "gross",
    "lines": [
      {
        "description": "איפור כלה",
        "quantity": 1,
        "unitPriceExVat": 120000
      }
    ],
    "payments": [
      {
        "method": 3,
        "amount": 190000
      }
    ],
    "externalRef": "order-8812"
  }'
const res = await fetch(`${BASE}/businesses/${BID}/documents/${DOC_ID}`, {
  method: 'PATCH',
  headers: {
    'X-Api-Key': KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "docType": 320,
    "party": {
      "name": "דנה לוי",
      "taxId": "514667426",
      "phone": "0521111111",
      "email": "dana@example.com",
      "address": "הרצל 12, תל אביב"
    },
    "priceMode": "gross",
    "lines": [
      {
        "description": "איפור כלה",
        "quantity": 1,
        "unitPriceExVat": 120000
      }
    ],
    "payments": [
      {
        "method": 3,
        "amount": 190000
      }
    ],
    "externalRef": "order-8812"
  }),
})
const data = await res.json()
if (!data.ok) throw new Error(data.reason)
import requests
res = requests.patch(
    f"{BASE}/businesses/{BID}/documents/{DOC_ID}",
    headers={"X-Api-Key": KEY},
    json={
      "docType": 320,
      "party": {
        "name": "דנה לוי",
        "taxId": "514667426",
        "phone": "0521111111",
        "email": "dana@example.com",
        "address": "הרצל 12, תל אביב"
      },
      "priceMode": "gross",
      "lines": [
        {
          "description": "איפור כלה",
          "quantity": 1,
          "unitPriceExVat": 120000
        }
      ],
      "payments": [
        {
          "method": 3,
          "amount": 190000
        }
      ],
      "externalRef": "order-8812"
    },
)
data = res.json()
Set BASE to https://api.billos.co.il/v1 and KEY to your bk_live_… key, or a bk_test_… key to run it against the sandbox.
Manage your businesses, keys and webhooks in the BillOS Console.