# Upscrape Swiggy LLM Integration Prompt

Give this to an LLM or coding agent. It must fetch the OpenAPI spec first and use this brief only for orientation.

## First Step

Fetch and read this OpenAPI spec before writing code:

https://data.upscrape.com/catalog/platforms/swiggy/openapi.json?token=SFMyNTY.g2gDdAAAAAFtAAAAC3BsYXRmb3JtX2lkbQAAAAZzd2lnZ3luBgCSvdtKnwFiAAFRgA.f7ObZmQSmoX_QkzQdwvz8mmV-wPJJKtOhcXRECcYmNE
This signed OpenAPI URL is valid for approximately 7 days.

## Hard Rules

- Use the OpenAPI spec as the source of truth for endpoints, request bodies, response bodies, errors, and JSON schemas.
- Do not infer fields from capability descriptions; fetch the spec and use its component schemas.
- Authenticate every request with `Authorization: Bearer YOUR_API_KEY`.
- Start runs with `POST /execute`; do not invent platform-specific execute endpoints.
- Poll `GET /jobs/{id}` or `GET /jobs/{id}/result` until `state` is `completed` or `failed`.
- Optionally send `Prefer: wait=N` on `POST /execute` to wait up to N seconds for inline results.
- If the response is `200`, the job completed — read `results[0].data`. If `202`, poll `GET /jobs/{id}`.
- `stream` is public-facing but must remain `false` today.

## API Base

- Base URL: `https://data.upscrape.com`
- OpenAPI spec: `https://data.upscrape.com/catalog/platforms/swiggy/openapi.json?token=SFMyNTY.g2gDdAAAAAFtAAAAC3BsYXRmb3JtX2lkbQAAAAZzd2lnZ3luBgCSvdtKnwFiAAFRgA.f7ObZmQSmoX_QkzQdwvz8mmV-wPJJKtOhcXRECcYmNE`
- Execute endpoint: `POST /execute`
- Job poll endpoint: `GET /jobs/{id}`
- Result alias: `GET /jobs/{id}/result`
- Content-Type: `application/json`
- Optional header: `Idempotency-Key`
- Optional header: `Prefer: wait=N` (hold connection up to N seconds for synchronous result)

## Execution Flow

1. Send `POST /execute` with a platform capability ID and its `input` object.
2. The API responds with a queued `job_id`.
3. Poll the job endpoint until `state` becomes `completed` or `failed`.
4. If completed, read `results[0].data`; its exact shape is defined by the OpenAPI component schema for the selected capability.

## Example Execute Request

```json
{
  "capability": "swiggy.ads.list",
  "input": {
    "latitude": 12.9121181,
    "limit": 5,
    "longitude": 77.6445548
  }
}
```

## Optional Request Fields

- `network.session_id`: explicit reusable session identifier
- `network.session_key`: stable key used to derive a reusable session
- `network.sticky`: reuse the resolved session when `true`
- `timeout_ms`: per-capability timeout override up to the capability maximum listed below
- `stream`: must be `false`

## Supported Capabilities

- `swiggy.ads.list` - Ads List. Track Swiggy listing feed ad placements. Max `timeout_ms`: 30000. Streaming: disabled.
- `swiggy.ads.search` - Ads Search. Track Swiggy search ad placements for a query at a location. Max `timeout_ms`: 60000. Streaming: disabled.
- `swiggy.area.ads.search` - Area Ads Search. Track search ad placements across a Swiggy area grid. Max `timeout_ms`: 120000. Streaming: disabled.
- `swiggy.area.menu_items` - Area Menu Items Grid. Crawl a Swiggy area grid and stream deduplicated menu items. Max `timeout_ms`: 120000. Streaming: disabled.
- `swiggy.area.restaurants` - Area Restaurants. Crawl a Swiggy area grid and stream deduplicated restaurant rows. Max `timeout_ms`: 120000. Streaming: disabled.
- `swiggy.categories` - Categories. List Swiggy food categories and cuisine shortcuts for a location. Max `timeout_ms`: 30000. Streaming: disabled.
- `swiggy.instamart.categories` - Instamart Categories. Stream Instamart category URLs from sitemaps. Max `timeout_ms`: 120000. Streaming: disabled.
- `swiggy.instamart.category.products` - Instamart Category Products. Stream products from an Instamart category page. Max `timeout_ms`: 120000. Streaming: disabled.
- `swiggy.instamart.product` - Instamart Product. Fetch an Instamart product page. Max `timeout_ms`: 60000. Streaming: disabled.
- `swiggy.instamart.product.sitemap` - Instamart Product Sitemap. Stream Instamart PDP URLs from the product sitemap. Max `timeout_ms`: 120000. Streaming: disabled.
- `swiggy.list` - List. List Swiggy restaurants near a location. Max `timeout_ms`: 30000. Streaming: disabled.
- `swiggy.list.all_restaurants` - List All Restaurants. Walk Swiggy listing pages and stream deduplicated restaurants. Max `timeout_ms`: 120000. Streaming: disabled.
- `swiggy.list.restaurants` - List Restaurants. Stream Swiggy restaurant listing rows. Max `timeout_ms`: 30000. Streaming: disabled.
- `swiggy.menu` - Menu. Fetch a Swiggy restaurant menu by ID. Max `timeout_ms`: 30000. Streaming: disabled.
- `swiggy.menu.area_items` - Area Menu Items. Discover restaurants near a location and stream their menu items. Max `timeout_ms`: 120000. Streaming: disabled.
- `swiggy.menu.items` - Menu Items. Stream Swiggy menu items by restaurant ID. Max `timeout_ms`: 60000. Streaming: disabled.
- `swiggy.search` - Search. Search Swiggy restaurants near a location by keyword. Max `timeout_ms`: 60000. Streaming: disabled.
- `swiggy.search.dishes` - Search Dishes. Stream Swiggy dish search results by keyword. Max `timeout_ms`: 60000. Streaming: disabled.
- `swiggy.search.restaurants` - Search Restaurants. Stream Swiggy restaurant search results by keyword. Max `timeout_ms`: 60000. Streaming: disabled.