# SeLoger Place Hierarchy

Get the administrative hierarchy and metadata for a SeLoger place id, such as which department, region and postal area a place belongs to. Use it to enrich results with the full location chain rather than just a display name. A place id such as "AD08FR31096" for Paris is externally sourced: read it from the `locations=` query parameter of any seloger.com search URL. It reads the hierarchy and the place data, so this endpoint costs 2 credits. A failed request costs nothing.

- **Documentation:** [https://scrappa.co/docs/seloger-api/seloger_place](https://scrappa.co/docs/seloger-api/seloger_place)
- **API group:** SeLoger API
- **Endpoint:** `GET https://scrappa.co/api/seloger/place`

## 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 |
| --- | --- | --- | --- |
| `place_id` | string | Yes | SeLoger place id, e.g. "AD08FR31096" for Paris, obtainable from the `locations=` query parameter of any seloger.com search URL. |
| `parent_types[]` | array | No | Type keys of the parent nodes to return, e.g. AD06, NBH2. Omit it to receive every parent level the hierarchy names (for Paris: AD02 country and AD06 department). |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/seloger/place?place_id=AD08FR31096"
```

## Example response

```json
{
    "success": true,
    "place_id": "AD08FR31096",
    "hierarchy": {
        "parents": [
            {
                "id": "AD02FR1",
                "name": "France",
                "typeKey": "AD02"
            },
            {
                "id": "AD06FR76",
                "name": "Paris",
                "typeKey": "AD06"
            }
        ],
        "geoTypeKey": "AD08",
        "municipality": {
            "postalCode": "75000",
            "administrativeCode": "75056",
            "name": "Paris"
        },
        "countryId": "AD02FR1",
        "geoDpCode": "75",
        "mainPostalCode": "75000",
        "displayName": "Paris"
    },
    "parent_types": [
        "AD02",
        "AD06"
    ],
    "places": [
        {
            "placeId": "AD08FR31096",
            "label": "Paris"
        }
    ]
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | One or more query parameters failed validation. |
| 404 | Not Found | The requested resource does not exist upstream: the listing is gone, was never live, or is not reachable through the search it would belong to. This is not billed. |
| 503 | Upstream Unavailable | SeLoger did not return a usable response through any available request path, or refused the request this integration sent it. This failure is not billed and is retryable. |
| 503 | Service Disabled | The SeLoger integration is switched off. Reads as a clean 503 so a rollback needs no deploy. |

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