# PAP Autocomplete API Documentation

<p><strong>PAP Autocomplete API</strong> turns a place name into the numeric location id that the search endpoint needs. It finds regions, departments, cities and postal codes in France. Each result has the id, the full label such as <code>Courbevoie (92400)</code>, the name and the code in brackets. Pass the id as <code>location_id</code> and the label as <code>location_name</code> to the search endpoint.</p>

- **Documentation:** [https://scrappa.co/docs/pap-fr-api/pap_fr_autocomplete](https://scrappa.co/docs/pap-fr-api/pap_fr_autocomplete)
- **API group:** PAP API
- **Endpoint:** `GET https://scrappa.co/api/pap-fr/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 | Place name or postal code, 2 to 100 characters. Example: lyon. |
| `limit` | integer | No | Number of results, 1 to 25, default 10. |

## Example response

```json
{
    "data": {
        "items": [
            {
                "id": 43590,
                "code": "69",
                "name": "Lyon",
                "label": "Lyon (69)"
            }
        ],
        "query": "lyon"
    },
    "meta": {
        "billable": true,
        "endpoint_family": "autocomplete"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A parameter is missing or outside its allowed values. This response is not billable. |
| 503 | Upstream Unavailable | PAP could not be reached, or the page could not be confirmed as the requested one. Retry shortly. This response is not billable. |

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