Quickstart: invoice a customer in five calls
BASE="https://api.billos.co.il/v1"; KEY="bk_test_..." # sandbox key; the same script runs against production with your bk_live_ key
# 1. once per end user
BID=$(curl -s -X POST "$BASE/businesses" -H "X-Api-Key: $KEY" -H "Content-Type: application/json" \
-d '{"name":"סטודיו נועה","taxId":"123456782","dealerType":"murshe"}' | jq -r .business.id)
# 2. draft an invoice/receipt for ₪350 incl. VAT, paid by card
DOC=$(curl -s -X POST "$BASE/businesses/$BID/documents" -H "X-Api-Key: $KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: order-1001" -d '{
"docType": 320, "priceMode": "gross",
"party": {"name": "דנה לוי", "phone": "0521111111"},
"lines": [{"description": "איפור ערב", "quantity": 1, "unitPriceExVat": 35000}],
"payments": [{"method": 3, "amount": 35000}]
}' | jq -r .document.id)
# 3. issue (assigns the legal number, signs the PDF)
curl -s -X POST "$BASE/businesses/$BID/documents/$DOC/issue" -H "X-Api-Key: $KEY" | jq .document.docNumber
# 4. download the origin once and send it to the customer
curl -s -X POST "$BASE/businesses/$BID/documents/$DOC/prints" -H "X-Api-Key: $KEY" \
-H "Content-Type: application/json" -d '{"kind":"origin"}' -o invoice.pdf
# 5. later reprints are copies
curl -s -X POST "$BASE/businesses/$BID/documents/$DOC/prints" -H "X-Api-Key: $KEY" \
-H "Content-Type: application/json" -d '{"kind":"copy"}' -o invoice-copy.pdf