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

Preview a draft as PDF

POST /businesses/{bid}/documents/{id}/preview

Requires the documents scope.

The draft rendered as a "טיוטה"-watermarked PDF so your user sees exactly what they are about to issue. Nothing is recorded and no number is consumed. Drafts only. branding and contact stand in for what the page prints, for an editor that shows a look before it is saved.

Path parameters

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

Body (optional)

FieldTypeDescription
brandingBrandingAppearance of the rendered PDF. Stored once per business; a logo is stored as a file and referenced by hash, never re-frozen into each document.
contactobjectThe phone and email to print in this render; an empty value prints the business's own.
contact.phonestring
contact.emailstring

Response

200: raw application/pdf bytes.

Errors: 400, 401, 403, 404, 409, 429. Every failure answers { "error", "reason", "hint", "param", "doc_url", "retryable", "request_id" }: branch on reason, and read hint for what to change (https://docs.billos.co.il/errors.md).

POST /businesses/{bid}/documents/{id}/preview
curl -X POST "$BASE/businesses/$BID/documents/$DOC_ID/preview" \
  -H "X-Api-Key: $KEY"
  -o document.pdf
const res = await fetch(`${BASE}/businesses/${BID}/documents/${DOC_ID}/preview`, {
  method: 'POST',
  headers: {
    'X-Api-Key': KEY,
  },
})
const pdf = Buffer.from(await res.arrayBuffer())
import requests
res = requests.post(
    f"{BASE}/businesses/{BID}/documents/{DOC_ID}/preview",
    headers={"X-Api-Key": KEY},
)
open("document.pdf", "wb").write(res.content)
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.