import { issueDocument } from './billos.js'
const BASE = 'https://api.billos.co.il/v1'
const headers = { 'X-Api-Key': 'bk_live_xxxxxxxx', 'Content-Type': 'application/json' }
const { document } = await fetch(`${BASE}/businesses/${bid}/documents`, {
method: 'POST', headers,
body: JSON.stringify({
docType: 320, priceMode: 'gross',
party: { name: 'דנה לוי', phone: '0521111111' },
lines: [{ description: 'איפור ערב', quantity: 1, unitPriceExVat: 35000 }],
payments: [{ method: 3, amount: 35000 }],
}),
}).then((r) => r.json())
const issued = await fetch(`${BASE}/businesses/${bid}/documents/${document.id}/issue`, {
method: 'POST', headers,
}).then((r) => r.json())
console.log(issued.document.docNumber) // 1042
BASE=https://api.billos.co.il/v1
# draft: a ₪350 invoice/receipt, paid by card
curl -X POST $BASE/businesses/$BID/documents \
-H "X-Api-Key: bk_live_xxxxxxxx" \
-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 }]
}'
# issue: the legal number is assigned, the PDF is signed
curl -X POST $BASE/businesses/$BID/documents/$DOC/issue \
-H "X-Api-Key: bk_live_xxxxxxxx"
import os, requests
API = "https://api.billos.co.il/v1"
H = {"X-Api-Key": os.environ["BILLOS_KEY"]}
doc = requests.post(f"{API}/businesses/{bid}/documents", headers=H, json={
"docType": 320, "priceMode": "gross",
"party": {"name": "דנה לוי", "phone": "0521111111"},
"lines": [{"description": "איפור ערב", "quantity": 1, "unitPriceExVat": 35000}],
"payments": [{"method": 3, "amount": 35000}],
}).json()["document"]
issued = requests.post(f"{API}/businesses/{bid}/documents/{doc['id']}/issue", headers=H).json()
print(issued["document"]["docNumber"]) # 1042
$ npm install -g billos
$ billos login
a code appears, approve it in the console, the key arrives here
$ billos invoice --customer "דנה לוי" --amount 350 --type invoice-receipt
חשבונית מס/קבלה 1042 · ₪350.00 · דנה לוי
$ billos docs --json | jq '.documents[0].docNumber'
1042
// Claude, Cursor, or anything that speaks MCP: nine tools, the same key, the same ledger
{
"mcpServers": {
"billos": {
"url": "https://api.billos.co.il/mcp",
"headers": { "X-Api-Key": "bk_live_xxxxxxxx" }
}
}
}
// "תוציא קבלה על 350 שקל לדנה לוי" → create_document → חשבונית מס/קבלה 1042