This guide walks you through retrieving the currently authenticated user’s profile using the. Reference for the X API v2 standard tier covering quickstart.
This guide walks you through retrieving the currently authenticated user’s profile using the /me endpoint.
from xdk import Clientclient = Client(bearer_token="YOUR_USER_ACCESS_TOKEN")# Get authenticated user with pinned Postresponse = client.users.get_me( user_fields=["pinned_tweet_id"], expansions=["pinned_tweet_id"], tweet_fields=["created_at", "text"])print(f"Username: {response.data.username}")# Pinned Post is in response.includes.tweets
import { Client } from "@xdevplatform/xdk";const client = new Client({ accessToken: "YOUR_USER_ACCESS_TOKEN" });// Get authenticated user with pinned Postconst response = await client.users.getMe({ userFields: ["pinned_tweet_id"], expansions: ["pinned_tweet_id"], tweetFields: ["created_at", "text"],});console.log(`Username: ${response.data?.username}`);// Pinned Post is in response.includes?.tweets