{
  "openapi": "3.1.0",
  "info": {
    "title": "Twitter API — Content",
    "version": "1.0.0",
    "description": "Tweets, replies, and detailed thread data."
  },
  "servers": [
    {
      "url": "https://api.fetchlayer.dev/twitter"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key",
        "description": "Send your FetchLayer key as Authorization: Bearer ss-your-key."
      }
    }
  },
  "paths": {
    "/tweet-detail": {
      "post": {
        "operationId": "tweet-detail",
        "tags": [
          "Content"
        ],
        "summary": "Fetch a tweet by ID",
        "description": "Retrieve detailed metadata for a specific tweet by ID including full text, media, engagement stats, and thread context.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tweetId": {
                    "type": "string",
                    "description": "Tweet ID."
                  },
                  "screenName": {
                    "type": "string",
                    "description": "Optional screen name context for URL construction."
                  }
                },
                "additionalProperties": false,
                "required": [
                  "tweetId"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "tweetId": "1942939879222220800"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Unique tweet identifier."
                    },
                    "text": {
                      "type": "string",
                      "description": "Full tweet text."
                    },
                    "author": {
                      "type": "object",
                      "properties": {
                        "handle": {
                          "type": "string",
                          "description": "Author handle."
                        },
                        "displayName": {
                          "type": "string",
                          "description": "Author display name."
                        },
                        "isVerified": {
                          "type": "boolean",
                          "description": "Verified status."
                        },
                        "followersCount": {
                          "type": "number",
                          "description": "Author follower count."
                        }
                      },
                      "additionalProperties": false
                    },
                    "createdAt": {
                      "type": "string",
                      "description": "ISO 8601 timestamp."
                    },
                    "likeCount": {
                      "type": "number",
                      "description": "Like count."
                    },
                    "retweetCount": {
                      "type": "number",
                      "description": "Retweet/repost count."
                    },
                    "replyCount": {
                      "type": "number",
                      "description": "Reply count."
                    },
                    "quoteCount": {
                      "type": "number",
                      "description": "Quote tweet count."
                    },
                    "viewCount": {
                      "type": "number",
                      "description": "Impression count."
                    },
                    "url": {
                      "type": "string",
                      "description": "Canonical tweet URL."
                    },
                    "lang": {
                      "type": "string",
                      "description": "BCP 47 language code."
                    },
                    "media": {
                      "type": "array",
                      "description": "Attached media (photos, videos, cards).",
                      "items": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "id": "1942939879222220800",
                      "text": "Just tried the new GPT-4o vision features on the OpenAI playground — it correctly described a screenshot of our dashboard in one prompt. Incredible.",
                      "author": {
                        "handle": "devuser",
                        "displayName": "Dev User",
                        "isVerified": false,
                        "followersCount": 3200
                      },
                      "createdAt": "2026-07-01T18:42:00.000Z",
                      "likeCount": 142,
                      "retweetCount": 31,
                      "replyCount": 23,
                      "quoteCount": 4,
                      "viewCount": 8200,
                      "url": "https://x.com/devuser/status/1942939879222220800",
                      "lang": "en",
                      "media": []
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/tweet-replies": {
      "post": {
        "operationId": "tweet-replies",
        "tags": [
          "Content"
        ],
        "summary": "Fetch replies for a tweet",
        "description": "Retrieve reply tweets and continuation cursors for a specific tweet. Each reply includes the same fields as a tweet result.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tweetId": {
                    "type": "string",
                    "description": "Tweet ID."
                  },
                  "screenName": {
                    "type": "string",
                    "description": "Optional screen name context."
                  },
                  "cursor": {
                    "type": "string",
                    "description": "Pagination cursor."
                  }
                },
                "additionalProperties": false,
                "required": [
                  "tweetId"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "tweetId": "1942939879222220800"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "replies": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Reply tweet ID."
                          },
                          "text": {
                            "type": "string",
                            "description": "Reply text."
                          },
                          "author": {
                            "type": "object",
                            "properties": {
                              "handle": {
                                "type": "string",
                                "description": "Author handle."
                              },
                              "displayName": {
                                "type": "string",
                                "description": "Author display name."
                              }
                            },
                            "additionalProperties": false
                          },
                          "createdAt": {
                            "type": "string",
                            "description": "ISO 8601 timestamp."
                          },
                          "likeCount": {
                            "type": "number",
                            "description": "Like count."
                          },
                          "retweetCount": {
                            "type": "number",
                            "description": "Retweet count."
                          },
                          "replyCount": {
                            "type": "number",
                            "description": "Nested reply count."
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "cursor": {
                      "type": "string",
                      "description": "Pagination cursor for next page."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "replies": [
                        {
                          "id": "1942941234567890000",
                          "text": "Absolutely. I used it to analyze a full Next.js project structure and it caught a race condition I missed.",
                          "author": {
                            "handle": "reactdev",
                            "displayName": "React Dev",
                            "isVerified": false
                          },
                          "createdAt": "2026-07-01T19:05:00.000Z",
                          "likeCount": 28,
                          "retweetCount": 2,
                          "replyCount": 5
                        },
                        {
                          "id": "1942942345678900000",
                          "text": "How does it compare to Claude Computer Use for those kinds of tasks?",
                          "author": {
                            "handle": "ai_researcher",
                            "displayName": "AI Researcher",
                            "isVerified": false
                          },
                          "createdAt": "2026-07-01T19:12:00.000Z",
                          "likeCount": 12,
                          "retweetCount": 0,
                          "replyCount": 8
                        }
                      ],
                      "cursor": "DAABCgABF8zK9v__-W9"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/user-tweets": {
      "post": {
        "operationId": "user-tweets",
        "tags": [
          "Content"
        ],
        "summary": "Fetch tweets for a user",
        "description": "Retrieve timeline tweets for a user handle with full engagement data and pagination support.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "handle": {
                    "type": "string",
                    "description": "Twitter handle without @."
                  },
                  "count": {
                    "type": "number",
                    "description": "Number of tweets (max 100).",
                    "example": "25"
                  },
                  "cursor": {
                    "type": "string",
                    "description": "Pagination cursor for next page."
                  }
                },
                "additionalProperties": false,
                "required": [
                  "handle"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "handle": "openai",
                    "count": 3
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tweets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Tweet ID."
                          },
                          "text": {
                            "type": "string",
                            "description": "Full tweet text."
                          },
                          "createdAt": {
                            "type": "string",
                            "description": "ISO 8601 timestamp."
                          },
                          "likeCount": {
                            "type": "number",
                            "description": "Like count."
                          },
                          "replyCount": {
                            "type": "number",
                            "description": "Reply count."
                          },
                          "retweetCount": {
                            "type": "number",
                            "description": "Retweet count."
                          },
                          "viewCount": {
                            "type": "number",
                            "description": "Impression count."
                          },
                          "url": {
                            "type": "string",
                            "description": "Canonical tweet URL."
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "cursor": {
                      "type": "string",
                      "description": "Pagination cursor."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "tweets": [
                        {
                          "id": "1942900000000000000",
                          "text": "Introducing GPT-4.1 — our most capable model yet, with improved reasoning, coding, and instruction following. Rolling out to API users starting today.",
                          "createdAt": "2026-07-01T14:00:00.000Z",
                          "likeCount": 12500,
                          "replyCount": 2100,
                          "retweetCount": 3400,
                          "viewCount": 1200000,
                          "url": "https://x.com/OpenAI/status/1942900000000000000"
                        },
                        {
                          "id": "1942800000000000000",
                          "text": "Sora is now available to all ChatGPT Plus and Pro subscribers. Create realistic and imaginative videos from text instructions.",
                          "createdAt": "2026-06-30T16:00:00.000Z",
                          "likeCount": 9800,
                          "replyCount": 1600,
                          "retweetCount": 2800,
                          "viewCount": 950000,
                          "url": "https://x.com/OpenAI/status/1942800000000000000"
                        }
                      ],
                      "cursor": "DAABCgABF8zK9v__-X0"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/user-replies": {
      "post": {
        "operationId": "user-replies",
        "tags": [
          "Content"
        ],
        "summary": "Fetch replies by a user",
        "description": "Retrieve recent replies authored by a user handle across different tweet threads.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "handle": {
                    "type": "string",
                    "description": "Twitter handle without @."
                  },
                  "count": {
                    "type": "number",
                    "description": "Number of replies (max 100).",
                    "example": "25"
                  },
                  "cursor": {
                    "type": "string",
                    "description": "Pagination cursor."
                  }
                },
                "additionalProperties": false,
                "required": [
                  "handle"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "handle": "sama",
                    "count": 3
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "replies": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Reply tweet ID."
                          },
                          "text": {
                            "type": "string",
                            "description": "Reply text."
                          },
                          "inReplyToId": {
                            "type": "string",
                            "description": "Tweet ID being replied to."
                          },
                          "author": {
                            "type": "object",
                            "properties": {
                              "handle": {
                                "type": "string",
                                "description": "Author handle."
                              }
                            },
                            "additionalProperties": false
                          },
                          "createdAt": {
                            "type": "string",
                            "description": "ISO 8601 timestamp."
                          },
                          "likeCount": {
                            "type": "number",
                            "description": "Like count."
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "cursor": {
                      "type": "string",
                      "description": "Pagination cursor."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "replies": [
                        {
                          "id": "1942950000000000000",
                          "text": "We think this is the most important capability for agents. More to share soon.",
                          "inReplyToId": "1942900000000000000",
                          "author": {
                            "handle": "sama",
                            "displayName": "Sam Altman"
                          },
                          "createdAt": "2026-07-01T15:30:00.000Z",
                          "likeCount": 4200
                        }
                      ],
                      "cursor": "DAABCgABF8zK9v__-Y1"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    }
  }
}