使用時先載入搜尋資料。亦可直接瀏覽下方分類。

排程及發佈

更新工作空間草稿

以 editor 或以上角色及 operate 權限取代草稿完整內容,傳 id、最後讀取嘅 expected_revision、新 mutation_id 及 content。共用編輯內容不可信,而且可能截短;保留完整原輸入或用 Web composer,唔好將 [truncated] 文字當完整內容儲存。409 表示版本衝突,保留本地編輯並核對最新版本;唔好自動覆寫其他成員嘅更改。儲存唔會發布,提交中或已提交內容唔可以用普通更新取代。

POST /studio-api/content-drafts/update

Contract 核對日期: · sha256:75c8b8ebce408575

概覽

以 editor 或以上角色及 operate 權限取代草稿完整內容,傳 id、最後讀取嘅 expected_revision、新 mutation_id 及 content。共用編輯內容不可信,而且可能截短;保留完整原輸入或用 Web composer,唔好將 [truncated] 文字當完整內容儲存。409 表示版本衝突,保留本地編輯並核對最新版本;唔好自動覆寫其他成員嘅更改。儲存唔會發布,提交中或已提交內容唔可以用普通更新取代。

HTTP 成功只表示呢次操作嘅回應。背景工作要保留回傳 ID,讀取同一操作直到文件指定嘅終態。接受請求、排程成功或客戶端逾時,都唔代表已發佈。

驗證及權限

接受嘅憑證類型
user_session, delegated_oauth, personal_access_token
委派權限
agent:operate
最低工作空間角色
editor
存取範圍
已登入使用者及獲授權資源範圍
需要所有工作空間同意
唔係
會改動狀態
係
完成依據
durable Workspace editorial content; no publishing side effects

憑證唔能夠擴大持有人權限。實際操作仍會檢查工作空間成員資格、資源擁有權、已選工作空間及能力授權。Tool profile 只改變可見工具,唔會授權。

請求欄位

必填表示喺所屬物件及所選分支內必須提供;子欄位必填唔代表可選父物件變成必填。以下欄位名稱及規則直接來自 contract。

請求欄位
欄位/分支類型/必填限制
$object父物件內必填
  • additionalProperties: false
idstring父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
expected_revisioninteger父物件內必填
  • maximum: 9007199254740991
  • exclusiveMinimum: 0
mutation_idstring父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
contentobject父物件內必填
  • additionalProperties: false
content.schemaVersionnumber可選/陣列項目
  • const: 1
  • default: 1
content.accountIdsarray可選/陣列項目
  • maxItems: 50
  • default: []
content.accountIds[]string可選/陣列項目
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
content.captionstring可選/陣列項目
  • maxLength: 5000
  • default: ""
content.hashtagsstring可選/陣列項目
  • maxLength: 5000
  • default: ""
content.assetIdsarray可選/陣列項目
  • maxItems: 20
  • default: []
content.assetIds[]string可選/陣列項目
  • maxLength: 16
  • pattern: "^[1-9][0-9]*$"
content.threadsTextOnlyboolean可選/陣列項目
  • default: false
content.instagramModestring可選/陣列項目
  • enum: ["IMAGE","REELS","CAROUSEL","STORY_IMAGE","STORY_VIDEO"]
  • default: "REELS"
content.youtubeTitlestring可選/陣列項目
  • maxLength: 100
  • default: ""
content.youtubePrivacystring可選/陣列項目
  • enum: ["private","unlisted","public"]
  • default: "private"
content.youtubeSyntheticboolean可選/陣列項目
  • default: false
content.youtubeCategoryIdstring可選/陣列項目
  • maxLength: 32
  • default: ""
content.youtubeShortboolean可選/陣列項目
  • default: false
content.linkUrlstring可選/陣列項目
  • maxLength: 2048
  • default: ""
content.scheduledAtstring可選/陣列項目
  • maxLength: 64
  • default: ""
content.displayTimezonestring可選/陣列項目
  • minLength: 1
  • maxLength: 128
  • default: "UTC"
content.publishNowboolean可選/陣列項目
  • default: false
content.destinationOverridesobject可選/陣列項目
  • default: {}
  • additionalProperties: {"type":"object","properties":{"caption":{"type":"string","maxLength":5000},"scheduledAt":{"type":"string","maxLength":64}},"additionalProperties":false}
