/auth/signup Create a user + tenant + initial owner membership + email-verification token in one transaction. Sends a verification email. Audit-logged with IP + User-Agent for DPDP §8(8).
- · email (string, lowercase)
- · password (≥10 chars)
Selected high-traffic endpoints with their authentication
requirements, request shape, CSRF need, and response contract.
Every endpoint listed is in production code on the
main branch.
Order matters. Inbound requests traverse top to bottom:
/auth/signup Create a user + tenant + initial owner membership + email-verification token in one transaction. Sends a verification email. Audit-logged with IP + User-Agent for DPDP §8(8).
/auth/signin CSRF Verify credentials with argon2id constant-time compare. Returns generic ErrInvalidCredentials for both unknown-email and wrong-password to prevent enumeration. Creates session row, sets HttpOnly+Secure session cookie.
/invoices CSRF Create a draft invoice. Server-side compute of CGST/SGST/IGST from supplier state vs place-of-supply. Lines persisted with HSN, qty, rate, discount, tax_rate, taxable, per-tax money fields, total.
/invoices/{id}/finalize CSRF Flip a draft → finalized. Allocates the gapless per-FY invoice number via SELECT FOR UPDATE on invoice_counters. Writes JSONB snapshot for 6-year retention. Enqueues render_pdf job.
/invoices/{id}/cancel CSRF Cancel a finalized invoice. ErrCannotCancelPaid if any payment is allocated to it. Audit-logged.
/payments CSRF Record a payment + allocations across one or more invoices in a single tx. Allocation sum ≤ payment amount enforced server-side. Supports Idempotency-Key for retry safety.
/quotations/{id}/send CSRF Flip draft → sent. Issues a 256-bit random share token (crypto/rand → hex), persists to quotations.public_token. Audit-logged with the supplier IP + UA so future replays can be traced.
/quotations/{id}/convert CSRF Convert an accepted quotation to a draft invoice atomically. Creates the invoice with the same lines + customer + place-of-supply, stamps quotation.converted_to_invoice_id, transitions quote to 'converted' state. Single tx.
/q/{token} Customer-facing read-only view of a quote. Token regex-validated at the HTTP boundary BEFORE the DB lookup. Returns 404 indistinguishably for rejected and unknown tokens (privacy: prevents enumeration of valid-but-rejected URLs). No cookies set on this response.
/gstr2b/upload CSRF Multipart upload of a CBIC v3.0 GSTR-2B JSON. Parses strictly; counts skipped non-b2b sections; persists one gstr2b_imports row + N gstr2b_invoices rows in a single tx. Period collision returns ErrPeriodExists; re-upload with ?replace=1 triggers the replace flow.
/gstr2b/{import_id} The reconciliation page. Pulls books-side purchases for the period, runs gstr2b.Match against the persisted portal rows, groups by bucket, renders the 4-tab UI. Default tab: issues.
/gstr2b/invoices/{id}/mark CSRF HTMX endpoint. Sets gstr2b_invoices.user_marked to one of {ignore, dispute, clear}. Returns the updated <tr> row HTML for in-place swap. Audit-logged.
/gstr1/download.json Returns the CBIC v3.0 GSTR-1 JSON for the active period. Schema includes B2B / B2CL / B2CS / CDNR / CDNUR sections + HSN summary. Same bytes the offline tool expects.
This is a curated subset. The full ~70 routes are listed at /api grouped by domain. Drop us an email if you'd like deeper docs on a specific endpoint.