{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/multi-upload-tool-com/json-schema/multi-upload-tool-com-upload-schema.json",
  "title": "Upload",
  "description": "One publication to one account.",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/multi-upload-tool-com-openapi.json#/components/schemas/Upload",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "platform": {
      "$ref": "#/$defs/Platform"
    },
    "accountId": {
      "type": "string"
    },
    "title": {
      "type": [
        "string",
        "null"
      ]
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "$ref": "#/$defs/UploadStatus"
    },
    "url": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "description": "Public URL of the published post, once it succeeds."
    },
    "error": {
      "type": [
        "string",
        "null"
      ],
      "description": "Failure reason when status is `failed`."
    },
    "failure": {
      "$ref": "#/$defs/UploadFailure"
    },
    "xCredits": {
      "type": [
        "object",
        "null"
      ],
      "description": "X posts only: credits this post cost. `spent` is what was debited (1, or 15 when the text contains a link), `refunded` what came back when the post failed, `net` the difference. Null until the job has run.",
      "properties": {
        "spent": {
          "type": "integer"
        },
        "refunded": {
          "type": "integer"
        },
        "net": {
          "type": "integer"
        }
      }
    },
    "scheduledFor": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "Platform": {
      "type": "string",
      "description": "A supported social platform.",
      "enum": [
        "tiktok",
        "youtube",
        "instagram",
        "facebook",
        "linkedin",
        "pinterest",
        "bluesky",
        "threads",
        "x"
      ]
    },
    "UploadFailure": {
      "type": [
        "object",
        "null"
      ],
      "description": "What a failure means, as data. Null unless status is `failed`.",
      "required": [
        "code",
        "retryable",
        "nextAction"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "rate_limited",
            "account_disconnected",
            "platform_unavailable",
            "queue_expired",
            "unknown",
            "media_invalid",
            "media_unreachable",
            "content_flagged",
            "platform_processing_timeout",
            "cancelled"
          ]
        },
        "retryable": {
          "type": "boolean",
          "description": "Whether retrying the same post can succeed."
        },
        "nextAction": {
          "type": "string",
          "enum": [
            "retry",
            "retry_later",
            "reconnect_account",
            "replace_media",
            "edit_post",
            "check_platform",
            "none"
          ]
        }
      }
    },
    "UploadStatus": {
      "type": "string",
      "enum": [
        "pending",
        "scheduled",
        "processing",
        "completed",
        "failed",
        "draft",
        "pending_approval"
      ]
    }
  }
}