# Fotocasa Agency

With client_id, returns an agency inventory paginated by page with a real total. With slug, returns the agency minisite page: that surface is single-page, so full inventory always comes from client_id. If both are given, client_id wins and the minisite is not fetched. property_type and transaction_type are validated against the known enum ids - an unknown code is refused with a 422 rather than forwarded, because upstream answers it with a valid-looking zero total.

- **Documentation:** [https://scrappa.co/docs/fotocasa-api/fotocasa_agency](https://scrappa.co/docs/fotocasa-api/fotocasa_agency)
- **API group:** Fotocasa API
- **Endpoint:** `GET https://scrappa.co/api/fotocasa/agency`

## 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 |
| --- | --- | --- | --- |
| `client_id` | string | No | Numeric agency.id from a search item. The UUID publisherId is rejected. |
| `slug` | string | No | Agency slug for the minisite page, for example espigul-immobiliaria. |
| `property_type` | integer | No | Numeric propertyType to narrow the inventory. One of the known ids; an unknown code is a 422. |
| `transaction_type` | integer | No | Numeric transactionType to narrow the inventory. One of the known ids; an unknown code is a 422. |
| `page` | integer | No | 1-based page number for a client_id inventory. The slug minisite is single-page and ignores this. |
| `size` | integer | No | Page size, 1-1000, for a client_id inventory. A page can return one item fewer than requested when a promoted placement takes a slot. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/fotocasa/agency?client_id=9202774016338&size=5"
```

## Example response

```json
{
    "success": true,
    "data": {
        "total_items": 26,
        "items": [
            {
                "id": "1_190783970"
            }
        ]
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 404 | Not Found | The requested listing or location was not found. This response is not billable. |
| 422 | Validation Error | A public parameter is invalid, including an unknown property_type or transaction_type. This response is not billable. |
| 503 | Service Unavailable | The service could not obtain a complete result from Fotocasa. 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)
