{
  "openapi": "3.1.0",
  "info": {
    "title": "Tracery connected apps API",
    "version": "1.0.0",
    "description": "The calls a business's own product makes to keep its books in Tracery: its sales as invoices, the payments a gateway took, refunds as credit notes, cancels, and each day's count and total.\n\nEvery call carries a key the business made in Tracery, under Settings, Connected apps, as a bearer token. A test key checks each call as a live key would and saves nothing.\n\nAn app may make 600 calls a minute. A call is at most 256 KB."
  },
  "servers": [
    {
      "url": "https://api.tracery.in"
    }
  ],
  "security": [
    {
      "appKey": []
    }
  ],
  "components": {
    "securitySchemes": {
      "appKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "The app's key, as Tracery showed it once when it was made."
      }
    },
    "schemas": {
      "AppIdentity": {
        "type": "object",
        "properties": {
          "app": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "Tracery's ID of the app."
              },
              "name": {
                "type": "string",
                "description": "The name the business gave the app in Tracery.",
                "example": "Shop website"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "description": "The app the key is for."
          },
          "business": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "The business's name in Tracery.",
                "example": "Apple Inc"
              }
            },
            "required": [
              "name"
            ],
            "description": "The business whose books the app writes to."
          },
          "mode": {
            "$ref": "#/components/schemas/AppKeyMode"
          },
          "saves": {
            "type": "boolean",
            "description": "Whether calls with this key save anything: true for a live key."
          },
          "callsAMinute": {
            "type": "integer",
            "description": "How many calls the app may make in a minute before it is asked to wait."
          },
          "numbers": {
            "type": "string",
            "enum": [
              "app",
              "tracery"
            ],
            "description": "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."
          }
        },
        "required": [
          "app",
          "business",
          "mode",
          "saves",
          "callsAMinute",
          "numbers"
        ],
        "example": {
          "app": {
            "id": "app_01kqetk0j2w79nb1zn1rzxacah",
            "name": "Shop website"
          },
          "numbers": "app",
          "business": {
            "name": "Apple Inc"
          },
          "mode": "live",
          "saves": true,
          "callsAMinute": 600
        }
      },
      "AppKeyMode": {
        "type": "string",
        "enum": [
          "live",
          "test"
        ],
        "description": "live keys save what the app sends. test keys check it the same way and save nothing."
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "What went wrong, as a code that stays the same.",
                "example": "validation_failed"
              },
              "message": {
                "type": "string",
                "description": "What went wrong, in words to read.",
                "example": "Some fields need attention."
              },
              "details": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ErrorDetail"
                },
                "description": "Each field that is wrong; empty when the refusal is not about a field."
              },
              "requestId": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The ID of the call, also sent as the X-Request-Id header, to quote when asking for help."
              }
            },
            "required": [
              "code",
              "message",
              "details",
              "requestId"
            ],
            "description": "Why the call was refused."
          }
        },
        "required": [
          "error"
        ]
      },
      "ErrorDetail": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "The field, by its path in the body, such as lines.0.taxable.",
            "example": "lines.0.taxable"
          },
          "message": {
            "type": "string",
            "description": "What is wrong with it, in words to read.",
            "example": "This cannot be below zero."
          },
          "code": {
            "type": "string",
            "description": "The kind of problem, as a code."
          }
        },
        "required": [
          "path",
          "message"
        ]
      },
      "RecordedSale": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Your own ID for the sale.",
            "example": "order-10042"
          },
          "status": {
            "type": "string",
            "enum": [
              "recorded",
              "joined",
              "unchanged",
              "checked",
              "cancelled"
            ],
            "description": "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."
          },
          "saved": {
            "type": "boolean",
            "description": "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": {
            "type": "object",
            "properties": {
              "id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Tracery's ID of the invoice. Null for a sale only checked."
              },
              "number": {
                "type": "string",
                "description": "The invoice's number: the one your app gave, or the one Tracery gave.",
                "example": "SW/26-27/0042"
              },
              "date": {
                "type": "string",
                "description": "The date on the invoice.",
                "example": "2026-11-11"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "invoice",
                  "bill_of_supply"
                ],
                "description": "A bill of supply when nothing on it is taxed."
              },
              "currency": {
                "type": "string",
                "description": "The invoice currency, as its three letter code.",
                "example": "INR"
              },
              "total": {
                "type": "string",
                "example": "1180.00",
                "description": "In the invoice currency."
              },
              "taxable": {
                "type": "string",
                "example": "1180.00",
                "description": "In the invoice currency."
              },
              "paid": {
                "type": "string",
                "example": "0.00",
                "description": "What is paid of it, in the invoice currency."
              },
              "credited": {
                "type": "string",
                "example": "0.00",
                "description": "What credit notes took off it, in the invoice currency."
              },
              "open": {
                "type": "string",
                "example": "1180.00",
                "description": "What is still to be paid, in the invoice currency."
              },
              "igst": {
                "type": "string",
                "example": "1180.00",
                "description": "In rupees."
              },
              "cgst": {
                "type": "string",
                "example": "1180.00",
                "description": "In rupees."
              },
              "sgst": {
                "type": "string",
                "example": "1180.00",
                "description": "SGST or UTGST, in rupees."
              },
              "placeOfSupply": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The GST code of the state the supply is made to; 96 for a buyer abroad. Null for a business with no GSTIN.",
                "example": "32"
              },
              "irn": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The IRN Tracery keeps for it; null when it has none."
              },
              "link": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Where people of the business open the invoice in Tracery."
              },
              "numberedBy": {
                "type": "string",
                "enum": [
                  "app",
                  "tracery"
                ],
                "description": "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."
              },
              "pdf": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Where your app reads the PDF with its key, for one Tracery numbered; null for one your app numbered, and for one only checked.",
                "example": "https://api.tracery.in/apps/v1/sales/order-10042/pdf"
              },
              "email": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/AppDocumentEmail"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "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."
              }
            },
            "required": [
              "id",
              "number",
              "date",
              "kind",
              "currency",
              "total",
              "taxable",
              "paid",
              "credited",
              "open",
              "igst",
              "cgst",
              "sgst",
              "placeOfSupply",
              "irn",
              "link",
              "numberedBy",
              "pdf",
              "email"
            ],
            "description": "The invoice Tracery holds for the sale."
          },
          "buyer": {
            "type": "object",
            "properties": {
              "kept": {
                "type": "string",
                "enum": [
                  "client",
                  "sale"
                ],
                "description": "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": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Tracery's ID of the client. Null where a test key's check would have made it."
                  },
                  "name": {
                    "type": "string",
                    "description": "The client's name in Tracery.",
                    "example": "Anna Thomas"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "description": "The client in Tracery the invoice is under."
              }
            },
            "required": [
              "kept",
              "client"
            ],
            "description": "Who the invoice is to, as Tracery keeps the buyer."
          }
        },
        "required": [
          "id",
          "status",
          "saved",
          "invoice",
          "buyer"
        ],
        "example": {
          "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"
            }
          }
        }
      },
      "AppDocumentEmail": {
        "type": "object",
        "properties": {
          "to": {
            "type": "string",
            "description": "The address it goes to: the buyer.email of the sale.",
            "example": "anna-demo@tracery.in"
          },
          "status": {
            "type": "string",
            "enum": [
              "waits_for_irn",
              "waits_for_signature",
              "queued",
              "emailed",
              "not_emailed"
            ],
            "description": "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."
          },
          "problem": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it was not emailed; null otherwise."
          }
        },
        "required": [
          "to",
          "status",
          "problem"
        ]
      },
      "Sale": {
        "type": "object",
        "properties": {
          "invoiceNumber": {
            "type": [
              "string",
              "null"
            ],
            "description": "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.",
            "example": "SW/26-27/0042"
          },
          "date": {
            "type": "string",
            "format": "date",
            "example": "2026-09-21",
            "description": "The date on the invoice."
          },
          "dueDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "example": "2026-09-21",
            "description": "Left out, the invoice is due on its date."
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "Left out, the sale is in rupees. A sale to a buyer in India is in rupees.",
            "example": "INR"
          },
          "exchangeRate": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "string",
                "maxLength": 24,
                "pattern": "^\\d+(\\.\\d+)?$"
              },
              {
                "type": "null"
              }
            ],
            "example": "83.25",
            "description": "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": {
            "type": [
              "string",
              "null"
            ],
            "description": "Which of the business's own GSTINs the invoice was issued under. Left out, its usual one."
          },
          "buyer": {
            "type": "object",
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "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.",
                "example": "Anna Thomas"
              },
              "gstin": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "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.",
                "example": "32AAACQ1234A1ZD"
              },
              "country": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The two letter country code. Left out, the buyer is in India.",
                "example": "IN"
              },
              "state": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "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.",
                "example": "32"
              },
              "address": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "line1": {
                    "type": "string",
                    "description": "The first line of the address.",
                    "example": "14 Marine Drive"
                  },
                  "line2": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "A second line, when the address needs one."
                  },
                  "city": {
                    "type": "string",
                    "description": "The town or city.",
                    "example": "Kochi"
                  },
                  "postalCode": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "example": "682031",
                    "description": "The 6 digit PIN code of a buyer in India, or the postal code of one abroad."
                  },
                  "region": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "The state or province of a buyer abroad."
                  }
                },
                "required": [
                  "line1",
                  "city"
                ],
                "additionalProperties": false,
                "description": "The buyer's address, as the invoice keeps it. Left out, it keeps none."
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ],
                "example": "anna-demo@tracery.in",
                "description": "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."
              }
            },
            "additionalProperties": false,
            "description": "Who bought: a business with its GSTIN, or a person, in India or abroad."
          },
          "placeOfSupply": {
            "type": [
              "string",
              "null"
            ],
            "description": "Where the supply is made, when it is not the buyer's own state. Left out for a buyer abroad.",
            "example": "32"
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "description": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "What was sold. Left out, the name of the HSN or SAC code is used.",
                  "example": "Pro plan, one month"
                },
                "hsnSac": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The HSN code of goods or the SAC code of a service, 4 to 8 digits.",
                  "example": "998314"
                },
                "quantity": {
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": 0
                    },
                    {
                      "type": "string",
                      "maxLength": 24,
                      "pattern": "^\\d+(\\.\\d+)?$"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "example": 1,
                  "description": "Left out, the quantity is 1. The taxable value is for the whole line."
                },
                "unit": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "For goods, the unit GST returns count them in, such as NOS or KGS.",
                  "example": "NOS"
                },
                "taxable": {
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": 0
                    },
                    {
                      "type": "string",
                      "maxLength": 24,
                      "pattern": "^\\d+(\\.\\d+)?$"
                    }
                  ],
                  "example": "1000.00",
                  "description": "The value of the line before GST, after any discount."
                },
                "gstRate": {
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": 0
                    },
                    {
                      "type": "string"
                    }
                  ],
                  "description": "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.",
                  "example": 18
                },
                "servicePeriod": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/ServicePeriod"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "taxable",
                "gstRate"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 100,
            "description": "What was sold, a line for each kind of goods or service, up to 100."
          },
          "total": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "string",
                "maxLength": 24,
                "pattern": "^\\d+(\\.\\d+)?$"
              }
            ],
            "example": "1180.50",
            "description": "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": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "igst": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": 0
                  },
                  {
                    "type": "string",
                    "maxLength": 24,
                    "pattern": "^\\d+(\\.\\d+)?$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "example": "1180.50",
                "description": "IGST, on a supply to another state, or an export with IGST paid."
              },
              "cgst": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": 0
                  },
                  {
                    "type": "string",
                    "maxLength": 24,
                    "pattern": "^\\d+(\\.\\d+)?$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "example": "1180.50",
                "description": "CGST, on a supply within the business's own state."
              },
              "sgst": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": 0
                  },
                  {
                    "type": "string",
                    "maxLength": 24,
                    "pattern": "^\\d+(\\.\\d+)?$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "example": "1180.50",
                "description": "SGST or UTGST."
              }
            },
            "additionalProperties": false,
            "description": "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."
          },
          "eInvoice": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "signedQrCode": {
                "type": "string",
                "minLength": 1,
                "maxLength": 4000,
                "description": "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."
              },
              "ackNo": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^[0-9]{1,20}$",
                "description": "The acknowledgement number the IRP gave, digits only."
              },
              "ackDate": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Needed only when the QR code does not say when its IRN was made."
              }
            },
            "required": [
              "signedQrCode"
            ],
            "additionalProperties": false,
            "description": "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."
          }
        },
        "required": [
          "date",
          "buyer",
          "lines",
          "total"
        ],
        "additionalProperties": false,
        "example": {
          "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"
          }
        }
      },
      "ServicePeriod": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date",
            "example": "2026-09-21",
            "description": "The first day the line is for."
          },
          "to": {
            "type": "string",
            "format": "date",
            "example": "2026-09-21",
            "description": "The last day the line is for, both days counted."
          }
        },
        "required": [
          "from",
          "to"
        ],
        "additionalProperties": false,
        "description": "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.",
        "example": {
          "from": "2026-11-01",
          "to": "2027-10-31"
        }
      },
      "CancelSale": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Why the sale is cancelled, kept on its invoice for the people of the business.",
            "example": "The buyer cancelled the order before paying"
          }
        },
        "required": [
          "reason"
        ],
        "additionalProperties": false,
        "example": {
          "reason": "The buyer cancelled the order before paying"
        }
      },
      "RecordedPayment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Your own ID for the payment.",
            "example": "pay_N7dK2"
          },
          "status": {
            "type": "string",
            "enum": [
              "recorded",
              "updated",
              "unchanged",
              "checked",
              "undone"
            ],
            "description": "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."
          },
          "saved": {
            "type": "boolean",
            "description": "Whether the payment is in the business's books. False for a test key's check, and for a payment undone in Tracery."
          },
          "date": {
            "type": "string",
            "description": "The day the gateway took the payment.",
            "example": "2026-11-11"
          },
          "gateway": {
            "type": "string",
            "enum": [
              "razorpay",
              "cashfree",
              "stripe",
              "paypal",
              "payu",
              "phonepe",
              "paytm",
              "ccavenue",
              "instamojo",
              "easebuzz",
              "billdesk",
              "other"
            ],
            "description": "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.",
            "example": "razorpay"
          },
          "reference": {
            "type": [
              "string",
              "null"
            ],
            "description": "The gateway's own ID for the payment, as you sent it; null when you sent none.",
            "example": "pay_N7dK2"
          },
          "amount": {
            "type": "string",
            "example": "1180.00",
            "description": "What the buyer paid, in the sale currency."
          },
          "fee": {
            "type": [
              "string",
              "null"
            ],
            "description": "What the gateway kept, in rupees, as you sent it. Null while not known.",
            "example": "27.85"
          },
          "net": {
            "type": "string",
            "example": "1152.15",
            "description": "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": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Null where a test key's check would have made the balance."
              },
              "name": {
                "type": "string",
                "description": "The balance's name in Tracery.",
                "example": "Razorpay balance"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "description": "The balance in Tracery the money landed in. Null for a test key's check of a sale Tracery does not hold."
          },
          "sale": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "Your own ID for the sale."
              },
              "invoiceNumber": {
                "type": "string",
                "description": "The number of the sale's invoice.",
                "example": "SW/26-27/0042"
              },
              "currency": {
                "type": "string",
                "description": "The invoice currency, as its three letter code.",
                "example": "INR"
              },
              "total": {
                "type": "string",
                "example": "1180.00",
                "description": "The total of the invoice with its GST."
              },
              "paid": {
                "type": "string",
                "example": "1180.00",
                "description": "What is paid of it now."
              },
              "credited": {
                "type": "string",
                "example": "0.00",
                "description": "What credit notes took off it."
              },
              "open": {
                "type": "string",
                "example": "0.00",
                "description": "What is still to be paid."
              }
            },
            "required": [
              "id",
              "invoiceNumber",
              "currency",
              "total",
              "paid",
              "credited",
              "open"
            ],
            "description": "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."
          }
        },
        "required": [
          "id",
          "status",
          "saved",
          "date",
          "gateway",
          "reference",
          "amount",
          "fee",
          "net",
          "balance",
          "sale"
        ],
        "example": {
          "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"
          }
        }
      },
      "Payment": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "example": "2026-09-21",
            "description": "The day the gateway took the payment, on or after the invoice date."
          },
          "amount": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "string",
                "maxLength": 24,
                "pattern": "^\\d+(\\.\\d+)?$"
              }
            ],
            "example": "1180.00",
            "description": "What the buyer paid, in the currency of the sale, before any fee. At most what the sale still has to be paid."
          },
          "gateway": {
            "type": "string",
            "enum": [
              "razorpay",
              "cashfree",
              "stripe",
              "paypal",
              "payu",
              "phonepe",
              "paytm",
              "ccavenue",
              "instamojo",
              "easebuzz",
              "billdesk",
              "other"
            ],
            "description": "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.",
            "example": "razorpay"
          },
          "fee": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "string",
                "maxLength": 24,
                "pattern": "^\\d+(\\.\\d+)?$"
              },
              {
                "type": "null"
              }
            ],
            "example": "27.85",
            "description": "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": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "string",
                "maxLength": 24,
                "pattern": "^\\d+(\\.\\d+)?$"
              },
              {
                "type": "null"
              }
            ],
            "example": "98250.00",
            "description": "Only for a sale in another currency, and then needed: what the amount came to in rupees, before the fee."
          },
          "reference": {
            "type": [
              "string",
              "null"
            ],
            "description": "The gateway's own ID for the payment, as its payout report names it. Left out, your payment ID is kept.",
            "example": "pay_N7dK2"
          }
        },
        "required": [
          "date",
          "amount",
          "gateway"
        ],
        "additionalProperties": false,
        "example": {
          "date": "2026-11-02",
          "amount": "1180.00",
          "gateway": "razorpay",
          "fee": "27.85",
          "reference": "pay_N7dK2"
        }
      },
      "RecordedRefund": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Your own ID for the refund.",
            "example": "rfnd_Q2xT9"
          },
          "status": {
            "type": "string",
            "enum": [
              "recorded",
              "unchanged",
              "checked",
              "cancelled"
            ],
            "description": "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."
          },
          "saved": {
            "type": "boolean",
            "description": "Whether the refund is in the business's books. False for a test key's check."
          },
          "creditNote": {
            "type": "object",
            "properties": {
              "id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Tracery's ID of the credit note. Null for a refund only checked."
              },
              "link": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Where people of the business open the credit note in Tracery."
              },
              "numberedBy": {
                "type": "string",
                "enum": [
                  "app",
                  "tracery"
                ],
                "description": "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."
              },
              "pdf": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Where your app reads the PDF with its key, for one Tracery numbered; null for one your app numbered, and for one only checked.",
                "example": "https://api.tracery.in/apps/v1/sales/order-10042/refunds/rfnd_Q2xT9/pdf"
              },
              "email": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/AppDocumentEmail"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "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."
              },
              "number": {
                "type": "string",
                "description": "The credit note's number: the one your app gave, or the one Tracery gave.",
                "example": "SW/CN/26-27/007"
              },
              "date": {
                "type": "string",
                "description": "The date on the credit note.",
                "example": "2026-11-11"
              },
              "currency": {
                "type": "string",
                "description": "The currency of the sale, as its three letter code.",
                "example": "INR"
              },
              "total": {
                "type": "string",
                "example": "1180.00",
                "description": "In the currency of the sale."
              },
              "taxable": {
                "type": "string",
                "example": "1000.00",
                "description": "The value it takes off before GST, in the currency of the sale."
              },
              "igst": {
                "type": "string",
                "example": "0.00",
                "description": "In rupees."
              },
              "cgst": {
                "type": "string",
                "example": "90.00",
                "description": "In rupees."
              },
              "sgst": {
                "type": "string",
                "example": "90.00",
                "description": "SGST or UTGST, in rupees."
              },
              "irn": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The IRN kept for the credit note, while it stands."
              }
            },
            "required": [
              "id",
              "link",
              "numberedBy",
              "pdf",
              "email",
              "number",
              "date",
              "currency",
              "total",
              "taxable",
              "igst",
              "cgst",
              "sgst",
              "irn"
            ],
            "description": "The credit note Tracery holds for the refund."
          },
          "paidBack": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "amount": {
                "type": "string",
                "example": "1180.00",
                "description": "In the currency of the sale."
              },
              "rupees": {
                "type": "string",
                "example": "1180.00",
                "description": "What left the balance, in rupees."
              },
              "gateway": {
                "type": "string",
                "enum": [
                  "razorpay",
                  "cashfree",
                  "stripe",
                  "paypal",
                  "payu",
                  "phonepe",
                  "paytm",
                  "ccavenue",
                  "instamojo",
                  "easebuzz",
                  "billdesk",
                  "other"
                ],
                "description": "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.",
                "example": "razorpay"
              },
              "balance": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Null where a test key's check would have made the balance."
                  },
                  "name": {
                    "type": "string",
                    "description": "The balance's name in Tracery.",
                    "example": "Razorpay balance"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "description": "The balance in Tracery the money left."
              },
              "undone": {
                "type": "boolean",
                "description": "True once someone undid the money paid back in Tracery."
              }
            },
            "required": [
              "amount",
              "rupees",
              "gateway",
              "balance",
              "undone"
            ],
            "description": "The money that went back to the buyer. Null when none did."
          },
          "sale": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "Your own ID for the sale."
              },
              "invoiceNumber": {
                "type": "string",
                "description": "The number of the sale's invoice.",
                "example": "SW/26-27/0042"
              },
              "currency": {
                "type": "string",
                "description": "The invoice currency, as its three letter code.",
                "example": "INR"
              },
              "total": {
                "type": "string",
                "example": "1180.00",
                "description": "The total of the invoice with its GST."
              },
              "paid": {
                "type": "string",
                "example": "1180.00",
                "description": "What is paid of it now."
              },
              "credited": {
                "type": "string",
                "example": "0.00",
                "description": "What credit notes took off it."
              },
              "open": {
                "type": "string",
                "example": "0.00",
                "description": "What is still to be paid."
              }
            },
            "required": [
              "id",
              "invoiceNumber",
              "currency",
              "total",
              "paid",
              "credited",
              "open"
            ],
            "description": "The sale as it stands with this refund."
          }
        },
        "required": [
          "id",
          "status",
          "saved",
          "creditNote",
          "paidBack",
          "sale"
        ],
        "example": {
          "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"
          }
        }
      },
      "Refund": {
        "type": "object",
        "properties": {
          "creditNoteNumber": {
            "type": [
              "string",
              "null"
            ],
            "description": "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.",
            "example": "SW/CN/26-27/007"
          },
          "date": {
            "type": "string",
            "format": "date",
            "example": "2026-09-21",
            "description": "The date on the credit note, on or after the invoice date. Money paid back is recorded on this day."
          },
          "reason": {
            "type": "string",
            "description": "Why the credit note was issued, kept on it for the people of the business.",
            "example": "The buyer returned the order"
          },
          "lines": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "description": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "What was sold. Left out, the name of the HSN or SAC code is used.",
                  "example": "Pro plan, one month"
                },
                "hsnSac": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The HSN code of goods or the SAC code of a service, 4 to 8 digits.",
                  "example": "998314"
                },
                "quantity": {
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": 0
                    },
                    {
                      "type": "string",
                      "maxLength": 24,
                      "pattern": "^\\d+(\\.\\d+)?$"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "example": 1,
                  "description": "Left out, the quantity is 1. The taxable value is for the whole line."
                },
                "unit": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "For goods, the unit GST returns count them in, such as NOS or KGS.",
                  "example": "NOS"
                },
                "taxable": {
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": 0
                    },
                    {
                      "type": "string",
                      "maxLength": 24,
                      "pattern": "^\\d+(\\.\\d+)?$"
                    }
                  ],
                  "example": "1000.00",
                  "description": "The value of the line before GST, after any discount."
                },
                "gstRate": {
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": 0
                    },
                    {
                      "type": "string"
                    }
                  ],
                  "description": "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.",
                  "example": 18
                },
                "servicePeriod": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/ServicePeriod"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "taxable",
                "gstRate"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 100,
            "description": "What the credit note takes off, as the lines of a sale are sent. Left out, it takes off every line of the sale."
          },
          "total": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "string",
                "maxLength": 24,
                "pattern": "^\\d+(\\.\\d+)?$"
              }
            ],
            "example": "1180.00",
            "description": "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": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "igst": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": 0
                  },
                  {
                    "type": "string",
                    "maxLength": 24,
                    "pattern": "^\\d+(\\.\\d+)?$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "example": "1180.50",
                "description": "IGST, on a supply to another state, or an export with IGST paid."
              },
              "cgst": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": 0
                  },
                  {
                    "type": "string",
                    "maxLength": 24,
                    "pattern": "^\\d+(\\.\\d+)?$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "example": "1180.50",
                "description": "CGST, on a supply within the business's own state."
              },
              "sgst": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": 0
                  },
                  {
                    "type": "string",
                    "maxLength": 24,
                    "pattern": "^\\d+(\\.\\d+)?$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "example": "1180.50",
                "description": "SGST or UTGST."
              }
            },
            "additionalProperties": false,
            "description": "The GST on the credit note, in rupees. Each one sent is checked against what Tracery works out, to a rupee."
          },
          "paidBack": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "string",
                "maxLength": 24,
                "pattern": "^\\d+(\\.\\d+)?$"
              },
              {
                "type": "null"
              }
            ],
            "example": "1180.00",
            "description": "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": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "string",
                "maxLength": 24,
                "pattern": "^\\d+(\\.\\d+)?$"
              },
              {
                "type": "null"
              }
            ],
            "example": "98250.00",
            "description": "Only for a sale in another currency, and then needed with paidBack: what left the gateway balance in rupees."
          },
          "gateway": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "razorpay",
              "cashfree",
              "stripe",
              "paypal",
              "payu",
              "phonepe",
              "paytm",
              "ccavenue",
              "instamojo",
              "easebuzz",
              "billdesk",
              "other",
              null
            ],
            "description": "The gateway the money went back through. Left out, it is the gateway the latest payment your app sent for the sale came through.",
            "example": "razorpay"
          },
          "reference": {
            "type": [
              "string",
              "null"
            ],
            "description": "The gateway's own ID for the refund, as its payout report names it. Left out, your refund ID is kept.",
            "example": "rfnd_Q2xT9"
          },
          "eInvoice": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "signedQrCode": {
                "type": "string",
                "minLength": 1,
                "maxLength": 4000,
                "description": "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."
              },
              "ackNo": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^[0-9]{1,20}$",
                "description": "The acknowledgement number the IRP gave, digits only."
              },
              "ackDate": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Needed only when the QR code does not say when its IRN was made."
              }
            },
            "required": [
              "signedQrCode"
            ],
            "additionalProperties": false,
            "description": "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."
          }
        },
        "required": [
          "date",
          "reason",
          "total"
        ],
        "additionalProperties": false,
        "example": {
          "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"
        }
      },
      "GatewayNoticeAnswer": {
        "type": "object",
        "properties": {
          "gateway": {
            "type": "string",
            "enum": [
              "cashfree",
              "stripe"
            ],
            "description": "The gateway the notice came from."
          },
          "type": {
            "type": "string",
            "description": "What the gateway calls the notice.",
            "example": "PAYMENT_SUCCESS_WEBHOOK"
          },
          "readAs": {
            "type": "string",
            "enum": [
              "payment",
              "refund",
              "payout",
              "nothing"
            ],
            "description": "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."
          },
          "status": {
            "type": "string",
            "enum": [
              "recorded",
              "updated",
              "unchanged",
              "checked",
              "undone",
              "cancelled",
              "kept",
              "withdrawn",
              "not_read"
            ],
            "description": "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."
          },
          "why": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why nothing was read from the notice; null when something was."
          },
          "payment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RecordedPayment"
              },
              {
                "type": "null"
              }
            ],
            "description": "The payment as the payment call answers it, when the notice was one."
          },
          "refund": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RecordedRefund"
              },
              {
                "type": "null"
              }
            ],
            "description": "The refund as the refund call answers it, when the notice was one."
          }
        },
        "required": [
          "gateway",
          "type",
          "readAs",
          "status",
          "why",
          "payment",
          "refund"
        ],
        "example": {
          "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
        }
      },
      "GatewayNoticeBody": {
        "type": "object",
        "additionalProperties": {},
        "description": "The gateway's notice body exactly as it came, after your app has checked the gateway's signature on it.",
        "example": {
          "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"
            }
          }
        }
      },
      "AppDayCheck": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "description": "The day.",
            "example": "2026-11-02"
          },
          "saved": {
            "type": "boolean",
            "description": "Whether Tracery keeps these totals: false for a test key's check."
          },
          "agrees": {
            "type": "boolean",
            "description": "Whether every count and total you sent is what Tracery holds."
          },
          "totals": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "currency": {
                  "type": "string",
                  "description": "The currency, as its three letter code.",
                  "example": "INR"
                },
                "sales": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "sent": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer",
                          "description": "How many.",
                          "example": 1
                        },
                        "total": {
                          "type": "string",
                          "example": "1180.00",
                          "description": "What they come to, in this currency."
                        }
                      },
                      "required": [
                        "count",
                        "total"
                      ],
                      "description": "What your app sent for the day."
                    },
                    "held": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer",
                          "description": "How many.",
                          "example": 1
                        },
                        "total": {
                          "type": "string",
                          "example": "1180.00",
                          "description": "What they come to, in this currency."
                        }
                      },
                      "required": [
                        "count",
                        "total"
                      ],
                      "description": "What Tracery holds from your app for the day."
                    },
                    "agrees": {
                      "type": "boolean",
                      "description": "Whether the two are the same."
                    }
                  },
                  "required": [
                    "sent",
                    "held",
                    "agrees"
                  ],
                  "description": "Null for a kind you did not send, which is not compared."
                },
                "payments": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "sent": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer",
                          "description": "How many.",
                          "example": 1
                        },
                        "total": {
                          "type": "string",
                          "example": "1180.00",
                          "description": "What they come to, in this currency."
                        }
                      },
                      "required": [
                        "count",
                        "total"
                      ],
                      "description": "What your app sent for the day."
                    },
                    "held": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer",
                          "description": "How many.",
                          "example": 1
                        },
                        "total": {
                          "type": "string",
                          "example": "1180.00",
                          "description": "What they come to, in this currency."
                        }
                      },
                      "required": [
                        "count",
                        "total"
                      ],
                      "description": "What Tracery holds from your app for the day."
                    },
                    "agrees": {
                      "type": "boolean",
                      "description": "Whether the two are the same."
                    }
                  },
                  "required": [
                    "sent",
                    "held",
                    "agrees"
                  ],
                  "description": "Null for a kind you did not send, which is not compared."
                },
                "refunds": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "sent": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer",
                          "description": "How many.",
                          "example": 1
                        },
                        "total": {
                          "type": "string",
                          "example": "1180.00",
                          "description": "What they come to, in this currency."
                        }
                      },
                      "required": [
                        "count",
                        "total"
                      ],
                      "description": "What your app sent for the day."
                    },
                    "held": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer",
                          "description": "How many.",
                          "example": 1
                        },
                        "total": {
                          "type": "string",
                          "example": "1180.00",
                          "description": "What they come to, in this currency."
                        }
                      },
                      "required": [
                        "count",
                        "total"
                      ],
                      "description": "What Tracery holds from your app for the day."
                    },
                    "agrees": {
                      "type": "boolean",
                      "description": "Whether the two are the same."
                    }
                  },
                  "required": [
                    "sent",
                    "held",
                    "agrees"
                  ],
                  "description": "Null for a kind you did not send, which is not compared."
                }
              },
              "required": [
                "currency",
                "sales",
                "payments",
                "refunds"
              ]
            },
            "description": "For each currency you sent, your count and total beside Tracery's."
          }
        },
        "required": [
          "date",
          "saved",
          "agrees",
          "totals"
        ],
        "example": {
          "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
            }
          ]
        }
      },
      "AppDay": {
        "type": "object",
        "properties": {
          "totals": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "currency": {
                  "type": "string",
                  "minLength": 3,
                  "maxLength": 3,
                  "description": "The currency, as its three letter code.",
                  "example": "INR"
                },
                "sales": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "count": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000000,
                      "description": "How many your app holds for the day.",
                      "example": 42
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "number",
                          "minimum": 0
                        },
                        {
                          "type": "string",
                          "maxLength": 24,
                          "pattern": "^\\d+(\\.\\d+)?$"
                        }
                      ],
                      "example": "49560.00",
                      "description": "What they come to, in this currency."
                    }
                  },
                  "required": [
                    "count",
                    "total"
                  ],
                  "additionalProperties": false,
                  "description": "Every sale your app sent for the day, cancelled ones too, and the total of their invoices with GST as issued."
                },
                "payments": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "count": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000000,
                      "description": "How many your app holds for the day.",
                      "example": 42
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "number",
                          "minimum": 0
                        },
                        {
                          "type": "string",
                          "maxLength": 24,
                          "pattern": "^\\d+(\\.\\d+)?$"
                        }
                      ],
                      "example": "49560.00",
                      "description": "What they come to, in this currency."
                    }
                  },
                  "required": [
                    "count",
                    "total"
                  ],
                  "additionalProperties": false,
                  "description": "The payments a gateway took that day, and what the buyers paid."
                },
                "refunds": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "count": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000000,
                      "description": "How many your app holds for the day.",
                      "example": 42
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "number",
                          "minimum": 0
                        },
                        {
                          "type": "string",
                          "maxLength": 24,
                          "pattern": "^\\d+(\\.\\d+)?$"
                        }
                      ],
                      "example": "49560.00",
                      "description": "What they come to, in this currency."
                    }
                  },
                  "required": [
                    "count",
                    "total"
                  ],
                  "additionalProperties": false,
                  "description": "The refunds of the day, by their credit note date, and what went back to the buyers."
                }
              },
              "required": [
                "currency"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 20,
            "description": "The day's totals, one for each currency your app sold in, up to 20."
          }
        },
        "required": [
          "totals"
        ],
        "additionalProperties": false,
        "example": {
          "totals": [
            {
              "currency": "INR",
              "sales": {
                "count": 1,
                "total": "1180.00"
              },
              "payments": {
                "count": 1,
                "total": "1180.00"
              }
            }
          ]
        }
      }
    },
    "parameters": {}
  },
  "paths": {
    "/apps/v1/me": {
      "get": {
        "tags": [
          "Connected apps API"
        ],
        "summary": "Who this key belongs to",
        "description": "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.",
        "responses": {
          "200": {
            "description": "The app and its business",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppIdentity"
                }
              }
            }
          },
          "401": {
            "description": "The key was not sent, is not a whole Tracery key, or no longer works: ended, replaced, or its app disconnected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The call came from a web page rather than a server, the business is paused on Tracery, or its connected apps are switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "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",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls this minute; wait for the seconds Retry-After gives, then send again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/apps/v1/sales/{saleId}": {
      "put": {
        "tags": [
          "Sales"
        ],
        "summary": "Send a sale: its invoice",
        "description": "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.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
              "description": "Your own ID for the sale, such as your order ID.",
              "example": "order-10042"
            },
            "required": true,
            "description": "Your own ID for the sale, such as your order ID.",
            "name": "saleId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Sale"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The sale as Tracery holds it; nothing was added by this call",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordedSale"
                }
              }
            }
          },
          "201": {
            "description": "The sale, recorded by this call",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordedSale"
                }
              }
            }
          },
          "401": {
            "description": "The key was not sent, is not a whole Tracery key, or no longer works: ended, replaced, or its app disconnected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The call came from a web page rather than a server, the business is paused on Tracery, or its connected apps are switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "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",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "The call is larger than 256 KB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "A field is wrong or missing; details names each one and says why",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls this minute; wait for the seconds Retry-After gives, then send again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Sales"
        ],
        "summary": "Read back a sale your app sent",
        "description": "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.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
              "description": "Your own ID for the sale, such as your order ID.",
              "example": "order-10042"
            },
            "required": true,
            "description": "Your own ID for the sale, such as your order ID.",
            "name": "saleId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The sale as Tracery holds it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordedSale"
                }
              }
            }
          },
          "401": {
            "description": "The key was not sent, is not a whole Tracery key, or no longer works: ended, replaced, or its app disconnected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The call came from a web page rather than a server, the business is paused on Tracery, or its connected apps are switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Tracery holds nothing your app sent at this address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "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",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls this minute; wait for the seconds Retry-After gives, then send again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/apps/v1/sales/{saleId}/cancel": {
      "post": {
        "tags": [
          "Sales"
        ],
        "summary": "Cancel a sale nothing is paid or refunded on",
        "description": "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.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
              "description": "Your own ID for the sale, such as your order ID.",
              "example": "order-10042"
            },
            "required": true,
            "description": "Your own ID for the sale, such as your order ID.",
            "name": "saleId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelSale"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The sale, cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordedSale"
                }
              }
            }
          },
          "401": {
            "description": "The key was not sent, is not a whole Tracery key, or no longer works: ended, replaced, or its app disconnected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The call came from a web page rather than a server, the business is paused on Tracery, or its connected apps are switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Tracery holds nothing your app sent at this address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "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",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "The call is larger than 256 KB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "A field is wrong or missing; details names each one and says why",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls this minute; wait for the seconds Retry-After gives, then send again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/apps/v1/sales/{saleId}/pdf": {
      "get": {
        "tags": [
          "Sales"
        ],
        "summary": "A sale's invoice as a PDF",
        "description": "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.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
              "description": "Your own ID for the sale, such as your order ID.",
              "example": "order-10042"
            },
            "required": true,
            "description": "Your own ID for the sale, such as your order ID.",
            "name": "saleId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The PDF, as Tracery printed it when it issued the document",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "The key was not sent, is not a whole Tracery key, or no longer works: ended, replaced, or its app disconnected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The call came from a web page rather than a server, the business is paused on Tracery, or its connected apps are switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Tracery holds nothing your app sent at this address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "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",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls this minute; wait for the seconds Retry-After gives, then send again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "The PDF could not be printed just now; try again shortly",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/apps/v1/sales/{saleId}/refunds/{refundId}/pdf": {
      "get": {
        "tags": [
          "Sales"
        ],
        "summary": "A refund's credit note as a PDF",
        "description": "Only for a credit note Tracery numbered and issued for the refund. One your app numbered itself is refused with 409.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
              "description": "Your own ID for the sale, such as your order ID.",
              "example": "order-10042"
            },
            "required": true,
            "description": "Your own ID for the sale, such as your order ID.",
            "name": "saleId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
              "description": "Your own ID for the refund, such as the gateway's refund ID.",
              "example": "rfnd_Q2xT9"
            },
            "required": true,
            "description": "Your own ID for the refund, such as the gateway's refund ID.",
            "name": "refundId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The PDF, as Tracery printed it when it issued the document",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "The key was not sent, is not a whole Tracery key, or no longer works: ended, replaced, or its app disconnected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The call came from a web page rather than a server, the business is paused on Tracery, or its connected apps are switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Tracery holds nothing your app sent at this address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "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",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls this minute; wait for the seconds Retry-After gives, then send again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "The PDF could not be printed just now; try again shortly",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/apps/v1/sales/{saleId}/payments/{paymentId}": {
      "put": {
        "tags": [
          "Payments"
        ],
        "summary": "Send a payment a gateway took for a sale",
        "description": "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.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
              "description": "Your own ID for the sale, such as your order ID.",
              "example": "order-10042"
            },
            "required": true,
            "description": "Your own ID for the sale, such as your order ID.",
            "name": "saleId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
              "description": "Your own ID for the payment, such as the gateway's payment ID.",
              "example": "pay_N7dK2"
            },
            "required": true,
            "description": "Your own ID for the payment, such as the gateway's payment ID.",
            "name": "paymentId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Payment"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The payment as Tracery holds it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordedPayment"
                }
              }
            }
          },
          "201": {
            "description": "The payment, recorded by this call",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordedPayment"
                }
              }
            }
          },
          "401": {
            "description": "The key was not sent, is not a whole Tracery key, or no longer works: ended, replaced, or its app disconnected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The call came from a web page rather than a server, the business is paused on Tracery, or its connected apps are switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Tracery holds nothing your app sent at this address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "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",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "The call is larger than 256 KB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "A field is wrong or missing; details names each one and says why",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls this minute; wait for the seconds Retry-After gives, then send again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Payments"
        ],
        "summary": "Read back a payment your app sent",
        "description": "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.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
              "description": "Your own ID for the sale, such as your order ID.",
              "example": "order-10042"
            },
            "required": true,
            "description": "Your own ID for the sale, such as your order ID.",
            "name": "saleId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
              "description": "Your own ID for the payment, such as the gateway's payment ID.",
              "example": "pay_N7dK2"
            },
            "required": true,
            "description": "Your own ID for the payment, such as the gateway's payment ID.",
            "name": "paymentId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The payment as Tracery holds it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordedPayment"
                }
              }
            }
          },
          "401": {
            "description": "The key was not sent, is not a whole Tracery key, or no longer works: ended, replaced, or its app disconnected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The call came from a web page rather than a server, the business is paused on Tracery, or its connected apps are switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Tracery holds nothing your app sent at this address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "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",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls this minute; wait for the seconds Retry-After gives, then send again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/apps/v1/sales/{saleId}/refunds/{refundId}": {
      "put": {
        "tags": [
          "Refunds"
        ],
        "summary": "Send a refund: its credit note, and the money that went back",
        "description": "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.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
              "description": "Your own ID for the sale, such as your order ID.",
              "example": "order-10042"
            },
            "required": true,
            "description": "Your own ID for the sale, such as your order ID.",
            "name": "saleId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
              "description": "Your own ID for the refund, such as the gateway's refund ID.",
              "example": "rfnd_Q2xT9"
            },
            "required": true,
            "description": "Your own ID for the refund, such as the gateway's refund ID.",
            "name": "refundId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Refund"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The refund as Tracery holds it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordedRefund"
                }
              }
            }
          },
          "201": {
            "description": "The refund, recorded by this call",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordedRefund"
                }
              }
            }
          },
          "401": {
            "description": "The key was not sent, is not a whole Tracery key, or no longer works: ended, replaced, or its app disconnected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The call came from a web page rather than a server, the business is paused on Tracery, or its connected apps are switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Tracery holds nothing your app sent at this address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "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",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "The call is larger than 256 KB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "A field is wrong or missing; details names each one and says why",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls this minute; wait for the seconds Retry-After gives, then send again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Refunds"
        ],
        "summary": "Read back a refund your app sent",
        "description": "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.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
              "description": "Your own ID for the sale, such as your order ID.",
              "example": "order-10042"
            },
            "required": true,
            "description": "Your own ID for the sale, such as your order ID.",
            "name": "saleId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
              "description": "Your own ID for the refund, such as the gateway's refund ID.",
              "example": "rfnd_Q2xT9"
            },
            "required": true,
            "description": "Your own ID for the refund, such as the gateway's refund ID.",
            "name": "refundId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The refund as Tracery holds it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordedRefund"
                }
              }
            }
          },
          "401": {
            "description": "The key was not sent, is not a whole Tracery key, or no longer works: ended, replaced, or its app disconnected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The call came from a web page rather than a server, the business is paused on Tracery, or its connected apps are switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Tracery holds nothing your app sent at this address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "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",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls this minute; wait for the seconds Retry-After gives, then send again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/apps/v1/gateway-notices/{gateway}": {
      "post": {
        "tags": [
          "Gateway notices"
        ],
        "summary": "Pass on a gateway's notice of a payment, refund or payout",
        "description": "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.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "cashfree",
                "stripe"
              ],
              "description": "The gateway the notice came from.",
              "example": "cashfree"
            },
            "required": true,
            "description": "The gateway the notice came from.",
            "name": "gateway",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GatewayNoticeBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What the notice was read as, and what Tracery holds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GatewayNoticeAnswer"
                }
              }
            }
          },
          "201": {
            "description": "What the notice was read as, recorded by this call",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GatewayNoticeAnswer"
                }
              }
            }
          },
          "401": {
            "description": "The key was not sent, is not a whole Tracery key, or no longer works: ended, replaced, or its app disconnected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The call came from a web page rather than a server, the business is paused on Tracery, or its connected apps are switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "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",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "The call is larger than 256 KB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "A field is wrong or missing; details names each one and says why",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls this minute; wait for the seconds Retry-After gives, then send again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/apps/v1/days/{date}": {
      "put": {
        "tags": [
          "Days"
        ],
        "summary": "Send a day's count and total, to check nothing was missed",
        "description": "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.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-11-02",
              "description": "The day, by the dates your app sends with its sales, payments and refunds."
            },
            "required": true,
            "description": "The day, by the dates your app sends with its sales, payments and refunds.",
            "name": "date",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppDay"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What your app sent beside what Tracery holds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppDayCheck"
                }
              }
            }
          },
          "401": {
            "description": "The key was not sent, is not a whole Tracery key, or no longer works: ended, replaced, or its app disconnected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The call came from a web page rather than a server, the business is paused on Tracery, or its connected apps are switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "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",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "The call is larger than 256 KB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "A field is wrong or missing; details names each one and says why",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls this minute; wait for the seconds Retry-After gives, then send again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Days"
        ],
        "summary": "Read back a day's totals beside what Tracery holds now",
        "description": "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.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-11-02",
              "description": "The day, by the dates your app sends with its sales, payments and refunds."
            },
            "required": true,
            "description": "The day, by the dates your app sends with its sales, payments and refunds.",
            "name": "date",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "What your app sent beside what Tracery holds now",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppDayCheck"
                }
              }
            }
          },
          "401": {
            "description": "The key was not sent, is not a whole Tracery key, or no longer works: ended, replaced, or its app disconnected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The call came from a web page rather than a server, the business is paused on Tracery, or its connected apps are switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Tracery holds nothing your app sent at this address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "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",
            "content": {
              "application/json": {
                "example": {
                  "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"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls this minute; wait for the seconds Retry-After gives, then send again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {}
}
