# Instagram Reels Web Search (`instagram.web_reels_search`)

Search Instagram Reels through a web search index with an optional recency window and numbered pages (pages 1-11 of about 10 reels).

Docs: https://primaryapi.com/docs/api-reference/instagram/web_reels_search

- Endpoint: `POST https://api.primaryapi.com/v1/run/instagram.web_reels_search`
- Category: Social · Platform: `instagram` · Kind: search · Status: live
- Price: 1 credit per call; up to 3 credits if a call is retried elsewhere. A quote’s `maxCredits` is the most a given call can cost.
- Billing unit: per successful call
- Reliability: routed to a healthy upstream and retried automatically when an attempt fails; live 30-day status: `GET https://api.primaryapi.com/v1/status/apis?sku=instagram.web_reels_search`
- Execution: synchronous (answers 202 only if it outlives the wait window)

## Input

| Field | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
| `query` | string | yes |  | max 500 chars | Search keyword, for example "crossfit". |
| `datePosted` | enum | no |  | one of: last-week, last-month, last-year | Recency hint, not a hard filter: narrows the web index by when it discovered or last crawled the reel. Hour/day windows are not available. |
| `page` | integer | no | 1 | 1–11 | 1-based results page (1-11, default 1). |

Unknown fields are rejected with `400 invalid_input`. The routing controls `preferLatencyUnderMs` and `maxCredits` may be sent in the same JSON body.

## Output

When `output.found` is `true`, `output.data` has this shape:

| Field | Type | Description |
|---|---|---|
| `reels` | object[] |  |
| `reels[].id` | string | Instagram media id (pk) |
| `reels[].shortcode` | string \| null | Shortcode used in the public URL |
| `reels[].url` | string \| null | Canonical public URL |
| `reels[].productType` | string \| null | feed \| clips \| igtv \| carousel_container |
| `reels[].mediaType` | enum \| null |  |
| `reels[].caption` | string \| null |  |
| `reels[].hashtags` | string[] | Hashtags in the caption, without # |
| `reels[].mentions` | string[] | Accounts mentioned in the caption, without @ |
| `reels[].createdUtc` | integer \| null | Creation time, unix seconds (UTC) |
| `reels[].likes` | integer \| null |  |
| `reels[].comments` | integer \| null |  |
| `reels[].views` | integer \| null | Play/view count; null when hidden or not returned by the source |
| `reels[].reshares` | integer \| null |  |
| `reels[].durationSeconds` | number \| null |  |
| `reels[].carouselCount` | integer \| null | Number of slides in a carousel |
| `reels[].media` | object[] | Photo/video URLs (temporary signed CDN links) |
| `reels[].media[].type` | enum |  |
| `reels[].media[].url` | string |  |
| `reels[].media[].width` | integer \| null |  |
| `reels[].media[].height` | integer \| null |  |
| `reels[].thumbnail` | string \| null |  |
| `reels[].videoUrl` | string \| null |  |
| `reels[].hasAudio` | boolean \| null |  |
| `reels[].countsHidden` | boolean \| null | Owner hides like/view counts |
| `reels[].isPinned` | boolean \| null |  |
| `reels[].paidPartnership` | boolean \| null |  |
| `reels[].userId` | string \| null | Numeric id of the posting account |
| `reels[].username` | string \| null | Username of the posting account |
| `reels[].displayName` | string \| null |  |
| `reels[].verified` | boolean \| null |  |
| `reels[].avatarUrl` | string \| null |  |
| `reels[].taggedUsers` | string[] | Usernames tagged in the media |
| `reels[].coauthors` | string[] | Collab co-author usernames |
| `reels[].locationId` | string \| null |  |
| `reels[].locationName` | string \| null |  |
| `reels[].locationLat` | number \| null |  |
| `reels[].locationLng` | number \| null |  |
| `reels[].audioId` | string \| null |  |
| `reels[].soundTitle` | string \| null |  |
| `reels[].soundAuthor` | string \| null |  |
| `nextCursor` | string \| null | Always null from the web index (ask for page + 1). Set only when the instagram.reels_search fallback served page 1; it continues instagram.reels_search, not this API. |

When the thing you asked about does not exist (or a search matches nothing) the call still succeeds: `output.found` is `false`, `output.data` is `null` and `output.reason` says why (`not_found`, `private`, `no_results`, …). Misses are free unless the notes below say misses are billed.

## Example request

```bash
curl -sS -X POST "https://api.primaryapi.com/v1/run/instagram.web_reels_search" \
  -H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"coffee"}'
```

## Example response

_Values are placeholders that follow the output schema; `credits` is what this call would cost at the usual price._

```json
{
  "output": {
    "found": true,
    "data": {
      "reels": [
        {
          "id": "string",
          "shortcode": "string",
          "url": "https://example.com",
          "productType": "string",
          "mediaType": "image",
          "caption": "string",
          "hashtags": [
            "string"
          ],
          "mentions": [
            "string"
          ],
          "createdUtc": 0,
          "likes": 0,
          "comments": 0,
          "views": 0,
          "reshares": 0,
          "durationSeconds": 0,
          "carouselCount": 0,
          "media": [
            {
              "type": "image",
              "url": "https://example.com",
              "width": 0,
              "height": 0
            }
          ],
          "thumbnail": "string",
          "videoUrl": "https://example.com",
          "hasAudio": true,
          "countsHidden": true,
          "isPinned": true,
          "paidPartnership": true,
          "userId": "string",
          "username": "string",
          "displayName": "string",
          "verified": true,
          "avatarUrl": "https://example.com",
          "taggedUsers": [
            "string"
          ],
          "coauthors": [
            "string"
          ],
          "locationId": "string",
          "locationName": "string",
          "locationLat": 0,
          "locationLng": 0,
          "audioId": "string",
          "soundTitle": "string",
          "soundAuthor": "string"
        }
      ],
      "nextCursor": null
    }
  },
  "provider": "PrimaryAPI",
  "credits": 1,
  "items": 1,
  "requestId": "req_01JBXK6Y2N9V8T4R3Q2P1M0A7Z",
  "nextCursor": null
}
```

## Pricing and reliability

- Usual price: 1 credit per call
- Price ceiling: up to 3 credits if a call is retried elsewhere. A quote’s `maxCredits` is the most a given call can cost; the `maxCredits` routing control caps it per call
- Live 30-day status, success rate, uptime and latency: `GET https://api.primaryapi.com/v1/status/apis?sku=instagram.web_reels_search`

## Errors to handle

`invalid_input`, `unauthorized`, `insufficient_balance`, `key_limit_reached`, `trial_cap_reached`, `forbidden`, `not_found`, `idempotency_conflict`, `rate_limited`, `all_sources_failed`, `service_unavailable`, `timeout`. See https://primaryapi.com/docs/errors.

## Notes

Web-index search: results skew older than Instagram-native search and carry no view counts. Fallback: page 1 without datePosted is delegated to instagram.reels_search (Instagram-native ranking).

