{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rizamo-com/json-schema/rizamo-com-network-post-schema.json",
  "title": "NetworkPost",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rizamo-com-openapi.json#/components/schemas/NetworkPost",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "profileId": {
      "type": "string"
    },
    "accountId": {
      "type": "string"
    },
    "network": {
      "$ref": "#/$defs/Network"
    },
    "networkId": {
      "type": "string",
      "description": "Its id on the network."
    },
    "origin": {
      "enum": [
        "rizamo",
        "external"
      ],
      "type": "string",
      "description": "rizamo: published through Rizamo, and `postId` is that post. external: made in the network's own apps or another tool."
    },
    "postId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "The Rizamo post it went out as. Null when it was made elsewhere."
    },
    "format": {
      "$ref": "#/$defs/PostFormat"
    },
    "caption": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Where it is on the network."
    },
    "thumbnailUrl": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "A small copy of its picture that Rizamo keeps, on Rizamo's media host: the link works for a few hours, so get the post again for a fresh one. The network's own link until the copy is made."
    },
    "publishedAt": {
      "type": "string",
      "format": "date-time"
    },
    "deletedAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "description": "When Rizamo found it gone from the network. A deleted post keeps no caption or picture."
    },
    "metrics": {
      "anyOf": [
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        {
          "type": "null"
        }
      ],
      "description": "Its latest lifetime totals, as the network reports them, by the names every network shares (impressions, reach, engagements, likes, comments, shares, saves, clicks, views) and a few only some have (Instagram and Facebook stories: replies; Instagram stories: navigation with its parts taps_forward, taps_back, exits and swipes_forward; Instagram and Facebook reels, TikTok and YouTube: watch_time and avg_watch_time in milliseconds; Instagram feed posts and stories, Facebook reels, TikTok and YouTube: follows, which on YouTube are the subscribers a video brought from its watch page; Instagram feed posts and stories and TikTok: profile_visits; Instagram and Threads: reposts; Threads: quotes, and comments for its replies; YouTube: engaged_views, plays past the first frame or a tap to play, as YouTube counted views before its views began counting every start: Shorts from 31 March 2025, every video from 24 August 2026). A Facebook reel's reach is its Page post's viewers, where Meta gives them, and its likes every reaction. A Facebook story has views, reach, engagements (Meta's own total), replies and shares, read while it is live and only with `read_insights`; one that ended before Rizamo read it has none, as `metricsUnavailable` says. A YouTube video has no engagements: YouTube's policies forbid numbers worked out from its own, and its watch times, shares, follows and engaged views come 2 to 3 days late. A Threads thread Rizamo published counts its posts' numbers summed, and its replies once: the first post's (every reply under it), less its own parts. A null value is one the network hides because it is small (Meta: under 5). Null until Rizamo first reads them: 1 hour after publishing, then at 6 hours, daily to day 90 and every 30 days after (YouTube every 28) (TikTok's until a year, when TikTok stops updating them, and 24 to 48 hours late, so its first read is at 24 hours; YouTube's views, likes and comments from the first hour, its other numbers 2 to 3 days late); stories every 2 hours while live, the last time 23 hours after they went up."
    },
    "metricsAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "description": "When those numbers were read."
    },
    "details": {
      "anyOf": [
        {
          "$ref": "#/$defs/PostDetails"
        },
        {
          "type": "null"
        }
      ]
    },
    "detailsAt": {
      "anyOf": [
        {
          "$ref": "#/$defs/DetailsAt"
        },
        {
          "type": "null"
        }
      ]
    },
    "metricsUnavailable": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Why it has no numbers and will get none: an Instagram post from before the account became a professional account, a story that ended before Rizamo read it (Facebook's, whose numbers are read only while it is live), or a post deleted with no numbers kept (YouTube keeps none once a video is gone; elsewhere it went before Rizamo's first read). Null while it has numbers, or its first read is still to come."
    },
    "promoted": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "description": "Whether the network says the post is promoted in an ad: TikTok's Spark Ads (true while it is used in one), whose views then include paid ones, as every TikTok view count does. A post shown only in ads is listed too, with true. Null on networks that do not say."
    },
    "metricsFinal": {
      "anyOf": [
        {
          "enum": [
            "read",
            "webhook"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Stories: their numbers are final, and what made them so. read: Rizamo read them 23 hours after the story went up, the last read while it is live (the final numbers for accounts connected through Instagram Login). webhook: Instagram sent them an hour after the story ended (accounts connected through a Facebook Page). Null while they can still change."
    }
  },
  "required": [
    "id",
    "profileId",
    "accountId",
    "network",
    "networkId",
    "origin",
    "postId",
    "format",
    "caption",
    "url",
    "thumbnailUrl",
    "publishedAt",
    "deletedAt",
    "metrics",
    "metricsAt",
    "metricsUnavailable",
    "promoted",
    "metricsFinal"
  ],
  "$defs": {
    "AudienceBreakdowns": {
      "type": "object",
      "properties": {
        "age": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AudienceShare"
          }
        },
        "gender": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AudienceShare"
          }
        },
        "country": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AudienceShare"
          },
          "description": "The top 45, as the network gives them (LinkedIn its top 100)."
        },
        "city": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AudienceShare"
          },
          "description": "The top 45, as the network gives them; on LinkedIn, its market areas, its top 100."
        },
        "industry": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AudienceShare"
          },
          "description": "LinkedIn only: a Page's followers by industry, its top 100."
        },
        "jobFunction": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AudienceShare"
          },
          "description": "LinkedIn only: a Page's followers by job function."
        },
        "seniority": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AudienceShare"
          },
          "description": "LinkedIn only: a Page's followers by seniority."
        },
        "companySize": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AudienceShare"
          },
          "description": "LinkedIn only: a Page's followers by the size of the company they work at."
        }
      },
      "required": [
        "age",
        "gender",
        "country",
        "city"
      ]
    },
    "AudienceShare": {
      "type": "object",
      "properties": {
        "value": {
          "type": "string",
          "description": "The group: an age range (25-34), a gender (female, male, unknown), a country code (PT), a city (Lisbon, Lisbon District) or, on LinkedIn, a market area (Greater Lisbon), an industry, a job function, a seniority or a company size (2-10 employees), as LinkedIn names them."
        },
        "count": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "People in the group; views where the network counts views (YouTube's countries, a Facebook reel's viewers). 0 where the network gives only a share (`percent`)."
        },
        "percent": {
          "type": "number",
          "description": "The group's share in percent, where the network gives shares and no counts: YouTube's viewers by age and gender, of the views of signed-in viewers."
        }
      },
      "required": [
        "value",
        "count"
      ]
    },
    "DetailsAt": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": "string",
        "format": "date-time"
      },
      "description": "When each of `details` was read, by its key. A read that does not bring a detail (TikTok stops giving them after a week with no views) leaves its last value and time, so a detail read before `metricsAt` is from an earlier read than the numbers. Null when `details` is."
    },
    "Network": {
      "enum": [
        "instagram",
        "facebook",
        "threads",
        "linkedin",
        "tiktok",
        "youtube",
        "x",
        "pinterest",
        "google"
      ],
      "type": "string"
    },
    "PostDetails": {
      "type": "object",
      "properties": {
        "skip_rate": {
          "type": "number",
          "description": "The share of views skipped in the first 3 seconds, in percent. From Instagram reels."
        },
        "completion_rate": {
          "type": "number",
          "description": "The share of viewers who watched the whole video, in percent. From TikTok videos."
        },
        "avg_view_percentage": {
          "type": "number",
          "description": "How much of the video a view watched on average, in percent. From YouTube posts."
        },
        "traffic_sources": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "source": {
                "type": "string",
                "description": "Where the views came from: `for_you`, `following`, `profile`, `search`, `sound`, `hashtag`, `direct_message`, `other`, or the network's own name in lower case with underscores."
              },
              "percent": {
                "type": "number",
                "description": "Its share of the views, in percent, where the network gives shares."
              },
              "views": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Its views, where the network gives counts. Never worked out from a share, or a share from them."
              }
            },
            "required": [
              "source"
            ]
          },
          "description": "Where its views came from, as the network gives it: each source's share of the views in percent (`percent`), or its views (`views`), never one worked out from the other. From TikTok posts and YouTube posts. Largest first."
        },
        "viewer_types": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "type": {
                "enum": [
                  "new",
                  "returning",
                  "followers",
                  "non_followers"
                ],
                "type": "string",
                "description": "new and returning viewers make one split, followers and non_followers another: each adds up to the whole on its own."
              },
              "percent": {
                "type": "number",
                "description": "Its share of the views, in percent, where the network gives shares."
              },
              "views": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Its views, where the network gives counts. Never worked out from a share, or a share from them."
              }
            },
            "required": [
              "type"
            ]
          },
          "description": "New and returning viewers, followers and non-followers: each type's share of the viewers in percent (`percent`), or its views (`views`), as the network gives it. From TikTok posts."
        },
        "retention": {
          "type": "object",
          "properties": {
            "unit": {
              "enum": [
                "second",
                "fraction"
              ],
              "type": "string",
              "description": "second: `at` is seconds into the video. fraction: `at` is the share of its length, from 0 to 1."
            },
            "points": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "at": {
                    "type": "number"
                  },
                  "percent": {
                    "type": "number",
                    "description": "Viewers still watching, in percent of those who started."
                  }
                },
                "required": [
                  "at",
                  "percent"
                ]
              },
              "description": "In order of `at`, at most 100: a longer curve (TikTok's, one a second) is picked down to that many of the network's own points, evenly along it, the first and last kept."
            }
          },
          "required": [
            "unit",
            "points"
          ],
          "description": "How many viewers were still watching at each point of the video, in percent of those who started: by the second (`unit` second) or by the share of the video's length from 0 to 1 (`unit` fraction; YouTube's first point is at 0.01, its last at 1, Facebook's first at 0, where the reel starts). From Facebook reels, TikTok videos and YouTube posts."
        },
        "viewer_demographics": {
          "$ref": "#/$defs/AudienceBreakdowns",
          "description": "Who watched it, by age, gender, country and city: the groups the network gives, largest first, each as a share in percent (`percent`, its `count` 0) or as views (`count`), as the network gives it, never one worked out from the other. From Facebook reels and TikTok posts. A part the network does not give is empty (TikTok gives no ages per video, Facebook no cities)."
        }
      },
      "description": "What the network says about the post that is not a count: rates in percent, where its views came from, who watched and for how long. The latest read only, with no history (`metrics` has the counts and the timeline their days); each part is the last one a read brought, read when `detailsAt` says. Null until a read brings one, and on networks that give none."
    },
    "PostFormat": {
      "enum": [
        "feed",
        "carousel",
        "reel",
        "story",
        "video",
        "short",
        "photo",
        "document",
        "pin"
      ],
      "type": "string",
      "description": "What a target publishes: feed, carousel, reel, story, video, short, photo, document or pin."
    }
  }
}