{"openapi":"3.0.3","info":{"title":"Twitter (X) API","version":"1.0.0","description":"Public X (formerly Twitter) profiles, posts, replies, followers and search with stable schemas.","contact":{"email":"support@endpointry.com"},"termsOfService":"https://endpointry.com/legal/terms"},"servers":[{"url":"https://api.endpointry.com/v1/twitter"}],"tags":[{"name":"Twitter (X) API","description":"Public X (formerly Twitter) profiles, posts, replies, followers and search with stable schemas."}],"components":{"schemas":{"ResponseMeta":{"type":"object","properties":{"request_id":{"type":"string","example":"req_9f2c4a1b8d3e0f6a7c5b9d1e"},"as_of":{"type":"string","format":"date-time","description":"When this snapshot of the data was taken (UTC)."},"cache":{"type":"string","enum":["HIT","MISS"]},"pagination":{"$ref":"#/components/schemas/PaginationMeta"},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/ResponseWarning"}}},"required":["request_id"]},"PaginationMeta":{"type":"object","properties":{"page":{"type":"integer"},"next_cursor":{"type":"string","nullable":true},"next_offset":{"type":"integer","nullable":true},"next_page":{"type":"integer","nullable":true},"limit":{"type":"integer"},"returned":{"type":"integer"},"total":{"type":"integer"}}},"ResponseWarning":{"type":"object","properties":{"code":{"type":"string"},"detail":{"type":"string"}},"required":["code","detail"]},"TwitterUser":{"type":"object","properties":{"id":{"type":"string","example":"11348282"},"username":{"type":"string","example":"NASA"},"name":{"type":"string","example":"NASA"},"url":{"type":"string","format":"uri","example":"https://x.com/NASA"},"description":{"type":"string","nullable":true,"description":"The bio, with shortened links expanded."},"location":{"type":"string","nullable":true,"example":"Pale Blue Dot"},"website":{"type":"string","nullable":true,"format":"uri","example":"http://www.nasa.gov/","description":"The profile link, expanded."},"created_at":{"type":"string","format":"date-time","example":"2007-12-19T20:20:32.000Z"},"followers":{"type":"integer","example":92131169},"following":{"type":"integer","example":115},"tweets":{"type":"integer","example":74577,"description":"Posts published, retweets and replies included."},"likes":{"type":"integer","example":17122,"description":"Posts this account liked."},"media":{"type":"integer","example":28263,"description":"Posts with photos or videos."},"listed":{"type":"integer","example":96871,"description":"Public lists that include this account."},"verified":{"type":"boolean","description":"Whether the account shows a verification badge."},"verified_type":{"type":"string","nullable":true,"enum":["blue","business","government",null],"example":"government","description":"Which badge: `blue` (subscription), `business` or `government`."},"protected":{"type":"boolean","description":"Protected accounts show their profile, but not their posts or connections."},"profile_image_url":{"type":"string","nullable":true,"format":"uri","example":"https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_400x400.jpg"},"profile_banner_url":{"type":"string","nullable":true,"format":"uri","example":"https://pbs.twimg.com/profile_banners/11348282/1788992290"},"pinned_tweet_id":{"type":"string","nullable":true,"description":"The post pinned to the top of the profile, if any."}},"required":["id","username","name","url","description","location","website","created_at","followers","following","tweets","likes","media","listed","verified","verified_type","protected","profile_image_url","profile_banner_url","pinned_tweet_id"]},"Problem":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"code":{"type":"string"},"detail":{"type":"string"},"request_id":{"type":"string"}},"required":["type","title","status","code","request_id"]},"TwitterTweet":{"type":"object","properties":{"id":{"type":"string","example":"2124940993489162256"},"url":{"type":"string","format":"uri","example":"https://x.com/NASA/status/2124940993489162256"},"created_at":{"type":"string","format":"date-time","example":"2026-11-23T18:59:46.000Z"},"author":{"$ref":"#/components/schemas/TwitterTweetAuthor"},"text":{"type":"string","description":"The full text, long posts included, with shortened links expanded and the links to attached media removed."},"lang":{"type":"string","nullable":true,"example":"en","description":"The language X detected."},"likes":{"type":"integer"},"retweets":{"type":"integer"},"replies":{"type":"integer"},"quotes":{"type":"integer"},"bookmarks":{"type":"integer"},"views":{"type":"integer","nullable":true,"description":"Null where X shows no view count."},"conversation_id":{"type":"string","description":"The id of the post that started the thread."},"in_reply_to":{"$ref":"#/components/schemas/TwitterInReplyTo"},"hashtags":{"type":"array","items":{"type":"string"},"example":["Artemis"]},"mentions":{"type":"array","items":{"$ref":"#/components/schemas/TwitterMention"}},"urls":{"type":"array","items":{"type":"string","format":"uri"},"description":"Links in the text, expanded."},"media":{"type":"array","items":{"$ref":"#/components/schemas/TwitterMedia"}},"sensitive":{"type":"boolean","description":"Whether X marks the media as possibly sensitive."},"quoted_tweet":{"$ref":"#/components/schemas/TwitterEmbeddedTweet"},"retweeted_tweet":{"$ref":"#/components/schemas/TwitterRetweetedTweet"}},"required":["id","url","created_at","author","text","lang","likes","retweets","replies","quotes","bookmarks","views","conversation_id","in_reply_to","hashtags","mentions","urls","media","sensitive","quoted_tweet","retweeted_tweet"]},"TwitterTweetAuthor":{"type":"object","properties":{"id":{"type":"string","example":"11348282"},"username":{"type":"string","example":"NASA"},"name":{"type":"string","example":"NASA"},"verified":{"type":"boolean"},"profile_image_url":{"type":"string","nullable":true,"format":"uri"}},"required":["id","username","name","verified","profile_image_url"]},"TwitterInReplyTo":{"type":"object","nullable":true,"properties":{"tweet_id":{"type":"string"},"user_id":{"type":"string","nullable":true},"username":{"type":"string","nullable":true}},"required":["tweet_id","user_id","username"]},"TwitterMention":{"type":"object","properties":{"id":{"type":"string","example":"1451773004"},"username":{"type":"string","example":"Space_Station"}},"required":["id","username"]},"TwitterMedia":{"type":"object","properties":{"type":{"type":"string","enum":["photo","video","gif"],"example":"video"},"url":{"type":"string","format":"uri","example":"https://pbs.twimg.com/media/HX1OkiYWQAAGf8b.jpg","description":"The image, or the poster frame of a video or GIF."},"width":{"type":"integer","nullable":true,"example":720},"height":{"type":"integer","nullable":true,"example":405},"alt_text":{"type":"string","nullable":true,"description":"The description its author wrote, if any."},"duration_ms":{"type":"integer","nullable":true,"example":165965,"description":"Videos only."},"video_url":{"type":"string","nullable":true,"format":"uri","example":"https://video.twimg.com/amplify_video/2124940778208215040/vid/avc1/1920x1080/ZPhFDSjcq_onYTBH.mp4?tag=16","description":"The highest-bitrate MP4 of a video or GIF."}},"required":["type","url","width","height","alt_text","duration_ms","video_url"]},"TwitterEmbeddedTweet":{"type":"object","nullable":true,"properties":{"id":{"type":"string","example":"2124940993489162256"},"url":{"type":"string","format":"uri","example":"https://x.com/NASA/status/2124940993489162256"},"created_at":{"type":"string","format":"date-time","example":"2026-11-23T18:59:46.000Z"},"author":{"$ref":"#/components/schemas/TwitterTweetAuthor"},"text":{"type":"string","description":"The full text, long posts included, with shortened links expanded and the links to attached media removed."},"lang":{"type":"string","nullable":true,"example":"en","description":"The language X detected."},"likes":{"type":"integer"},"retweets":{"type":"integer"},"replies":{"type":"integer"},"quotes":{"type":"integer"},"bookmarks":{"type":"integer"},"views":{"type":"integer","nullable":true,"description":"Null where X shows no view count."},"conversation_id":{"type":"string","description":"The id of the post that started the thread."},"in_reply_to":{"$ref":"#/components/schemas/TwitterInReplyTo"},"hashtags":{"type":"array","items":{"type":"string"},"example":["Artemis"]},"mentions":{"type":"array","items":{"$ref":"#/components/schemas/TwitterMention"}},"urls":{"type":"array","items":{"type":"string","format":"uri"},"description":"Links in the text, expanded."},"media":{"type":"array","items":{"$ref":"#/components/schemas/TwitterMedia"}},"sensitive":{"type":"boolean","description":"Whether X marks the media as possibly sensitive."}},"required":["id","url","created_at","author","text","lang","likes","retweets","replies","quotes","bookmarks","views","conversation_id","in_reply_to","hashtags","mentions","urls","media","sensitive"],"description":"The post this one quotes; null when it quotes nothing or the quoted post is gone."},"TwitterRetweetedTweet":{"type":"object","nullable":true,"properties":{"id":{"type":"string","example":"2124940993489162256"},"url":{"type":"string","format":"uri","example":"https://x.com/NASA/status/2124940993489162256"},"created_at":{"type":"string","format":"date-time","example":"2026-11-23T18:59:46.000Z"},"author":{"$ref":"#/components/schemas/TwitterTweetAuthor"},"text":{"type":"string","description":"The full text, long posts included, with shortened links expanded and the links to attached media removed."},"lang":{"type":"string","nullable":true,"example":"en","description":"The language X detected."},"likes":{"type":"integer"},"retweets":{"type":"integer"},"replies":{"type":"integer"},"quotes":{"type":"integer"},"bookmarks":{"type":"integer"},"views":{"type":"integer","nullable":true,"description":"Null where X shows no view count."},"conversation_id":{"type":"string","description":"The id of the post that started the thread."},"in_reply_to":{"$ref":"#/components/schemas/TwitterInReplyTo"},"hashtags":{"type":"array","items":{"type":"string"},"example":["Artemis"]},"mentions":{"type":"array","items":{"$ref":"#/components/schemas/TwitterMention"}},"urls":{"type":"array","items":{"type":"string","format":"uri"},"description":"Links in the text, expanded."},"media":{"type":"array","items":{"$ref":"#/components/schemas/TwitterMedia"}},"sensitive":{"type":"boolean","description":"Whether X marks the media as possibly sensitive."},"quoted_tweet":{"$ref":"#/components/schemas/TwitterEmbeddedTweet"}},"required":["id","url","created_at","author","text","lang","likes","retweets","replies","quotes","bookmarks","views","conversation_id","in_reply_to","hashtags","mentions","urls","media","sensitive","quoted_tweet"],"description":"For a repost, the original post in full; its counts are the original’s."}},"parameters":{}},"paths":{"/user":{"get":{"operationId":"twitter.user","summary":"Get a profile","description":"Returns a public account by `username` or `user_id`: name, bio, location and website, join date, follower, following and post counts, verification badge, protection, avatar, banner and pinned post. Returns `404 NOT_FOUND` when no account answers to that name or id, or the account is suspended or deactivated. Protected accounts return their profile. Records are cached briefly and shared with the account’s lists.","x-points":10,"tags":["Twitter (X) API"],"parameters":[{"schema":{"type":"string","pattern":"^@?[A-Za-z0-9_]{1,20}$","example":"NASA","description":"The account handle, with or without the leading @. Give this or `user_id`."},"required":false,"description":"The account handle, with or without the leading @. Give this or `user_id`.","name":"username","in":"query"},{"schema":{"type":"string","pattern":"^[0-9]{1,20}$","description":"The numeric user id, which survives a change of username. Give this or `username`."},"required":false,"description":"The numeric user id, which survives a change of username. Give this or `username`.","name":"user_id","in":"query"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/ResponseMeta"},"data":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TwitterUser"}},"required":["user"]}},"required":["meta","data"]}}}},"default":{"description":"Error response (RFC 9457 problem+json)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/user/tweets":{"get":{"operationId":"twitter.user-tweets","summary":"Get an account’s posts","description":"Returns an account’s posts, newest first, about 20 per page: its own posts and reposts, and with `replies=true` its replies to others too. Each post carries its full text, counts, media, links, and the post it quotes or reposts. The pinned post is not repeated here; `/user` names it. A protected account returns an empty page. Returns `404 NOT_FOUND` when no account answers to that name or id, or the account is suspended or deactivated. Page with `meta.pagination.next_cursor`, which is `null` on the last page.","x-points":10,"tags":["Twitter (X) API"],"parameters":[{"schema":{"type":"string","pattern":"^@?[A-Za-z0-9_]{1,20}$","example":"NASA","description":"The account handle, with or without the leading @. Give this or `user_id`."},"required":false,"description":"The account handle, with or without the leading @. Give this or `user_id`.","name":"username","in":"query"},{"schema":{"type":"string","pattern":"^[0-9]{1,20}$","description":"The numeric user id, which survives a change of username. Give this or `username`."},"required":false,"description":"The numeric user id, which survives a change of username. Give this or `username`.","name":"user_id","in":"query"},{"schema":{"type":"string","enum":["true","false"],"default":"false","example":"false","description":"`true` adds the account’s replies to others."},"required":false,"description":"`true` adds the account’s replies to others.","name":"replies","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from `meta.pagination.next_cursor` of a previous response."},"required":false,"description":"Opaque cursor from `meta.pagination.next_cursor` of a previous response.","name":"cursor","in":"query"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/ResponseMeta"},"data":{"type":"object","properties":{"tweets":{"type":"array","items":{"$ref":"#/components/schemas/TwitterTweet"}}},"required":["tweets"]}},"required":["meta","data"]}}}},"default":{"description":"Error response (RFC 9457 problem+json)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/tweet":{"get":{"operationId":"twitter.tweet","summary":"Get a post","description":"Returns one post by id with its full text (long posts included), author, counts and views, media with video files, links, hashtags and mentions, the post it replies to, and the post it quotes or reposts. Returns `404 NOT_FOUND` for a deleted, withheld or unknown post. Records are cached for a minute.","x-points":10,"tags":["Twitter (X) API"],"parameters":[{"schema":{"type":"string","pattern":"^[0-9]{1,20}$","example":"2124940993489162256","description":"The numeric post id, as a string."},"required":true,"description":"The numeric post id, as a string.","name":"id","in":"query"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/ResponseMeta"},"data":{"type":"object","properties":{"tweet":{"$ref":"#/components/schemas/TwitterTweet"}},"required":["tweet"]}},"required":["meta","data"]}}}},"default":{"description":"Error response (RFC 9457 problem+json)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/tweet/replies":{"get":{"operationId":"twitter.tweet-replies","summary":"Get a post’s replies","description":"Returns the replies to a post in the order X ranks them (`sort`: `relevance`, `recent` or `likes`), each in the post shape. A reply to a reply carries `in_reply_to`, so threads can be rebuilt. Returns `404 NOT_FOUND` for a deleted or unknown post. Page with `meta.pagination.next_cursor`, which is `null` on the last page.","x-points":10,"tags":["Twitter (X) API"],"parameters":[{"schema":{"type":"string","pattern":"^[0-9]{1,20}$","example":"2124940993489162256","description":"The numeric post id, as a string."},"required":true,"description":"The numeric post id, as a string.","name":"id","in":"query"},{"schema":{"type":"string","enum":["relevance","recent","likes"],"default":"relevance","example":"relevance","description":"The order X ranks replies in: `relevance`, `recent` or `likes`."},"required":false,"description":"The order X ranks replies in: `relevance`, `recent` or `likes`.","name":"sort","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from `meta.pagination.next_cursor` of a previous response."},"required":false,"description":"Opaque cursor from `meta.pagination.next_cursor` of a previous response.","name":"cursor","in":"query"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/ResponseMeta"},"data":{"type":"object","properties":{"replies":{"type":"array","items":{"$ref":"#/components/schemas/TwitterTweet"}}},"required":["replies"]}},"required":["meta","data"]}}}},"default":{"description":"Error response (RFC 9457 problem+json)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/search":{"get":{"operationId":"twitter.search","summary":"Search posts","description":"Searches public posts, `latest` first or X’s `top` ranking, about 20 per page. The query takes X’s search operators (`from:NASA`, `lang:en`, `since:2026-01-01`, `\"exact phrase\"`, `-exclude`). Ads are left out. No match is an empty page, not an error. Page with `meta.pagination.next_cursor`, which is `null` on the last page.","x-points":15,"tags":["Twitter (X) API"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":500,"example":"cloudflare","description":"What to search for, with X’s operators (`from:`, `lang:`, `since:`, `\"exact phrase\"` …)."},"required":true,"description":"What to search for, with X’s operators (`from:`, `lang:`, `since:`, `\"exact phrase\"` …).","name":"query","in":"query"},{"schema":{"type":"string","enum":["latest","top"],"default":"latest","example":"latest","description":"`latest` for newest first, `top` for X’s ranking."},"required":false,"description":"`latest` for newest first, `top` for X’s ranking.","name":"type","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from `meta.pagination.next_cursor` of a previous response."},"required":false,"description":"Opaque cursor from `meta.pagination.next_cursor` of a previous response.","name":"cursor","in":"query"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/ResponseMeta"},"data":{"type":"object","properties":{"tweets":{"type":"array","items":{"$ref":"#/components/schemas/TwitterTweet"}}},"required":["tweets"]}},"required":["meta","data"]}}}},"default":{"description":"Error response (RFC 9457 problem+json)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/user/followers":{"get":{"operationId":"twitter.user-followers","summary":"Get an account’s followers","description":"Returns the accounts that follow an account, most recent first as X lists them, each in the profile shape; X decides the page size (often 50–70). A protected account returns an empty page. Returns `404 NOT_FOUND` when no account answers to that name or id, or the account is suspended or deactivated. Page with `meta.pagination.next_cursor`, which is `null` on the last page.","x-points":10,"tags":["Twitter (X) API"],"parameters":[{"schema":{"type":"string","pattern":"^@?[A-Za-z0-9_]{1,20}$","example":"NASA","description":"The account handle, with or without the leading @. Give this or `user_id`."},"required":false,"description":"The account handle, with or without the leading @. Give this or `user_id`.","name":"username","in":"query"},{"schema":{"type":"string","pattern":"^[0-9]{1,20}$","description":"The numeric user id, which survives a change of username. Give this or `username`."},"required":false,"description":"The numeric user id, which survives a change of username. Give this or `username`.","name":"user_id","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from `meta.pagination.next_cursor` of a previous response."},"required":false,"description":"Opaque cursor from `meta.pagination.next_cursor` of a previous response.","name":"cursor","in":"query"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/ResponseMeta"},"data":{"type":"object","properties":{"users":{"type":"array","items":{"$ref":"#/components/schemas/TwitterUser"}}},"required":["users"]}},"required":["meta","data"]}}}},"default":{"description":"Error response (RFC 9457 problem+json)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/user/following":{"get":{"operationId":"twitter.user-following","summary":"Get the accounts an account follows","description":"Returns the accounts an account follows, most recent first as X lists them, each in the profile shape; X decides the page size (often 50–70). A protected account returns an empty page. Returns `404 NOT_FOUND` when no account answers to that name or id, or the account is suspended or deactivated. Page with `meta.pagination.next_cursor`, which is `null` on the last page.","x-points":10,"tags":["Twitter (X) API"],"parameters":[{"schema":{"type":"string","pattern":"^@?[A-Za-z0-9_]{1,20}$","example":"NASA","description":"The account handle, with or without the leading @. Give this or `user_id`."},"required":false,"description":"The account handle, with or without the leading @. Give this or `user_id`.","name":"username","in":"query"},{"schema":{"type":"string","pattern":"^[0-9]{1,20}$","description":"The numeric user id, which survives a change of username. Give this or `username`."},"required":false,"description":"The numeric user id, which survives a change of username. Give this or `username`.","name":"user_id","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from `meta.pagination.next_cursor` of a previous response."},"required":false,"description":"Opaque cursor from `meta.pagination.next_cursor` of a previous response.","name":"cursor","in":"query"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/ResponseMeta"},"data":{"type":"object","properties":{"users":{"type":"array","items":{"$ref":"#/components/schemas/TwitterUser"}}},"required":["users"]}},"required":["meta","data"]}}}},"default":{"description":"Error response (RFC 9457 problem+json)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}}}}