# Instagram Hashtag Recent Posts (`instagram.hashtag_recent_posts`)

Newest Instagram posts under a hashtag, read from its live chronological feed, for monitoring a tag as posts appear.

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

- Endpoint: `POST https://api.primaryapi.com/v1/run/instagram.hashtag_recent_posts`
- Category: Social · Platform: `instagram` · Kind: list · Status: live
- Price: 1 credit per call; up to 58 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.hashtag_recent_posts`
- Execution: synchronous (answers 202 only if it outlives the wait window)

## Input

| Field | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
| `hashtag` | string | yes |  | max 150 chars; pattern: ^#?[^\s#]+$ | Hashtag to read, with or without the leading #, for example "travel". |
| `limit` | integer | no | 50 | 1–100 | Maximum number of results to return (1-100, default 50). |
| `cursor` | string | no |  |  | Opaque pagination cursor: pass the previous response's nextCursor. |

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 |
|---|---|---|
| `posts` | object[] |  |
| `posts[].id` | string |  |
| `posts[].shortcode` | string |  |
| `posts[].url` | string |  |
| `posts[].caption` | string \| null |  |
| `posts[].createdUtc` | integer \| null | Publish time, unix seconds (UTC) |
| `posts[].productType` | string \| null | feed \| clips \| igtv \| carousel_container \| … |
| `posts[].likes` | integer \| null |  |
| `posts[].comments` | integer \| null |  |
| `posts[].views` | integer \| null | Play/view count of videos and reels |
| `posts[].reshares` | integer \| null |  |
| `posts[].durationSeconds` | number \| null |  |
| `posts[].carouselCount` | integer \| null |  |
| `posts[].width` | integer \| null |  |
| `posts[].height` | integer \| null |  |
| `posts[].countsHidden` | boolean \| null |  |
| `posts[].paidPartnership` | boolean \| null |  |
| `posts[].media` | object[] |  |
| `posts[].media[].type` | enum |  |
| `posts[].media[].url` | string |  |
| `posts[].media[].width` | integer \| null |  |
| `posts[].media[].height` | integer \| null |  |
| `posts[].hashtags` | string[] |  |
| `posts[].mentions` | string[] |  |
| `posts[].taggedUsers` | string[] |  |
| `posts[].coauthors` | string[] |  |
| `posts[].username` | string \| null |  |
| `posts[].userId` | string \| null |  |
| `posts[].displayName` | string \| null |  |
| `posts[].avatarUrl` | string \| null |  |
| `posts[].verified` | boolean \| null |  |
| `posts[].private` | boolean \| null |  |
| `posts[].locationId` | string \| null |  |
| `posts[].locationName` | string \| null |  |
| `posts[].locationLat` | number \| null |  |
| `posts[].locationLng` | number \| null |  |
| `posts[].soundTitle` | string \| null |  |
| `posts[].soundAuthor` | string \| null |  |
| `posts[].audioId` | string \| null |  |
| `nextCursor` | string \| null |  |

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.

Pagination: pass the previous response’s `nextCursor` as `cursor` to get the next page; `nextCursor: null` means there are no more results.

## Example request

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

## 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": {
      "posts": [
        {
          "id": "string",
          "shortcode": "string",
          "url": "https://example.com",
          "caption": "string",
          "createdUtc": 0,
          "productType": "string",
          "likes": 0,
          "comments": 0,
          "views": 0,
          "reshares": 0,
          "durationSeconds": 0,
          "carouselCount": 0,
          "width": 0,
          "height": 0,
          "countsHidden": true,
          "paidPartnership": true,
          "media": [
            {
              "type": "image",
              "url": "https://example.com",
              "width": 0,
              "height": 0
            }
          ],
          "hashtags": [
            "string"
          ],
          "mentions": [
            "string"
          ],
          "taggedUsers": [
            "string"
          ],
          "coauthors": [
            "string"
          ],
          "username": "string",
          "userId": "string",
          "displayName": "string",
          "avatarUrl": "https://example.com",
          "verified": true,
          "private": true,
          "locationId": "string",
          "locationName": "string",
          "locationLat": 0,
          "locationLng": 0,
          "soundTitle": "string",
          "soundAuthor": "string",
          "audioId": "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 58 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.hashtag_recent_posts`

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

Engagement counts on fresh posts are usually near zero; the recent feed excludes reels. Flat price per page; `limit` trims a page and the cursor resumes inside it; cursors are tied to the source that issued them.

