POST/api/v4/social/posts

创建社交帖子

在品牌已连接的 Facebook、Instagram、X、LinkedIn 和 Pinterest 账号上创建草稿、定时发布或立即发布的帖子。

需要 API 密钥。请求头格式和密钥轮换请参阅身份验证。

参数

请求体

名称类型必填描述
inputobject必填Wrapper object. Every field below is a property of `input`, the entire body must be nested under it.
input.socialProfileIdstring必填UUID of the brand publishing the post, the same value used as the `brandId` path token elsewhere. Every platform in `platforms` must already have a connection on this brand.
input.namestring必填Internal name for the post (not shown to the audience). Used to find it again in lists.
input.platformsarray of strings必填Platforms to publish to: `FACEBOOK`, `INSTAGRAM`, `TWITTER` (X), `LINKEDIN`, `PINTEREST`.
input.contentstring必填The post body, published to every platform in `platforms`.
input.actionstring必填`DRAFT` to save without publishing, `SCHEDULE` to publish at a future time (requires a schedule), or `PUBLISH` to publish now.
input.mediaUrlsarray of strings可选Public https image URLs to attach. Instagram and Pinterest require at least one.
input.videoUrlsarray of strings可选Public https video URLs to attach.
input.linkstring可选Link to attach to the post where the platform supports one.
input.scheduledAtstring可选Publish time as an ISO-8601 timestamp with an offset, e.g. `2026-10-02T09:30:00-04:00`. Required when `action` is `SCHEDULE` unless you send `scheduleDate` + `scheduleTime`. Never send both forms.
input.scheduleDatestring可选Publish date as `YYYY-MM-DD`, interpreted in the **brand's** timezone. Must be sent together with `scheduleTime`.
input.scheduleTimestring可选Publish time as `HH:MM` (24-hour), interpreted in the **brand's** timezone. Must be sent together with `scheduleDate`.
input.connectedChannelIdsarray of strings可选Restrict publishing to specific connections by their `id` from the connections list. Defaults to the brand's active connection for each platform in `platforms`.
input.clientReferencestring可选Your own identifier for this post, stored and echoed back. Use it to reconcile the post against your own records without holding onto the returned UUID.

请求示例

可直接粘贴的请求体。请将占位 ID 和值替换为您自己的。

Request body
{  "input": {    "socialProfileId": "6f2c9a41-7b0e-4d55-9a2f-3c8e1d47b902",    "name": "Autumn collection launch",    "platforms": ["INSTAGRAM", "FACEBOOK", "LINKEDIN"],    "content": "Our autumn collection lands today. Solid oak, hand-finished, made two blocks from the shop. Come see it in person this weekend.",    "mediaUrls": ["https://cdn.example.com/social/autumn-collection.jpg"],    "link": "https://jennyhome.example/autumn",    "action": "SCHEDULE",    "scheduleDate": "2026-10-02",    "scheduleTime": "09:30",    "clientReference": "campaign-4471-slot-01"  }}

响应

200Post accepted. Publishing runs asynchronously, poll GET /social/posts/{postId} for per-channel status.
Response
{  "data": {    "createSimpleSocialMediaPost": {      "success": true,      "error": [],      "socialPostId": "c47a1e58-2b93-4f10-a6d7-58e0c9b12345",      "status": "SCHEDULED"    }  }}
200Validation failed. Nothing was created. The status is still 200: read `success` and the `error` array.
Response
{  "data": {    "createSimpleSocialMediaPost": {      "success": false,      "error": [        {          "message": "SY95045: No connected channel for PINTEREST on this brand",          "code": "SY95045",          "contextInfo": [{ "key": "platform", "value": "PINTEREST" }]        },        {          "message": "SY95046: scheduleTime must be HH:MM in the brand's timezone",          "code": "SY95046",          "contextInfo": null        }      ],      "socialPostId": null,      "status": null    }  }}
401Unauthenticated, missing or invalid API key.
404No brand with that ID on this account (`SY95043`).

