BigBasket API workflow: from PIN code to product
A session can follow one PIN code from the first check to the product detail.
- Call
bigbasket-pincodewithbody.pincodeand readserviceableto see whether BigBasket delivers there. - Call
bigbasket-searchwith the samebody.pincodeand abody.querysuch as atta. - Choose a row of
resultsand copy itsproduct_id. - Call
bigbasket-productwith thatbody.product_idand the samebody.pincode. - Read
priceandmrpof theproductobject and the pack sizes inpacks.
Keep the PIN code the same across these three calls, because the catalogue, the prices and the stock follow it.
Choose the call that answers your question
The four calls answer different questions, so start from the question you need answered:
bigbasket-pincode: whether and how BigBasket serves a PIN codebigbasket-categories: which categories exist and whichslugan entry carriesbigbasket-search: which products match a keyword, a category or a brand at a PIN codebigbasket-product: the details and the pack sizes of one product
Only bigbasket-categories works without body.pincode, so the category tree needs no location, while prices, stock and delivery follow the PIN code.
Read the price, MRP and unit price of a product
The selling price sits in price and the maximum retail price in mrp. discount_percent and discount_text express the gap as a discount off the MRP. A row of bigbasket-search and the product of bigbasket-product carry these four fields under the same names.
To compare packs of different sizes, read unit_price instead of price. In a search row it has an amount and a per, which states the unit, such as 100 g or a litre. Compare amount between rows only when per is the same, because a price per 100 g and a price per litre are different units.
Compare the pack sizes of one product
One product can be sold in several pack sizes, and each size has its own price and stock.
- In a
bigbasket-searchanswer, readother_packsof a row for the other sizes of that product. Each entry haspack_size,price,mrp,unit_priceandin_stock. - For a single product, call
bigbasket-productand readpacks, which lists the sizes with the same fields. - Compare
unit_priceacross the sizes, and checkis_best_valueto see which pack counts as the best value. - Leave out a pack whose
in_stockshows that it is not available at the PIN code.
Read ingredients, nutrition and storage details
Ingredients, nutrition and storage details come from bigbasket-product and are not part of a search row.
- Call
bigbasket-productwithbody.pincodeandbody.product_id. - Read
descriptionfor the product text andingredientsfor the ingredients. - Read
nutritionfor the nutrition facts andstoragefor the storage details. - Read
other_infofor the manufacturer and best-before details of the product.
sections keeps the sections of the product page as they appear there, and tags lists the tags of the product.
Browse a category or a brand
To list a category or a brand page instead of running a keyword search:
- Call
bigbasket-categoriesand note theslugof the entry you want. - Call
bigbasket-searchwithbody.pincodeand that slug asbody.category. - To narrow the rows to one brand, copy a
brand_slugfrom a row and send it asbody.brandnext tobody.category. - To list one brand on its own, send
body.brandwithoutbody.queryandbody.category.
Leave body.query out of a category search, because body.category is not combined with it. A category or brand page carries 48 rows, and a keyword search page carries 40.
Filter and sort a search
To find well-rated, discounted products in one price range:
- Set
body.price_bandto51_100, the selling-price band from Rs 51 to Rs 100. - Set
body.discount_bandtoover_25for the top discount band off the MRP. - Set
body.min_ratingto4for products rated 4 stars or more. - Set
body.sorttoprice_ascto read the cheapest rows first.
Because the price band matches the product family, a row can show a pack outside the band, and rows_outside_price_filter counts those rows.
Page through search results
Search results come in pages, so a longer list is read page by page.
- Send the first call with
body.pageset to 1, or leave it out. - Read
has_next,pageandlast_pagein the data. - While
has_nextshows a further page, repeat the call withbody.pageone higher and every other input unchanged. - Stop at
last_page.
returned gives the rows on the current page, and total is the count that BigBasket reports for the search. When nothing matches, substituted_results shows that the page holds suggestions and substituted_for says what they replaced, so those rows are suggestions rather than matches.
Compare prices between cities
Prices, totals and stock depend on the PIN code, so one term searched at two PIN codes gives two different answers.
- Pick one PIN code per city, for example 560004 for Bangalore and 400020 for Mumbai.
- Send the same
body.queryand filters tobigbasket-searchonce per PIN code. - Match the rows of the two answers by
product_id. - Compare
price,mrpandin_stockof each matched pair, and readtotalfor how many matches each PIN code reports.
How BigBasket works
BigBasket takes grocery orders online and delivers them to the customer's home on a date and in a time slot the customer chooses. BB Now is its delivery service that promises delivery within minutes from a nearby store, while the older BBExpress service delivers within about an hour.
Prices in India carry a maximum retail price, the MRP, which is the manufacturer-calculated highest price, and shops sell at or below it. A PIN is the six-digit code of India Post's postal system, whose first digit identifies one of nine postal zones.
[
{
"body": {
"pincode": "400020",
"query": "atta"
}
},
{
"body": {
"pincode": "400020",
"product_id": "30006887"
}
}
]{
"body": {
"pincode": "560001"
}
}{
"body": {}
}{
"body": {
"pincode": "400020",
"category": "atta-whole-wheat",
"brand": "aashirvaad",
"min_rating": "4",
"sort": "price_asc",
"page": 1
}
}Server-side request template
This server-side template shows authentication and request identity using the first operation of this API. Choose the operation for your use case and check its current availability and price on the API page. After a timeout, resend the unchanged request with the same Idempotency-Key.
The gateway request is always POST.
Use a JSON object with the documented path, query, headers and body locations; omit unused locations. input.headers is JSON data for the operation, not browser request headers. Do not put credentials here. Keep body arrays, scalar values and null as documented; omission is different from null.
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/bigbasket/bigbasket-categories' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{}}'Integration checklist
- The API key is stored in a server-side secret manager and never sent to a browser.
- Each request carries its own Idempotency-Key, kept until the request has a final answer.
- The integration reads ok and error.code and handles each error code as the error table describes.
- An uncertain POST is inspected using its original identity, never blindly repeated with a new one.
- The operation’s current availability and price have been checked on its API page.
BigBasket API overview and prices · Read the API reference · Try it in the playground