# An agent's production

Source: https://help.ruuster.com/idx/agents-production

> Get one of your agents' listings for sale now and the homes they sold, on either side where the MLS allows it, counted by city and ZIP over up to 36 months.

```http
GET https://idx.ruuster.com/v1/agents/{agentMlsId}/production
```

publishable or secret key · 2 units · cached 3600 s

"Where they've sold" for an agent profile page: the agent's listings for sale now, and the homes they
sold, with the count, total volume and the top cities and ZIP codes. Use the agent's MLS id (the
member id their board issued), not a Ruuster id. It answers for your own brokerage's agents only:
any other MLS id gets `404 agent_not_found`.

## What to know

- `months` is 1 to 36 (36 when you leave it out). Each MLS caps it again at its own sold window, so
  `period.soldFrom` says from when sales are shown.
- Member ids are per MLS. When your account has more than one MLS, send `mls` with the board's id
  (repeat it for several).
- Sales count only on MLSs that show sold data; `sold.soldHiddenMlsIds` names the others. A home
  whose address the MLS hides counts in the totals but never in a city or ZIP row.
- Both sides count where the MLS allows the buyer side: `sold.bySide` splits the sales into the
  listing side and the buyer side, `sold.buyerSideMlsIds` names the MLSs whose buyer-side sales are
  counted and `sold.buyerSideSkippedMlsIds` the ones counted on the listing side only. A sale the
  agent was on both sides of counts once in `sold.count`.
- Only MLSs that allow market statistics are counted; `boardsLeftOut` names any left out. When none
  of the MLSs allows them, the answer is 403 `brokerage_not_enabled`.
- `agent.via` is `agent` for one of your brokerage's agents, or `office` when the agent is counted
  through your brokerage's own offices (then only listings under those offices count).
- `current.listingIds` and `sold.listingIds` hold up to 100 ids each; fetch a card or page for any of
  them with `GET /v1/listings/{listingId}`.

## Path parameters

| Name | Type | Description |
|---|---|---|
| `agentMlsId` | string | The agent's MLS id: the member id their MLS issued (letters, digits, dots, dashes or underscores, up to 64), as the listing agent's MLS id on their listings. Not a Ruuster id. |

## Query parameters

| Name | Type | Description |
|---|---|---|
| `mls` | uuid, repeat | Only these of your MLS boards (their MLS ids; repeat for several). Default: every board of your account. The agent's MLS id is per board, so send the board when you have more than one. A board that isn't yours is 400 invalid_parameter. At most 20 values. |
| `months` | integer 1 to 36, default 36 | How many months of sales to count, ending now (1 to 36). Each MLS caps it again at its own sold window: period.soldFrom says from when sales are shown. |

## Response

