Tring API
Issue Israeli tax documents from your code: receipts, tax invoices, tax invoice / receipts, credit notes and transaction invoices. Tring computes the amounts and the VAT, numbers the document, signs it and keeps it. Your system sends what was sold or received.
import { Tring } from 'tring-sdk';
const tring = new Tring(); // TRING_API_KEY=kbl_test_...
const { draft } = await tring.prepareDraft(issuerId, receipt, { idempotencyKey: 'order-1001-receipt' });
const { document } = await tring.confirmDraft(draft.id);from tring_sdk import Tring
tring = Tring() # TRING_API_KEY=kbl_test_...
draft = tring.prepare_draft(issuer_id, receipt, idempotency_key="order-1001-receipt")["draft"]
document = tring.confirm_draft(draft["id"])["document"]curl -sS -X POST "$TRING_BASE_URL/v1/issuers/$TRING_ISSUER_ID/drafts" \
-H "Authorization: Bearer $TRING_API_KEY" \
-H "Idempotency-Key: order-1001-receipt" \
-H "Content-Type: application/json" --data @receipt.jsonWhere to start
| Page | What it covers |
|---|---|
| Quickstart | A sandbox key, install, your first receipt in curl, JavaScript or Python |
| Issuing documents | Prepare and confirm, the Idempotency-Key, what to do when the outcome is unknown, the five types, corrections |
| Webhooks and events | Signed notices when a document is issued or downloaded, checking them, reading events after a gap |
| SDKs | Configuration, retries, errors, pagination, helpers, webhook signatures |
| AI agents and MCP | Connect Claude Code or Cursor; how issuing stays behind a person's approval |
| API reference | Every operation, its SDK method and its error codes |
Five rules
- Issuing is two calls: prepare computes a draft and issues nothing; confirm issues it.
- One
Idempotency-Keyper document, made from your order number and stored before the first call. - When a confirm gets no answer, send the same confirm again. Never prepare again under a new key.
- Amounts are text with two decimals (
"118.00"), quantities with four ("1.0000"). - Build against the sandbox: its keys start with
kbl_test_. Production is a new address and akbl_live_key.
Packages
| Package | Install |
|---|---|
| TypeScript / JavaScript SDK (Node 18+) | npm install tring-sdk |
| Python SDK (3.9+) | pip install tring-sdk |
| MCP server for AI agents | npx -y tring-mcp |
| Local mock of the API | npx tring-mock-server |
All four are generated from the same OpenAPI spec. For AI tools there is llms.txt and llms-full.txt.