content.destinationOverrides.*object可選/陣列項目
  • additionalProperties: false
content.destinationOverrides.*.captionstring可選/陣列項目
  • maxLength: 5000
content.destinationOverrides.*.scheduledAtstring可選/陣列項目
  • maxLength: 64
content.expiresAtstring可選/陣列項目
  • maxLength: 64
  • default: ""
完整 JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "expected_revision": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991
    },
    "mutation_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "content": {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "default": 1,
          "type": "number",
          "const": 1
        },
        "accountIds": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "caption": {
          "default": "",
          "type": "string",
          "maxLength": 5000
        },
        "hashtags": {
          "default": "",
          "type": "string",
          "maxLength": 5000
        },
        "assetIds": {
          "default": [],
          "maxItems": 20,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 16,
            "pattern": "^[1-9][0-9]*$"
          }
        },
        "threadsTextOnly": {
          "default": false,
          "type": "boolean"
        },
        "instagramMode": {
          "default": "REELS",
          "type": "string",
          "enum": [
            "IMAGE",
            "REELS",
            "CAROUSEL",
            "STORY_IMAGE",
            "STORY_VIDEO"
          ]
        },
        "youtubeTitle": {
          "default": "",
          "type": "string",
          "maxLength": 100
        },
        "youtubePrivacy": {
          "default": "private",
          "type": "string",
          "enum": [
            "private",
            "unlisted",
            "public"
          ]
        },
        "youtubeSynthetic": {
          "default": false,
          "type": "boolean"
        },
        "youtubeCategoryId": {
          "default": "",
          "type": "string",
          "maxLength": 32
        },
        "youtubeShort": {
          "default": false,
          "type": "boolean"
        },
        "linkUrl": {
          "default": "",
          "type": "string",
          "maxLength": 2048
        },
        "scheduledAt": {
          "default": "",
          "type": "string",
          "maxLength": 64
        },
        "displayTimezone": {
          "default": "UTC",
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "publishNow": {
          "default": false,
          "type": "boolean"
        },
        "destinationOverrides": {
          "default": {},
          "type": "object",
          "propertyNames": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "additionalProperties": {
            "type": "object",
            "properties": {
              "caption": {
                "type": "string",
                "maxLength": 5000
              },
              "scheduledAt": {
                "type": "string",
                "maxLength": 64
              }
            },
            "additionalProperties": false
          }
        },
        "expiresAt": {
          "default": "",
          "type": "string",
          "maxLength": 64
        }
      },
      "additionalProperties": false
    }
  },
  "required": [
    "id",
    "expected_revision",
    "mutation_id",
    "content"
  ],
  "additionalProperties": false
}

回應及完成條件

成功 HTTP 狀態碼: 200. 完成依據: durable Workspace editorial content; no publishing side effects.

HTTP 成功只表示呢次操作嘅回應。背景工作要保留回傳 ID,讀取同一操作直到文件指定嘅終態。接受請求、排程成功或客戶端逾時,都唔代表已發佈。

必填表示喺所屬物件及所選分支內必須提供;子欄位必填唔代表可選父物件變成必填。以下欄位名稱及規則直接來自 contract。

回應及完成條件
欄位/分支類型/必填限制
$object父物件內必填—
draftobject父物件內必填—
draft.idstring父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
draft.workspace_idstring父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
draft.revisioninteger父物件內必填
  • maximum: 9007199254740991
  • exclusiveMinimum: 0
draft.statestring父物件內必填
  • enum: ["draft","submitting","submitted"]
draft.contentobject父物件內必填—
draft.content.schemaVersionnumber父物件內必填
  • const: 1
  • default: 1
draft.content.accountIdsarray父物件內必填
  • maxItems: 50
  • default: []
draft.content.accountIds[]string可選/陣列項目
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
draft.content.captionstring父物件內必填
  • maxLength: 5000
  • default: ""
draft.content.hashtagsstring父物件內必填
  • maxLength: 5000
  • default: ""
draft.content.assetIdsarray父物件內必填
  • maxItems: 20
  • default: []
draft.content.assetIds[]string可選/陣列項目
  • maxLength: 16
  • pattern: "^[1-9][0-9]*$"
