# Instagram Post (`instagram.post`)

One public Instagram post or reel by URL: owner, caption, like, comment and play counts, media URLs and audio.

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

- Endpoint: `POST https://api.primaryapi.com/v1/run/instagram.post`
- Category: Social · Platform: `instagram` · Kind: lookup · 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.post`
- Execution: synchronous (answers 202 only if it outlives the wait window)

## Input

| Field | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
| `url` | string | yes |  | max 2048 chars; pattern: ^https?:\/\/(?:www\.\|m\.)?(?:instagram\.com\|instagr\.am)\/(?:(?!share\/)[A-Za-z0-9._]{1,30}\/)?(?:p\|reel\|reels\|tv)\/([A-Za-z0-9_-]{5,}) | Public Instagram post, reel or /tv/ URL, for example "https://www.instagram.com/p/DLNsnpUTdVS/". Profile URLs and /share/ links are not accepted. |
| `requirePlayCount` | boolean | no | false |  | Serve videos and reels only from a source that reports the play count (photos are unaffected). |
| `hostVideo` | false | no | false |  | Hosted MP4 copies are not offered yet: only false is accepted (kept for request compatibility). |

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 |
|---|---|---|
| `id` | string | Numeric media id |
| `shortcode` | string |  |
| `url` | string |  |
| `type` | enum |  |
| `productType` | string \| null | feed \| clips \| igtv \| carousel_container \| … |
| `caption` | string \| null |  |
| `createdUtc` | integer \| null | Publish time, unix seconds (UTC) |
| `likes` | integer \| null |  |
| `comments` | integer \| null |  |
| `plays` | integer \| null | Play count of videos and reels (Instagram plays only) |
| `reshares` | integer \| null |  |
| `durationSeconds` | number \| null |  |
| `hasAudio` | boolean \| null |  |
| `displayUrl` | string \| null | Cover / display image (temporary CDN link) |
| `videoUrl` | string \| null | Direct video file (temporary CDN link) |
| `altText` | string \| null |  |
| `countsHidden` | boolean \| null | Owner hides like and view counts |
| `paidPartnership` | boolean \| null |  |
| `carouselCount` | integer \| null |  |
| `media` | object[] |  |
| `media[].type` | enum |  |
| `media[].url` | string |  |
| `media[].width` | integer \| null |  |
| `media[].height` | integer \| null |  |
| `hashtags` | string[] |  |
| `mentions` | string[] |  |
| `taggedUsers` | string[] |  |
| `coauthors` | string[] |  |
| `owner` | string \| null | Username of the post owner |
| `userId` | string \| null |  |
| `displayName` | string \| null |  |
| `avatarUrl` | string \| null |  |
| `verified` | boolean \| null |  |
| `locationId` | string \| null |  |
| `locationName` | string \| null |  |
| `locationLat` | number \| null |  |
| `locationLng` | number \| null |  |
| `soundTitle` | string \| null |  |
| `soundAuthor` | string \| null |  |
| `audioId` | string \| null |  |
| `hostedUrl` | string \| null | Hosted MP4 copy (hostVideo is not offered yet: always null) |
| `bytes` | integer \| null | Size of the hosted MP4 (always null until hostVideo exists) |
| `expiresUtc` | integer \| null | Expiry of hostedUrl (always null until hostVideo exists) |

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.post" \
  -H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.instagram.com/p/DLNsnpUTdVS/"}'
```

## 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": {
      "id": "string",
      "shortcode": "string",
      "url": "https://www.instagram.com/p/DLNsnpUTdVS/",
      "type": "image",
      "productType": "string",
      "caption": "string",
      "createdUtc": 0,
      "likes": 0,
      "comments": 0,
      "plays": 0,
      "reshares": 0,
      "durationSeconds": 0,
      "hasAudio": true,
      "displayUrl": "https://example.com",
      "videoUrl": "https://example.com",
      "altText": "string",
      "countsHidden": true,
      "paidPartnership": true,
      "carouselCount": 0,
      "media": [
        {
          "type": "image",
          "url": "https://www.instagram.com/p/DLNsnpUTdVS/",
          "width": 0,
          "height": 0
        }
      ],
      "hashtags": [
        "string"
      ],
      "mentions": [
        "string"
      ],
      "taggedUsers": [
        "string"
      ],
      "coauthors": [
        "string"
      ],
      "owner": "string",
      "userId": "string",
      "displayName": "string",
      "avatarUrl": "https://example.com",
      "verified": true,
      "locationId": "string",
      "locationName": "string",
      "locationLat": 0,
      "locationLng": 0,
      "soundTitle": "string",
      "soundAuthor": "string",
      "audioId": "string",
      "hostedUrl": "https://example.com",
      "bytes": 0,
      "expiresUtc": 0
    }
  },
  "provider": "PrimaryAPI",
  "credits": 1,
  "items": 1,
  "requestId": "req_01JBXK6Y2N9V8T4R3Q2P1M0A7Z"
}
```

## 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.post`

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

Media URLs are temporary signed CDN links. Play counts are fragile on every source; use requirePlayCount to skip sources that omit them.

