{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/postlake-dev/json-schema/postlake-dev-social-account-schema.json",
  "title": "SocialAccount",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/postlake-dev-openapi.json#/components/schemas/SocialAccount",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "platform": {
      "$ref": "#/$defs/Platform"
    },
    "handle": {
      "type": "string"
    },
    "profileId": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "status": {
      "type": "string"
    },
    "avatarUrl": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "connectVariant": {
      "type": "string",
      "description": "Which door this account was connected through, for networks that have more than one. Instagram is the case: `instagram` means Instagram Login, `facebook` means it was connected through a Facebook Page. The two reach genuinely different feature sets, so this decides what the account can do. Absent on networks with a single way in."
    },
    "accountType": {
      "oneOf": [
        {
          "type": "string",
          "enum": [
            "BUSINESS",
            "MEDIA_CREATOR",
            "PERSONAL"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "Instagram account type when known. Stories support both login routes, subject to Meta account eligibility. Facebook Login Stories require a Business account. Null means the type is unknown; Meta enforces eligibility during publishing."
    },
    "discovers": {
      "type": "object",
      "description": "What this ACCOUNT can search, as opposed to GET /v1/platforms/{platform}, which can only speak for the network as a whole. An Instagram connected by Instagram Login cannot search creators or hashtags however the platform-level flags read, so check here before calling a discovery endpoint rather than learning it from an error.",
      "properties": {
        "posts": {
          "type": "boolean"
        },
        "profiles": {
          "type": "boolean"
        },
        "profilePosts": {
          "type": "boolean"
        },
        "places": {
          "type": "boolean"
        },
        "creators": {
          "type": "boolean",
          "description": "True only when the connection can reach its creator-discovery product. A true still leaves the network's own onboarding to be done: Meta refuses the search with `creator_marketplace_not_onboarded` until the brand has accepted the relevant terms."
        }
      },
      "required": [
        "posts",
        "profiles",
        "profilePosts",
        "places",
        "creators"
      ]
    },
    "requires": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "What this network needs before it will publish, in one sentence (media requirements, title and caption limits). Read it before composing: TikTok, Instagram, YouTube and Pinterest all refuse text-only posts. Null when the network accepts anything."
    }
  },
  "required": [
    "id",
    "platform",
    "handle",
    "profileId",
    "status",
    "discovers"
  ],
  "$defs": {
    "Platform": {
      "type": "string",
      "enum": [
        "bluesky",
        "threads",
        "x",
        "linkedin",
        "instagram",
        "tiktok",
        "facebook",
        "youtube",
        "pinterest"
      ]
    }
  }
}