draft.content.threadsTextOnlyboolean父物件內必填
  • default: false
draft.content.instagramModestring父物件內必填
  • enum: ["IMAGE","REELS","CAROUSEL","STORY_IMAGE","STORY_VIDEO"]
  • default: "REELS"
draft.content.youtubeTitlestring父物件內必填
  • maxLength: 100
  • default: ""
draft.content.youtubePrivacystring父物件內必填
  • enum: ["private","unlisted","public"]
  • default: "private"
draft.content.youtubeSyntheticboolean父物件內必填
  • default: false
draft.content.youtubeCategoryIdstring父物件內必填
  • maxLength: 32
  • default: ""
draft.content.youtubeShortboolean父物件內必填
  • default: false
draft.content.linkUrlstring父物件內必填
  • maxLength: 2048
  • default: ""
draft.content.scheduledAtstring父物件內必填
  • maxLength: 64
  • default: ""
draft.content.displayTimezonestring父物件內必填
  • minLength: 1
  • maxLength: 128
  • default: "UTC"
draft.content.publishNowboolean父物件內必填
  • default: false
draft.content.destinationOverridesobject父物件內必填
  • default: {}
  • additionalProperties: {"type":"object","properties":{"caption":{"type":"string","maxLength":5000},"scheduledAt":{"type":"string","maxLength":64}}}
draft.content.destinationOverrides.*object可選/陣列項目—
draft.content.destinationOverrides.*.captionstring可選/陣列項目
  • maxLength: 5000
draft.content.destinationOverrides.*.scheduledAtstring可選/陣列項目
  • maxLength: 64
draft.content.expiresAtstring父物件內必填
  • maxLength: 64
  • default: ""
draft.created_bystring | null父物件內必填—
draft.created_byanyOf 1string父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
draft.created_byanyOf 2null父物件內必填—
draft.updated_bystring | null父物件內必填—
draft.updated_byanyOf 1string父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
draft.updated_byanyOf 2null父物件內必填—
draft.created_atstring父物件內必填
  • format: "date-time"
  • pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
draft.updated_atstring父物件內必填
  • format: "date-time"
  • pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
draft.submissionobject | null父物件內必填—
draft.submissionanyOf 1object父物件內必填—
draft.submission.idanyOf 1string父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
draft.submission.expected_revisionanyOf 1integer父物件內必填
  • maximum: 9007199254740991
  • exclusiveMinimum: 0
draft.submission.started_atanyOf 1string父物件內必填
  • format: "date-time"
  • pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
draft.submission.receiptanyOf 1object | null父物件內必填—
draft.submission.receiptanyOf 1 / anyOf 1object父物件內必填—
draft.submission.receipt.batch_idanyOf 1 / anyOf 1string | null父物件內必填—
draft.submission.receipt.batch_idanyOf 1 / anyOf 1 / anyOf 1string父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
draft.submission.receipt.batch_idanyOf 1 / anyOf 1 / anyOf 2null父物件內必填—
draft.submission.receipt.successesanyOf 1 / anyOf 1array父物件內必填
  • maxItems: 50
draft.submission.receipt.successes[]anyOf 1 / anyOf 1object可選/陣列項目—
draft.submission.receipt.successes[].social_account_idanyOf 1 / anyOf 1string父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
draft.submission.receipt.successes[].post_idanyOf 1 / anyOf 1string父物件內必填
  • pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
draft.submission.receipt.failuresanyOf 1 / anyOf 1array父物件內必填
  • maxItems: 50
draft.submission.receipt.failures[]anyOf 1 / anyOf 1object可選/陣列項目—
draft.submission.receipt.failures[].social_account_idanyOf 1 / anyOf 1string父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
draft.submission.receipt.failures[].codeanyOf 1 / anyOf 1string父物件內必填
  • minLength: 1
  • maxLength: 160
draft.submission.receipt.failures[].messageanyOf 1 / anyOf 1string父物件內必填
  • maxLength: 2000
