# Trovaprezzi Autocomplete API Documentation

`GET /api/trovaprezzi/autocomplete` returns public product suggestions for a search term. Each term carries a path and puid that pass unchanged into product and price-history calls.

- **Documentation:** [https://scrappa.co/docs/trovaprezzi-api/trovaprezzi_autocomplete](https://scrappa.co/docs/trovaprezzi-api/trovaprezzi_autocomplete)
- **API group:** Trovaprezzi API
- **Endpoint:** `GET https://scrappa.co/api/trovaprezzi/autocomplete`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | string | Yes | Search term. Required. |
| `category_id` | integer | No | Public category id. Defaults to 71 (phones). |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/trovaprezzi/autocomplete?query=airtag&category_id=71"
```

## Example response

```json
{
    "success": true,
    "query": "airtag",
    "category_id": 71,
    "terms": [
        {
            "id": "1",
            "name": "Apple AirTag",
            "puid": "apple+airtag",
            "path": "/informatica/prezzi-scheda-prodotto/apple_airtag",
            "image": "https://s1.trovaprezzi.it/apple_airtag.jpg",
            "price": 29.9,
            "currency": "EUR"
        }
    ],
    "meta": {
        "duration_ms": 220,
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | One or more query parameters failed validation. |
| 503 | Upstream Unavailable | Trovaprezzi returned a challenged, empty or malformed response through the approved pool. |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
