# Bayut Agency API Documentation

Retrieve a Bayut agency profile by name or numeric id: name, slug, public url, location, logo, the RERA license list and the agent count. An unknown agency is a non-billable 404.

- **Documentation:** [https://scrappa.co/docs/bayut-api/bayut_agency](https://scrappa.co/docs/bayut-api/bayut_agency)
- **API group:** Bayut API
- **Endpoint:** `GET https://scrappa.co/api/bayut/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 |
| --- | --- | --- | --- |
| `query` | string | No | Agency name, e.g. Driven Properties. Required unless external_id is set. |
| `external_id` | string | No | Numeric agency id, e.g. 6168. Required unless query is set. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/bayut/agency?external_id=6168"
```

## Example response

```json
{
    "success": true,
    "data": {
        "agency": {
            "external_id": "6168",
            "name": "Driven Properties",
            "slug": "driven-properties-6168",
            "url": "https://www.bayut.com/companies/driven-properties-6168/",
            "location": "Dubai",
            "logo_url": "https://bayut-production.s3.eu-central-1.amazonaws.com/image/27769554/822a0ada129b4039b81c38d1dedeb2ed",
            "agents_count": 536,
            "licenses": [
                {
                    "number": "11917",
                    "authority": "RERA"
                }
            ]
        }
    },
    "meta": {
        "endpoint_family": "agency",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A public parameter or range is invalid. This response is not billable. |
| 404 | Not Found | No listing or agency matches that id. This response is not billable. |
| 502 | Invalid Source Response | Bayut returned an unexpected response shape. This response is not billable. |
| 503 | Service Unavailable | The transport or Bayut was unavailable after retries. This response is not billable and is safe to retry. |

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