# Morizon Location Autocomplete API Documentation

Scrappa's `GET /api/morizon/locations` finds the locations that the search accepts in `location`, by the start of a name.

## What you get

Each suggestion has an `id`, `name`, a `description` with the kind of place and its parents (for example `dzielnica, Kraków, małopolskie`), and the centre coordinates. Pass the `id` as `location` to `/api/morizon/search`.

## Pagination

Use `limit` (1-30, default 10). When `pagination.has_next` is `true`, pass `pagination.next_cursor` as `cursor` to get the next suggestions.

## Narrowing

`type` and `transaction` narrow the suggestions to places that have listings of that kind.

- **Documentation:** [https://scrappa.co/docs/morizon-api/morizon_locations](https://scrappa.co/docs/morizon-api/morizon_locations)
- **API group:** Morizon API
- **Endpoint:** `GET https://scrappa.co/api/morizon/locations`

## 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 | Start of a place name, at least 2 characters. |
| `limit` | integer | No | Suggestions per page, 1-30 (default 10). |
| `cursor` | string | No | next_cursor from the previous page. |
| `type` | string | No | flat, house, plot, commercial, garage or room. |
| `transaction` | string | No | sale or rent. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/morizon/locations?q=krak&limit=5"
```

## Example response

```json
{
    "success": true,
    "query": "krak",
    "returned": 2,
    "locations": [
        {
            "id": "311510",
            "name": "Krak\u00f3w",
            "description": "miasto, ma\u0142opolskie",
            "suggestion": "Krak\u00f3w",
            "latitude": 50.0619474,
            "longitude": 19.9368564
        },
        {
            "id": "1900000311510",
            "name": "Podg\u00f3rze",
            "description": "dzielnica, Krak\u00f3w, ma\u0142opolskie",
            "suggestion": "Krak\u00f3w Podg\u00f3rze",
            "latitude": 50.02935766,
            "longitude": 19.96284485
        }
    ],
    "pagination": {
        "has_next": true,
        "next_cursor": "TG9jYXRpb25TdWdnZXN0aW9uQ3Vyc29y"
    },
    "meta": {
        "endpoint_family": "locations",
        "billable": true,
        "attempts": 1
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A query parameter is missing, unknown or unusable. Unknown parameters are rejected, never ignored. Non-billable. |
| 503 | Upstream Unavailable | Morizon could not be reached after retries, answered with an error, or returned an unexpected answer (`upstream_unavailable`, `upstream_blocked`, `parser_drift`). 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)
