Skip to content
Scrappa Get API key
Hostelworld API 1 credit/request

Hostelworld City Autocomplete API Documentation

GET https://scrappa.co/api/hostelworld/autocomplete

Hostelworld City Autocomplete API Documentation Turn a name into Hostelworld ids. Returns cities, regions, popular places and properties that match the text, each with a numeric id, a display name and a type. Use the id of a city result as city_id in the search endpoint. A query without matches is a successful, billable response with an empty results list.

Hostelworld City Autocomplete API Documentation 1 credit/request

Endpoint

Request preview
GET
https://scrappa.co/api/hostelworld/autocomplete
Auth header
x-api-key
Cost
1 credit/request
query = coffee shops
Response preview
200 OK
{
    "data": {
        "results": [
            {
                "id": 26,
                "name": "Berlin, Germany",
                "type": "city"
            },
            {
                "id": 11283,
                "name": "Berlin, New Hampshire, USA",
                "type": "city"
            },
            {
...

Parameters

Start with the required fields, then add optional filters only when your use case needs them.

Runnable path

1 required parameter needed before sending a request.

query string Required

Text to look up, 2 to 100 characters. Example: berlin.

Example value coffee shops

Response Schema

Example response fields are illustrative; inspect the JSON before integrating.

Example response fields

Scan these fields before integrating.

data meta success
JSON Response
200 OK
{
    "data": {
        "results": [
            {
                "id": 26,
                "name": "Berlin, Germany",
                "type": "city"
            },
            {
                "id": 11283,
                "name": "Berlin, New Hampshire, USA",
                "type": "city"
            },
            {
                "id": 11286,
                "city": {
                    "id": 26,
                    "name": "Berlin",
                    "country": "Germany"
                },
                "name": "EastSeven Berlin Hostel, Berlin, Germany",
                "type": "property"
            }
        ]
    },
    "meta": {
        "billable": true,
        "endpoint_family": "autocomplete"
    },
    "success": true
}

Errors

Handle these documented responses before retrying or showing customer-facing failures.

422

Validation Error

A required query parameter is missing or invalid. This response is not billable.

{
    "errors": {
        "query": [
            "The query field is required."
        ]
    },
    "message": "The request validation failed"
}
503

Invalid Source Response

Hostelworld answered with a shape that no longer matches the documented contract. This response is not billable.

{
    "meta": {
        "billable": false,
        "retryable": true,
        "endpoint_family": "autocomplete"
    },
    "error": {
        "code": "PARSER_DRIFT",
        "message": "The Hostelworld response could not be read. Please retry later."
    },
    "success": false
}
503

Service Unavailable

The upstream service is temporarily unavailable. Please retry shortly.

{
    "meta": {
        "billable": false,
        "retryable": true,
        "endpoint_family": "autocomplete"
    },
    "error": {
        "code": "UPSTREAM_UNAVAILABLE",
        "message": "The Hostelworld API is temporarily unavailable. Please retry."
    },
    "success": false
}

Generate Code with AI

Copy a ready-made prompt with all the endpoint details, parameters, and example responses. Paste it into ChatGPT, Claude, or any AI assistant to instantly generate working code.

Try It Live

Test this endpoint in our interactive playground with real data.