# Products Search

Search Tesco's anonymous storefront by keyword and return the ranked product ids and canonical product URLs for one results page.

- Platform: [Tesco](https://docs.upscrape.com/docs/platforms/tesco)
- Capability ID: `tesco.products.search`
- Cost: 1 credit per request
- Maximum runtime: 30 seconds
- Execute endpoint: `POST https://data.upscrape.com/execute`

## Request

Use the exact public capability ID in the shared execute envelope.

```bash
curl --request POST \
  --url https://data.upscrape.com/execute \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Prefer: wait=30" \
  --data '{
  "input": {
    "page": 1,
    "query": "milk"
  },
  "capability": "tesco.products.search"
}'
```

## Input

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `page` | `integer` | No | 1-based search results page. Defaults to 1. |
| `query` | `string` | Yes | Product search term, for example milk. |

### Example input

```json
{
  "page": 1,
  "query": "milk"
}
```

## Response

Successful output is returned in `results[0].data`. Raw platform output is intentionally open-ended and may evolve with the upstream source.

### Illustrative sample output

This redacted fixture is an example, not a fixed response schema.

```json
{
  "items": [
    {
      "position": 1,
      "tpnc": "309449739",
      "url": "https://www.tesco.com/shop/en-GB/products/309449739"
    },
    {
      "position": 2,
      "tpnc": "320980398",
      "url": "https://www.tesco.com/shop/en-GB/products/320980398"
    },
    {
      "position": 3,
      "tpnc": "287971983",
      "url": "https://www.tesco.com/shop/en-GB/products/287971983"
    }
  ],
  "page": 1,
  "query": "milk"
}
```
### Illustrative output fields

Derived from the sample above for orientation only. These fields are not a fixed response schema.

| Path | Observed type | Example |
| --- | --- | --- |
| `items` | `array` | 3 items |
| `items` | `array` | 3 items |
| `page` | `integer` | 1 |
| `query` | `string` | milk |

## Execution behavior

A `200` response completed inline. A `202` response was queued; poll `GET /jobs/{id}` until the job reaches `completed` or `failed`. Use an `Idempotency-Key` when retrying must not create a duplicate logical job.

## Related documentation

- [Authentication](https://docs.upscrape.com/docs/api/authentication)
- [Jobs and results](https://docs.upscrape.com/docs/api/jobs)
- [Errors and retries](https://docs.upscrape.com/docs/api/errors)
- [Idempotency](https://docs.upscrape.com/docs/api/idempotency)
