Get Quote Endpoint for ONDC
The Get Quote API allows you to retrieve a quote based on the provided order details including company ID, items, and buyer information. This endpoint is essential for obtaining pricing information before placing an order in the ONDC network.
Endpoint Details
This endpoint allows you to get a quote for an order by providing order details, company information, and buyer details.
endpoint: path: /company_order/getQuote method: GET headers: - name: X-API-KEY required: true description: API key for authentication. This header will be used to identify the consuming channel of the API. parameters: - name: data in: query description: Contains order details including company ID, items, and buyer information. required: true schema: type: object properties: companyId: type: string description: Company identifier items: type: array items: type: object properties: itemId: type: string description: Item identifier denomination: type: number description: Item denomination quantity: type: number description: Item quantity buyerPhNumber: type: string description: Buyer phone number buyerEmail: type: string description: Buyer email address address: type: string description: Buyer address city: type: string description: Buyer city response: description: JSON object containing quote details with encrypted response data.
Endpoint Url:
/company_order/getQuote
Note: Append this path to the appropriate base URL mentioned in the Prerequisites section.
Endpoint Description and Usage:
This endpoint is used to retrieve a quote for an order in the ONDC network. The request requires order details including company ID, item information, and buyer details as query parameters. The response contains encrypted quote data with pricing breakdown and transaction details.
Security
All requests to this endpoint must be authenticated using the required headers as specified in the Prerequisites section. Ensure that your API key is kept secure and not exposed in client-side code. Failure to provide valid authentication headers will result in a 401 Unauthorized error.
Sample Request:
Here is an example of a cURL command to get a quote using this endpoint:
curl -X GET \ {{base_url}}/company_order/getQuote \ -H "X-API-KEY: YOUR_API_KEY"
Request Body Schema
The request body should contain the following order details:
{ "companyId": "string", "items": [ { "itemId": "string", "denomination": 0, "quantity": 0 } ], "buyerPhNumber": "string", "buyerEmail": "string", "address": "string", "city": "string" }
Query Parameters
The GET request requires the following query parameter with order details:
parameters: - name: data in: query description: Contains order details including company ID, items, and buyer information. required: true schema: type: object properties: companyId: type: string description: Company identifier items: type: array items: type: object properties: itemId: type: string description: Item identifier denomination: type: number description: Item denomination quantity: type: number description: Item quantity buyerPhNumber: type: string description: Buyer phone number buyerEmail: type: string description: Buyer email address address: type: string description: Buyer address city: type: string description: Buyer city
Encrypted Response
When the request is successful, the API returns an encrypted JSON response with quote data:
{ "event": "connected", "data": { "message": "Connected to SSE" }, "quoteEnc": { "data": "cXrgjk6kixMW4cIGi/3LU5OsM+ZBs6c0ZDYZd59vn156LHfx5+8jjxtMgJzNI2KgVLG1C7MmmEbrIBPjzBUJE3tV4AFqYKxfpQLXtBDjDAHsQXiM34X2+TdnRQE/7WipW0edz2oG775+y0XztM38qmb1sa3Ja/f9+bK2yleSEDoYPa0dkUxYvLtZDxVo1Y8s30BKRsOVFDnM011vsjiBgiH4Zx4fPeBckgecFakUhJncNd+2hkEYbgJEYKTKKC3X+HG/mNoKYBs/vFcQ4d19lksJ5LruLqzay7BIIY68T0WCn3KPjhlVQ00+5Gb9cyOL3exxI2WK305BusRIp8igreEAoBClFQ/ValIai08GCqgYhrOHKdodHt8B4Ee6jm5JkfuPc3tsFGA61IL4JXrHam0VJqmZ5ldO6h2DS0ufwZHkP2kBIqGWfLgx+isg+PzcP7ycE42J2TCCDK9WJ2LAWn7hs3x9jymQg6BeDDi0YcNQZFwV4hZoHAWakpw+LmCZw8yupI2Agkch8TG9b6dF76NM9r0oKhFFESgjxcP3MR9+nfcopSYgIbryDJFQCV/8nMEgoeV6Cgjv6ZHsh9yKQ3jv6JbThvtoYbqGrKznOG8R0/Cw8J0eI/AdmkrNGv3072NUtgeWY+q1uWpxzjwSk1pH4bGTJEFMWuZleLTAJYRTBiKDxfYZJRuvOVjNc1TRCYqEj+6p4TBf9KrqASs5gVq4WqnEmdfZzFcxhbRDQMQxr5m1J6jVj/VPQR0yIPMM/srl75RJT1i3jwN2BOT1TA==", "iv": "d63fbb9e74688a94" } }
Decrypted Response
After decrypting the response data, you will get detailed quote information with pricing breakdown:
{ "transaction_id": "fcdc4fab-3321-40ec-a85d-6d2f47eaca11", "quote": { "price": { "currency": "INR", "value": "100.00" }, "breakup": [ { "item": { "id": "100:e6236f29-3df2-40ef-b43f-bf667accca1f", "quantity": { "selected": { "count": 1 } }, "price": { "currency": "INR", "value": "100", "offered_value": "100" } }, "title": "ITEM", "price": { "currency": "INR", "value": "100" } }, { "item": { "id": "100:e6236f29-3df2-40ef-b43f-bf667accca1f" }, "title": "TAX", "price": { "currency": "INR", "value": "0" } }, { "item": { "id": "100:e6236f29-3df2-40ef-b43f-bf667accca1f" }, "title": "CONVENIENCE_FEE", "price": { "currency": "INR", "value": "0" } } ], "ttl": "P1D" } }
Error Response
If there is an error with the request (e.g., item out of stock, invalid parameters), the API will return a JSON object with error details:
{ "event": "connected", "data": { "message": "Connected to SSE" }, "Error": { "message": "Item Out Of Stock" } }
Response Schema (YAML)
The response schema for both encrypted and decrypted responses is as follows:
Note: The quoteEnc.data field contains the encrypted quote details on success. The iv field is required for decryption. In case of errors, an Error object will be present instead of quoteEnc.parameters: - name: status in: body description: Contains response metadata. required: true schema: type: object properties: code: type: string description: HTTP-style status code. error: type: boolean description: Indicates if the API encountered an error. - name: message in: body description: Human-readable message describing the result or error. required: true schema: type: string - name: result in: body description: Contains details of the result in case of success; will be null in case of an error. required: true schema: type: object nullable: true properties: transaction_id: type: string description: Unique identifier for the transaction quote: type: object properties: price: type: object properties: currency: type: string description: Currency of the quoted price value: type: string description: Total value of the quote breakup: type: array items: type: object properties: item: type: object properties: id: type: string description: Item identifier quantity: type: object properties: selected: type: object properties: count: type: integer description: Selected quantity price: type: object properties: currency: type: string description: Item currency value: type: string description: Item value offered_value: type: string description: Offered value title: type: string description: Breakdown title (ITEM, TAX, CONVENIENCE_FEE) price: type: object properties: currency: type: string description: Breakdown currency value: type: string description: Breakdown value ttl: type: string description: Time-to-live of the quote
Integration Support
For assistance during the integration process, please contact ONDC support at help@meribachat.in