{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/preflight-social/json-schema/preflight-social-upload-instructions-schema.json",
  "title": "UploadInstructions",
  "description": "Where to PUT the bytes. The file never passes through the API.",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/preflight-social-openapi.json#/components/schemas/UploadInstructions",
  "type": "object",
  "required": [
    "id",
    "status",
    "upload"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "const": "awaiting_upload"
    },
    "upload": {
      "oneOf": [
        {
          "title": "single",
          "type": "object",
          "required": [
            "type",
            "url",
            "method",
            "headers"
          ],
          "properties": {
            "type": {
              "const": "single",
              "description": "Up to 16 MB."
            },
            "url": {
              "type": "string",
              "format": "uri",
              "description": "PUT the whole file here, then POST /media/{id}/uploaded."
            },
            "method": {
              "const": "PUT"
            },
            "headers": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              },
              "description": "Send these with the PUT; Content-Type above all."
            }
          }
        },
        {
          "title": "multipart",
          "type": "object",
          "required": [
            "type",
            "partSize",
            "parts",
            "completeUrl"
          ],
          "properties": {
            "type": {
              "const": "multipart",
              "description": "Over 16 MB."
            },
            "partSize": {
              "type": "integer",
              "description": "Bytes per part; the last is shorter."
            },
            "parts": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "partNumber": {
                    "type": "integer"
                  },
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              },
              "description": "PUT each part and keep its ETag response header."
            },
            "completeUrl": {
              "type": "string",
              "description": "/v1/media/{id}/complete, relative to the host: POST parts[{ partNumber, etag }] there once every part is in."
            }
          }
        }
      ]
    }
  }
}