为一个品牌创建一篇帖子,发布到该品牌已连接的一个或多个社交账号。一次调用即可涵盖全部 3 种生命周期:保存 DRAFT、将 SCHEDULE 加入队列,或立即 PUBLISH。

使用场景:通过您自己的日历安排营销活动。您的应用已经知道客户想发布什么内容,以及何时发布。对于每个时段,调用此端点时传入 action: "SCHEDULE",并传入 scheduledAt 或 scheduleDate + scheduleTime,同时将您自己的时段标识符作为 clientReference 传入,这样无需存储返回的 UUID 也能核对。在 GET /social/posts/{postId} 报告所有渠道均已发布之前,将该条目显示为待处理,并提供一个调用 POST /social/posts/cancel 的取消按钮。

发布是异步的

action: "PUBLISH" 在返回响应之前不会发布帖子。此调用会接受帖子,返回 socialPostId,并将帖子交给发布流水线。要了解实际结果,请轮询 GET /social/posts/{postId} 并读取按渠道列出的 channels[] 数组:每个条目的 status 表示对应平台的结果。同一个请求中的帖子可能在 Instagram 上发布成功,却在 LinkedIn 上发布失败,因此应以 channels[] 为准,而帖子级别的 status 只是摘要。

选择定时发布方式

action: "SCHEDULE" 要求使用以下 2 种形式之一,不能同时使用:

形式字段时间解释依据
绝对时间点scheduledAt,带时区偏移量的 ISO-8601 格式(2026-10-02T09:30:00-04:00)您发送的时区偏移量
本地时间scheduleDate(YYYY-MM-DD)和 scheduleTime(HH:MM)品牌的时区

同时发送这 2 种形式、发送 scheduleDate 却不发送 scheduleTime,或发送不带时区偏移量的 scheduledAt,都会被拒绝并返回 SY95046。DRAFT 和 PUBLISH 均不得携带任何定时发布设置。

注意事项。

  • 请求体必须封装在 input 对象中。
  • 检查 success,而不是 HTTP 状态。验证失败时会返回 HTTP 200,其中包含 success: false,且 error 数组中的每个条目对应一个问题。当 success 为 false 时,不会创建任何内容。
  • 请求体通过 socialProfileId 标识品牌。brandId 只用作 URL 路径参数,从不用作请求体字段。
  • platforms 中的每个平台都必须已在该品牌下建立连接。如果某个平台没有有效渠道,则会失败并返回 SY95045;请先读取品牌的连接,对于缺少连接的平台,引导用户通过连接链接 建立连接。
  • 平台值为大写枚举名称 FACEBOOK、INSTAGRAM、TWITTER、LINKEDIN、PINTEREST。TWITTER 表示 X;该值保留了旧名称,小写值会被拒绝。
  • Instagram 和 Pinterest 不接受纯文本帖子:当 platforms 包含其中任一平台时,请提供至少 1 个 mediaUrls 条目。
  • 帖子 ID 是普通 UUID,而不是地点帖子使用的 Base64 relay ID。
  • 如果要一次处理较多帖子,请使用 POST /social/bulk-posts,它接受相同的行结构,并会预先验证整个批次。

写入操作:未在实际账户中执行。所示请求和响应根据 API schema 构建;实际运行时,会向真实社交账号发布内容。

Request
curl -X POST 'https://listingsapi.com/api/v4/social/posts' \  -H "Authorization: API $LISTINGSAPI_KEY" \  -H 'Content-Type: application/json' \  -d '{    "input": {      "socialProfileId": "6f2c9a41-7b0e-4d55-9a2f-3c8e1d47b902",      "name": "Autumn collection launch",      "platforms": [        "INSTAGRAM",        "FACEBOOK",        "LINKEDIN"      ],      "content": "Our autumn collection lands today. Solid oak, hand-finished, made two blocks from the shop. Come see it in person this weekend.",      "mediaUrls": [        "https://cdn.example.com/social/autumn-collection.jpg"      ],      "link": "https://jennyhome.example/autumn",      "action": "SCHEDULE",      "scheduleDate": "2026-10-02",      "scheduleTime": "09:30",      "clientReference": "campaign-4471-slot-01"    }  }'