# ViewIt Agency Profile API Documentation

Scrappa's `GET /api/viewit/agency` returns the public profile of one ViewIt rental company and its rentals.

## What you get

`agency_id`, `name`, `logo` and `website` (null when the company shows none), `listings_total`, `items` (the same item shape as the search) and `pagination`. A page holds 5 rentals and `page` is 1 to 20.

## Thin profile

ViewIt shows a company as a name, a logo and its listings. There is no phone number, email, address or review, so this API has none of them.

## How to find a company

Take a `company_id` from the autocomplete endpoint and pass it as `id`.

- **Documentation:** [https://scrappa.co/docs/viewit-api/viewit_agency](https://scrappa.co/docs/viewit-api/viewit_agency)
- **API group:** ViewIt API
- **Endpoint:** `GET https://scrappa.co/api/viewit/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 |
| --- | --- | --- | --- |
| `id` | integer | Yes | company_id from the autocomplete endpoint, for example 2045 (Realstar). |
| `page` | integer | No | Result page, 1 to 20. A page holds up to 5 listings. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/viewit/agency?id=2045"
```

## Example response

```json
{
    "success": true,
    "data": {
        "agency_id": 2045,
        "name": "Realstar",
        "logo": "https://images.viewit.ca/companylogos/2045_Realstar_20152110114516.jpg",
        "website": "https://www.realstar.ca",
        "listings_total": 34,
        "items": [
            {
                "listing_id": 3844,
                "detail_path": "468470SummerhillAve-Toronto-2bdrm-VIT=3844",
                "url": "https://www.viewit.ca/468470SummerhillAve-Toronto-2bdrm-VIT=3844",
                "address": "468, 470 Summerhill Ave",
                "bedrooms_label": "2 bds",
                "bedrooms": 2,
                "unit_type": "apartment",
                "price": 2200,
                "price_from": false,
                "currency": "CAD",
                "latitude": 43.686504,
                "longitude": -79.374658,
                "photo": "https://images.viewit.ca/3844/Image058.jpg",
                "description": "Available immediately. Beautiful Rosedale. Totally renovated 2 bedroom with dishwasher.",
                "sponsored": false,
                "has_video": true
            }
        ],
        "pagination": {
            "page": 1,
            "per_page": 5,
            "total": 34,
            "total_pages": 7,
            "max_pages": 20,
            "capped": false,
            "range_from": 1,
            "range_to": 5,
            "has_next_page": true
        }
    },
    "meta": {
        "endpoint_family": "agency",
        "billable": true,
        "attempts": 1
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 404 | Not Found | ViewIt has no company with this id (`NOT_FOUND`). Non-billable. |
| 422 | Validation Error | A query parameter is missing, unknown or unusable. Unknown parameters and unknown values are rejected, never ignored. Non-billable. |
| 422 | Page Out of Range | The page is past the last page of results (`PAGE_OUT_OF_RANGE`). ViewIt serves at most 20 pages (100 results) per query: narrow the filters, for example with a price band. Non-billable. |
| 503 | Upstream Unavailable | ViewIt could not be reached, refused the request or answered with a page this API could not read (`UPSTREAM_UNAVAILABLE`). Retryable and never billed. Clients are never rate limited. |

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