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)品牌的時區

若同時傳送兩種形式、傳送 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 結構描述建構的;執行時會發布至真實的社群帳號。

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