X Profile API Documentation
The X Profile API returns an X (formerly Twitter) account's public profile: its bio, website, location, follower, following and post counts, verification and professional labels, affiliation and join date.
It also returns the newest posts the account's profile page shows, up to 5, with the pinned post first. Each post comes with its likes, reposts, comments, quotes and saves, its views where X shows them, its photos, videos and GIFs, its links, mentions and hashtags, and the post it quotes. These are the account's recent posts, not its full timeline, and there is no pagination.
When the account doesn't exist, is suspended, is age-restricted or is withheld, the response holds an error message instead of a profile.
API Parameters
Search Query
-
- Name
-
username - Required
- Required
- Description
-
Parameter defines the X username of the account, with or without the leading
@. It holds 1 to 15 letters, digits or underscores, for exampleNASAor@NASA. Names of X's own pages, such ashomeorexplore, are refused.
Engine
-
- Name
-
engine - Required
- Required
- Description
-
Parameter defines an engine that will be used to retrieve real-time data. It must be set to
x_profile.
API key
-
- Name
-
api_key - Required
- Required
- Description
-
The
api_keyauthenticates your requests. Use it as a query parameter (https://www.searchapi.io/api/v1/search?api_key=YOUR_API_KEY) or in the Authorization header (Bearer YOUR_API_KEY).
Zero Data Retention
-
- Name
-
zero_retention - Enterprise Only
- Enterprise Only
- Required
- Optional
- Description
-
Set this parameter to
trueto disable all logging and persistent storage. No request parameters, HTML, or JSON responses are stored or logged. Suitable for high-compliance use cases. Debugging and support may be limited while enabled.
API Examples
Full Response
https://www.searchapi.io/api/v1/search?engine=x_profile&username=Google
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "x_profile",
"username": "Google"
}
response = requests.get(url, params=params)
print(response.text)
{
"search_metadata": {
"id": "search_bvIe5e1LRArweJMvqvqVlz5k",
"status": "Success",
"created_at": "2026-11-21T13:58:40Z",
"request_time_taken": 4.04,
"parsing_time_taken": 0.01,
"total_time_taken": 4.05,
"request_url": "https://x.com/Google",
"html_url": "https://www.searchapi.io/api/v1/searches/search_bvIe5e1LRArweJMvqvqVlz5k.html",
"json_url": "https://www.searchapi.io/api/v1/searches/search_bvIe5e1LRArweJMvqvqVlz5k"
},
"search_parameters": {
"engine": "x_profile",
"username": "Google"
},
"profile": {
"id": "20536157",
"username": "Google",
"name": "Google",
"link": "https://x.com/Google",
"bio": "Here to help.",
"external_link": "https://blog.google/newsletter-subscribe/",
"location": "Mountain View, CA",
"followers": 31872059,
"following": 301,
"posts": 252212,
"media_posts": 38416,
"is_verified": true,
"verified_type": "Business",
"is_business": true,
"professional_type": "Business",
"category": "Science & Technology",
"affiliates": 40,
"created_at": "2009-02-10T19:14:39Z",
"avatar": "https://pbs.twimg.com/profile_images/2042749771337564160/AgOFPEL3_normal.jpg",
"avatar_hd": "https://pbs.twimg.com/profile_images/2042749771337564160/AgOFPEL3_400x400.jpg",
"banner": "https://pbs.twimg.com/profile_banners/20536157/1780004508"
},
"posts": [
{
"position": 1,
"id": "2123172282574987698",
"link": "https://x.com/Google/status/2123172282574987698",
"text": "Meet Gemini 4 Neon, bringing frontier-level intelligence with fast end-to-end task completion.\n\nBuilt for complex coding, knowledge work, and science workflows, it ranks #3 overall on the @ArtificialAnlys Intelligence Index at xhigh (ahead of comparable models) and #2 on the Vals Index, landing on the Pareto frontier.",
"iso_date": "2026-11-18T21:51:33Z",
"language": "en",
"likes": 5005,
"reposts": 423,
"comments": 241,
"quotes": 243,
"saves": 445,
"views": 726067,
"media": [
{
"type": "image",
"link": "https://pbs.twimg.com/media/HXcD2U1W0AAPiPD.jpg",
"width": 2088,
"height": 2088,
"alt_text": "An orange neon sign glowing on a dark wall spells out \"Gemini 4 Neon\" preceded by a four-pointed star logo. "
}
],
"mentions": [
"ArtificialAnlys"
],
"is_pinned": true
},
"..."
]
}
Profile of a Government Account
https://www.searchapi.io/api/v1/search?engine=x_profile&username=NASA
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "x_profile",
"username": "NASA"
}
response = requests.get(url, params=params)
print(response.text)
{
"profile": {
"id": "11348282",
"username": "NASA",
"name": "NASA",
"link": "https://x.com/NASA",
"bio": "Making the seemingly impossible, possible. ✨",
"external_link": "http://www.nasa.gov/",
"location": "Pale Blue Dot",
"followers": 92191229,
"following": 115,
"posts": 74570,
"media_posts": 28260,
"is_verified": true,
"verified_type": "Government",
"affiliates": 85,
"birth_date": "1958-10-01",
"created_at": "2007-12-19T20:20:32Z",
"avatar": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_normal.jpg",
"avatar_hd": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_400x400.jpg",
"banner": "https://pbs.twimg.com/profile_banners/11348282/1788992290"
}
}
Pinned and Quoted Posts
https://www.searchapi.io/api/v1/search?engine=x_profile&username=elonmusk
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "x_profile",
"username": "elonmusk"
}
response = requests.get(url, params=params)
print(response.text)
{
"posts": [
{
"position": 1,
"id": "2122408454325416322",
"link": "https://x.com/elonmusk/status/2122408454325416322",
"text": "Catching a Starship from space",
"iso_date": "2026-11-16T19:16:22Z",
"language": "en",
"likes": 42992,
"reposts": 5145,
"comments": 6941,
"quotes": 472,
"saves": 1497,
"views": 4010966,
"quoted_post": {
"id": "2122368004298068305",
"link": "https://x.com/SpaceX/status/2122368004298068305",
"author": {
"id": "34743251",
"username": "SpaceX",
"name": "SpaceX",
"link": "https://x.com/SpaceX",
"avatar": "https://pbs.twimg.com/profile_images/1697749409851985920/HbrI04tM_normal.jpg",
"is_verified": true,
"verified_type": "Business"
},
"text": "Don't Panic \n\nRiding on Starship 42 during final approach to catch",
"iso_date": "2026-11-16T16:35:38Z",
"language": "en",
"likes": 43914,
"reposts": 6063,
"comments": 1633,
"quotes": 897,
"views": 4725264,
"media": [
{
"type": "video",
"link": "https://video.twimg.com/amplify_video/2122367103676133376/vid/avc1/3840x2160/9dUEKqNpvS499WXB.mp4?ta...",
"thumbnail": "https://pbs.twimg.com/amplify_video_thumb/2122367103676133376/img/yzTQaoPWnW71rwM2.jpg",
"width": 3840,
"height": 2160,
"duration": 54.664
},
"..."
]
},
"is_pinned": true
},
"..."
]
}