draft.submission.receiptanyOf 1 / anyOf 2null父物件內必填—
draft.submissionanyOf 2null父物件內必填—
replayedboolean父物件內必填—
完整 JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "draft": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        },
        "workspace_id": {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        },
        "revision": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "state": {
          "type": "string",
          "enum": [
            "draft",
            "submitting",
            "submitted"
          ]
        },
        "content": {
          "type": "object",
          "properties": {
            "schemaVersion": {
              "default": 1,
              "type": "number",
              "const": 1
            },
            "accountIds": {
              "default": [],
              "maxItems": 50,
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              }
            },
            "caption": {
              "default": "",
              "type": "string",
              "maxLength": 5000
            },
            "hashtags": {
              "default": "",
              "type": "string",
              "maxLength": 5000
            },
            "assetIds": {
              "default": [],
              "maxItems": 20,
              "type": "array",
              "items": {
                "type": "string",
                "maxLength": 16,
                "pattern": "^[1-9][0-9]*$"
              }
            },
            "threadsTextOnly": {
              "default": false,
              "type": "boolean"
            },
            "instagramMode": {
              "default": "REELS",
              "type": "string",
              "enum": [
                "IMAGE",
                "REELS",
                "CAROUSEL",
                "STORY_IMAGE",
                "STORY_VIDEO"
              ]
            },
            "youtubeTitle": {
              "default": "",
              "type": "string",
              "maxLength": 100
            },
            "youtubePrivacy": {
              "default": "private",
              "type": "string",
              "enum": [
                "private",
                "unlisted",
                "public"
              ]
            },
            "youtubeSynthetic": {
              "default": false,
              "type": "boolean"
            },
            "youtubeCategoryId": {
              "default": "",
              "type": "string",
              "maxLength": 32
            },
            "youtubeShort": {
              "default": false,
              "type": "boolean"
            },
            "linkUrl": {
              "default": "",
              "type": "string",
              "maxLength": 2048
            },
            "scheduledAt": {
              "default": "",
              "type": "string",
              "maxLength": 64
            },
            "displayTimezone": {
              "default": "UTC",
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "publishNow": {
              "default": false,
              "type": "boolean"
            },
            "destinationOverrides": {
              "default": {},
              "type": "object",
              "propertyNames": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "additionalProperties": {
                "type": "object",
                "properties": {
                  "caption": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "scheduledAt": {
                    "type": "string",
                    "maxLength": 64
                  }
                }
              }
            },
            "expiresAt": {
              "default": "",
              "type": "string",
              "maxLength": 64
            }
          },
          "required": [
            "schemaVersion",
            "accountIds",
            "caption",
            "hashtags",
            "assetIds",
            "threadsTextOnly",
            "instagramMode",
            "youtubeTitle",
            "youtubePrivacy",
            "youtubeSynthetic",
            "youtubeCategoryId",
            "youtubeShort",
            "linkUrl",
            "scheduledAt",
            "displayTimezone",
            "publishNow",
            "destinationOverrides",
            "expiresAt"
          ]
        },
        "created_by": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            {
              "type": "null"
            }
          ]
        },
        "updated_by": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            {
              "type": "null"
            }
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
        },
        "submission": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "expected_revision": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "started_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "receipt": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "batch_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "successes": {
                          "maxItems": 50,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "social_account_id": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                              },
                              "post_id": {
                                "type": "string",
                                "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                              }
                            },
                            "required": [
                              "social_account_id",
                              "post_id"
                            ]
                          }
                        },
                        "failures": {
                          "maxItems": 50,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "social_account_id": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                              },
                              "code": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 160
                              },
                              "message": {
                                "type": "string",
                                "maxLength": 2000
                              }
                            },
                            "required": [
                              "social_account_id",
                              "code",
                              "message"
                            ]
                          }
                        }
                      },
                      "required": [
                        "batch_id",
                        "successes",
                        "failures"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "expected_revision",
                "started_at",
                "receipt"
              ]
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "workspace_id",
        "revision",
        "state",
        "content",
        "created_by",
        "updated_by",
        "created_at",
        "updated_at",
        "submission"
      ]
    },
    "replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "draft",
    "replayed"
  ]
}

錯誤及安全重試

檢查 HTTP 狀態及實際回應格式。驗證400可能回傳 ZodError;handler 錯誤可能係 error/message/code envelope。保留可用嘅 request_id 或 x-request-id,唔好記錄憑證。401/403先修正存取問題;429遵守 Retry-After。寫入結果未明或5xx時,先讀原有結果,再決定重試;只喺操作支援時重用 idempotency key,並冇通用重試或 exactly-once 保證。

