# Homegate Search API Documentation

Search public Homegate listings by offer type and location: for each listing the id, price (CHF), rooms, living space, address, image urls, agency branding and the public listing url, plus search metadata and a has_more pagination flag. A valid empty result is a successful response. Unknown locations answer a non-billable 422.

- **Documentation:** [https://scrappa.co/docs/homegate-api/homegate_search](https://scrappa.co/docs/homegate-api/homegate_search)
- **API group:** Homegate API
- **Endpoint:** `GET https://scrappa.co/api/homegate/search`

## 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 |
| --- | --- | --- | --- |
| `offer_type` | string | No | Rent or buy listings. Example: rent. |
| `location` | string | Yes | Homegate English location url name from the locations endpoint, e.g. city-zurich. Example: city-zurich. |
| `page` | integer | No | 1-based page number, 20 listings per page by default. Defaults to 1. |
| `size` | integer | No | Listings per page: 10, 20, 50 or 100. Defaults to 20. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/homegate/search?offer_type=rent&location=city-zurich&size=20"
```

## Example response

```json
{
    "success": true,
    "data": {
        "search_metadata": {
            "offer_type": "rent",
            "location": "city-zurich",
            "page": 1,
            "size": 20,
            "total": 1000,
            "max_from": 980,
            "sort_by": "listingType",
            "sort_direction": "desc"
        },
        "results": [
            {
                "id": "4002086198",
                "offer_type": "rent",
                "title": "City Pop - Cosy Studio Apartments just next to HB Z\u00fcrich",
                "description": "Wir bieten zentral gelegene Apartments im Geb\u00e4ude City Pop Zurich City an der Militarstrasse 106, 8004 Z\u00fcrich an.",
                "price": {
                    "currency": "CHF",
                    "gross": 2257,
                    "interval": "MONTH"
                },
                "rooms": 1.5,
                "living_space": 24,
                "address": {
                    "street": "Milit\u00e4rstrasse 106",
                    "postal_code": "8004",
                    "locality": "Z\u00fcrich",
                    "region": "ZH",
                    "geoTags": [
                        "geo-city-zurich"
                    ],
                    "latitude": 47.375900941538,
                    "longitude": 8.518080868209
                },
                "images": [
                    "https://media2.homegate.ch/listings/v2/e335city/4002086198/image/92c334cb2a581eeda57f107e6b2d3fd3.jpg"
                ],
                "lister": {
                    "logo_url": "https://media2.homegate.ch/t_customer_logo/logos/l_e335city_v2.png",
                    "subscription_type": "Gold"
                },
                "url": "https://www.homegate.ch/rent/4002086198"
            }
        ],
        "pagination": {
            "current_page": 1,
            "total": 1000,
            "max_from": 980,
            "has_more": true
        }
    },
    "meta": {
        "endpoint_family": "search",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | The location parameter is missing or not a Homegate url name. This response is not billable. |
| 422 | Unknown Location | Homegate could not resolve the location url name. This response is not billable. |
| 503 | Upstream Unavailable | Homegate is temporarily unreachable, blocked the request, or answered a shape we could not parse. Retry later; 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)
