# Oikotie Autocomplete API Documentation

<p><strong>Oikotie Autocomplete API</strong> turns text into Oikotie places: cities, districts, streets, regions, postcodes and countries. Finnish and Swedish names work. Each result has an <code>id</code>, a <code>type</code>, a <code>name</code>, coordinates when known and the parent place. The <code>search</code> block holds the exact <code>location_id</code>, <code>location_type</code> and <code>location_name</code> to pass to the search route. An empty list is a valid answer and is billed.</p>

- **Documentation:** [https://scrappa.co/docs/oikotie-api/oikotie_autocomplete](https://scrappa.co/docs/oikotie-api/oikotie_autocomplete)
- **API group:** Oikotie API
- **Endpoint:** `GET https://scrappa.co/api/oikotie/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 text, 2 to 100 characters. Example: tampere. |

## Example response

```json
{
    "data": {
        "query": "tamp",
        "results": [
            {
                "id": 386,
                "name": "Tampere",
                "type": "city",
                "parent": {
                    "id": 7,
                    "name": "Pirkanmaa",
                    "type": "region"
                },
                "search": {
                    "location_id": 386,
                    "location_name": "Tampere",
                    "location_type": "city"
                },
                "coordinates": {
                    "latitude": 61.497856,
                    "longitude": 23.762255
                }
            },
            {
                "id": 14711153,
                "name": "Ranta-Tampella",
                "type": "district",
                "parent": {
                    "id": 386,
                    "name": "Tampere",
                    "type": "city"
                },
                "search": {
                    "location_id": 14711153,
                    "location_name": "Ranta-Tampella",
                    "location_type": "district"
                },
                "coordinates": null
            },
            {
                "id": 335222,
                "name": "Tampella",
                "type": "district",
                "parent": {
                    "id": 386,
                    "name": "Tampere",
                    "type": "city"
                },
                "search": {
                    "location_id": 335222,
                    "location_name": "Tampella",
                    "location_type": "district"
                },
                "coordinates": {
                    "latitude": 61.504612,
                    "longitude": 23.761225
                }
            }
        ]
    },
    "meta": {
        "billable": true,
        "endpoint_family": "autocomplete"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A required parameter or a value is invalid. This response is not billable. |
| 503 | Upstream Unavailable | Oikotie could not be reached or returned data that does not match the request. This response is not billable and is retryable. |

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