This guide walks you through retrieving the currently authenticated user’s profile using the /me endpoint.
PrerequisitesBefore you begin, you’ll need:
- A developer account with an approved App
- User Access Token (OAuth 1.0a or OAuth 2.0 PKCE)
Get the authenticated user
Make a request to the /me endpoint with a User Access Token:
curl "https://api.x.com/2/users/me?\
user.fields=created_at,description,verified,public_metrics,profile_image_url" \
-H "Authorization: Bearer $USER_ACCESS_TOKEN"
Response
{
"data": {
"id": "2244994945",
"name": "X Developers",
"username": "XDevelopers",
"created_at": "2013-12-14T04:35:55.000Z",
"description": "The voice of the X developer community",
"verified": true,
"profile_image_url": "https://pbs.twimg.com/profile_images/...",
"public_metrics": {
"followers_count": 583423,
"following_count": 2048,
"tweet_count": 14052,
"listed_count": 1672
}
}
}
Use case
The /me endpoint is essential when:
- Verifying authentication — Confirm the user is properly authenticated
- Getting the user ID — Retrieve the authenticated user’s ID for other API calls
- Personalizing experiences — Display the user’s profile in your app
- On behalf of requests — Know who you’re making requests for
Include pinned Post
Request the user’s pinned Post:
curl "https://api.x.com/2/users/me?\
user.fields=pinned_tweet_id&\
expansions=pinned_tweet_id&\
tweet.fields=created_at,text" \
-H "Authorization: Bearer $USER_ACCESS_TOKEN"
Response with expansion
{
"data": {
"id": "2244994945",
"name": "X Developers",
"username": "XDevelopers",
"pinned_tweet_id": "1234567890"
},
"includes": {
"tweets": [
{
"id": "1234567890",
"text": "Welcome to my profile!",
"created_at": "2024-01-01T00:00:00.000Z"
}
]
}
}
Available fields
| Field | Description |
|---|
created_at | Account creation date |
description | User bio |
profile_image_url | Avatar URL |
verified | Verification status |
public_metrics | Follower/following counts |
location | User-defined location |
url | User’s website |
protected | Protected account status |
pinned_tweet_id | Pinned Post ID |
Authentication requirement
The /me endpoint requires User Context authentication. App-Only (Bearer Token) authentication is not supported.
Use either:
Next steps