Classify a product for GST
Sets a product’s HSN/SAC code and its GST rate, creating the classification or replacing it. There is no POST: a product has at most one, so there is no second one to create. BOTH FIELDS ARE REQUIRED AND NEITHER IS DEFAULTED. An omitted gst_rate_bps would read as 0 and make the product exempt, which is a real configuration and therefore indistinguishable from a bug on every later read. THIS CHANGES WHAT FUTURE INVOICES CHARGE. It does not touch documents already issued: their rates are frozen into the invoice at issue time. A product this store does not own is a 404. THERE IS NO DELETE. Removing a classification does not fail anything, it silently returns the product to HSN 9999 at the store default, so the next invoice is taxed differently with nothing looking changed. Correct the code here instead.
Authorizations
A secret API key. Publishable keys cannot reach this API. A key may carry an expiry, and an expired key is refused exactly like an unknown one, with a 401 that names no reason; check the key's expires_at in the dashboard rather than inferring it from a response. When a merchant rolls a key's secret they choose a grace window of up to 3 days, and for its duration BOTH the new secret and the one it replaced authenticate, so an integration moves over on its own deploy schedule instead of at the instant the button is pressed. Move before the window closes: after it, the old secret is refused. Nothing else about this contract moves with a roll. The key keeps its id and its scopes, so the only thing an integration updates is the credential itself.
Headers
A unique key per logical write. Replaying a request with the same key returns the first response byte for byte instead of applying the write twice.
Path Parameters
Body
An upsert keyed by the PRODUCT in the path, so there is no POST: a product has at most one classification. BOTH FIELDS ARE REQUIRED AND NEITHER IS DEFAULTED. An omitted rate would read as 0 and make the product exempt, which is a real configuration and so indistinguishable from a bug on every later read. IT CHANGES WHAT FUTURE INVOICES CHARGE and touches no document already issued: rates are frozen into the invoice at issue time. A product this store does not own is a 404. product_id is refused in the body: the product is named by the path.
The HSN or SAC code, 4 to 8 digits. How many digits a return must carry is the merchant's own compliance decision, so this is stored as given rather than padded or truncated.
This product's rate in BASIS POINTS: 12% is 1200. It overrides the store default for every line of this product, including a rate of zero, which is how an exempt product is expressed.
0 <= x <= 10000Response
Success
