{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/preflight-social/json-schema/preflight-social-post-input-schema.json",
  "title": "PostInput",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/preflight-social-openapi.json#/components/schemas/PostInput",
  "type": "object",
  "required": [
    "targets"
  ],
  "properties": {
    "content": {
      "type": "string",
      "maxLength": 64000,
      "description": "The text. On YouTube it is the description unless youtube.description is set."
    },
    "linkUrl": {
      "type": "string",
      "format": "uri"
    },
    "mediaIds": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uuid"
      },
      "minItems": 1,
      "maxItems": 35,
      "description": "Files in order; they must be ready."
    },
    "altTexts": {
      "type": "array",
      "items": {
        "type": [
          "string",
          "null"
        ],
        "maxLength": 1000
      },
      "description": "Alt text per file, same order as mediaIds."
    },
    "scheduledAt": {
      "type": "string",
      "format": "date-time",
      "description": "One instant for every channel. Up to five minutes in the past counts as now; older is refused with 400 scheduled_in_past (send publishNow to publish at once)."
    },
    "scheduledLocal": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}$",
      "description": "The same wall-clock time read in each channel's own zone."
    },
    "queue": {
      "type": "boolean",
      "default": false,
      "description": "Each channel takes its next free slot from its posting schedule."
    },
    "publishNow": {
      "type": "boolean",
      "default": false
    },
    "saveAsDraft": {
      "type": "boolean",
      "default": false,
      "description": "Park it without a time. Needs only posts:write."
    },
    "targets": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/TargetInput"
      }
    },
    "repeat": {
      "$ref": "#/$defs/RepeatInput"
    },
    "tags": {
      "type": "array",
      "maxItems": 10,
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 40
      },
      "description": "Tags by name. An existing tag is matched in any capitalisation; a new name makes a new tag. On PATCH, exactly these replace the post's tags and [] removes them all."
    }
  },
  "$defs": {
    "Platform": {
      "type": "string",
      "enum": [
        "youtube",
        "tiktok",
        "instagram",
        "facebook",
        "threads",
        "twitter",
        "linkedin",
        "pinterest",
        "bluesky",
        "mastodon",
        "telegram",
        "discord",
        "tumblr"
      ],
      "description": "A network's name. twitter (X) is text-only and not offered to new accounts."
    },
    "RepeatInput": {
      "type": "object",
      "required": [
        "everyDays",
        "times"
      ],
      "description": "Publish again every everyDays days, times times in all (this post included), each time with the next wording: content first, then each of variants in turn. Every wording is checked against every target now. Each later time is made as a new post when the one before it is done, checked again, and saved as a draft instead of sent if it no longer passes or the month's allowance is spent. A post a client approved needs approving again. On PATCH, null stops the series after this post.",
      "properties": {
        "everyDays": {
          "type": "integer",
          "minimum": 1,
          "maximum": 365
        },
        "times": {
          "type": "integer",
          "minimum": 2,
          "maximum": 52
        },
        "variants": {
          "type": "array",
          "maxItems": 9,
          "items": {
            "type": "string",
            "maxLength": 64000
          },
          "description": "Other wordings of content."
        }
      }
    },
    "TargetInput": {
      "type": "object",
      "required": [
        "platform"
      ],
      "properties": {
        "platform": {
          "$ref": "#/$defs/Platform"
        },
        "accountId": {
          "type": "string",
          "format": "uuid",
          "description": "Which connected account, when the workspace has several for one network."
        },
        "options": {
          "type": "object",
          "additionalProperties": true,
          "description": "Per-network settings: youtube.title, tags, categoryId, privacy, playlistId, thumbnailMediaId, subtitles, firstComment; tiktok.privacy (required), allowComments, asDraft; instagram.placement (feed, reel, story), shareToFeed, collaborators; facebook.asReel, firstComment; threads.poll, thread; pinterest.boardId (required), title; bluesky/mastodon/twitter.thread; mastodon.visibility, spoilerText; discord.threadName; tumblr.tags; linkedin.firstComment; boost {afterLikes, withinHours, reply, repost} on Bluesky, Mastodon, Threads, Facebook, Instagram and YouTube; utm {campaign, skipHosts} or true on any network, tagging the links with utm_source, utm_medium=social and utm_campaign; caption to override the text for this network. See /documentation#options."
        }
      }
    }
  }
}