# Autocomplete search

Read JioMart autocomplete suggestions for a query with optional PIN context.

- Platform: [JioMart](https://docs.upscrape.com/docs/platforms/jiomart)
- Capability ID: `jiomart.autocomplete.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 $UPSCRAPE_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Prefer: wait=30" \
  --data '{
  "input": {
    "limit": 10,
    "pincode": "400001",
    "query": "rice"
  },
  "capability": "jiomart.autocomplete.search"
}'
```

## Input

Provide at least three non-whitespace query characters. pincode must be a valid six-digit Indian PIN when present; location may also carry pincode, city and state.

limit accepts 1 to 50 and bounds the suggestions returned by the capability.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | `integer` | No | Maximum number of results to return. From 1 to 50. |
| `location` | `object` | No |  |
| `location.city` | `string` | No | City name. |
| `location.pincode` | `string` | No | Postal code (PIN) that sets the delivery location. |
| `location.state` | `string` | No | State or region name. |
| `pincode` | `string` | No | Postal code (PIN) that sets the delivery location. |
| `query` | `string` | Yes | At least three characters after trimming, as required by JioMart autocomplete. |

### Example input

```json
{
  "limit": 10,
  "pincode": "400001",
  "query": "rice"
}
```

## Response

Successful output is returned in `results[0].data`.

suggestions are autocomplete choices, not product-search results, demand volume or stock evidence.

Use a returned suggestion as a query input to products.search when you want catalogue products.

### Illustrative sample output

This example shows one response. Values and optional fields vary with the data available.

```json
{
  "raw": {
    "items": [
      {
        "_custom_json": {
          "result_type": "query_suggestion"
        },
        "display": "rice",
        "image": "https://cdn1.jiomartjcp.com/v2/catalog-cloud/jiomar/original/images/othe/egurhk/.j/pg/0000000004911738851.jpg.9f5a238d8d.jpg",
        "type": "product"
      },
      {
        "_custom_json": {
          "result_type": "query_suggestion"
        },
        "display": "rice 26 kg",
        "image": "https://cdn1.jiomartjcp.com/v2/catalog-cloud/jiomar/original/images/othe/egurhk/.j/pg/0000000004942604491.jpg.1f7e111cc1.jpg",
        "type": "product"
      },
      {
        "_custom_json": {
          "result_type": "query_suggestion"
        },
        "display": "rice 5kg",
        "image": "https://cdn1.jiomartjcp.com/v2/catalog-cloud/jiomar/original/images/othe/egurhk/.j/pg/0000000004904276691.jpg.0624440e8a.jpg",
        "type": "product"
      }
    ],
    "meta": {
      "nextPageToken": "[redacted:nextpagetoken]",
      "provider": {
        "version": "0.0.1"
      }
    }
  },
  "suggestions": [
    {
      "_custom_json": {
        "result_type": "query_suggestion"
      },
      "display": "rice",
      "image": "https://cdn1.jiomartjcp.com/v2/catalog-cloud/jiomar/original/images/othe/egurhk/.j/pg/0000000004911738851.jpg.9f5a238d8d.jpg",
      "type": "product"
    },
    {
      "_custom_json": {
        "result_type": "query_suggestion"
      },
      "display": "rice 26 kg",
      "image": "https://cdn1.jiomartjcp.com/v2/catalog-cloud/jiomar/original/images/othe/egurhk/.j/pg/0000000004942604491.jpg.1f7e111cc1.jpg",
      "type": "product"
    },
    {
      "_custom_json": {
        "result_type": "query_suggestion"
      },
      "display": "rice 5kg",
      "image": "https://cdn1.jiomartjcp.com/v2/catalog-cloud/jiomar/original/images/othe/egurhk/.j/pg/0000000004904276691.jpg.0624440e8a.jpg",
      "type": "product"
    }
  ]
}
```
### Illustrative output fields

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

| Path | Observed type | Example |
| --- | --- | --- |
| `raw` | `object` | 2 fields |
| `raw.items` | `array` | 3 items |
| `raw.meta` | `object` | 2 fields |
| `suggestions` | `array` | 3 items |
| `suggestions` | `array` | 3 items |

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