Instagram 帖子嵌入代码 API

按帖子或 Reels 的 url 取 Instagram oEmbed 嵌入代码:html 贴进网页就显示成官方嵌入卡片,另带 author_name 和 thumbnail_url,每千次 $0.56。

  • html 是可贴进网页的嵌入代码
  • hidecaption 控制是否显示帖子正文
  • maxwidth 限定卡片宽度
免费开始

接口健康状态

24h 健康值
正常
  • 健康 / 正常
  • 可用
  • 少量可用
  • 基本不可用
正常

24 小时趋势

30 天趋势

  1. 1请求

    POST /api/v1/social
    {
      "platform": "instagram",
      "action": "oembed",
      "params": {
        "url": "https://www.instagram.com/p/DbYmqpplO_N/"
      }
    }
  2. 2JSON 响应

    {
      "results": {
        "author_name": "n•••a",
        "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…",
        …
      }
    }
  3. 3字段

    author_nameversiontypetitle
    n•••a1.0richThe Sun and Moon are coming together to put on a show for Earth, and we'll be sharing it with you. 😎 On 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! …
  4. 4CSV

    instagram-oembed-sample.csv version,type,title,author_name,author_url,author_id,media_id,provider_name,provider_url,width,html,thumbnail_url,thumbnail_width,thumbnail_height,shortcode,url,platform

请求带帖子 url 和可选的 hidecaption、maxwidth;返回一个 JSON 对象,html 是嵌入代码,另有 author_name、thumbnail_url 等字段,列成字段表,也可下载为 CSV。

能拿到什么数据

下表是对 instagram.com/p/DbYmqpplO_N 的一次真实调用,采集于 2026年11月21日 15:18(UTC),返回一个对象;灰条是隐去的个人信息(CSV 里是 •••)。你自己调用时,按字段表返回这些字段。

versiontypetitleauthor_nameauthor_urlauthor_idmedia_idprovider_nameprovider_urlwidthhtmlthumbnail_urlthumbnail_widththumbnail_heightshortcodeurlplatform
1.0richThe Sun and Moon are coming together to put on a show for Earth, and we'll be sharing it with you. 😎 On 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•••ainstagram.com/3952078729724096461_528817151Instagramhttps://www.instagram.com540<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…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…10801920DbYmqpplO_Nhttps://www.instagram.com/reel/DbYmqpplO_N/instagram

用途

  • 在网页里展示帖子

    把 html 贴进博客或内容管理系统,页面上就显示成 Instagram 的嵌入卡片。

  • 只放卡片、不带正文

    hidecaption 填 true,嵌入卡片不显示帖子正文。

  • 适配版面宽度

    用 maxwidth 限定卡片的最大宽度,再配合 width 排版。

  • 做链接预览

    读 thumbnail_url、author_name 和 title,给一条帖子链接配上缩略图和作者名。

Instagram oEmbed 与 EveryInfra 对比

下面从支持的帖子、返回内容、最大宽度和不支持的帖子四方面,比 Meta 官方 Instagram oEmbed 和 EveryInfra oembed。

对比项Instagram oEmbedEveryInfra
支持的帖子"Supports photo, video, Reel, and Feed posts."url 填帖子或 Reels 的链接(/p/ 或 /reel/ 形式)。
返回的嵌入代码"The embed HTML will be assigned to the html property."html 是嵌入代码,和 Instagram 官方 oEmbed 一样;另有 author_name、thumbnail_url、shortcode 等字段。
最大宽度"You can set the maximum width by including the maxwidth query string parameter in your request."maxwidth 是 320 到 658 的整数,单位像素,不传是 540。
不支持的帖子"Posts on private, inactive, and age-restricted Instagram accounts are not supported."帖子不存在或看不到时返回空结果,不收费。

引文出自 Meta 开发者文档,页面标注 2026-05-15 更新,2026-11-22 核对。 官方出处: Embed an Instagram Post (更新于 2026-05-15)

限制和注意事项

  • url 必填,填帖子或 Reels 的链接。
  • hidecaption 为 true 时嵌入卡片不显示帖子正文,不传是 false。
  • maxwidth 是 320 到 658 的整数,不传是 540。
  • 帖子不存在或看不到时返回空结果,不收费。

价格

每次调用 $0.000556,按次计费,不按字段多少算;一次调用取一条帖子的嵌入代码。失败和空结果不收费。

调用次数费用
10,000$5.56
100,000$55.56
1,000,000$555.56

合计按每次调用的标价算。

代码示例

#
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/"
  }
}'

OpenAPI 定义 (JSON)示例从环境变量 EVERYINFRA_API_KEY 读取 Key,复制出去的代码不含你的 Key。

API 参考

下面是 oembed 的参数、响应字段、错误和计费,可以复制整页,或用 Markdown 打开后交给 AI 助手。

POST

AI 提示词

#
请帮我用 EveryInfra 的「Instagram 帖子嵌入代码」接口(instagram/oembed)写一个数据采集脚本。

接口约定:
- 请求:POST https://api.everyinfra.com/api/v1/social,请求头 Authorization: Bearer <API Key>;Key 从环境变量 EVERYINFRA_API_KEY 读取,不要写进代码。
- 请求体里 platform 填 instagram,action 填 oembed,参数放在 params 里。
- 必填参数:
  - url:帖子或 Reel 链接,如 https://www.instagram.com/p/<shortcode>/ 或 /reel/<shortcode>/。
