# Instagram 帖子嵌入代码 API (instagram.oembed)

- Canonical page: [https://everyinfra.com/instagram-api/oembed](https://everyinfra.com/instagram-api/oembed?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "instagram", "action": "oembed", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: single object
- Mode: sync; add "mode": "async" for slow tasks

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=instagram&action=oembed

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | 帖子或 Reel 链接，如 https://www.instagram.com/p/<shortcode>/ 或 /reel/<shortcode>/。返回和 Instagram 官方 oEmbed 一样的字段和嵌入代码。帖子不存在或看不到时返回空结果，不扣费。 |
| hidecaption | not declared | no | not declared | true 时嵌入卡片不显示帖子正文；不传是 false。 |
| maxwidth | integer | no | not declared | 嵌入卡片的最大宽度，像素，320 到 658 的整数；不传是 540。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| version | （oembed）oEmbed 版本，1.0。 |
| type | 记录类型，取值随能力而定（如 video / image / text）。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| author_name | 作者昵称（显示名）。 |
| author_url | 作者在原平台的主页链接。 |
| author_id | 作者在原平台的唯一 ID。 |
| media_id | 帖子的数字编号。oembed 给的是「帖子编号_作者编号」的写法。 |
| provider_name | （oembed）固定为 Instagram。 |
| provider_url | （oembed）固定为 https://www.instagram.com。 |
| width | 原图或原视频的宽，像素。 |
| html | （oembed）嵌入代码：一段 blockquote 加 Instagram 的 embed.js，贴进网页就显示成官方的嵌入卡片。 |
| thumbnail_url | 缩略图链接，分辨率低于 image_url。 |
| thumbnail_width | （oembed）缩略图的宽，像素。 |
| thumbnail_height | （oembed）缩略图的高，像素。 |
| shortcode | 帖子码：帖子链接里 /p/ 或 /reel/ 后面那一段。 |
| url | 该记录在原平台上的可访问链接。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "instagram",
  "action": "oembed",
  "params": {
    "url": "https://www.instagram.com/p/DbYmqpplO_N/"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "instagram",
        "action": "oembed",
        "params": {
            "url": "https://www.instagram.com/p/DbYmqpplO_N/",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-11-21T07:18:47Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "instagram",
  "action": "oembed",
  "results": {
    "version": "1.0",
    "type": "rich",
    "title": "The Sun and Moon are coming together to put on a show for Earth, and we'll be sharing it with you. 😎\n\nOn Aug. 12, a total solar eclipse will pass over Earth, and we'll be broadcasting it live along the path of totality. Check our link in bio to learn how to watch along with us!\n\n…",
    "author_name": "n•••a",
    "author_url": "https://www.instagram.com/•••",
    "author_id": "•••",
    "media_id": "3952078729724096461_528817151",
    "provider_name": "Instagram",
    "provider_url": "https://www.instagram.com",
    "width": 540,
    "html": "<blockquote class=\"instagram-media\" data-instgrm-captioned data-instgrm-permalink=\"https://www.instagram.com/reel/DbYmqpplO_N/?utm_source=ig_embed&amp;utm_campaign=loading\" data-instgrm-version=\"14\" style=\" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0…",
    "thumbnail_url": "https://scontent-lax3-1.cdninstagram.com/v/t51.82787-15/760192799_18631809481049152_7782886010573196119_n.jpg?stp=dst-jpg_e15_tt6&_nc_cat=109&_nc_map=urlgen_bucketless&ig_cache_key=Mzk1MjA3ODcyOTcyNDA5NjQ2MTE4NjMxODA5NDc1MDQ5MTUy.3-ccb7-5&ccb=7-5&_nc_sid=58cdad&efg=eyJ2ZW5jb2RlX3…",
    "thumbnail_width": 1080,
    "thumbnail_height": 1920,
    "shortcode": "DbYmqpplO_N",
    "url": "https://www.instagram.com/reel/DbYmqpplO_N/",
    "platform": "instagram"
  },
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=instagram
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
