# Search topic

Search public popular content by topic keyword, legacy topic ID or topic URL, with available dates and engagement counts.

- Platform: [Instagram](https://docs.upscrape.com/docs/platforms/instagram)
- Capability ID: `instagram.topic.search`
- Cost: 1 credit per request
- Maximum runtime: 120 seconds
- Execute endpoint: `POST https://data.upscrape.com/execute`

## Request

Use the exact public capability ID in the shared execute envelope.

```bash
curl --request POST \
  --url https://data.upscrape.com/execute \
  --header "Authorization: Bearer $UPSCRAPE_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Prefer: wait=30" \
  --data '{
  "input": {
    "limit": 12,
    "topic": "sports"
  },
  "capability": "instagram.topic.search"
}'
```

## Input


| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `cursor` | `string` | No | Opaque next_cursor from a previous response |
| `limit` | `integer` | No | Maximum deduplicated results From 1 to 120. Default: `24`. |
| `max_pages` | `integer` | No | Maximum upstream pages for this request From 1 to 10. Default: `2`. |
| `topic` | `string` | Yes | Known topic ID, topic slug, explore-topic URL, or public /popular/ URL |

### Example input

```json
{
  "limit": 12,
  "topic": "sports"
}
```

## Response

Successful output is returned in `results[0].data`.

Raw platform output is intentionally open-ended and may evolve with the upstream source.

### Illustrative sample output

This example shows one response. Values and optional fields vary with the data available.

```json
{
  "category": "Sports",
  "has_more": true,
  "next_cursor": "[redacted:token]",
  "pages": 1,
  "posts": [
    {
      "caption": "No handed catch 🤯\n\n#gymnastics #gymnast #olympics #sports #olympic",
      "id": "3821162622834555967",
      "play_count": 104409550,
      "shortcode": "DUHfyj7Dbw_",
      "type": "Video",
      "url": "https://www.instagram.com/reel/DUHfyj7Dbw_/",
      "user": {
        "id": "17841401267387798",
        "is_verified": true,
        "username": "iandgunther"
      },
      "video_versions": [
        {
          "height": 0,
          "width": 0
        },
        {
          "height": 0,
          "width": 0
        },
        {
          "height": 0,
          "width": 0
        }
      ]
    },
    {
      "caption": "Imagine an eagle landing on your shoulder before a game 😳🦅 #MLBonNetflix \n\n#baseball #mlb #sports",
      "id": "3862390664806429764",
      "play_count": 10025526,
      "shortcode": "DWZ99iHknRE",
      "type": "Video",
      "url": "https://www.instagram.com/reel/DWZ99iHknRE/",
      "user": {
        "id": "17841474528124930",
        "is_verified": true,
        "username": "netflixsports"
      },
      "video_versions": [
        {
          "height": 0,
          "width": 0
        },
        {
          "height": 0,
          "width": 0
        },
        {
          "height": 0,
          "width": 0
        }
      ]
    },
    {
      "caption": "Dan Hurley’s reaction to UCONN’s game-winner 😭🔥\n\n(via @marchmadnessmbb) #sports #cbb #marchmadness #uconn #basketball",
      "id": "3864287323110685920",
      "play_count": 16734318,
      "shortcode": "DWgtNi0Drzg",
      "type": "Video",
      "url": "https://www.instagram.com/reel/DWgtNi0Drzg/",
      "user": {
        "id": "17841400113190453",
        "is_verified": true,
        "username": "bleacherreport"
      },
      "video_versions": [
        {
          "height": 0,
          "width": 0
        },
        {
          "height": 0,
          "width": 0
        },
        {
          "height": 0,
          "width": 0
        }
      ]
    }
  ],
  "topic_id": "1283274535024498",
  "topic_name": "Sports",
  "topic_slug": "sports",
  "total_count": 12
}
```
### Illustrative output fields

Derived from the sample above for orientation only. These fields are not a fixed response schema.

| Path | Observed type | Example |
| --- | --- | --- |
| `category` | `string` | Sports |
| `has_more` | `boolean` | true |
| `next_cursor` | `string` | [redacted:token] |
| `pages` | `integer` | 1 |
| `posts` | `array` | 3 items |
| `posts` | `array` | 3 items |
| `topic_id` | `string` | 1283274535024498 |
| `topic_name` | `string` | Sports |
| `topic_slug` | `string` | sports |
| `total_count` | `integer` | 12 |

## Execution behavior

A `200` response completed inline. A `202` response was queued; poll `GET /jobs/{id}` until the job reaches `completed` or `failed`. Use an `Idempotency-Key` when retrying must not create a duplicate logical job.

## Related documentation

- [Authentication](https://docs.upscrape.com/docs/api/authentication)
- [Jobs and results](https://docs.upscrape.com/docs/api/jobs)
- [Errors and retries](https://docs.upscrape.com/docs/api/errors)
- [Idempotency](https://docs.upscrape.com/docs/api/idempotency)
