Connected apps API
A business's own shop, website or app sends Tracery each sale, payment and refund as it happens, and Tracery keeps them in the books as invoices, money received and credit notes, with every check it makes on its own. Calls go to https://api.tracery.in.
Version 1.0.0, updated 12 November 2026
Before you start
The API is for a business's own product: a shop, a website that sells plans, an app that takes payments. Its server tells Tracery of each sale, payment and refund as it happens, and Tracery keeps them in the business's books as invoices, money received and credit notes, after every check it makes on its own.
Each call carries a key the business makes in Tracery: in the menu, open Settings, then Access and data, then Connected apps. Someone who manages the business's settings adds your app there and makes its key; if Connected apps is not there yet, the business's owner asks Tracery support to switch it on. Tracery shows the key whole once, when it is made, and keeps only a hash of it, so a lost key is replaced, never read back.
- A test key, starting trk_test_, runs every check a live key runs and saves nothing. Build against it first.
- A live key, starting trk_live_, saves what your app sends into the books.
- An app has one key of each kind in use. When one is replaced, the old key works on for as long as the person chose (not at all, an hour, a day or a week), so your servers move over with no call refused.
- Call Tracery from your server only. A call from a web page is refused, so the key never reaches a browser.
Your first call
Keep the key in an environment variable on your server, here TRACERY_KEY, and send it as a bearer token. The first call shows the key works, which app and business it is for, and whether it saves.
Who this key belongs to
GET/apps/v1/me
The first call to make: it shows the key works, which app and business it is for, and whether it is a live key or a test key.
curl https://api.tracery.in/apps/v1/me \-H "Authorization: Bearer $TRACERY_KEY"What comes back
- 200 The app and its business
- 401, 403, 409, 429 Refused, each for the reason under Refusals
{"app": {"id": "app_01kqetk0j2w79nb1zn1rzxacah","name": "Shop website"},"numbers": "app","business": {"name": "Apple Inc"},"mode": "live","saves": true,"callsAMinute": 600}app- object
- The app the key is for.
app.id- text
- Tracery's ID of the app.
app.name- text
- The name the business gave the app in Tracery.
business- object
- The business whose books the app writes to.
business.name- text
- The business's name in Tracery.
mode- one of
- live keys save what the app sends. test keys check it the same way and save nothing.
live,test saves- true or false
- Whether calls with this key save anything: true for a live key.
callsAMinute- whole number
- How many calls the app may make in a minute before it is asked to wait.
numbers- one of
- Who numbers the invoices and credit notes the app sends. app: send invoiceNumber and creditNoteNumber. tracery: leave them out; Tracery numbers, prints and keeps each one, and gives its number and PDF back. The business sets it in Tracery.
app,tracery
How calls work
Your own IDs
A sale, payment and refund each go under your own ID for it, in the address: 1 to 64 letters, digits, ".", "_", ":" or "-", starting with a letter or digit. Your order ID is a good one.
Safe to send again
Sending the same sale, payment or refund again changes nothing and answers what Tracery holds, as unchanged. When a call fails or times out, send it again.
What cannot change
An issued invoice or credit note is not changed. The same ID sent with other values is refused with 409, naming each field that differs. Only an e-invoice, or a fee learnt later, may be added by sending the same call again.
Amounts and dates
Send an amount as a number or as its digits in text, such as 1180.5 or "1180.50", with no commas. Answers give every amount as text, such as "1180.00". Dates are calendar days, such as 2026-11-02.
Refusals
A refused call answers with a code and a message in words. A wrong or missing field is answered 422 with each field named at its path, such as lines.0.taxable. A field Tracery does not know is refused too, so a typing slip is never dropped quietly.
Size and pace
A call is at most 256 KB, and an app may make 600 calls a minute. Past that, calls are answered 429 with a Retry-After header: wait that many seconds, then send again.
Who numbers invoices
The business chooses, in Tracery, who numbers the invoices and credit notes of your app. The first call says which, as numbers.
- app: your app numbers them. Send invoiceNumber with each sale and creditNoteNumber with each refund. Tracery records them as issued outside Tracery, under your numbers.
- tracery: leave the numbers out. Tracery issues each one under the business's next number, prints it, keeps it, and gives the number and the PDF's address back. Send buyer.email and Tracery emails it to the buyer from the business; the answer's email says whether it went.
Sales
A sale becomes an invoice in the books, or a bill of supply when nothing on it is taxed. Send each sale once it is made, whether or not it is paid.
Send a sale: its invoice
PUT/apps/v1/sales/{saleId}
Send the sale under your own ID for it. The first call makes its invoice in the books, after every check Tracery makes on its own invoices: recorded as issued outside Tracery under your app's number, or, where the business has Tracery number your app's invoices, issued by Tracery under its next number and printed, with the number and the PDF's address in the answer. When Tracery already holds your invoice under its number, recorded by a person or from a file, the sale is tied to it once its date, total and buyer agree, and nothing new is recorded; when they do not agree it is refused, naming the invoice. Sending the same sale again changes nothing and answers what Tracery holds, so it is safe to send again when unsure. Other values under the same ID are refused with 409, as an issued invoice is not changed; only its e-invoice may come later, with the same sale sent again. With a test key every check runs and nothing is saved.
In the address
saleId- text
- Your own ID for the sale, such as your order ID.
In the body
invoiceNumber- text
- The number your app gave the invoice: up to 16 letters, digits, "-" and "/", and not used by another document of the financial year. Needed while your app numbers its own invoices; left out where the business has Tracery number them, as Tracery gives the number. A sale sent again may leave it out, or send the number it has.
date- date, needed
- The date on the invoice.
dueDate- date
- Left out, the invoice is due on its date.
currency- text
- Left out, the sale is in rupees. A sale to a buyer in India is in rupees.
exchangeRate- number or text
- Only for a sale in another currency: rupees for one unit of it. Left out, Tracery looks the rate up for the invoice date, as it does for its own invoices.
gstin- text
- Which of the business's own GSTINs the invoice was issued under. Left out, its usual one.
buyer- object, needed
- Who bought: a business with its GSTIN, or a person, in India or abroad.
buyer.name- text
- The name of the buyer, as the invoice prints it. Needed with a GSTIN no client in Tracery has yet, as the client is made from it. Left out, the invoice carries the name of the client the buyer is kept under.
buyer.gstin- text
- The GSTIN of a buyer registered under GST. With one, the buyer is a client in Tracery: the client with this GSTIN, or a new one made from the name. Without one, the buyer stays on the sale.
buyer.country- text
- The two letter country code. Left out, the buyer is in India.
buyer.state- text
- The state of a buyer in India, as its GST code or name. Left out, it is the state of the GSTIN. A buyer in India with no GSTIN needs it, or a place of supply.
buyer.address- object
- The buyer's address, as the invoice keeps it. Left out, it keeps none.
buyer.address.line1- text, needed
- The first line of the address.
buyer.address.line2- text
- A second line, when the address needs one.
buyer.address.city- text, needed
- The town or city.
buyer.address.postalCode- text
- The 6 digit PIN code of a buyer in India, or the postal code of one abroad.
buyer.address.region- text
- The state or province of a buyer abroad.
buyer.email- text
- Where Tracery emails the invoice, with its PDF, from the business. Only where the business has Tracery number your app's invoices, as Tracery never emails one your app numbered; the credit note of a refund goes to the same address. Left out, nothing is emailed.
placeOfSupply- text
- Where the supply is made, when it is not the buyer's own state. Left out for a buyer abroad.
lines- list of objects, needed
- What was sold, a line for each kind of goods or service, up to 100.
lines[].description- text
- What was sold. Left out, the name of the HSN or SAC code is used.
lines[].hsnSac- whole number or text
- The HSN code of goods or the SAC code of a service, 4 to 8 digits.
lines[].quantity- number or text
- Left out, the quantity is 1. The taxable value is for the whole line.
lines[].unit- text
- For goods, the unit GST returns count them in, such as NOS or KGS.
lines[].taxable- number or text, needed
- The value of the line before GST, after any discount.
lines[].gstRate- number or text, needed
- The GST rate as a percent: 18, "18" or "18%". For a line with no GST, "Exempt", "Nil rated" or "Non-GST"; 0 reads as nil rated. For a sale to a buyer abroad, send the rate the supply carries in India, such as 18: an export is zero rated, so no GST is added.
lines[].servicePeriod- object
- The days a service line is for, such as a year of a plan. Its income is spread evenly over them at the year end, as AS 9 asks. Printed under the line. Only a service line has one.
lines[].servicePeriod.from- date, needed
- The first day the line is for.
lines[].servicePeriod.to- date, needed
- The last day the line is for, both days counted.
total- number or text, needed
- The total of the invoice with its GST, in the invoice currency. For a sale to a buyer abroad no GST is added to it. Tracery works the total out from the lines and refuses a sale whose total differs by more than 2 units.
tax- object
- The GST on the invoice, in rupees. Each one sent is checked against what Tracery works out, to a rupee. For a sale to a buyer abroad, send IGST only when the export was made with IGST paid; left out, it is recorded as made under the LUT.
tax.igst- number or text
- IGST, on a supply to another state, or an export with IGST paid.
tax.cgst- number or text
- CGST, on a supply within the business's own state.
tax.sgst- number or text
- SGST or UTGST.
eInvoice- object
- The e-invoice your app got from the IRP for this invoice. It may come with the sale or later: send the same sale again with it. It is not one of the values that must stay the same.
eInvoice.signedQrCode- text, needed
- The Signed QR Code text the IRP gave for this invoice, as it is. Tracery reads the IRN and its date from it, and checks that it names this invoice.
eInvoice.ackNo- text
- The acknowledgement number the IRP gave, digits only.
eInvoice.ackDate- text
- Needed only when the QR code does not say when its IRN was made.
curl -X PUT https://api.tracery.in/apps/v1/sales/order-10042 \-H "Authorization: Bearer $TRACERY_KEY" \-H "Content-Type: application/json" \--data @- <<'JSON'{"invoiceNumber": "SW/26-27/0042","date": "2026-11-02","buyer": {"name": "Anna Thomas","state": "Kerala","address": {"line1": "14 Marine Drive","city": "Kochi","postalCode": "682031"}},"lines": [{"description": "Pro plan, one month","hsnSac": "998314","taxable": "1000.00","gstRate": 18,"servicePeriod": {"from": "2026-11-02","to": "2026-12-01"}}],"total": "1180.00","tax": {"cgst": "90.00","sgst": "90.00"}}JSONWhat comes back
- 200 The sale as Tracery holds it; nothing was added by this call
- 201 The sale, recorded by this call
- 401, 403, 409, 413, 422, 429 Refused, each for the reason under Refusals
{"id": "order-10042","status": "recorded","saved": true,"invoice": {"id": "inv_01kh9zz0e2jd8gtmj76g09f42a","number": "SW/26-27/0042","date": "2026-11-02","kind": "invoice","currency": "INR","total": "1180.00","taxable": "1000.00","paid": "0.00","credited": "0.00","open": "1180.00","igst": "0.00","cgst": "90.00","sgst": "90.00","placeOfSupply": "32","irn": null,"numberedBy": "app","email": null,"link": "https://app.tracery.in/b/biz_01kqcyd244mja1bsrhqk02c11v/sales/invoices/inv_01kh9zz0e2jd8gtmj76g09f42a","pdf": null},"buyer": {"kept": "sale","client": {"id": "cli_01kr6nd2nxvn9aact0yx8xr54a","name": "Shop website buyers"}}}id- text
- Your own ID for the sale.
status- one of
- recorded: recorded by this call. joined: Tracery already held the invoice under its number, recorded by a person or from a file, and its date, total and buyer agree, so this call tied the sale to it and recorded nothing new. unchanged: recorded or joined before, with the same values. checked: a test key ran every check and saved or changed nothing. cancelled: its invoice is cancelled, by your app or in Tracery.
recorded,joined,unchanged,checked,cancelled saved- true or false
- Whether the sale is in the business's books. False only for a test key's check of a sale Tracery does not hold.
invoice- object
- The invoice Tracery holds for the sale.
invoice.id- text
- Tracery's ID of the invoice. Null for a sale only checked.
invoice.number- text
- The invoice's number: the one your app gave, or the one Tracery gave.
invoice.date- text
- The date on the invoice.
invoice.kind- one of
- A bill of supply when nothing on it is taxed.
invoice,bill_of_supply invoice.currency- text
- The invoice currency, as its three letter code.
invoice.total- text
- In the invoice currency.
invoice.taxable- text
- In the invoice currency.
invoice.paid- text
- What is paid of it, in the invoice currency.
invoice.credited- text
- What credit notes took off it, in the invoice currency.
invoice.open- text
- What is still to be paid, in the invoice currency.
invoice.igst- text
- In rupees.
invoice.cgst- text
- In rupees.
invoice.sgst- text
- SGST or UTGST, in rupees.
invoice.placeOfSupply- text
- The GST code of the state the supply is made to; 96 for a buyer abroad. Null for a business with no GSTIN.
invoice.irn- text
- The IRN Tracery keeps for it; null when it has none.
invoice.link- text
- Where people of the business open the invoice in Tracery.
invoice.numberedBy- one of
- app: the number your app gave it, recorded as issued outside Tracery. tracery: numbered, printed and kept by Tracery, as the business has Tracery number your invoices.
app,tracery invoice.pdf- text
- Where your app reads the PDF with its key, for one Tracery numbered; null for one your app numbered, and for one only checked.
invoice.email- object
- Its email from the business, with its PDF, for a sale that named buyer.email while Tracery numbers your invoices. Null when none was asked, and for one only checked.
invoice.email.to- text
- The address it goes to: the buyer.email of the sale.
invoice.email.status- one of
- waits_for_irn: it goes once the business records the document's IRN. waits_for_signature: it goes once the business's signatory signs it. queued: on its way. emailed: sent. not_emailed: it did not go, and problem says why; the business can still email it from Tracery.
waits_for_irn,waits_for_signature,queued,emailed,not_emailed invoice.email.problem- text
- Why it was not emailed; null otherwise.
buyer- object
- Who the invoice is to, as Tracery keeps the buyer.
buyer.kept- one of
- client: the buyer is a client of its own. sale: the buyer is kept on the sale, under the client that holds the buyers of this app.
client,sale buyer.client- object
- The client in Tracery the invoice is under.
buyer.client.id- text
- Tracery's ID of the client. Null where a test key's check would have made it.
buyer.client.name- text
- The client's name in Tracery.
Read back a sale your app sent
GET/apps/v1/sales/{saleId}
Where the sale stands in Tracery now: its invoice, with what is paid, credited and still open, and how its buyer was kept. A sale Tracery does not hold answers 404.
In the address
saleId- text
- Your own ID for the sale, such as your order ID.
curl https://api.tracery.in/apps/v1/sales/order-10042 \-H "Authorization: Bearer $TRACERY_KEY"What comes back
- 200 The sale as Tracery holds it
- 401, 403, 404, 409, 429 Refused, each for the reason under Refusals
{"id": "order-10042","status": "recorded","saved": true,"invoice": {"id": "inv_01kh9zz0e2jd8gtmj76g09f42a","number": "SW/26-27/0042","date": "2026-11-02","kind": "invoice","currency": "INR","total": "1180.00","taxable": "1000.00","paid": "0.00","credited": "0.00","open": "1180.00","igst": "0.00","cgst": "90.00","sgst": "90.00","placeOfSupply": "32","irn": null,"numberedBy": "app","email": null,"link": "https://app.tracery.in/b/biz_01kqcyd244mja1bsrhqk02c11v/sales/invoices/inv_01kh9zz0e2jd8gtmj76g09f42a","pdf": null},"buyer": {"kept": "sale","client": {"id": "cli_01kr6nd2nxvn9aact0yx8xr54a","name": "Shop website buyers"}}}id- text
- Your own ID for the sale.
status- one of
- recorded: recorded by this call. joined: Tracery already held the invoice under its number, recorded by a person or from a file, and its date, total and buyer agree, so this call tied the sale to it and recorded nothing new. unchanged: recorded or joined before, with the same values. checked: a test key ran every check and saved or changed nothing. cancelled: its invoice is cancelled, by your app or in Tracery.
recorded,joined,unchanged,checked,cancelled saved- true or false
- Whether the sale is in the business's books. False only for a test key's check of a sale Tracery does not hold.
invoice- object
- The invoice Tracery holds for the sale.
invoice.id- text
- Tracery's ID of the invoice. Null for a sale only checked.
invoice.number- text
- The invoice's number: the one your app gave, or the one Tracery gave.
invoice.date- text
- The date on the invoice.
invoice.kind- one of
- A bill of supply when nothing on it is taxed.
invoice,bill_of_supply invoice.currency- text
- The invoice currency, as its three letter code.
invoice.total- text
- In the invoice currency.
invoice.taxable- text
- In the invoice currency.
invoice.paid- text
- What is paid of it, in the invoice currency.
invoice.credited- text
- What credit notes took off it, in the invoice currency.
invoice.open- text
- What is still to be paid, in the invoice currency.
invoice.igst- text
- In rupees.
invoice.cgst- text
- In rupees.
invoice.sgst- text
- SGST or UTGST, in rupees.
invoice.placeOfSupply- text
- The GST code of the state the supply is made to; 96 for a buyer abroad. Null for a business with no GSTIN.
invoice.irn- text
- The IRN Tracery keeps for it; null when it has none.
invoice.link- text
- Where people of the business open the invoice in Tracery.
invoice.numberedBy- one of
- app: the number your app gave it, recorded as issued outside Tracery. tracery: numbered, printed and kept by Tracery, as the business has Tracery number your invoices.
app,tracery invoice.pdf- text
- Where your app reads the PDF with its key, for one Tracery numbered; null for one your app numbered, and for one only checked.
invoice.email- object
- Its email from the business, with its PDF, for a sale that named buyer.email while Tracery numbers your invoices. Null when none was asked, and for one only checked.
invoice.email.to- text
- The address it goes to: the buyer.email of the sale.
invoice.email.status- one of
- waits_for_irn: it goes once the business records the document's IRN. waits_for_signature: it goes once the business's signatory signs it. queued: on its way. emailed: sent. not_emailed: it did not go, and problem says why; the business can still email it from Tracery.
waits_for_irn,waits_for_signature,queued,emailed,not_emailed invoice.email.problem- text
- Why it was not emailed; null otherwise.
buyer- object
- Who the invoice is to, as Tracery keeps the buyer.
buyer.kept- one of
- client: the buyer is a client of its own. sale: the buyer is kept on the sale, under the client that holds the buyers of this app.
client,sale buyer.client- object
- The client in Tracery the invoice is under.
buyer.client.id- text
- Tracery's ID of the client. Null where a test key's check would have made it.
buyer.client.name- text
- The client's name in Tracery.
Cancel a sale nothing is paid or refunded on
POST/apps/v1/sales/{saleId}/cancel
Cancels the invoice of a sale that has no payment and no credit note against it, as a person of the business cancels one: it stays on record with its number, and its entry is taken out of the books. Sending the cancel again changes nothing and answers the sale as cancelled. A sale with money or a note against it, one in a locked period, or one whose IRN can no longer be cancelled is refused with 409: send a refund for it instead. When the invoice has an IRN, Tracery marks it cancelled; cancel it on the IRP too. With a test key the cancel is checked and nothing is changed.
In the address
saleId- text
- Your own ID for the sale, such as your order ID.
In the body
reason- text, needed
- Why the sale is cancelled, kept on its invoice for the people of the business.
curl -X POST https://api.tracery.in/apps/v1/sales/order-10042/cancel \-H "Authorization: Bearer $TRACERY_KEY" \-H "Content-Type: application/json" \--data @- <<'JSON'{"reason": "The buyer cancelled the order before paying"}JSONWhat comes back
- 200 The sale, cancelled
- 401, 403, 404, 409, 413, 422, 429 Refused, each for the reason under Refusals
{"id": "order-10042","status": "recorded","saved": true,"invoice": {"id": "inv_01kh9zz0e2jd8gtmj76g09f42a","number": "SW/26-27/0042","date": "2026-11-02","kind": "invoice","currency": "INR","total": "1180.00","taxable": "1000.00","paid": "0.00","credited": "0.00","open": "1180.00","igst": "0.00","cgst": "90.00","sgst": "90.00","placeOfSupply": "32","irn": null,"numberedBy": "app","email": null,"link": "https://app.tracery.in/b/biz_01kqcyd244mja1bsrhqk02c11v/sales/invoices/inv_01kh9zz0e2jd8gtmj76g09f42a","pdf": null},"buyer": {"kept": "sale","client": {"id": "cli_01kr6nd2nxvn9aact0yx8xr54a","name": "Shop website buyers"}}}id- text
- Your own ID for the sale.
status- one of
- recorded: recorded by this call. joined: Tracery already held the invoice under its number, recorded by a person or from a file, and its date, total and buyer agree, so this call tied the sale to it and recorded nothing new. unchanged: recorded or joined before, with the same values. checked: a test key ran every check and saved or changed nothing. cancelled: its invoice is cancelled, by your app or in Tracery.
recorded,joined,unchanged,checked,cancelled saved- true or false
- Whether the sale is in the business's books. False only for a test key's check of a sale Tracery does not hold.
invoice- object
- The invoice Tracery holds for the sale.
invoice.id- text
- Tracery's ID of the invoice. Null for a sale only checked.
invoice.number- text
- The invoice's number: the one your app gave, or the one Tracery gave.
invoice.date- text
- The date on the invoice.
invoice.kind- one of
- A bill of supply when nothing on it is taxed.
invoice,bill_of_supply invoice.currency- text
- The invoice currency, as its three letter code.
invoice.total- text
- In the invoice currency.
invoice.taxable- text
- In the invoice currency.
invoice.paid- text
- What is paid of it, in the invoice currency.
invoice.credited- text
- What credit notes took off it, in the invoice currency.
invoice.open- text
- What is still to be paid, in the invoice currency.
invoice.igst- text
- In rupees.
invoice.cgst- text
- In rupees.
invoice.sgst- text
- SGST or UTGST, in rupees.
invoice.placeOfSupply- text
- The GST code of the state the supply is made to; 96 for a buyer abroad. Null for a business with no GSTIN.
invoice.irn- text
- The IRN Tracery keeps for it; null when it has none.
invoice.link- text
- Where people of the business open the invoice in Tracery.
invoice.numberedBy- one of
- app: the number your app gave it, recorded as issued outside Tracery. tracery: numbered, printed and kept by Tracery, as the business has Tracery number your invoices.
app,tracery invoice.pdf- text
- Where your app reads the PDF with its key, for one Tracery numbered; null for one your app numbered, and for one only checked.
invoice.email- object
- Its email from the business, with its PDF, for a sale that named buyer.email while Tracery numbers your invoices. Null when none was asked, and for one only checked.
invoice.email.to- text
- The address it goes to: the buyer.email of the sale.
invoice.email.status- one of
- waits_for_irn: it goes once the business records the document's IRN. waits_for_signature: it goes once the business's signatory signs it. queued: on its way. emailed: sent. not_emailed: it did not go, and problem says why; the business can still email it from Tracery.
waits_for_irn,waits_for_signature,queued,emailed,not_emailed invoice.email.problem- text
- Why it was not emailed; null otherwise.
buyer- object
- Who the invoice is to, as Tracery keeps the buyer.
buyer.kept- one of
- client: the buyer is a client of its own. sale: the buyer is kept on the sale, under the client that holds the buyers of this app.
client,sale buyer.client- object
- The client in Tracery the invoice is under.
buyer.client.id- text
- Tracery's ID of the client. Null where a test key's check would have made it.
buyer.client.name- text
- The client's name in Tracery.
A sale's invoice as a PDF
GET/apps/v1/sales/{saleId}/pdf
Only for an invoice Tracery numbered and issued for the sale. One your app numbered itself is refused with 409, as Tracery never printed it. The same PDF every time, as an issued invoice does not change.
In the address
saleId- text
- Your own ID for the sale, such as your order ID.
curl https://api.tracery.in/apps/v1/sales/order-10042/pdf \-H "Authorization: Bearer $TRACERY_KEY" \-o document.pdfWhat comes back
- 200 The PDF, as Tracery printed it when it issued the document
- 401, 403, 404, 409, 429, 503 Refused, each for the reason under Refusals
Payments
A payment a gateway took for a sale is money received into the gateway's balance in Tracery. What the gateway later pays out to the bank leaves that balance.
Send a payment a gateway took for a sale
PUT/apps/v1/sales/{saleId}/payments/{paymentId}
Send the payment under your own ID for it, after its sale. The first call records it as money received into the gateway's balance in Tracery, against the sale's invoice. The whole amount lands in that balance; the gateway's fee, when you send it, is kept with the payment and becomes a cost when the gateway's tax invoice is recorded and paid from the balance. Sending the same payment again changes nothing, so it is safe to send again when unsure. Other values under the same ID are refused with 409; only a fee you learn later may be added, by sending the same payment again with it. Send only money a gateway took: money paid straight into a bank account is recorded in Tracery from the bank statement. With a test key every check runs and nothing is saved.
In the address
saleId- text
- Your own ID for the sale, such as your order ID.
paymentId- text
- Your own ID for the payment, such as the gateway's payment ID.
In the body
date- date, needed
- The day the gateway took the payment, on or after the invoice date.
amount- number or text, needed
- What the buyer paid, in the currency of the sale, before any fee. At most what the sale still has to be paid.
gateway- one of, needed
- The payment gateway that took the money. Use "other" for one not listed. Each gateway of an app has one balance in Tracery, which its payments land in and its payouts leave.
razorpay,cashfree,stripe,paypal,payu,phonepe,paytm,ccavenue,instamojo,easebuzz,billdesk,other fee- number or text
- What the gateway kept from this payment, in rupees, with the GST on its fee. Left out when your app does not know it yet: send the same payment again with the fee once it does. Tracery keeps it with the payment, to know what the gateway pays out and what its tax invoice should come to.
amountInr- number or text
- Only for a sale in another currency, and then needed: what the amount came to in rupees, before the fee.
reference- text
- The gateway's own ID for the payment, as its payout report names it. Left out, your payment ID is kept.
curl -X PUT https://api.tracery.in/apps/v1/sales/order-10042/payments/pay_N7dK2 \-H "Authorization: Bearer $TRACERY_KEY" \-H "Content-Type: application/json" \--data @- <<'JSON'{"date": "2026-11-02","amount": "1180.00","gateway": "razorpay","fee": "27.85","reference": "pay_N7dK2"}JSONWhat comes back
- 200 The payment as Tracery holds it
- 201 The payment, recorded by this call
- 401, 403, 404, 409, 413, 422, 429 Refused, each for the reason under Refusals
{"id": "pay_N7dK2","status": "recorded","saved": true,"date": "2026-11-02","gateway": "razorpay","reference": "pay_N7dK2","amount": "1180.00","fee": "27.85","net": "1152.15","balance": {"id": "acc_01k4vgd1evcb0g5exhd76q41x1","name": "Razorpay balance"},"sale": {"id": "order-10042","invoiceNumber": "SW/26-27/0042","currency": "INR","total": "1180.00","paid": "1180.00","credited": "0.00","open": "0.00"}}id- text
- Your own ID for the payment.
status- one of
- recorded: recorded by this call. updated: its fee was added by this call. unchanged: recorded before with the same values. checked: a test key ran every check and saved nothing. undone: someone undid it in Tracery since, so it is not recorded again.
recorded,updated,unchanged,checked,undone saved- true or false
- Whether the payment is in the business's books. False for a test key's check, and for a payment undone in Tracery.
date- text
- The day the gateway took the payment.
gateway- one of
- The payment gateway that took the money. Use "other" for one not listed. Each gateway of an app has one balance in Tracery, which its payments land in and its payouts leave.
razorpay,cashfree,stripe,paypal,payu,phonepe,paytm,ccavenue,instamojo,easebuzz,billdesk,other reference- text
- The gateway's own ID for the payment, as you sent it; null when you sent none.
amount- text
- What the buyer paid, in the sale currency.
fee- text
- What the gateway kept, in rupees, as you sent it. Null while not known.
net- text
- The amount in rupees less the fee: what the gateway pays out for it. The whole amount is in the balance until the payout and the gateway's tax invoice take it out.
balance- object
- The balance in Tracery the money landed in. Null for a test key's check of a sale Tracery does not hold.
balance.id- text
- Null where a test key's check would have made the balance.
balance.name- text
- The balance's name in Tracery.
sale- object
- The sale as it stands with this payment. Null for a test key's check of a sale Tracery does not hold: a test key saves no sale, so only the payment's own values were checked.
sale.id- text
- Your own ID for the sale.
sale.invoiceNumber- text
- The number of the sale's invoice.
sale.currency- text
- The invoice currency, as its three letter code.
sale.total- text
- The total of the invoice with its GST.
sale.paid- text
- What is paid of it now.
sale.credited- text
- What credit notes took off it.
sale.open- text
- What is still to be paid.
Read back a payment your app sent
GET/apps/v1/sales/{saleId}/payments/{paymentId}
The payment as Tracery holds it now, with where its sale stands. One someone undid in Tracery answers undone. A payment Tracery does not hold answers 404.
In the address
saleId- text
- Your own ID for the sale, such as your order ID.
paymentId- text
- Your own ID for the payment, such as the gateway's payment ID.
curl https://api.tracery.in/apps/v1/sales/order-10042/payments/pay_N7dK2 \-H "Authorization: Bearer $TRACERY_KEY"What comes back
- 200 The payment as Tracery holds it
- 401, 403, 404, 409, 429 Refused, each for the reason under Refusals
{"id": "pay_N7dK2","status": "recorded","saved": true,"date": "2026-11-02","gateway": "razorpay","reference": "pay_N7dK2","amount": "1180.00","fee": "27.85","net": "1152.15","balance": {"id": "acc_01k4vgd1evcb0g5exhd76q41x1","name": "Razorpay balance"},"sale": {"id": "order-10042","invoiceNumber": "SW/26-27/0042","currency": "INR","total": "1180.00","paid": "1180.00","credited": "0.00","open": "0.00"}}id- text
- Your own ID for the payment.
status- one of
- recorded: recorded by this call. updated: its fee was added by this call. unchanged: recorded before with the same values. checked: a test key ran every check and saved nothing. undone: someone undid it in Tracery since, so it is not recorded again.
recorded,updated,unchanged,checked,undone saved- true or false
- Whether the payment is in the business's books. False for a test key's check, and for a payment undone in Tracery.
date- text
- The day the gateway took the payment.
gateway- one of
- The payment gateway that took the money. Use "other" for one not listed. Each gateway of an app has one balance in Tracery, which its payments land in and its payouts leave.
razorpay,cashfree,stripe,paypal,payu,phonepe,paytm,ccavenue,instamojo,easebuzz,billdesk,other reference- text
- The gateway's own ID for the payment, as you sent it; null when you sent none.
amount- text
- What the buyer paid, in the sale currency.
fee- text
- What the gateway kept, in rupees, as you sent it. Null while not known.
net- text
- The amount in rupees less the fee: what the gateway pays out for it. The whole amount is in the balance until the payout and the gateway's tax invoice take it out.
balance- object
- The balance in Tracery the money landed in. Null for a test key's check of a sale Tracery does not hold.
balance.id- text
- Null where a test key's check would have made the balance.
balance.name- text
- The balance's name in Tracery.
sale- object
- The sale as it stands with this payment. Null for a test key's check of a sale Tracery does not hold: a test key saves no sale, so only the payment's own values were checked.
sale.id- text
- Your own ID for the sale.
sale.invoiceNumber- text
- The number of the sale's invoice.
sale.currency- text
- The invoice currency, as its three letter code.
sale.total- text
- The total of the invoice with its GST.
sale.paid- text
- What is paid of it now.
sale.credited- text
- What credit notes took off it.
sale.open- text
- What is still to be paid.
Refunds
A refund is a credit note against the sale's invoice and, when money went back, a payment out of the gateway's balance.
Send a refund: its credit note, and the money that went back
PUT/apps/v1/sales/{saleId}/refunds/{refundId}
Send the refund under your own ID for it, after its sale and the payment it gives back. The first call makes its credit note against the sale's invoice, after every check Tracery makes on its own credit notes: recorded as issued outside Tracery under your app's number, or, where the business has Tracery number your app's invoices, issued by Tracery under its next number and printed. It also records the money that went back as paid out of the gateway's balance in Tracery. Leave paidBack out for a credit note on a sale not yet paid. Sending the same refund again changes nothing, so it is safe to send again when unsure. Other values under the same ID are refused with 409, as an issued credit note is not changed; only its e-invoice may come later. A refund in part takes off only the lines you send; more that goes back later is another refund with a credit note of its own. With a test key every check runs and nothing is saved.
In the address
saleId- text
- Your own ID for the sale, such as your order ID.
refundId- text
- Your own ID for the refund, such as the gateway's refund ID.
In the body
creditNoteNumber- text
- The number your app gave the credit note: up to 16 letters, digits, "-" and "/", and not used by another document of the financial year. Needed while your app numbers its own invoices; left out where the business has Tracery number them, as Tracery gives the number. A refund sent again may leave it out, or send the number it has.
date- date, needed
- The date on the credit note, on or after the invoice date. Money paid back is recorded on this day.
reason- text, needed
- Why the credit note was issued, kept on it for the people of the business.
lines- list of objects
- What the credit note takes off, as the lines of a sale are sent. Left out, it takes off every line of the sale.
lines[].description- text
- What was sold. Left out, the name of the HSN or SAC code is used.
lines[].hsnSac- whole number or text
- The HSN code of goods or the SAC code of a service, 4 to 8 digits.
lines[].quantity- number or text
- Left out, the quantity is 1. The taxable value is for the whole line.
lines[].unit- text
- For goods, the unit GST returns count them in, such as NOS or KGS.
lines[].taxable- number or text, needed
- The value of the line before GST, after any discount.
lines[].gstRate- number or text, needed
- The GST rate as a percent: 18, "18" or "18%". For a line with no GST, "Exempt", "Nil rated" or "Non-GST"; 0 reads as nil rated. For a sale to a buyer abroad, send the rate the supply carries in India, such as 18: an export is zero rated, so no GST is added.
lines[].servicePeriod- object
- The days a service line is for, such as a year of a plan. Its income is spread evenly over them at the year end, as AS 9 asks. Printed under the line. Only a service line has one.
lines[].servicePeriod.from- date, needed
- The first day the line is for.
lines[].servicePeriod.to- date, needed
- The last day the line is for, both days counted.
total- number or text, needed
- The total of the credit note with its GST, in the currency of the sale. Tracery works the total out from the lines and refuses a refund whose total differs by more than 2 units. At most what the sale has open once the money paid back is counted.
tax- object
- The GST on the credit note, in rupees. Each one sent is checked against what Tracery works out, to a rupee.
tax.igst- number or text
- IGST, on a supply to another state, or an export with IGST paid.
tax.cgst- number or text
- CGST, on a supply within the business's own state.
tax.sgst- number or text
- SGST or UTGST.
paidBack- number or text
- What went back to the buyer through the gateway, in the currency of the sale: at most what is paid of the sale, and at most the total of the credit note. Left out when no money went back, as for a sale not yet paid.
paidBackInr- number or text
- Only for a sale in another currency, and then needed with paidBack: what left the gateway balance in rupees.
gateway- one of
- The gateway the money went back through. Left out, it is the gateway the latest payment your app sent for the sale came through.
razorpay,cashfree,stripe,paypal,payu,phonepe,paytm,ccavenue,instamojo,easebuzz,billdesk,other reference- text
- The gateway's own ID for the refund, as its payout report names it. Left out, your refund ID is kept.
eInvoice- object
- The e-invoice your app got from the IRP for this credit note. It may come with the refund or later: send the same refund again with it. It is not one of the values that must stay the same.
eInvoice.signedQrCode- text, needed
- The Signed QR Code text the IRP gave for this invoice, as it is. Tracery reads the IRN and its date from it, and checks that it names this invoice.
eInvoice.ackNo- text
- The acknowledgement number the IRP gave, digits only.
eInvoice.ackDate- text
- Needed only when the QR code does not say when its IRN was made.
curl -X PUT https://api.tracery.in/apps/v1/sales/order-10042/refunds/rfnd_Q2xT9 \-H "Authorization: Bearer $TRACERY_KEY" \-H "Content-Type: application/json" \--data @- <<'JSON'{"creditNoteNumber": "SW/CN/26-27/007","date": "2026-11-09","reason": "The buyer asked for the plan to be stopped","total": "1180.00","tax": {"cgst": "90.00","sgst": "90.00"},"paidBack": "1180.00","reference": "rfnd_Q2xT9"}JSONWhat comes back
- 200 The refund as Tracery holds it
- 201 The refund, recorded by this call
- 401, 403, 404, 409, 413, 422, 429 Refused, each for the reason under Refusals
{"id": "rfnd_Q2xT9","status": "recorded","saved": true,"creditNote": {"id": "inv_01k3stwrh73w3kp57y3wnfh4mx","number": "SW/CN/26-27/007","date": "2026-11-09","currency": "INR","total": "1180.00","taxable": "1000.00","igst": "0.00","cgst": "90.00","sgst": "90.00","irn": null,"numberedBy": "app","email": null,"link": "https://app.tracery.in/b/biz_01kqcyd244mja1bsrhqk02c11v/sales/invoices/inv_01k3stwrh73w3kp57y3wnfh4mx","pdf": null},"paidBack": {"amount": "1180.00","rupees": "1180.00","gateway": "razorpay","balance": {"id": "acc_01k4vgd1evcb0g5exhd76q41x1","name": "Razorpay balance"},"undone": false},"sale": {"id": "order-10042","invoiceNumber": "SW/26-27/0042","currency": "INR","total": "1180.00","paid": "0.00","credited": "1180.00","open": "0.00"}}id- text
- Your own ID for the refund.
status- one of
- recorded: recorded by this call, or read back as it stands. unchanged: recorded before with the same values. checked: a test key ran every check and saved nothing. cancelled: its credit note was cancelled in Tracery since, so it is not recorded again.
recorded,unchanged,checked,cancelled saved- true or false
- Whether the refund is in the business's books. False for a test key's check.
creditNote- object
- The credit note Tracery holds for the refund.
creditNote.id- text
- Tracery's ID of the credit note. Null for a refund only checked.
creditNote.link- text
- Where people of the business open the credit note in Tracery.
creditNote.numberedBy- one of
- app: the number your app gave it, recorded as issued outside Tracery. tracery: numbered, printed and kept by Tracery, as the business has Tracery number your invoices.
app,tracery creditNote.pdf- text
- Where your app reads the PDF with its key, for one Tracery numbered; null for one your app numbered, and for one only checked.
creditNote.email- object
- Its email from the business, with its PDF, for a sale that named buyer.email while Tracery numbers your invoices. Null when none was asked, and for one only checked.
creditNote.email.to- text
- The address it goes to: the buyer.email of the sale.
creditNote.email.status- one of
- waits_for_irn: it goes once the business records the document's IRN. waits_for_signature: it goes once the business's signatory signs it. queued: on its way. emailed: sent. not_emailed: it did not go, and problem says why; the business can still email it from Tracery.
waits_for_irn,waits_for_signature,queued,emailed,not_emailed creditNote.email.problem- text
- Why it was not emailed; null otherwise.
creditNote.number- text
- The credit note's number: the one your app gave, or the one Tracery gave.
creditNote.date- text
- The date on the credit note.
creditNote.currency- text
- The currency of the sale, as its three letter code.
creditNote.total- text
- In the currency of the sale.
creditNote.taxable- text
- The value it takes off before GST, in the currency of the sale.
creditNote.igst- text
- In rupees.
creditNote.cgst- text
- In rupees.
creditNote.sgst- text
- SGST or UTGST, in rupees.
creditNote.irn- text
- The IRN kept for the credit note, while it stands.
paidBack- object
- The money that went back to the buyer. Null when none did.
paidBack.amount- text
- In the currency of the sale.
paidBack.rupees- text
- What left the balance, in rupees.
paidBack.gateway- one of
- The payment gateway that took the money. Use "other" for one not listed. Each gateway of an app has one balance in Tracery, which its payments land in and its payouts leave.
razorpay,cashfree,stripe,paypal,payu,phonepe,paytm,ccavenue,instamojo,easebuzz,billdesk,other paidBack.balance- object
- The balance in Tracery the money left.
paidBack.balance.id- text
- Null where a test key's check would have made the balance.
paidBack.balance.name- text
- The balance's name in Tracery.
paidBack.undone- true or false
- True once someone undid the money paid back in Tracery.
sale- object
- The sale as it stands with this refund.
sale.id- text
- Your own ID for the sale.
sale.invoiceNumber- text
- The number of the sale's invoice.
sale.currency- text
- The invoice currency, as its three letter code.
sale.total- text
- The total of the invoice with its GST.
sale.paid- text
- What is paid of it now.
sale.credited- text
- What credit notes took off it.
sale.open- text
- What is still to be paid.
Read back a refund your app sent
GET/apps/v1/sales/{saleId}/refunds/{refundId}
The refund as Tracery holds it now: its credit note and the money that went back. One whose credit note was cancelled in Tracery answers cancelled. A refund Tracery does not hold answers 404.
In the address
saleId- text
- Your own ID for the sale, such as your order ID.
refundId- text
- Your own ID for the refund, such as the gateway's refund ID.
curl https://api.tracery.in/apps/v1/sales/order-10042/refunds/rfnd_Q2xT9 \-H "Authorization: Bearer $TRACERY_KEY"What comes back
- 200 The refund as Tracery holds it
- 401, 403, 404, 409, 429 Refused, each for the reason under Refusals
{"id": "rfnd_Q2xT9","status": "recorded","saved": true,"creditNote": {"id": "inv_01k3stwrh73w3kp57y3wnfh4mx","number": "SW/CN/26-27/007","date": "2026-11-09","currency": "INR","total": "1180.00","taxable": "1000.00","igst": "0.00","cgst": "90.00","sgst": "90.00","irn": null,"numberedBy": "app","email": null,"link": "https://app.tracery.in/b/biz_01kqcyd244mja1bsrhqk02c11v/sales/invoices/inv_01k3stwrh73w3kp57y3wnfh4mx","pdf": null},"paidBack": {"amount": "1180.00","rupees": "1180.00","gateway": "razorpay","balance": {"id": "acc_01k4vgd1evcb0g5exhd76q41x1","name": "Razorpay balance"},"undone": false},"sale": {"id": "order-10042","invoiceNumber": "SW/26-27/0042","currency": "INR","total": "1180.00","paid": "0.00","credited": "1180.00","open": "0.00"}}id- text
- Your own ID for the refund.
status- one of
- recorded: recorded by this call, or read back as it stands. unchanged: recorded before with the same values. checked: a test key ran every check and saved nothing. cancelled: its credit note was cancelled in Tracery since, so it is not recorded again.
recorded,unchanged,checked,cancelled saved- true or false
- Whether the refund is in the business's books. False for a test key's check.
creditNote- object
- The credit note Tracery holds for the refund.
creditNote.id- text
- Tracery's ID of the credit note. Null for a refund only checked.
creditNote.link- text
- Where people of the business open the credit note in Tracery.
creditNote.numberedBy- one of
- app: the number your app gave it, recorded as issued outside Tracery. tracery: numbered, printed and kept by Tracery, as the business has Tracery number your invoices.
app,tracery creditNote.pdf- text
- Where your app reads the PDF with its key, for one Tracery numbered; null for one your app numbered, and for one only checked.
creditNote.email- object
- Its email from the business, with its PDF, for a sale that named buyer.email while Tracery numbers your invoices. Null when none was asked, and for one only checked.
creditNote.email.to- text
- The address it goes to: the buyer.email of the sale.
creditNote.email.status- one of
- waits_for_irn: it goes once the business records the document's IRN. waits_for_signature: it goes once the business's signatory signs it. queued: on its way. emailed: sent. not_emailed: it did not go, and problem says why; the business can still email it from Tracery.
waits_for_irn,waits_for_signature,queued,emailed,not_emailed creditNote.email.problem- text
- Why it was not emailed; null otherwise.
creditNote.number- text
- The credit note's number: the one your app gave, or the one Tracery gave.
creditNote.date- text
- The date on the credit note.
creditNote.currency- text
- The currency of the sale, as its three letter code.
creditNote.total- text
- In the currency of the sale.
creditNote.taxable- text
- The value it takes off before GST, in the currency of the sale.
creditNote.igst- text
- In rupees.
creditNote.cgst- text
- In rupees.
creditNote.sgst- text
- SGST or UTGST, in rupees.
creditNote.irn- text
- The IRN kept for the credit note, while it stands.
paidBack- object
- The money that went back to the buyer. Null when none did.
paidBack.amount- text
- In the currency of the sale.
paidBack.rupees- text
- What left the balance, in rupees.
paidBack.gateway- one of
- The payment gateway that took the money. Use "other" for one not listed. Each gateway of an app has one balance in Tracery, which its payments land in and its payouts leave.
razorpay,cashfree,stripe,paypal,payu,phonepe,paytm,ccavenue,instamojo,easebuzz,billdesk,other paidBack.balance- object
- The balance in Tracery the money left.
paidBack.balance.id- text
- Null where a test key's check would have made the balance.
paidBack.balance.name- text
- The balance's name in Tracery.
paidBack.undone- true or false
- True once someone undid the money paid back in Tracery.
sale- object
- The sale as it stands with this refund.
sale.id- text
- Your own ID for the sale.
sale.invoiceNumber- text
- The number of the sale's invoice.
sale.currency- text
- The invoice currency, as its three letter code.
sale.total- text
- The total of the invoice with its GST.
sale.paid- text
- What is paid of it now.
sale.credited- text
- What credit notes took off it.
sale.open- text
- What is still to be paid.
A refund's credit note as a PDF
GET/apps/v1/sales/{saleId}/refunds/{refundId}/pdf
Only for a credit note Tracery numbered and issued for the refund. One your app numbered itself is refused with 409.
In the address
saleId- text
- Your own ID for the sale, such as your order ID.
refundId- text
- Your own ID for the refund, such as the gateway's refund ID.
curl https://api.tracery.in/apps/v1/sales/order-10042/refunds/rfnd_Q2xT9/pdf \-H "Authorization: Bearer $TRACERY_KEY" \-o document.pdfWhat comes back
- 200 The PDF, as Tracery printed it when it issued the document
- 401, 403, 404, 409, 429, 503 Refused, each for the reason under Refusals
Gateway notices
Your app may pass on the notices Cashfree and Stripe send it, in place of sending their payments and whole refunds itself. Check the gateway's signature first, with your own gateway secret: Tracery never holds it. Then pass the notice on as it came. Name the sale in Cashfree's order_id, or in Stripe's metadata as sale_id, with your own sale ID.
Pass on a gateway's notice of a payment, refund or payout
POST/apps/v1/gateway-notices/{gateway}
Pass the gateway's notice on exactly as it came, once your app has checked the gateway's signature on it. Cashfree: payment success and charges notices (versions 2023-08-01, 2025-01-01 and 2026-01-01), refund status, automatic refund and settlement notices. Stripe: charge.succeeded, charge.captured, refund.created, refund.updated, refund.failed, payout.paid, payout.failed and payout.canceled events. A payment is recorded as the payment call records one, under the gateway's ID; a payment your app already sent with that ID as its reference, or with none and the same amount on the same day, is the same payment, and a notice only adds a fee it lacks. A refund of a whole sale is recorded as the refund call records one, with a credit note Tracery numbers; a refund in part, or one where your app numbers its own credit notes, needs the refund call with its lines. A payment Cashfree gave back by itself changes nothing when Tracery never recorded it, and is refused for a person when it did. A Stripe refund that failed after it went through keeps its credit note and shows on the app for a person to put right. A payout is kept as the gateway's word that money is on its way: Tracery ties it to its bank line by the UTR, or by the gateway, amount and day, books that line from the gateway's balance, and shows on the app a payout no bank statement bears out. Notices in rupees only. The sale goes in Cashfree's order_id or in Stripe's metadata sale_id, as your own sale ID. Any other notice is answered as not read, so you may pass on every notice. A notice for a sale or payment Tracery does not hold yet is refused with 409: answer the gateway with an error, so it sends the notice again later. With a test key every check runs and nothing is saved.
In the address
gateway- one of
- The gateway the notice came from.
cashfree,stripe
In the body
The gateway's notice body exactly as it came, after your app has checked the gateway's signature on it.
curl -X POST https://api.tracery.in/apps/v1/gateway-notices/cashfree \-H "Authorization: Bearer $TRACERY_KEY" \-H "Content-Type: application/json" \--data @- <<'JSON'{"type": "PAYMENT_SUCCESS_WEBHOOK","event_time": "2026-11-11T12:20:31+05:30","data": {"order": {"order_id": "order_8123"},"payment": {"cf_payment_id": "5114910311985","payment_status": "SUCCESS","payment_amount": 1180,"payment_currency": "INR","payment_time": "2026-11-11T12:20:29+05:30"}}}JSONWhat comes back
- 200 What the notice was read as, and what Tracery holds
- 201 What the notice was read as, recorded by this call
- 401, 403, 409, 413, 422, 429 Refused, each for the reason under Refusals
{"gateway": "cashfree","type": "PAYMENT_SUCCESS_WEBHOOK","readAs": "payment","status": "recorded","why": null,"payment": {"id": "cashfree-5114910311985","status": "recorded","saved": true,"date": "2026-11-11","gateway": "cashfree","reference": "5114910311985","amount": "1180.00","fee": null,"net": "1180.00","balance": {"id": "acc_01k2mrh4jen8dmfyq7sw24qp8z","name": "Cashfree balance"},"sale": {"id": "order_8123","invoiceNumber": "SW/26-27/0044","currency": "INR","total": "1180.00","paid": "1180.00","credited": "0.00","open": "0.00"}},"refund": null}gateway- one of
- The gateway the notice came from.
cashfree,stripe type- text
- What the gateway calls the notice.
readAs- one of
- What Tracery read the notice as. nothing: a notice that moves no money, or one Tracery does not read, answered so the gateway does not send it again; why says which.
payment,refund,payout,nothing status- one of
- For a payment or refund, as their own calls answer. kept: the gateway's word of a payout was kept by this call. withdrawn: the gateway took that word back, or said a refund failed after all. unchanged: taken before. checked: a test key ran every check and saved nothing. not_read: nothing was read.
recorded,updated,unchanged,checked,undone,cancelled,kept,withdrawn,not_read why- text
- Why nothing was read from the notice; null when something was.
payment- object
- The payment as the payment call answers it, when the notice was one.
payment.id- text
- Your own ID for the payment.
payment.status- one of
- recorded: recorded by this call. updated: its fee was added by this call. unchanged: recorded before with the same values. checked: a test key ran every check and saved nothing. undone: someone undid it in Tracery since, so it is not recorded again.
recorded,updated,unchanged,checked,undone payment.saved- true or false
- Whether the payment is in the business's books. False for a test key's check, and for a payment undone in Tracery.
payment.date- text
- The day the gateway took the payment.
payment.gateway- one of
- The payment gateway that took the money. Use "other" for one not listed. Each gateway of an app has one balance in Tracery, which its payments land in and its payouts leave.
razorpay,cashfree,stripe,paypal,payu,phonepe,paytm,ccavenue,instamojo,easebuzz,billdesk,other payment.reference- text
- The gateway's own ID for the payment, as you sent it; null when you sent none.
payment.amount- text
- What the buyer paid, in the sale currency.
payment.fee- text
- What the gateway kept, in rupees, as you sent it. Null while not known.
payment.net- text
- The amount in rupees less the fee: what the gateway pays out for it. The whole amount is in the balance until the payout and the gateway's tax invoice take it out.
payment.balance- object
- The balance in Tracery the money landed in. Null for a test key's check of a sale Tracery does not hold.
payment.balance.id- text
- Null where a test key's check would have made the balance.
payment.balance.name- text
- The balance's name in Tracery.
payment.sale- object
- The sale as it stands with this payment. Null for a test key's check of a sale Tracery does not hold: a test key saves no sale, so only the payment's own values were checked.
payment.sale.id- text
- Your own ID for the sale.
payment.sale.invoiceNumber- text
- The number of the sale's invoice.
payment.sale.currency- text
- The invoice currency, as its three letter code.
payment.sale.total- text
- The total of the invoice with its GST.
payment.sale.paid- text
- What is paid of it now.
payment.sale.credited- text
- What credit notes took off it.
payment.sale.open- text
- What is still to be paid.
refund- object
- The refund as the refund call answers it, when the notice was one.
refund.id- text
- Your own ID for the refund.
refund.status- one of
- recorded: recorded by this call, or read back as it stands. unchanged: recorded before with the same values. checked: a test key ran every check and saved nothing. cancelled: its credit note was cancelled in Tracery since, so it is not recorded again.
recorded,unchanged,checked,cancelled refund.saved- true or false
- Whether the refund is in the business's books. False for a test key's check.
refund.creditNote- object
- The credit note Tracery holds for the refund.
refund.creditNote.id- text
- Tracery's ID of the credit note. Null for a refund only checked.
refund.creditNote.link- text
- Where people of the business open the credit note in Tracery.
refund.creditNote.numberedBy- one of
- app: the number your app gave it, recorded as issued outside Tracery. tracery: numbered, printed and kept by Tracery, as the business has Tracery number your invoices.
app,tracery refund.creditNote.pdf- text
- Where your app reads the PDF with its key, for one Tracery numbered; null for one your app numbered, and for one only checked.
refund.creditNote.email- object
- Its email from the business, with its PDF, for a sale that named buyer.email while Tracery numbers your invoices. Null when none was asked, and for one only checked.
refund.creditNote.email.to- text
- The address it goes to: the buyer.email of the sale.
refund.creditNote.email.status- one of
- waits_for_irn: it goes once the business records the document's IRN. waits_for_signature: it goes once the business's signatory signs it. queued: on its way. emailed: sent. not_emailed: it did not go, and problem says why; the business can still email it from Tracery.
waits_for_irn,waits_for_signature,queued,emailed,not_emailed refund.creditNote.email.problem- text
- Why it was not emailed; null otherwise.
refund.creditNote.number- text
- The credit note's number: the one your app gave, or the one Tracery gave.
refund.creditNote.date- text
- The date on the credit note.
refund.creditNote.currency- text
- The currency of the sale, as its three letter code.
refund.creditNote.total- text
- In the currency of the sale.
refund.creditNote.taxable- text
- The value it takes off before GST, in the currency of the sale.
refund.creditNote.igst- text
- In rupees.
refund.creditNote.cgst- text
- In rupees.
refund.creditNote.sgst- text
- SGST or UTGST, in rupees.
refund.creditNote.irn- text
- The IRN kept for the credit note, while it stands.
refund.paidBack- object
- The money that went back to the buyer. Null when none did.
refund.paidBack.amount- text
- In the currency of the sale.
refund.paidBack.rupees- text
- What left the balance, in rupees.
refund.paidBack.gateway- one of
- The payment gateway that took the money. Use "other" for one not listed. Each gateway of an app has one balance in Tracery, which its payments land in and its payouts leave.
razorpay,cashfree,stripe,paypal,payu,phonepe,paytm,ccavenue,instamojo,easebuzz,billdesk,other refund.paidBack.balance- object
- The balance in Tracery the money left.
refund.paidBack.balance.id- text
- Null where a test key's check would have made the balance.
refund.paidBack.balance.name- text
- The balance's name in Tracery.
refund.paidBack.undone- true or false
- True once someone undid the money paid back in Tracery.
refund.sale- object
- The sale as it stands with this refund.
refund.sale.id- text
- Your own ID for the sale.
refund.sale.invoiceNumber- text
- The number of the sale's invoice.
refund.sale.currency- text
- The invoice currency, as its three letter code.
refund.sale.total- text
- The total of the invoice with its GST.
refund.sale.paid- text
- What is paid of it now.
refund.sale.credited- text
- What credit notes took off it.
refund.sale.open- text
- What is still to be paid.
Day totals
At the end of each day your app may send how many sales, payments and refunds it holds for the day and what they come to. Tracery answers with what it holds beside each, so anything that never arrived is found while it is fresh.
Send a day's count and total, to check nothing was missed
PUT/apps/v1/days/{date}
Optional. Send, for each currency, how many sales, payments and refunds your app holds for the day and what they come to. Tracery answers at once with what it holds beside each, and for 35 days it tells the business when the two differ, so a sale, payment or refund that never arrived is found. Send the whole day each time: the same call again replaces what was sent before. A kind left out is not compared. It saves nothing in the books. With a test key the totals are compared and not kept.
In the address
date- date
- The day, by the dates your app sends with its sales, payments and refunds.
In the body
totals- list of objects, needed
- The day's totals, one for each currency your app sold in, up to 20.
totals[].currency- text, needed
- The currency, as its three letter code.
totals[].sales- object
- Every sale your app sent for the day, cancelled ones too, and the total of their invoices with GST as issued.
totals[].sales.count- whole number, needed
- How many your app holds for the day.
totals[].sales.total- number or text, needed
- What they come to, in this currency.
totals[].payments- object
- The payments a gateway took that day, and what the buyers paid.
totals[].payments.count- whole number, needed
- How many your app holds for the day.
totals[].payments.total- number or text, needed
- What they come to, in this currency.
totals[].refunds- object
- The refunds of the day, by their credit note date, and what went back to the buyers.
totals[].refunds.count- whole number, needed
- How many your app holds for the day.
totals[].refunds.total- number or text, needed
- What they come to, in this currency.
curl -X PUT https://api.tracery.in/apps/v1/days/2026-11-02 \-H "Authorization: Bearer $TRACERY_KEY" \-H "Content-Type: application/json" \--data @- <<'JSON'{"totals": [{"currency": "INR","sales": {"count": 1,"total": "1180.00"},"payments": {"count": 1,"total": "1180.00"}}]}JSONWhat comes back
- 200 What your app sent beside what Tracery holds
- 401, 403, 409, 413, 422, 429 Refused, each for the reason under Refusals
{"date": "2026-11-02","saved": true,"agrees": true,"totals": [{"currency": "INR","sales": {"sent": {"count": 1,"total": "1180.00"},"held": {"count": 1,"total": "1180.00"},"agrees": true},"payments": {"sent": {"count": 1,"total": "1180.00"},"held": {"count": 1,"total": "1180.00"},"agrees": true},"refunds": null}]}date- text
- The day.
saved- true or false
- Whether Tracery keeps these totals: false for a test key's check.
agrees- true or false
- Whether every count and total you sent is what Tracery holds.
totals- list of objects
- For each currency you sent, your count and total beside Tracery's.
totals[].currency- text
- The currency, as its three letter code.
totals[].sales- object
- Null for a kind you did not send, which is not compared.
totals[].sales.sent- object
- What your app sent for the day.
totals[].sales.sent.count- whole number
- How many.
totals[].sales.sent.total- text
- What they come to, in this currency.
totals[].sales.held- object
- What Tracery holds from your app for the day.
totals[].sales.held.count- whole number
- How many.
totals[].sales.held.total- text
- What they come to, in this currency.
totals[].sales.agrees- true or false
- Whether the two are the same.
totals[].payments- object
- Null for a kind you did not send, which is not compared.
totals[].payments.sent- object
- What your app sent for the day.
totals[].payments.sent.count- whole number
- How many.
totals[].payments.sent.total- text
- What they come to, in this currency.
totals[].payments.held- object
- What Tracery holds from your app for the day.
totals[].payments.held.count- whole number
- How many.
totals[].payments.held.total- text
- What they come to, in this currency.
totals[].payments.agrees- true or false
- Whether the two are the same.
totals[].refunds- object
- Null for a kind you did not send, which is not compared.
totals[].refunds.sent- object
- What your app sent for the day.
totals[].refunds.sent.count- whole number
- How many.
totals[].refunds.sent.total- text
- What they come to, in this currency.
totals[].refunds.held- object
- What Tracery holds from your app for the day.
totals[].refunds.held.count- whole number
- How many.
totals[].refunds.held.total- text
- What they come to, in this currency.
totals[].refunds.agrees- true or false
- Whether the two are the same.
Read back a day's totals beside what Tracery holds now
GET/apps/v1/days/{date}
The count and total your app last sent for the day, beside what Tracery holds for it now, so a sale, payment or refund that went missing since shows. A day your app sent no totals for answers 404.
In the address
date- date
- The day, by the dates your app sends with its sales, payments and refunds.
curl https://api.tracery.in/apps/v1/days/2026-11-02 \-H "Authorization: Bearer $TRACERY_KEY"What comes back
- 200 What your app sent beside what Tracery holds now
- 401, 403, 404, 409, 429 Refused, each for the reason under Refusals
{"date": "2026-11-02","saved": true,"agrees": true,"totals": [{"currency": "INR","sales": {"sent": {"count": 1,"total": "1180.00"},"held": {"count": 1,"total": "1180.00"},"agrees": true},"payments": {"sent": {"count": 1,"total": "1180.00"},"held": {"count": 1,"total": "1180.00"},"agrees": true},"refunds": null}]}date- text
- The day.
saved- true or false
- Whether Tracery keeps these totals: false for a test key's check.
agrees- true or false
- Whether every count and total you sent is what Tracery holds.
totals- list of objects
- For each currency you sent, your count and total beside Tracery's.
totals[].currency- text
- The currency, as its three letter code.
totals[].sales- object
- Null for a kind you did not send, which is not compared.
totals[].sales.sent- object
- What your app sent for the day.
totals[].sales.sent.count- whole number
- How many.
totals[].sales.sent.total- text
- What they come to, in this currency.
totals[].sales.held- object
- What Tracery holds from your app for the day.
totals[].sales.held.count- whole number
- How many.
totals[].sales.held.total- text
- What they come to, in this currency.
totals[].sales.agrees- true or false
- Whether the two are the same.
totals[].payments- object
- Null for a kind you did not send, which is not compared.
totals[].payments.sent- object
- What your app sent for the day.
totals[].payments.sent.count- whole number
- How many.
totals[].payments.sent.total- text
- What they come to, in this currency.
totals[].payments.held- object
- What Tracery holds from your app for the day.
totals[].payments.held.count- whole number
- How many.
totals[].payments.held.total- text
- What they come to, in this currency.
totals[].payments.agrees- true or false
- Whether the two are the same.
totals[].refunds- object
- Null for a kind you did not send, which is not compared.
totals[].refunds.sent- object
- What your app sent for the day.
totals[].refunds.sent.count- whole number
- How many.
totals[].refunds.sent.total- text
- What they come to, in this currency.
totals[].refunds.held- object
- What Tracery holds from your app for the day.
totals[].refunds.held.count- whole number
- How many.
totals[].refunds.held.total- text
- What they come to, in this currency.
totals[].refunds.agrees- true or false
- Whether the two are the same.
Refusals
Every refusal has the same body. The message is written to be read; the code stays the same, for your app to act on. Two examples, from the sale above:
- 401
- The key was not sent, is not a whole Tracery key, or no longer works: ended, replaced, or its app disconnected.
- 403
- The call came from a web page rather than a server, the business is paused on Tracery, or its connected apps are switched off.
- 404
- Tracery holds nothing your app sent at this address.
- 409
- Other values than Tracery holds under this ID, a step the sale cannot take now, or an app disconnected in Tracery; the message says which.
- 413
- The call is larger than 256 KB.
- 422
- A field is wrong or missing; details names each one and says why.
- 429
- Too many calls this minute; wait for the seconds Retry-After gives, then send again.
- 503
- The PDF could not be printed just now; try again shortly.
{"error": {"code": "validation_failed","message": "Some fields need attention.","details": [{"path": "lines.0.taxable","message": "Send a number, or its digits as text, such as \"1180.50\".","code": "invalid_format"}],"requestId": "f6f1d73f-3dcc-48c9-9c2d-c5f4d8d02fcd"}}{"error": {"code": "sale_changed","message": "Sale order-10042 is recorded as invoice SW/26-27/0042 with other values. An invoice is not changed once it is issued, so nothing was changed. Read the sale back to see what Tracery holds.","details": [{"path": "total","message": "This differs from what was recorded."}],"requestId": "f96e8624-70a7-4760-b8c9-3ceadf4fa09c"}}What it does not take
Some events the API does not take, as they need a person to judge them. Someone of the business records these in Tracery:
- TDS a buyer deducted from what they paid.
- A payment that covers more than one sale.
- A gateway balance held in a currency other than rupees.
- A chargeback, or a dispute a buyer raised with their bank.
Money paid straight into a bank account, rather than through a gateway, is recorded from the bank statement, not sent by your app.
The description file
Every call on this page is read from one file: the description of the API in OpenAPI 3.1, with each field in words and a whole example for every body and answer. Tracery's own tests send each example to the API and compare its answer, so none can drift from what the API takes. Download it to build a client, or to read the API in your own tools.
Download the description, OpenAPI 3.1.0, version 1.0.0.