- 可选参数:
  - hidecaption:true 时嵌入卡片不显示帖子正文;不传是 false。
  - maxwidth:嵌入卡片的最大宽度,像素,320 到 658 的整数;不传是 540。
- 返回一个对象,主要字段:version((oembed)oEmbed 版本)、type、title、author_name、author_url、author_id、media_id(帖子的数字编号)、provider_name((oembed)固定为 Insta…)、provider_url((oembed)固定为 https…)、width(原图或原视频的宽)、html((oembed)嵌入代码:一段 b…)、thumbnail_url;一共 16 个字段,完整列表见 https://api.everyinfra.com/api/v1/social/catalog?platform=instagram。
- 示例请求体:
{
  "platform": "instagram",
  "action": "oembed",
  "params": {
    "url": "https://www.instagram.com/p/DbYmqpplO_N/"
  }
}
- 计费:$0.56 / 千次;失败和空结果不扣费。
- 一次要采几十上百个时,在请求体加 "mode": "async":先拿到 job_id,再轮询 GET https://api.everyinfra.com/api/v1/jobs/{job_id} 取结果。
- 返回 422 时,按错误信息里的候选参数和允许值修正;返回 429 或 503 时,按 Retry-After 等待后重试。

写代码前,先问清楚我要采哪些对象、一共多少个、需要哪些字段、结果存成什么格式,再把方案和大概花费讲给我确认。

请求参数

#
参数名位置类型必填默认值说明
Authorizationheaderstring是-Bearer 加你的 API Key。在控制台创建;不要放进网址或代码仓库。
platformbodystring是instagram平台标识,固定值。
actionbodystring是oembed能力标识,固定值。
urlbody.paramsstring是-帖子或 Reel 链接,如 https://www.instagram.com/p/<shortcode>/ 或 /reel/<shortcode>/。返回和 Instagram 官方 oEmbed 一样的字段和嵌入代码。帖子不存在或看不到时返回空结果,不扣费。
hidecaptionbody.paramsboolean否-true 时嵌入卡片不显示帖子正文;不传是 false。
maxwidthbody.paramsinteger否-嵌入卡片的最大宽度,像素,320 到 658 的整数;不传是 540。

响应示例

#
2026年11月21日 15:18(北京时间)用上方代码示例的参数真实调用所得。results 与 count 是那次的真实返回,已隐去名字、账号、头像、主页链接、联系方式等个人信息;id、billing、quota 每次调用都不同,只给结构。
json
{  "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": { … }}

返回字段

#

业务数据在 results 里;下表是每条记录可能包含的字段,平台没有提供的值不会被编造。

字段含义
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)。

错误与计费

#
401
缺少 Key 或 Key 无效。
402
余额不足,先充值。
422
参数名或取值不对,按错误信息给的候选改;不扣费。
429
超过每分钟请求上限,按 Retry-After 等待后再试。
503
暂时无法完成,预扣的费用退回;结果未知时先核对,不要直接重发。
200 空结果
没有数据,不扣费。

错误码

官方资料参照

#

只用于核对对象与术语,不表示平台对 EveryInfra 的授权或背书。

  • Instagram Platform:嵌入帖子(oEmbed) ↗

    Meta 的 oEmbed 文档说明 GET /instagram_oembed 按 url 返回帖子的嵌入 html 和基础信息,支持图片、视频、Reel 和信息流帖子,url 可以是 /p/ 或 /reel/ 形式的帖子链接,可用 maxwidth 限定最大宽度;私密、不活跃、限制年龄和关闭了嵌入的账号以及快拍不支持,文档限定该接口只用于在网站和应用里展示嵌入内容。可证明本接口的输入(帖子链接)、html 字段和 maxwidth 的含义;官方示例响应只有 version、provider_name、provider_url、type、width、html,本接口另外返回的 title、author_name、author_url、author_id、media_id、thumbnail_url、thumbnail_width、thumbnail_height、shortcode,以及 hidecaption 的取值和 maxwidth 的范围,这页都不证明。

    核对于 2026-11-21

常见问题

Instagram 嵌入代码接口返回什么?

返回和官方 oEmbed 一样的字段和嵌入代码:html、author_name、author_url、thumbnail_url、width、shortcode、url 等。

怎么把帖子嵌入到网页里?

请求带帖子的 url,把响应里的 html 贴进页面,就显示成 Instagram 的嵌入卡片。

取一条嵌入代码多少钱?

每次 $0.000556,每千次 $0.56,按调用次数算。失败和空结果不收费。

取嵌入代码要登录 Instagram 吗?

不用。请求头里放一把 EveryInfra API Key(Authorization: Bearer),不用登录 Instagram,也不用 Instagram 访问令牌。

oembed 和 post 有什么区别?

oembed 返回嵌入用的 html 和基础信息;post 读帖子的正文、点赞数、评论数这类内容数据。

同一把 Key 还能调用 Instagram 的其他能力,比如按链接读帖子内容的 post。

Google Analytics 同意才加载 隐私