{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/postplanify-com/json-schema/postplanify-com-post-schema.json",
  "title": "Post",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/postplanify-com-api-openapi.json#/components/schemas/Post",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "workspaceId": {
      "type": "string",
      "format": "uuid"
    },
    "caption": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "$ref": "#/$defs/PostStatus"
    },
    "platform": {
      "$ref": "#/$defs/SocialPlatform"
    },
    "socialPlatformPostId": {
      "type": [
        "string",
        "null"
      ],
      "description": "The native post ID on the social platform"
    },
    "isStory": {
      "type": "boolean"
    },
    "shortenLinks": {
      "type": "boolean",
      "description": "Whether links are shortened with the workspace's Bitly account at publish time"
    },
    "utmCampaign": {
      "type": [
        "string",
        "null"
      ],
      "description": "The `utm_campaign` added to shortened links, if any"
    },
    "scheduledAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "publishedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "socialAccount": {
      "$ref": "#/$defs/SocialAccountSummary"
    },
    "medias": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PostMedia"
      }
    },
    "logs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PostLog"
      }
    },
    "platformParams": {
      "type": [
        "object",
        "null"
      ],
      "description": "Platform-specific parameters (YouTube, TikTok, Pinterest, or Google Business fields)"
    },
    "label": {
      "$ref": "#/$defs/PostLabel",
      "nullable": true,
      "description": "The content-pillar label assigned to this post (null if none)"
    },
    "metrics": {
      "$ref": "#/$defs/PostMetrics",
      "nullable": true,
      "description": "Latest performance figures for the post. Always present on `GET /posts/{id}`;\non `GET /posts` only when `includeMetrics=true`.\n\n`null` means no analytics have been collected for this post, which is not\nthe same as zero engagement. Posts that have not been published yet are\nalways `null`.\n"
    }
  },
  "$defs": {
    "PostLabel": {
      "type": [
        "object",
        "null"
      ],
      "description": "A user-defined content label attached to a post (used for organizing content pillars)",
      "properties": {
        "name": {
          "type": "string"
        },
        "color": {
          "type": "string",
          "description": "Hex color code"
        }
      }
    },
    "PostLog": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "SUCCESS",
            "ERROR",
            "WARNING",
            "INFO"
          ]
        },
        "message": {
          "type": [
            "string",
            "null"
          ]
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "PostMedia": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "description": "Media type (e.g. IMAGE_JPEG, VIDEO_MP4)"
        },
        "size": {
          "type": "number",
          "description": "File size in bytes"
        },
        "width": {
          "type": [
            "integer",
            "null"
          ]
        },
        "height": {
          "type": [
            "integer",
            "null"
          ]
        },
        "duration": {
          "type": [
            "number",
            "null"
          ],
          "description": "Video duration in seconds"
        },
        "coverImageUrl": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "PostMetrics": {
      "type": [
        "object",
        "null"
      ],
      "description": "A post's most recent daily analytics snapshot. Snapshots are collected once per\nday per post, so `measuredAt` shows how fresh these figures are.\n",
      "properties": {
        "views": {
          "type": [
            "integer",
            "null"
          ]
        },
        "likes": {
          "type": [
            "integer",
            "null"
          ]
        },
        "comments": {
          "type": [
            "integer",
            "null"
          ]
        },
        "shares": {
          "type": [
            "integer",
            "null"
          ]
        },
        "engagementRate": {
          "type": [
            "number",
            "null"
          ],
          "format": "float",
          "description": "Engagement as a share of views, where the platform reports it"
        },
        "platformMetrics": {
          "type": [
            "object",
            "null"
          ],
          "description": "Platform-specific extras, present only where the platform reports them.\nFor example X returns bookmarks and quotes, Instagram returns reach and saves.\n"
        },
        "measuredAt": {
          "type": "string",
          "format": "date",
          "description": "The date this snapshot was taken"
        }
      }
    },
    "PostStatus": {
      "type": "string",
      "enum": [
        "SCHEDULED",
        "PUBLISHED",
        "CANCELLED",
        "RESCHEDULED"
      ]
    },
    "SocialAccountSummary": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "platform": {
          "$ref": "#/$defs/SocialPlatform"
        },
        "accountName": {
          "type": "string"
        },
        "accountUrl": {
          "type": [
            "string",
            "null"
          ]
        },
        "profilePictureUrl": {
          "type": [
            "string",
            "null"
          ]
        },
        "customLabel": {
          "type": [
            "string",
            "null"
          ],
          "description": "User-set label to distinguish accounts (e.g. \"Downtown\")"
        }
      }
    },
    "SocialPlatform": {
      "type": "string",
      "enum": [
        "FACEBOOK",
        "INSTAGRAM",
        "X",
        "LINKEDIN",
        "TIKTOK",
        "YOUTUBE",
        "THREADS",
        "BLUESKY",
        "PINTEREST",
        "GOOGLE_BUSINESS",
        "TELEGRAM"
      ]
    }
  }
}