問題排解指南

範例

以下虛構值已按 contract 驗證,唔係真實帳戶 ID、憑證或發佈紀錄。請用已授權範圍回傳嘅 ID、已準備好嘅素材及已審核排程取代,寫入前核對平台資格。此頁唔會呼叫 API。

喺伺服器環境設定 SOSOAPI_ACCESS_TOKEN,使用此操作接受嘅憑證。唔好放入瀏覽器程式。一般 agent 建議透過 sosoapi auth login 用瀏覽器 OAuth,由 CLI 管理憑證更新。

request.json

{
  "id": "44444444-4444-4444-8444-444444444444",
  "expected_revision": 1,
  "mutation_id": "66666666-6666-4666-8666-666666666666",
  "content": {
    "schemaVersion": 1,
    "accountIds": [],
    "caption": "Revised editorial content, still not scheduled.",
    "hashtags": "",
    "assetIds": [],
    "threadsTextOnly": false,
    "instagramMode": "REELS",
    "youtubeTitle": "",
    "youtubePrivacy": "private",
    "youtubeSynthetic": false,
    "youtubeCategoryId": "",
    "youtubeShort": false,
    "linkUrl": "",
    "scheduledAt": "",
    "displayTimezone": "UTC",
    "publishNow": false,
    "destinationOverrides": {},
    "expiresAt": ""
  }
}

cURL

curl --request POST \
  "https://gqeshlawtcexsapabaui.supabase.co/functions/v1/studio-api/content-drafts/update" \
  -H "Authorization: Bearer $SOSOAPI_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  --data-binary @request.json

JavaScript

// Server-side JavaScript. Do not print tokens or credential-bearing responses.
const token = process.env.SOSOAPI_ACCESS_TOKEN;
if (!token) throw new Error("Set an accepted credential for this operation");
const response = await fetch("https://gqeshlawtcexsapabaui.supabase.co/functions/v1/studio-api/content-drafts/update", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer " + token },
  body: JSON.stringify({
  "id": "44444444-4444-4444-8444-444444444444",
  "expected_revision": 1,
  "mutation_id": "66666666-6666-4666-8666-666666666666",
  "content": {
    "schemaVersion": 1,
    "accountIds": [],
    "caption": "Revised editorial content, still not scheduled.",
    "hashtags": "",
    "assetIds": [],
    "threadsTextOnly": false,
    "instagramMode": "REELS",
    "youtubeTitle": "",
    "youtubePrivacy": "private",
    "youtubeSynthetic": false,
    "youtubeCategoryId": "",
    "youtubeShort": false,
    "linkUrl": "",
    "scheduledAt": "",
    "displayTimezone": "UTC",
    "publishNow": false,
    "destinationOverrides": {},
    "expiresAt": ""
  }
})
});
const result = await response.json();
// Check response.ok, the operation-specific body and completion state before continuing.

CLI

npx sosoapi api post /studio-api/content-drafts/update < request.json

虛構回應範例

{
  "draft": {
    "id": "44444444-4444-4444-8444-444444444444",
    "workspace_id": "11111111-1111-4111-8111-111111111111",
    "revision": 2,
    "state": "draft",
    "content": {
      "schemaVersion": 1,
      "accountIds": [],
      "caption": "Revised editorial content, still not scheduled.",
      "hashtags": "",
      "assetIds": [],
      "threadsTextOnly": false,
      "instagramMode": "REELS",
      "youtubeTitle": "",
      "youtubePrivacy": "private",
      "youtubeSynthetic": false,
      "youtubeCategoryId": "",
      "youtubeShort": false,
      "linkUrl": "",
      "scheduledAt": "",
      "displayTimezone": "UTC",
      "publishNow": false,
      "destinationOverrides": {},
      "expiresAt": ""
    },
    "created_by": null,
    "updated_by": null,
    "created_at": "2099-01-15T08:00:00Z",
    "updated_at": "2099-01-15T08:30:00Z",
    "submission": null
  },
  "replayed": false
}

MCP: sosoapi_update_content_draft