{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/postbase-so/json-schema/postbase-so-post-schema.json",
  "title": "Post",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/postbase-so-openapi.json#/components/schemas/Post",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "scheduled",
        "publishing",
        "published",
        "failed"
      ]
    },
    "body": {
      "type": "string"
    },
    "thread": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "scheduled_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "media": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "type": {
            "type": "string"
          }
        }
      }
    },
    "channels": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PostChannel"
      }
    },
    "summary": {
      "type": "object",
      "properties": {
        "published": {
          "type": "integer"
        },
        "failed": {
          "type": "integer"
        },
        "pending": {
          "type": "integer"
        }
      }
    },
    "warning": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "channels"
  ],
  "$defs": {
    "PostChannel": {
      "type": "object",
      "properties": {
        "channel_id": {
          "type": "string",
          "format": "uuid"
        },
        "platform": {
          "type": [
            "string",
            "null"
          ]
        },
        "handle": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "draft",
            "scheduled",
            "publishing",
            "published",
            "failed"
          ]
        },
        "url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "The live post, once published"
        },
        "error": {
          "type": [
            "string",
            "null"
          ],
          "description": "Why it failed"
        },
        "warning": {
          "type": [
            "string",
            "null"
          ],
          "description": "It published, with something to know"
        },
        "retry_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When Postbase will retry a failed channel on its own"
        },
        "body": {
          "type": [
            "string",
            "null"
          ],
          "description": "This channel's own text, if any"
        },
        "metrics": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "number"
          },
          "description": "Latest likes, impressions, etc."
        }
      },
      "required": [
        "channel_id",
        "status"
      ]
    }
  }
}