{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/narrareach-com/json-schema/narrareach-com-schedule-article-request-schema.json",
  "title": "ScheduleArticleRequest",
  "description": "Unknown fields are rejected with VALIDATION_ERROR.",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/narrareach-com-openapi.json#/components/schemas/ScheduleArticleRequest",
  "type": "object",
  "required": [
    "platforms"
  ],
  "allOf": [
    {
      "anyOf": [
        {
          "required": [
            "draftId"
          ]
        },
        {
          "required": [
            "title",
            "contentHtml"
          ]
        }
      ]
    },
    {
      "anyOf": [
        {
          "required": [
            "scheduledFor"
          ]
        },
        {
          "required": [
            "platformSchedules"
          ]
        }
      ]
    }
  ],
  "properties": {
    "publishMode": {
      "type": "string",
      "enum": [
        "publish",
        "draft"
      ],
      "description": "Only valid when all selected destinations are WORDPRESS or GHOST. draft saves a remote draft without creating a publication or public URL."
    },
    "draftId": {
      "type": "string"
    },
    "title": {
      "type": "string",
      "maxLength": 500
    },
    "subtitle": {
      "type": "string",
      "maxLength": 500,
      "description": "Optional article subtitle. Substack delivery omits subtitles over 250 characters and returns a warning; the saved draft remains unchanged."
    },
    "contentHtml": {
      "type": "string",
      "maxLength": 250000,
      "description": "For a native Substack paywall, use <hr data-type=\"paywall\"> at the chosen paragraph boundary. A single {{NARRAREACH_PAYWALL}} in article text is translated automatically; paywallMarker is only needed for custom tokens. If placement is unclear, ask where the free preview ends before scheduling. For a native subscribe block, use <div data-type=\"button\" data-kind=\"subscribeCaption\" data-text=\"Subscribe\" data-caption=\"Your caption\"></div> at the requested position, escaping attribute values as HTML. Use data-kind=\"subscribe\" for no caption. Ordinary subscription links remain links, not native widgets."
    },
    "coverImage": {
      "$ref": "#/$defs/MediaSource",
      "description": "Optional cover image for a new draft, placed at the top of the published body."
    },
    "media": {
      "type": "array",
      "maxItems": 12,
      "description": "Optional inline images or Substack article videos for a new draft. Each replaces a 1-based {{media:N}} placeholder in contentHtml in order; leftovers are appended. kind defaults to image. Video requires SUBSTACK as the only platform (otherwise VIDEO_REQUIRES_SUBSTACK_ONLY) and is accepted as MP4, WebM, MOV or M4V up to 100MB from a public URL.",
      "items": {
        "type": "object",
        "required": [
          "sourceType"
        ],
        "additionalProperties": false,
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "image",
              "video"
            ],
            "default": "image"
          },
          "sourceType": {
            "type": "string",
            "enum": [
              "url",
              "data_uri",
              "base64"
            ]
          },
          "url": {
            "type": "string",
            "maxLength": 20000
          },
          "data": {
            "type": "string",
            "maxLength": 15000000
          },
          "mimeType": {
            "type": "string",
            "maxLength": 120
          },
          "fileName": {
            "type": "string",
            "maxLength": 200
          }
        }
      }
    },
    "sendToNewsletter": {
      "type": "boolean",
      "description": "Substack only: email the post to subscribers. Defaults to true."
    },
    "isPaidContent": {
      "type": "boolean",
      "description": "Substack only: make the post paid-only, independently of email delivery. Defaults to false. Cannot be combined with freewall."
    },
    "freewall": {
      "type": "boolean",
      "description": "New Substack drafts only: allow free and paid subscribers below the divider. Requires SUBSTACK; cannot be combined with isPaidContent or draftId. Uses the existing divider or paywallMarker; without one, the entire article requires a subscription. Equivalent HTML: <hr data-type=\"paywall\" data-access=\"subscribers\">."
    },
    "addSearchMetadata": {
      "type": "boolean",
      "description": "Generate SEO titles, descriptions, and a Substack slug for supported destinations. On by default on plans with article SEO; set false to turn it off. X has no separate article SEO settings."
    },
    "linkedinShareCommentary": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2800,
      "description": "Optional LinkedIn share text posted with a LinkedIn article."
    },
    "publication": {
      "type": "string",
      "minLength": 1,
      "maxLength": 300,
      "description": "Substack publication name, handle, or URL. Only with SUBSTACK in platforms. Optional with one connected publication; otherwise required, and the REST API never falls back to a remembered publication: nothing is scheduled and the request fails with SUBSTACK_PUBLICATION_REQUIRED or SUBSTACK_PUBLICATION_AMBIGUOUS (or PLATFORM_NOT_READY when Narrareach cannot confirm the session publishes there), listing the choices in error.details.substackPublications and any saved draft in error.details.createdDraft."
    },
    "substackConnectionId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 191,
      "description": "Connected Substack publication id, as an alternative to publication. Only with SUBSTACK in platforms."
    },
    "tags": {
      "type": "array",
      "maxItems": 50,
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 50
      },
      "description": "Optional article tags. Substack receives all supplied tags. Medium receives its supported first 5 topics and returns a warning when extras are omitted. The saved draft remains unchanged."
    },
    "paywallMarker": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Optional exact marker in contentHtml where a Substack free preview ends. It must appear exactly once. Narrareach replaces it with a native Substack paywall and enables paid delivery."
    },
    "linkedinPublicationType": {
      "type": "string",
      "enum": [
        "article",
        "newsletter"
      ]
    },
    "linkedinAuthorUrn": {
      "type": "string",
      "description": "Personal profile or Company Page author URN returned by the LinkedIn Article destinations endpoint."
    },
    "linkedinNewsletterUrn": {
      "type": "string",
      "description": "Newsletter URN returned for the selected LinkedIn Article author."
    },
    "platforms": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "enum": [
          "SUBSTACK",
          "MEDIUM",
          "LINKEDIN",
          "X",
          "WORDPRESS",
          "GHOST"
        ]
      }
    },
    "mediumPublicationId": {
      "type": "string",
      "maxLength": 200,
      "description": "Optional Medium publication to submit this story to instead of the personal profile. Only valid when platforms includes MEDIUM; null or blank means not set and is ignored. When the account only has writer access (canPublish false), the story is submitted for editorial review and left unscheduled — it goes live when an editor accepts it, not at the requested time. An explicit publication rejection allows personal-profile delivery with a warning. An ambiguous submission remains unpublished for review. Draft-only delivery does not submit to a publication."
    },
    "mediumNotifyFollowers": {
      "type": "boolean",
      "description": "Whether to email Medium subscribers about this story. true is only valid when platforms includes MEDIUM; false or null is ignored. Defaults to false. Best-effort: a failure to apply this setting is returned in warnings, not as a failure."
    },
    "scheduledFor": {
      "type": "string",
      "format": "date-time"
    },
    "platformSchedules": {
      "type": "array",
      "minItems": 1,
      "maxItems": 6,
      "description": "One schedule for every selected platform. Platforms must be unique and match platforms exactly.",
      "items": {
        "type": "object",
        "required": [
          "platform",
          "scheduledFor"
        ],
        "properties": {
          "platform": {
            "type": "string",
            "enum": [
              "SUBSTACK",
              "MEDIUM",
              "LINKEDIN",
              "X",
              "WORDPRESS",
              "GHOST"
            ]
          },
          "scheduledFor": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      }
    },
    "timezone": {
      "type": "string",
      "description": "IANA timezone saved with the item and used to show its local time. scheduledFor always carries its own offset. Defaults to the account's saved timezone, else UTC."
    },
    "idempotencyKey": {
      "type": "string",
      "maxLength": 200
    }
  },
  "additionalProperties": false,
  "$defs": {
    "MediaSource": {
      "type": "object",
      "required": [
        "sourceType"
      ],
      "additionalProperties": false,
      "description": "A public HTTPS URL, a data URI, or base64 bytes.",
      "properties": {
        "sourceType": {
          "type": "string",
          "enum": [
            "url",
            "data_uri",
            "base64"
          ]
        },
        "url": {
          "type": "string",
          "maxLength": 20000,
          "description": "For sourceType url."
        },
        "data": {
          "type": "string",
          "maxLength": 15000000,
          "description": "For data_uri or base64."
        },
        "mimeType": {
          "type": "string",
          "maxLength": 120,
          "description": "Required for raw base64, for example image/png."
        },
        "fileName": {
          "type": "string",
          "maxLength": 200
        }
      }
    }
  }
}