# Upscrape Zepto 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/zepto/openapi.json?token=SFMyNTY.g2gDdAAAAAFtAAAAC3BsYXRmb3JtX2lkbQAAAAV6ZXB0b24GAB2Z2UqfAWIAAVGA.eu2DM7SB9YG6j2saDbZFkHjVKHns1SIdc1oX3vrMrW8
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/zepto/openapi.json?token=SFMyNTY.g2gDdAAAAAFtAAAAC3BsYXRmb3JtX2lkbQAAAAV6ZXB0b24GAB2Z2UqfAWIAAVGA.eu2DM7SB9YG6j2saDbZFkHjVKHns1SIdc1oX3vrMrW8`
- 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": "zepto.ads",
  "input": {
    "latitude": 12.96902,
    "limit": 5,
    "longitude": 77.75395,
    "page_type": "HOME"
  }
}
```

## 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

- `zepto.ads` - List Ads. List current Zepto sponsored product, campaign, and banner placements for a location or page. Max `timeout_ms`: 30000. Streaming: disabled.
- `zepto.categories` - List Categories. List Zepto category and subcategory IDs for a store or latitude/longitude. Max `timeout_ms`: 30000. Streaming: disabled.
- `zepto.category.products` - List Category Products. List Zepto products from a /cn/.../cid/.../scid/... category URL. Max `timeout_ms`: 60000. Streaming: disabled.
- `zepto.health` - Health Check. Run a Zepto liveness check across location, catalog, search, and ad surfaces. Max `timeout_ms`: 120000. Streaming: disabled.
- `zepto.location` - Resolve Location. Resolve Zepto serviceability and store IDs for a latitude/longitude. Max `timeout_ms`: 30000. Streaming: disabled.
- `zepto.place.autocomplete` - Place Autocomplete. Find Zepto-supported address and place suggestions. Max `timeout_ms`: 30000. Streaming: disabled.
- `zepto.place.details` - Place Details. Resolve a Zepto place ID to coordinates and address components. Max `timeout_ms`: 30000. Streaming: disabled.
- `zepto.place.resolve` - Resolve Place. Resolve an address or place ID to coordinates, address details, and Zepto store serviceability. Max `timeout_ms`: 60000. Streaming: disabled.
- `zepto.product` - Get Product. Get Zepto product details from a product URL or product variant ID. Max `timeout_ms`: 30000. Streaming: disabled.
- `zepto.search` - Search Products. Search Zepto products by keyword. Max `timeout_ms`: 60000. Streaming: disabled.
- `zepto.search.filters` - Search Filters. Get Zepto filter metadata for a search query. Max `timeout_ms`: 30000. Streaming: disabled.