{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/post-quest-com/json-schema/post-quest-com-post-analytics-schema.json",
  "title": "PostAnalytics",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/post-quest-com-openapi.yaml#/components/schemas/PostAnalytics",
  "type": "object",
  "required": [
    "id",
    "social_account_id",
    "post_id",
    "platform",
    "platform_post_id",
    "platform_url",
    "caption",
    "thumbnail_url",
    "content_format",
    "posted_at",
    "metrics",
    "last_synced_at"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "social_account_id": {
      "type": "string",
      "format": "uuid"
    },
    "post_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "The PostQuest post, when it was published through PostQuest."
    },
    "platform": {
      "$ref": "#/$defs/Platform"
    },
    "platform_post_id": {
      "type": "string"
    },
    "platform_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri"
    },
    "caption": {
      "type": [
        "string",
        "null"
      ]
    },
    "thumbnail_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri"
    },
    "content_format": {
      "$ref": "#/$defs/ContentFormat"
    },
    "posted_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "metrics": {
      "$ref": "#/$defs/AnalyticsMetrics"
    },
    "last_synced_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  },
  "$defs": {
    "AnalyticsMetrics": {
      "type": "object",
      "description": "Zero can mean the platform does not report that metric. `engagements` is likes, comments, shares and saves combined.",
      "required": [
        "impressions",
        "reach",
        "views",
        "likes",
        "comments",
        "shares",
        "saves",
        "follows",
        "engagements"
      ],
      "properties": {
        "impressions": {
          "type": "integer",
          "minimum": 0
        },
        "reach": {
          "type": "integer",
          "minimum": 0
        },
        "views": {
          "type": "integer",
          "minimum": 0
        },
        "likes": {
          "type": "integer",
          "minimum": 0
        },
        "comments": {
          "type": "integer",
          "minimum": 0
        },
        "shares": {
          "type": "integer",
          "minimum": 0
        },
        "saves": {
          "type": "integer",
          "minimum": 0
        },
        "follows": {
          "type": "integer",
          "minimum": 0
        },
        "engagements": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "ContentFormat": {
      "type": "string",
      "enum": [
        "video",
        "text",
        "image",
        "carousel",
        "reel",
        "story"
      ]
    },
    "Platform": {
      "type": "string",
      "enum": [
        "instagram",
        "facebook",
        "x",
        "youtube",
        "tiktok",
        "pinterest",
        "linkedin",
        "threads",
        "bluesky",
        "mastodon"
      ]
    }
  }
}