# Worten Autocomplete API Documentation

`GET /api/worten/autocomplete` returns public search suggestions and matching categories for a partial query. Each suggestion has `text`, `id` and `categories`.

## Credits

A successful request costs **1 credit**. Errors, challenges and missing products cost nothing. The response shows the charge in `meta.credits_charged`.

- **Documentation:** [https://scrappa.co/docs/worten-api/worten_autocomplete](https://scrappa.co/docs/worten-api/worten_autocomplete)
- **API group:** Worten API
- **Endpoint:** `GET https://scrappa.co/api/worten/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 |
| --- | --- | --- | --- |
| `q` | string | Yes | Partial search words. |
| `max` | integer | No | Maximum suggestions, 1-20 (default 10). |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/worten/autocomplete?q=iphone&max=10"
```

## Example response

```json
{
    "success": true,
    "site": "pt",
    "suggestions": [
        {
            "text": "iphone",
            "id": "iphone",
            "categories": []
        }
    ],
    "meta": {
        "endpoint_family": "worten-autocomplete",
        "billable": true,
        "attempts": 1,
        "credits_charged": 1
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 404 | Not Found | The storefront has no product with that id (`not_found`). Non-billable. |
| 422 | Validation Error | A parameter is missing or unsupported. Only page sizes 24 and 48 are accepted, and filters use facet slugs from the search result. Non-billable. |
| 503 | Upstream Unavailable | The storefront could not be reached, answered with a challenge, or changed its response shape. Retryable and never billed. Clients are never rate limited. |

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