OpenSocialDocumentação

publications_draft

Criar intenção e rascunhos independentes por destino.

REST · POST /api/v1/operations/publications_draft · MCP · publications_draft

Permissão necessária · publish. Envie Idempotency-Key no REST ou requestKey no MCP. Substitua IDs e datas do exemplo antes de executar.

Exemplo de entrada

{
  "mediaId": "MEDIA_ID",
  "targets": [
    {
      "accountId": "ACCOUNT_ID"
    }
  ]
}

O REST retorna a saída abaixo diretamente. No MCP leia structuredContent.result. Consulte o contrato atual em /api/v1/openapi.json.

Em 401 confira a validade da credencial. Em 403 confira papel, escopos e contas. Em 409 releia o registro antes de tentar novamente.

JSON Schema · Entrada

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "mediaId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "caption": {
      "default": "",
      "type": "string",
      "maxLength": 12000
    },
    "hashtags": {
      "default": [],
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 100
      }
    },
    "targets": {
      "minItems": 1,
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "caption": {
            "type": "string",
            "maxLength": 12000
          },
          "hashtags": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 100
            }
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "unlisted",
              "private"
            ]
          },
          "coverMs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "madeForKids": {
            "type": "boolean"
          },
          "tiktok": {
            "type": "object",
            "properties": {
              "privacy": {
                "type": "string",
                "enum": [
                  "PUBLIC_TO_EVERYONE",
                  "FOLLOWER_OF_CREATOR",
                  "MUTUAL_FOLLOW_FRIENDS",
                  "SELF_ONLY"
                ]
              },
              "comment": {
                "type": "boolean"
              },
              "duet": {
                "type": "boolean"
              },
              "stitch": {
                "type": "boolean"
              },
              "commercial": {
                "type": "boolean"
              },
              "ownBrand": {
                "type": "boolean"
              },
              "brandedContent": {
                "type": "boolean"
              },
              "aiGenerated": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        "required": [
          "accountId"
        ]
      }
    }
  },
  "required": [
    "mediaId",
    "targets"
  ],
  "additionalProperties": false
}

JSON Schema · Saída

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "groupId": {
      "type": "string"
    },
    "publications": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "id": {
            "type": "string"
          }
        },
        "required": [
          "accountId",
          "errors",
          "id"
        ],
        "additionalProperties": {}
      }
    }
  },
  "required": [
    "groupId",
    "publications"
  ],
  "additionalProperties": {}
}