- Successful requests
- HTTP status:
200 OK - Response body always includes:
success: true
- HTTP status:
- Failed requests
- HTTP status:
4xxor5xx - Response body includes:
error: a string or an object with detailed information- For some endpoints (e.g.
/b2b/place-order), additional details may be returned undervalidationResultor as a structured object withinerror.
- HTTP status:
Successful Response Format
Example:
The data field structure depends on the specific endpoint (for example: order details, product list, etc.).
Generic Error Response Format
For all endpoints, on validation or logic errors, the API returns a non-2xx HTTP status (e.g.400, 401, 403, 404, 422, 500) with the following body:
Example Error Messages
Fields
| Field | Type | Description |
|---|---|---|
error | string or object | Error message or structured error details. |
Validation Errors (Place Order)
For/b2b/place-order, the API may return more detailed validation information when the request fails input validation.
In such cases:
- HTTP status: typically
400 Bad Requestor422 Unprocessable Entity - Response body may include either:
validationResultobject alongside a genericerrorstring, orerroras an object that already contains the detailed validation information.
Example 1: String error + validationResult object
Example 2: Structured error object
| Field | Type | Description |
|---|---|---|
error | string or object | Generic error message, or object with a message and details. |
validationResult | object | Optional. Key–value map of fields to an array of validation error messages. |
validationResult.<key> | array of string | List of human-readable validation messages for that field. |
Keys such asdata[0].quantityordata[0].requiredFields.mobileindicate the exact path of the invalid field in the request body.
Recommended Client-Side Handling
- Check HTTP status code
- If status is
200 OK, expectsuccess: true. - If status is
4xxor5xx, treat as error.
- If status is
- **Inspect **
error- If
erroris a string, display/log it directly. - If
erroris an object, useerror.message(if present) and inspect any nested detail fields.
- If
- Inspect
validationResult(if present)- Iterate over the keys to display per-field messages to the user.
- Use the keys (e.g.
data[0].quantity) to map messages back to the corresponding fields in your UI.
- Handle specific messages
- For example:
"Insufficient balance"→ prompt user to top up or adjust order."You can only checkout up to 10 items at a time"→ adjust the number of items before retrying."Checkout/Order not found..."→ verifycheckoutIdbefore retry.
- For example: