# FlixBus City Autocomplete API Documentation

<p><strong>FlixBus City Autocomplete API Documentation</strong> Find FlixBus cities by name. Each city carries its id (a UUID for search and the numeric legacy id), country, coordinates, time zone offset and the stations of the city with their importance. Use the city id as from_city_id or to_city_id in the search and calendar endpoints. Results are ranked by FlixBus. The result count is not fixed.</p>

- **Documentation:** [https://scrappa.co/docs/flixbus-api/flixbus_cities](https://scrappa.co/docs/flixbus-api/flixbus_cities)
- **API group:** FlixBus API
- **Endpoint:** `GET https://scrappa.co/api/flixbus/cities`

## 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 | City or station name, 2 to 100 characters. Example: berlin. |

## Example response

```json
{
    "data": {
        "query": "berlin",
        "total": 2,
        "cities": [
            {
                "id": "40d8f682-8646-11e6-9066-549f350fcb0c",
                "name": "Berlin",
                "score": 59.768116,
                "district": "Berlin",
                "location": {
                    "lat": 52.525016,
                    "lon": 13.369474
                },
                "stations": [
                    {
                        "id": "04a24865-34dd-458e-addd-f529fbd69aa7",
                        "name": "Berlin-Wannsee",
                        "is_train": true,
                        "legacy_id": 99373,
                        "importance_order": 10
                    },
                    {
                        "id": "88d83aa4-8f95-41f1-a3b6-d4d6152fca40",
                        "name": "Berlin Central Station",
                        "is_train": false,
                        "legacy_id": 105733,
                        "importance_order": 20
                    },
                    {
                        "id": "394a5408-d778-4959-a63e-973253443ed2",
                        "name": "Berlin Central Station",
                        "is_train": true,
                        "legacy_id": 20688,
                        "importance_order": 24
                    },
                    {
                        "id": "895f31c8-7f88-4d8f-a070-4b4a6320160a",
                        "name": "Berlin S\u00fcdkreuz",
                        "is_train": true,
                        "legacy_id": 20788,
                        "importance_order": 22
                    },
                    {
                        "id": "e6f7f0f4-4bb5-45a0-bcc2-d5e7279686dd",
                        "name": "Berlin-Spandau",
                        "is_train": true,
                        "legacy_id": 20798,
                        "importance_order": 19
                    },
                    {
                        "id": "d75cc465-3273-49b7-bcf0-a47cfdcd0852",
                        "name": "Berlin-Charlottenburg",
                        "is_train": true,
                        "legacy_id": 23808,
                        "importance_order": 12
                    },
                    {
                        "id": "dcbb994f-9603-11e6-9066-549f350fcb0c",
                        "name": "Berlin S\u00fcdkreuz",
                        "is_train": false,
                        "legacy_id": 481,
                        "importance_order": 23
                    },
                    {
                        "id": "dcbaaee6-9603-11e6-9066-549f350fcb0c",
                        "name": "Berlin central bus station",
                        "is_train": false,
                        "legacy_id": 1,
                        "importance_order": 25
                    },
                    {
                        "id": "dcbbf964-9603-11e6-9066-549f350fcb0c",
                        "name": "Berlin Gesundbrunnen",
                        "is_train": true,
                        "legacy_id": 914,
                        "importance_order": 18
                    },
                    {
                        "id": "dcbc32c3-9603-11e6-9066-549f350fcb0c",
                        "name": "Berlin Alexanderplatz",
                        "is_train": false,
                        "legacy_id": 1224,
                        "importance_order": 21
                    },
                    {
                        "id": "dcbfd6bc-9603-11e6-9066-549f350fcb0c",
                        "name": "Berlin Alt-Tegel",
                        "is_train": false,
                        "legacy_id": 3288,
                        "importance_order": 17
                    },
                    {
                        "id": "d73477d0-4b42-44f5-9593-037c4b0b6e11",
                        "name": "Berlin Wannsee",
                        "is_train": false,
                        "legacy_id": 13328,
                        "importance_order": 15
                    },
                    {
                        "id": "dcbf8654-9603-11e6-9066-549f350fcb0c",
                        "name": "Berlin Zoo",
                        "is_train": false,
                        "legacy_id": 2825,
                        "importance_order": 13
                    },
                    {
                        "id": "5ae86c41-b203-42cd-9be6-34cf93120e3e",
                        "name": "Berlin S-Treptower Park",
                        "is_train": false,
                        "legacy_id": 18088,
                        "importance_order": 14
                    }
                ],
                "legacy_id": 88,
                "country_code": "DE",
                "subdivision_code": null,
                "has_train_station": true,
                "timezone_offset_seconds": 7200
            },
            {
                "id": "40dc7203-8646-11e6-9066-549f350fcb0c",
                "name": "Potsdam",
                "score": 57.554024,
                "district": "Brandenburg",
                "location": {
                    "lat": 52.39061,
                    "lon": 13.066756
                },
                "stations": [
                    {
                        "id": "27ce86f1-3455-4f36-a2d0-cc0bf3c6d3b2",
                        "name": "Potsdam Medienstadt Babelsberg (train)",
                        "is_train": true,
                        "legacy_id": 122603,
                        "importance_order": 0
                    },
                    {
                        "id": "de1fe593-13d7-4a9c-aabc-6cad30db7097",
                        "name": "Potsdam Central Station",
                        "is_train": true,
                        "legacy_id": 29838,
                        "importance_order": 95
                    },
                    {
                        "id": "dcbf89f9-9603-11e6-9066-549f350fcb0c",
                        "name": "Potsdam",
                        "is_train": false,
                        "legacy_id": 2855,
                        "importance_order": 100
                    }
                ],
                "legacy_id": 641,
                "country_code": "DE",
                "subdivision_code": null,
                "has_train_station": true,
                "timezone_offset_seconds": 7200
            }
        ]
    },
    "meta": {
        "billable": true,
        "endpoint_family": "city_autocomplete"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A required query parameter is missing or invalid. This response is not billable. |
| 503 | Service Unavailable | FlixBus could not be reached or answered with an unexpected shape. 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)
