# A listing's photos

Source: https://help.ruuster.com/idx/listings-photos

> Get every photo of one listing, in gallery order, with sizes and alt text.

```http
GET https://idx.ruuster.com/v1/listings/{listingId}/photos
```

publishable or secret key · 1 unit · cached 900 s

Every photo of one listing, in the board's order, each with its `url`, `width`, `height`, `order`
and `alt` text. Use it for a lightbox or a gallery you load after the page, when you don't need the
rest of the listing.

## What to know

- `limit` caps the number of photos, up to 100.
- Use the `alt` text as it comes. It never contains a hidden street address.
- `photoAttrs` from `@ruuster/idx` builds the `<img>` attributes, with a `srcset` for photos on
  `photos.ruuster.com`. [Photos: sizes, alt text and loading](https://help.ruuster.com/idx/guide-photos).
- A removed listing answers 410 here too.
- With photo ids turned on for your account, each photo also has a stable `id` and `sizes`. With MLS
  captions turned on as well, it has the board's own `caption` and `room` where the board sends them. With
  customer fields turned on, `custom` holds your own photo fields.
  [Building on our data](https://help.ruuster.com/idx/guide-build-on-our-data).

## Path parameters

| Name | Type | Description |
|---|---|---|
| `listingId` | uuid | The listing's id (a uuid), as `id` on every listing the API returns. An MLS number is not an id: find it with /v1/suggest groups=listing. |

## Query parameters

| Name | Type | Description |
|---|---|---|
| `limit` | integer 1 to 100, default 100 | At most this many photos (1 to 100). |
| `format` | enum, default json | json = the public API shapes; widget = the shapes the Ruuster widget reads (for the widget and its adapters). Values: `json`, `widget`. |

## 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 |
|---|---|---|
| `photos` | array of object | Photos in order (the first `limit`). |
| `photos[].url` | string | https URL of the photo. |
| `photos[].width` | integer or null | Pixels, when known. |
| `photos[].height` | integer or null | Pixels, when known. |
| `photos[].order` | integer | 0-based position. |
| `photos[].alt` | string | Alt text (never the street when the address is hidden). |
| `photos[].id` | string | A stable id for this photo (the same whichever host serves it). Store your own fields against it. Present only where the account has photo ids turned on. |
| `photos[].sizes` | array of object | The photo at 480, 800 and 1200 pixels wide (on the photo CDN only; empty elsewhere). Present only with photo ids. |
| `photos[].sizes[].width` | integer | Pixels wide. |
| `photos[].sizes[].url` | string | https URL of this size. |
| `photos[].caption` | string or null | The MLS's own caption for the photo, passed through as plain text; null when the MLS sent none. Present only with photo captions. |
| `photos[].room` | string or null | The MLS's own room name for the photo; null when the MLS sent none. Present only with photo captions. |
| `photoCount` | integer | How many photos the listing has. |
| `custom` | object | Your account's own fields on this listing and its photos (set by your enrichment hook). Only your account sees them. Present only where custom fields are turned on and you have values. |
| `custom.listing` | array of object | Your fields on this listing, by key. |
| `custom.listing[].key` | string | Your field's key. |
| `custom.listing[].value` | string or number or boolean | The value, of the field's own type (text is plain text within its length). |
| `custom.photos` | array of object | Your fields on this listing's photos, by photo id and key. |
| `custom.photos[].photoId` | string | The photo's id (photos[].id). |
| `custom.photos[].key` | string | Your field's key. |
| `custom.photos[].value` | string or number or boolean | The value, of the field's own type (text is plain text within its length). |

## 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`, `mls_not_in_scope`, `not_found`, `listing_removed`, `daily_quota_exceeded`, `rate_limited`, `internal_error`, `api_paused`, `source_unavailable`

## Example request

cURL:

```bash
curl -s -G "https://idx.ruuster.com/v1/listings/aaaaaaaa-0000-4000-8000-000000000001/photos" \
  --data-urlencode limit=24 \
  -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.request("/listings/aaaaaaaa-0000-4000-8000-000000000001/photos", {
  limit: "24",
});
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/listings/aaaaaaaa-0000-4000-8000-000000000001/photos",
    params={
        "limit": "24",
    },
    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([
    'limit' => '24',
], '', '&', PHP_QUERY_RFC3986);
$ch = curl_init('https://idx.ruuster.com/v1/listings/aaaaaaaa-0000-4000-8000-000000000001/photos' . '?' . $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": {
    "photos": [
      {
        "url": "https://ruuster-public.s3.amazonaws.com/fixture-mls/aaaaaaaa-0000-4000-8000-000000000001/1.jpg",
        "width": null,
        "height": null,
        "order": 0,
        "alt": "4-bedroom home at 123 Peachtree St NE, Atlanta, GA 30308, photo 1 of 3"
      },
      {
        "url": "https://ruuster-public.s3.amazonaws.com/fixture-mls/aaaaaaaa-0000-4000-8000-000000000001/2.jpg",
        "width": null,
        "height": null,
        "order": 1,
        "alt": "4-bedroom home at 123 Peachtree St NE, Atlanta, GA 30308, photo 2 of 3"
      },
      {
        "url": "https://ruuster-public.s3.amazonaws.com/fixture-mls/aaaaaaaa-0000-4000-8000-000000000001/3.jpg",
        "width": null,
        "height": null,
        "order": 2,
        "alt": "4-bedroom home at 123 Peachtree St NE, Atlanta, GA 30308, photo 3 of 3"
      }
    ],
    "photoCount": 3
  },
  "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
      }
    ],
    "canonical": null,
    "audience": "display"
  }
}
```
