# VivaReal Count API Documentation

Scrappa's `GET /api/vivareal/count` returns the approximate number of listings for a filter set and the amenity facet counts for it, without listing rows. It accepts the same filters as the search endpoint.

## What you get

`total` is the approximate match count (it drifts while you page). `facets.amenities` maps each amenity code, such as `POOL` or `ELEVATOR`, to the number of matching listings. Use the codes in the `amenities` filter of the search endpoint. A valid answer is billed, including an empty page. Failures never consume credits.

- **Documentation:** [https://scrappa.co/docs/vivareal-api/vivareal_count](https://scrappa.co/docs/vivareal-api/vivareal_count)
- **API group:** VivaReal & ZAP Imoveis API
- **Endpoint:** `GET https://scrappa.co/api/vivareal/count`

## 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 |
| --- | --- | --- | --- |
| `portal` | string | No | ZAP (default) for ZAP Imoveis or VIVAREAL for VivaReal. Both use the same fields and filters. |
| `business` | string | Yes | RENTAL (aluguel) or SALE (venda). |
| `location_id` | string | No | Location id from location-autocomplete, for example BR>Sao Paulo>NULL>Sao Paulo>Zona Oeste>Pinheiros. The only working location filter. |
| `price_max` | integer | No | Maximum advertised price in BRL. |
| `bedrooms` | string | No | Bedroom counts, comma-separated. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/vivareal/count?portal=VIVAREAL&business=SALE"
```

## Example response

```json
{
    "success": true,
    "total": 995325,
    "total_is_approximate": true,
    "applied_filters": {
        "portal": "VIVAREAL",
        "business": "SALE",
        "listing_type": "USED"
    },
    "facets": {
        "amenities": {
            "KITCHEN": 350823,
            "AIR_CONDITIONING": 251807,
            "ELEVATOR": 243047,
            "POOL": 234255
        }
    },
    "meta": {
        "billable": true,
        "endpoint_family": "count",
        "portal": "VIVAREAL",
        "attempts": 1
    }
}
```

## Frequently asked questions

### Is this the official VivaReal or ZAP API?

No. Scrappa is an independent service and is not affiliated with VivaReal, ZAP Imoveis or their owners. Neither portal publishes a developer API.

### Are failed requests charged?

A valid answer is billed, including an empty page. Failures never consume credits.

## Related endpoints

- [Property Search](https://scrappa.co/docs/vivareal-api/vivareal_search)

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