Skip to content

API — Deals, Orders & Grievances ​

Accepting an offer/bid (or Buy Now) materialises an Order. The order then moves through dispatch → buyer receipt, with a grievance backstop. Stock physically moves only at buyer receipt (deduct-on-receipt).

Deals ​

MethodPathGatingNotes
GET/sell-leads/deals / /buy-leads/dealsrequireActiveUserMy sales / purchases lists.
GET/deals/:dealType/:idrequireActiveUser + membershipDeal detail. Seller-only fields (realisedPnl, costBasisPerKg) omitted for the buyer. Returns documents[] + a receipt summary + dealThreadId.

Orders (fulfilment + receipt) ​

MethodPathGatingNotes
GET/orders/receipt-dealsrequireActiveUserBuyer's "awaiting receipt" orders.
GET/orders/:id/match-candidatesrequireActiveUserBuyer's existing lots to merge into.
POST/orders/:id/dispatchsellerMark DISPATCHED (fulfilment axis, status-only). Generates a Dispatch Note, notifies the buyer. No body / no lot picker — the lot was chosen at bid.
POST/orders/:id/confirm-receiptbuyerCreate the buyer's batch (inherits GI/metrics/photos), decrement the seller lot, release the hold. Status → COMPLETED, fulfilment → DELIVERED.
POST/orders/:id/evidencepartyStage evidence files (images Sharp-compressed, PDFs kept). ≤8 files.
POST/orders/:id/cancelbuyerCancel with reason ≥10 + evidence.
POST/orders/:id/auto-reversesellerReverse a stale still-PLACED deal (release the hold).
POST/orders/:id/settle-off-platformsellerSettle a stale deal outside Cropto (decrement + release).

Deduct-on-receipt ​

A 14-day sweep (receipt-expiry-sweep) prompts the seller to choose (never auto-cancels).

Grievances ​

Mounted at /api/v1/grievances (NOT under /admin) — party reads plus admin/sub-admin adjudication.

MethodPathGatingNotes
POST/grievancespartyRaise (any category, PLACED → 7 days post-COMPLETED). Reason ≥20 chars + ≥1 evidence. Generates a GR PDF, notifies the counterparty.
GET/grievancesparty / adminMy grievances / the admin queue.
GET/grievances/:idparty / adminTimeline.
POST/grievances/:id/{assign,review,request-info,resolve}authorize('admin','sub-admin')SLA-timed lifecycle; outcomes REPLACE / PARTIAL_CREDIT / REVERSE / DISMISS → RM PDF, notify both, trust hook.
  • SLA timers: first response 72h, resolve 14 days; the grievance-sla-sweep job auto-escalates breaches to ESCALATED.
  • Phase 1 holds no funds: PARTIAL_CREDIT is advisory ₹ only; REVERSE only unwinds stock on a still-PLACED order. Grievance is a documentation + accountability + mediation engine, not a refund engine.

Order axes ​

AxisValues
statusPLACED → COMPLETED / CANCELLED / COMPLETED_OFF_PLATFORM
fulfilmentStatusPENDING / DISPATCHED / DELIVERED (tracking reserved)
paymentStatusOFF_PLATFORM (escrow reserved)

Terminal transitions are idempotent (same transition = no-op; a different one on a terminal order = 409). Documents are recorded in the polymorphic OrderDocument registry; transitions in the append-only OrderEvent ledger.

Internal technical documentation — Cropto