# Tring API > Tring issues Israeli tax documents (receipts, tax invoices, credit notes) through a JSON API, as software registered with the Israel Tax Authority. Official SDKs for TypeScript (`tring-sdk`) and Python (`tring-sdk`, import `tring_sdk`), an MCP server (`tring-mcp`) and a local mock (`tring-mock-server`). Rules an agent must follow when writing code against this API: - Issuing is two calls: prepare (`POST /v1/issuers/{issuerId}/drafts`, issues nothing) then confirm (`POST /v1/drafts/{draftId}/confirm`, issues). There is no single-call issue. Show the prepared draft to a person before confirming when a person is in the loop. - Every prepare needs an `Idempotency-Key` header: one key per document, made from the order number (for example `order-1001-receipt`) and stored before the first call. - If a confirm times out, the connection drops, or it answers 504 `OUTCOME_UNKNOWN`: send the same confirm again. Never prepare again under a new key; that can issue a second document. - Amounts are JSON strings with exactly two decimals (`"118.00"`), quantities with four (`"1.0000"`). A JSON number is refused, never rounded. - Unknown fields are refused (`FIELD_UNKNOWN`). Match errors on `error.code`, never on the message. Honour `Retry-After`. - Send `customer.externalRef` or `customer.key` on every document. - A route that takes a file (`PUT /v1/issuers/{issuerId}/expenses/{expenseId}/receipt`) takes the file itself as the body, with its media type (`image/jpeg`, `image/png`, `application/pdf`), never JSON (415 `UNSUPPORTED_MEDIA_TYPE`). The SDKs take bytes, a Blob or a path and read the media type from the first bytes; a file that is not what it was sent as is refused (422 `EXPENSE_REFUSED`, `file-kind`). - Sandbox keys start with `kbl_test_`; production keys with `kbl_live_`. Build against the sandbox. Never put a key in code, logs or URLs. - Each key holds scopes (`read`, `issue`, `delivery`, `records`, `businesses`, `webhooks`, `finance`, `expenses`); every operation needs one (`x-required-scope` in the spec). 403 `KEY_SCOPE_MISSING` names the missing scope: fix the key in the portal, do not retry. - Webhooks: check `Tring-Signature` (`t=,v1=`, HMAC-SHA256 of `.` plus the raw body, 300 s tolerance) on the raw bytes before parsing; answer 2xx within 10 s; do nothing twice for one event `id`; read details with the API, a notice holds identifiers only. `GET /v1/events?after=` catches up after a gap. - A document is final. Corrections are new documents (credit note 330, cancelling receipt 400 with `corrects`); cancellation only before the original left the business. ## Docs - [Tring API](https://developers.tring.co.il/en/): Issue Israeli receipts and invoices from your code: a JSON API, SDKs for TypeScript and Python, and an MCP server for AI coding agents. - [Quickstart](https://developers.tring.co.il/en/quickstart.html): From a sandbox key to an issued receipt in five minutes, with curl, JavaScript or Python. - [Issuing documents](https://developers.tring.co.il/en/issuing.html): Prepare and confirm, the Idempotency-Key, unknown outcomes, the five document types, amounts, customers, corrections and delivery. - [Webhooks and events](https://developers.tring.co.il/en/webhooks.html): Signed notices when a document is issued, downloaded or cancelled; checking the Tring-Signature header; retries, rotation and reading events after a gap. - [SDKs](https://developers.tring.co.il/en/sdks.html): The official TypeScript and Python SDKs: configuration, method names, retries, errors, pagination, helpers and webhook signature verification. - [AI agents and MCP](https://developers.tring.co.il/en/ai.html): Connect Claude Code or Cursor to Tring with the MCP server. Agents read and prepare; issuing waits for a person's approval of the exact draft. ## Reference - [API reference](https://developers.tring.co.il/en/reference.html): every operation, its SDK method and its error codes - [OpenAPI 3.1 spec](https://developers.tring.co.il/openapi.json): the source of truth for every route, field and answer - [Full docs as one text file](https://developers.tring.co.il/llms-full.txt) ## Optional - [Hebrew docs](https://developers.tring.co.il/): the same pages in Hebrew