The answer is `{ ok: true, data, meta }`. These are the fields of `data`; `meta` carries `brokerageId`, `freshness.asOf`, `mls` (each board's display rules) and `canonical`.

| Field | Type | Description |
|---|---|---|
| `agent` | object | The agent. Only your brokerage's own agents and offices can be asked for. |
| `agent.memberId` | string | The agent's MLS id. |
| `agent.mlsIds` | array of string | The MLSs counted. |
| `agent.via` | string (enum) | agent: one of your brokerage's agents; office: counted through your brokerage's own offices only. One of `agent`, `office`. |
| `boardsLeftOut` | array of object | MLSs left out of every count, and why. |
| `boardsLeftOut[].mlsId` | string |  |
| `boardsLeftOut[].why` | string (enum) | market_stats_off: this MLS doesn't allow market statistics. One of `market_stats_off`. |
| `period` | object | The window. |
| `period.months` | integer | The months asked for. |
| `period.from` | string | The start of the months asked for. |
| `period.through` | string | Now. |
| `period.soldFrom` | string or null | The oldest sale any MLS here lets us show (each MLS's sold window); null when none shows sold data. |
| `current` | object | The agent's listings for sale now. |
| `current.count` | integer | Listings for sale now. |
| `current.byStatus` | object | Current listings by status (only statuses the MLS lets us show). |
| `current.byStatus.active` | integer |  |
| `current.byStatus.coming_soon` | integer |  |
| `current.byStatus.pending` | integer |  |
| `current.byStatus.under_contract` | integer |  |
| `current.listingIds` | array of string | Up to 100 of their ids (GET /v1/listings/{id} each). |
| `sold` | object | The agent's sales. |
| `sold.count` | integer | Sales inside the window, on either side (see bySide). |
| `sold.volume` | number or null | Sum of the sold prices; null when no MLS here shows sold data. |
| `sold.byCity` | array of object | Top 25 cities. Homes whose address the MLS hides are counted in the totals only. |
| `sold.byCity[].key` | string | The city or ZIP as the MLS spells it. |
| `sold.byCity[].label` | string | The city or ZIP for display. |
| `sold.byCity[].count` | integer | Sales in this area. |
| `sold.byCity[].volume` | number or null | Sum of the sold prices in this area. |
| `sold.byPostalCode` | array of object | Top 25 ZIP codes, same rule. |
| `sold.byPostalCode[].key` | string | The city or ZIP as the MLS spells it. |
| `sold.byPostalCode[].label` | string | The city or ZIP for display. |
| `sold.byPostalCode[].count` | integer | Sales in this area. |
| `sold.byPostalCode[].volume` | number or null | Sum of the sold prices in this area. |
| `sold.listingIds` | array of string | Up to 100 of the sales, newest first. |
| `sold.soldHiddenMlsIds` | array of string | MLSs searched whose rules hide sold data (not counted). |
| `sold.bySide` | object | Sales by side. A sale the agent was on both sides of counts once in count and once in each side. |
| `sold.bySide.listing` | object | Sales where the agent was the listing agent. |
| `sold.bySide.listing.count` | integer |  |
| `sold.bySide.listing.volume` | number or null |  |
| `sold.bySide.buyer` | object | Sales where the agent was the buyer's agent (only on MLSs that allow the buyer side). |
| `sold.bySide.buyer.count` | integer |  |
| `sold.bySide.buyer.volume` | number or null |  |
| `sold.buyerSideMlsIds` | array of string | MLSs whose buyer-side sales are counted. |
| `sold.buyerSideSkippedMlsIds` | array of string | MLSs that show sold data but don't allow the buyer side: listing side only. |
| `sold.truncated` | boolean | true when there are more sales than listingIds holds. |

## Errors

These are the error codes this endpoint can answer. Every error has the same body; [Errors](https://help.ruuster.com/idx/reference-errors) explains each code and what to show.

`invalid_parameter`, `secret_key_in_url`, `invalid_credentials`, `missing_credentials`, `payment_required`, `access_revoked`, `brokerage_not_enabled`, `origin_not_allowed`, `origin_required`, `secret_key_in_browser`, `daily_quota_exceeded`, `rate_limited`, `internal_error`, `api_paused`, `source_unavailable`

## Example request

cURL:

```bash
curl -s -G "https://idx.ruuster.com/v1/agents/PROD1/production" \
  --data-urlencode months=12 \
  -H "Authorization: Bearer $IDX_SECRET_KEY"
```

TypeScript:

```typescript
import { createClient } from "@ruuster/idx";

const idx = createClient({ secretKey: process.env.IDX_SECRET_KEY });

const r = await idx.agentProduction("PROD1", {
  months: 12,
});
if (!r.ok) throw new Error(`${r.error.code}: ${r.error.message}`);
console.log(r.data);
```

Python:

```python
import os

import requests

res = requests.get(
    "https://idx.ruuster.com/v1/agents/PROD1/production",
    params={
        "months": "12",
    },
    headers={"Authorization": "Bearer " + os.environ["IDX_SECRET_KEY"]},
    timeout=30,
)
body = res.json()
if not body["ok"]:
    raise RuntimeError(body["error"]["code"] + ": " + body["error"]["message"])
print(body["data"])
```

PHP:

```php
<?php

$query = http_build_query([
    'months' => '12',
], '', '&', PHP_QUERY_RFC3986);
$ch = curl_init('https://idx.ruuster.com/v1/agents/PROD1/production' . '?' . $query);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('IDX_SECRET_KEY')],
    CURLOPT_TIMEOUT => 30,
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!$body['ok']) {
    throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
}
print_r($body['data']);
```

## Example response

```json
{
  "ok": true,
  "data": {
    "agent": {
      "memberId": "PROD1",
      "mlsIds": [
        "11111111-1111-4111-8111-111111111111",
        "43c8a0ee-4ac7-48e3-b684-72f1770ccb58",
        "33333333-3333-4333-8333-333333333333",
        "44444444-4444-4444-8444-444444444444",
        "802219ea-d7ac-46cf-b3e2-83e78ef13f68"
      ],
      "via": "agent"
    },
    "boardsLeftOut": [],
    "period": {
      "months": 12,
      "from": "2025-10-22T15:00:00.000Z",
      "through": "2026-10-22T15:00:00.000Z",
      "soldFrom": "2026-04-25T15:00:00.000Z"
    },
    "current": {
      "count": 4,
      "byStatus": {
        "active": 1,
        "under_contract": 1,
        "coming_soon": 1,
        "pending": 1
      },
      "listingIds": [
        "aaaaaaaa-0000-4000-8000-000000000200",
        "aaaaaaaa-0000-4000-8000-000000000201",
        "aaaaaaaa-0000-4000-8000-000000000202",
        "aaaaaaaa-0000-4000-8000-000000000203"
      ]
    },
    "sold": {
      "count": 2,
      "volume": 790000,
      "byCity": [
        {
          "key": "Savannah",
          "label": "Savannah",
          "count": 2,
          "volume": 790000
        }
      ],
      "byPostalCode": [
        {
          "key": "31401",
          "label": "31401",
          "count": 1,
          "volume": 400000
        },
        {
          "key": "31405",
          "label": "31405",
          "count": 1,
          "volume": 390000
        }
      ],
      "listingIds": [
        "aaaaaaaa-0000-4000-8000-000000000204",
        "aaaaaaaa-0000-4000-8000-000000000205"
      ],
      "soldHiddenMlsIds": [
        "43c8a0ee-4ac7-48e3-b684-72f1770ccb58"
      ],
      "bySide": {
        "listing": {
          "count": 2,
          "volume": 790000
        },
        "buyer": {
          "count": 0,
          "volume": 0
        }
      },
      "buyerSideMlsIds": [
        "11111111-1111-4111-8111-111111111111",
        "33333333-3333-4333-8333-333333333333",
        "44444444-4444-4444-8444-444444444444"
      ],
      "buyerSideSkippedMlsIds": [
        "802219ea-d7ac-46cf-b3e2-83e78ef13f68"
      ],
      "truncated": false
    }
  },
  "meta": {
    "brokerageId": "bbbbbbbb-0000-4000-8000-000000000001",
    "freshness": {
      "asOf": "2026-10-22T15:00:00.000Z"
    },
    "mls": [
      {
        "mlsId": "11111111-1111-4111-8111-111111111111",
        "mlsName": "Fixture MLS",
        "displayType": "IDX",
        "disclaimer": {
          "text": "Fixture MLS data is deemed reliable but not guaranteed. CLIENTOK-disclaimer",
          "html": null
        },
        "logo": {
          "url": "https://ruuster-public.s3.amazonaws.com/mls-logo/fixture.png",
          "width": 80,
          "height": 40,
          "alt": "Fixture MLS logo"
        },
        "attributionTemplate": null,
        "required": [
          {
            "element": "listing_office",
            "placement": "card"
          },
          {
            "element": "disclaimer",
            "placement": "page"
          }
        ],
        "notices": [
          {
            "kind": "dmca",
            "text": "To report content that you believe infringes your copyright, write to the MLS's designated copyright agent.",
            "html": null
          }
        ],
        "draft": true
      },
      {
        "mlsId": "43c8a0ee-4ac7-48e3-b684-72f1770ccb58",
        "mlsName": "NWMLS",
        "displayType": "IDX",
        "disclaimer": {
          "text": "NWMLS data is deemed reliable but not guaranteed. CLIENTOK-disclaimer",
          "html": null
        },
        "logo": {
          "url": "https://ruuster-public.s3.amazonaws.com/mls-logo/fixture.png",
          "width": 80,
          "height": 40,
          "alt": "NWMLS logo"
        },
        "attributionTemplate": null,
        "required": [
          {
            "element": "listing_office",
            "placement": "card"
          },
          {
            "element": "disclaimer",
            "placement": "page"
          }
        ],
        "notices": [],
        "draft": true
      },
      {
        "mlsId": "33333333-3333-4333-8333-333333333333",
        "mlsName": "No-Map MLS",
        "displayType": "IDX",
        "disclaimer": {
          "text": "No-Map MLS data is deemed reliable but not guaranteed. CLIENTOK-disclaimer",
          "html": null
        },
        "logo": {
          "url": "https://ruuster-public.s3.amazonaws.com/mls-logo/fixture.png",
          "width": 80,
          "height": 40,
          "alt": "No-Map MLS logo"
        },
        "attributionTemplate": null,
        "required": [
          {
            "element": "listing_office",
            "placement": "card"
          },
          {
            "element": "disclaimer",
            "placement": "page"
          }
        ],
        "notices": [],
        "draft": true
      },
      {
        "mlsId": "44444444-4444-4444-8444-444444444444",
        "mlsName": "Contact MLS",
        "displayType": "IDX",
        "disclaimer": {
          "text": "Contact MLS data is deemed reliable but not guaranteed. CLIENTOK-disclaimer",
          "html": null
        },
        "logo": {
          "url": "https://ruuster-public.s3.amazonaws.com/mls-logo/fixture.png",
          "width": 80,
          "height": 40,
          "alt": "Contact MLS logo"
        },
        "attributionTemplate": "Listed by {listAgentName}, {agentPhone}, {agentEmail}, {listOfficeName}",
        "required": [
          {
            "element": "listing_agent",
            "placement": "detail"
          },
          {
            "element": "agent_contact",
            "placement": "detail"
          },
          {
            "element": "courtesy_line",
            "placement": "card"
          }
        ],
        "notices": [],
        "draft": true
      },
      {
        "mlsId": "802219ea-d7ac-46cf-b3e2-83e78ef13f68",
        "mlsName": "Maine Listings",
        "displayType": "IDX",
        "disclaimer": {
          "text": "Maine Listings data is deemed reliable but not guaranteed. CLIENTOK-disclaimer",
          "html": null
        },
        "logo": {
          "url": "https://ruuster-public.s3.amazonaws.com/mls-logo/fixture.png",
          "width": 80,
          "height": 40,
          "alt": "Maine Listings logo"
        },
        "attributionTemplate": null,
        "required": [
          {
            "element": "listing_office",
            "placement": "card"
          },
          {
            "element": "disclaimer",
            "placement": "page"
          }
        ],
        "notices": [],
        "draft": true
      }
    ],
    "canonical": null,
    "audience": "display"
  }
}
```
