{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/xproapi/json-schema/xproapi-tweet-schema.json",
  "title": "Tweet",
  "description": "A public tweet.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/xproapi-openapi.json#/components/schemas/Tweet",
  "type": "object",
  "required": [
    "type",
    "id",
    "url",
    "text",
    "createdAt",
    "author"
  ],
  "properties": {
    "type": {
      "type": "string",
      "const": "tweet"
    },
    "id": {
      "type": "string",
      "pattern": "^[0-9]+$",
      "description": "Tweet id, as a string (64-bit)."
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "text": {
      "type": "string"
    },
    "source": {
      "type": "string"
    },
    "retweetCount": {
      "type": "integer",
      "minimum": 0
    },
    "replyCount": {
      "type": "integer",
      "minimum": 0
    },
    "likeCount": {
      "type": "integer",
      "minimum": 0
    },
    "quoteCount": {
      "type": "integer",
      "minimum": 0
    },
    "viewCount": {
      "type": "integer",
      "minimum": 0
    },
    "bookmarkCount": {
      "type": "integer",
      "minimum": 0
    },
    "createdAt": {
      "type": "string",
      "description": "X’s date format, e.g. \"Thu Oct 17 18:30:00 +0000 2024\" (UTC)."
    },
    "lang": {
      "type": "string"
    },
    "isReply": {
      "type": "boolean"
    },
    "inReplyToId": {
      "type": [
        "string",
        "null"
      ]
    },
    "conversationId": {
      "type": [
        "string",
        "null"
      ]
    },
    "displayTextRange": {
      "type": "array",
      "items": {
        "type": "integer"
      },
      "minItems": 2,
      "maxItems": 2
    },
    "inReplyToUserId": {
      "type": [
        "string",
        "null"
      ]
    },
    "inReplyToUsername": {
      "type": [
        "string",
        "null"
      ]
    },
    "author": {
      "$ref": "#/$defs/User"
    },
    "entities": {
      "type": "object",
      "description": "Hashtags, urls and user_mentions as X returns them."
    },
    "extendedEntities": {
      "type": "object",
      "description": "Media as X returns it; empty when none."
    },
    "quoted_tweet": {
      "oneOf": [
        {
          "$ref": "#/$defs/Tweet"
        },
        {
          "type": "null"
        }
      ]
    },
    "retweeted_tweet": {
      "oneOf": [
        {
          "$ref": "#/$defs/Tweet"
        },
        {
          "type": "null"
        }
      ]
    },
    "isLimitedReply": {
      "type": "boolean"
    }
  },
  "$defs": {
    "Tweet": {
      "type": "object",
      "description": "A public tweet.",
      "required": [
        "type",
        "id",
        "url",
        "text",
        "createdAt",
        "author"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "tweet"
        },
        "id": {
          "type": "string",
          "pattern": "^[0-9]+$",
          "description": "Tweet id, as a string (64-bit)."
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "text": {
          "type": "string"
        },
        "source": {
          "type": "string"
        },
        "retweetCount": {
          "type": "integer",
          "minimum": 0
        },
        "replyCount": {
          "type": "integer",
          "minimum": 0
        },
        "likeCount": {
          "type": "integer",
          "minimum": 0
        },
        "quoteCount": {
          "type": "integer",
          "minimum": 0
        },
        "viewCount": {
          "type": "integer",
          "minimum": 0
        },
        "bookmarkCount": {
          "type": "integer",
          "minimum": 0
        },
        "createdAt": {
          "type": "string",
          "description": "X’s date format, e.g. \"Thu Oct 17 18:30:00 +0000 2024\" (UTC)."
        },
        "lang": {
          "type": "string"
        },
        "isReply": {
          "type": "boolean"
        },
        "inReplyToId": {
          "type": [
            "string",
            "null"
          ]
        },
        "conversationId": {
          "type": [
            "string",
            "null"
          ]
        },
        "displayTextRange": {
          "type": "array",
          "items": {
            "type": "integer"
          },
          "minItems": 2,
          "maxItems": 2
        },
        "inReplyToUserId": {
          "type": [
            "string",
            "null"
          ]
        },
        "inReplyToUsername": {
          "type": [
            "string",
            "null"
          ]
        },
        "author": {
          "$ref": "#/$defs/User"
        },
        "entities": {
          "type": "object",
          "description": "Hashtags, urls and user_mentions as X returns them."
        },
        "extendedEntities": {
          "type": "object",
          "description": "Media as X returns it; empty when none."
        },
        "quoted_tweet": {
          "oneOf": [
            {
              "$ref": "#/$defs/Tweet"
            },
            {
              "type": "null"
            }
          ]
        },
        "retweeted_tweet": {
          "oneOf": [
            {
              "$ref": "#/$defs/Tweet"
            },
            {
              "type": "null"
            }
          ]
        },
        "isLimitedReply": {
          "type": "boolean"
        }
      }
    },
    "User": {
      "type": "object",
      "description": "A public X account.",
      "required": [
        "type",
        "id",
        "userName",
        "name",
        "url",
        "description",
        "profilePicture",
        "followers",
        "following",
        "isBlueVerified",
        "protected",
        "unavailable"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "user"
        },
        "id": {
          "type": "string",
          "pattern": "^[0-9]+$",
          "description": "Numeric user id, as a string. It never changes; store this rather than the username."
        },
        "userName": {
          "type": "string",
          "description": "Username without the @. Can change."
        },
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "description": {
          "type": "string",
          "description": "Bio; empty when none."
        },
        "profilePicture": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "followers": {
          "type": "integer",
          "minimum": 0
        },
        "following": {
          "type": "integer",
          "minimum": 0
        },
        "isBlueVerified": {
          "type": "boolean"
        },
        "protected": {
          "type": "boolean",
          "description": "Protected accounts’ tweets, followers and following can’t be read."
        },
        "unavailable": {
          "type": "boolean"
        }
      }
    }
  }
}