Swiggy Categories
swiggy.categories
The cuisines and food categories Swiggy suggests at a location, in the order it shows them.
At a glance
- Endpoint ID
swiggy.categories- Price
- 1 credit per call; failed calls are free
- Runs for up to
- 30 seconds
Request
Send the endpoint ID as capability and its fields as input. Set UPSCRAPE_API_KEY to your key first.
curl --request POST \ --url https://data.upscrape.com/execute \ --header "Authorization: Bearer $UPSCRAPE_API_KEY" \ --header "Content-Type: application/json" \ --header "Prefer: wait=30" \ --data '{ "capability": "swiggy.categories", "input": { "latitude": 12.9121181, "limit": 20, "longitude": 77.6445548 }}'
import jsonimport osimport requestspayload = json.loads(r'''{ "capability": "swiggy.categories", "input": { "latitude": 12.9121181, "limit": 20, "longitude": 77.6445548 }}''')response = requests.post( "https://data.upscrape.com/execute", headers={ "Authorization": f"Bearer {os.environ['UPSCRAPE_API_KEY']}", "Content-Type": "application/json", "Prefer": "wait=30", }, json=payload,)response.raise_for_status()print(json.dumps(response.json(), indent=2))
const response = await fetch("https://data.upscrape.com/execute", { method: "POST", headers: { "Authorization": `Bearer ${process.env.UPSCRAPE_API_KEY}`, "Content-Type": "application/json", "Prefer": "wait=30", }, body: JSON.stringify({ "capability": "swiggy.categories", "input": { "latitude": 12.9121181, "limit": 20, "longitude": 77.6445548 }}),});if (!response.ok) { throw new Error(`Upscrape request failed: ${response.status}`);}console.log(JSON.stringify(await response.json(), null, 2));
Input
| Field | Type | Required | What it does | Example |
|---|---|---|---|---|
latitude |
number | no | Latitude of the location. | 12.9121181 |
limit |
integer | no | Maximum number of categories. | 20 |
longitude |
number | no | Longitude of the location. | 77.6445548 |
Response
A finished call answers with HTTP 200; the data is in results[0].data, and billing.credits_charged is what it cost. A call still running after the wait answers 202: see jobs and results.
This is results[0].data from a real run:
{ "summary": { "latitude": 12.9121181, "longitude": 77.6445548, "total_items": 12 }, "items": [ { "entity_id": "swiggy://explore?query=Rolls", "id": "600995", "latitude": 12.9121181, "link": "swiggy://explore?query=Rolls", "longitude": 77.6445548, "query": "Rolls", "rank": 1, "section": "Popular Cuisines" }, { "entity_id": "swiggy://explore?query=Pizza", "id": "600813", "latitude": 12.9121181, "link": "swiggy://explore?query=Pizza", "longitude": 77.6445548, "query": "Pizza", "rank": 2, "section": "Popular Cuisines" } ]}
Fields
| Field | Type | What it is | Example |
|---|---|---|---|
items[].rank |
integer | The restaurant's place in the list. | 1 |
items[].query |
string | The search term. | Rolls |
items[].section |
string | The section of Swiggy's search page. | Popular Cuisines |
items[].entity_id |
string | swiggy://explore?query=Rolls | |
items[].id |
string | 600995 | |
items[].latitude |
number | Latitude. | 12.91 |
items[].link |
string | Swiggy's link for the search. | swiggy://explore?query=Rolls |
items[].longitude |
number | Longitude. | 77.64 |
items |
array | The results. | 12 records |
summary |
object | Totals for this response. | 3 fields |
summary.latitude |
number | Latitude. | 12.91 |
summary.longitude |
number | Longitude. | 77.64 |
summary.total_items |
integer | How many results this response holds. | 12 |
If a call fails
A failed call costs nothing. The response carries an error.code you can branch on; Errors and retries lists every code and which ones to retry.
Other Swiggy endpoints
swiggy.ads.listAdsswiggy.area.menu_itemsArea menu items gridswiggy.area.restaurantsArea restaurantsswiggy.listListswiggy.list.all_restaurantsAll restaurantsswiggy.list.restaurantsRestaurantsswiggy.menuMenuswiggy.menu.area_itemsArea menu itemsswiggy.menu.itemsMenu itemsswiggy.search.dishesDishes searchswiggy.search.restaurantsRestaurants search
Something missing or unclear? Ask the team that builds the Swiggy endpoints.