Profile
View your profile information, manage account labels, and check the availability of emails, phone numbers, and usernames.
account.viewer()
Get the currently authenticated user's profile, plus claims, education_flags and is_active_creator. Uses the GraphQL viewerQuery.
const me = await client.account.viewer();
console.log(me.id);
console.log(me.username);
console.log(me.name);
console.log(me.stats.followers.count);
console.log(me.stats.following);Returns: A parsed user object with all profile fields, stats, and verification status.
account.accountInformation()
Get the account information page: screen name, creation date, protection, verification, parody label and automation label. Uses the GraphQL accountInformationQuery.
account.aboutAccountCard(screenName)
Get the "about this account" hover card of a user: country, signup source and username changes. Uses the GraphQL userAboutAccountHoverCardContentQuery.
account.claims()
Get the viewer's claims, such as premium features. Uses the GraphQL ViewerClaimsQuery.
const claims = await client.account.claims();
console.log(claims);account.phoneState()
Get the emails and phone numbers on the account. ProfileUserPhoneState is gone, and the web client reads v1.1 users/email_phone_info instead, so this is the same as account.emailPhoneInfo().
const state = await client.account.phoneState();
console.log(state);account.accountLabel()
Get your current account label status (e.g. government, business, bot). Returns account_label, managed_label and owner_screen_name. Uses the GraphQL automationQuery.
const label = await client.account.accountLabel();
console.log(label);account.disableAccountLabel()
Remove your account label. Uses the GraphQL automationDisableMutation.
await client.account.disableAccountLabel();account.enableVerifiedPhoneLabel()
Enable the verified phone label on your profile. Uses the GraphQL verifiedPhoneRowEnableMutation.
await client.account.enableVerifiedPhoneLabel();account.disableVerifiedPhoneLabel()
Disable the verified phone label on your profile. Uses the GraphQL verifiedPhoneRowDisableMutation.
await client.account.disableVerifiedPhoneLabel();account.emailAvailable(email)
Check if an email address is available for registration. Uses the v1.1 users/email_available endpoint.
const result = await client.account.emailAvailable("test@example.com");
console.log(result.valid); // true if availableaccount.phoneAvailable(phone)
Check if a phone number is available. Uses the v1.1 users/phone_number_available endpoint.
const result = await client.account.phoneAvailable("+1234567890");
console.log(result);account.usernameAvailable(username)
Check if a username is available. Uses the GraphQL ocfEnterUsernameAvailabilityMutation.
const { available } = await client.account.usernameAvailable("desired_username");account.emailPhoneInfo(params?)
Get the email and phone information associated with the account. Uses the v1.1 users/email_phone_info endpoint.
const info = await client.account.emailPhoneInfo();
console.log(info);account.resendConfirmationEmail()
Resend the confirmation email for your account if it hasn't been verified yet. Uses the v1.1 account/resend_confirmation_email endpoint.
await client.account.resendConfirmationEmail();Social graph
account.friendsList(userId?, opts?)
List the accounts a user follows with their notification types. Defaults to you. Uses the v1.1 friends/list endpoint.
account.knownFollowers(user, opts?)
List followers of a user that you follow. Takes a user ID or screen name. Uses the v1.1 friends/following/list endpoint.
account.incomingFollowRequests(opts?)
List the IDs of pending follow requests. Uses the v1.1 friendships/incoming endpoint.
Contacts and location
account.contacts(cursor?)
List your uploaded contacts, 100 per page. Needs client.elevate(password).
account.uploadContacts(contacts)
Upload contacts in batches of 100 through contacts/upload_v2.
account.deleteContacts()
Delete every uploaded contact.
account.places(query)
Search places to tag in a post, by name or by { lat, long, accuracy? }.
account.deleteLocationData()
Delete the location data attached to your posts.
Other account endpoints
account.hashflags()
List the active hashflags with their hashtag, asset URL and time window.
account.notMyAccount({ screenName, secret, ut? })
Get the masked data for a "not my account" email link.
account.disassociateAccount({ screenName, secret })
Remove your email from an account you don't own, from a "not my account" link.
account.verificationStatus(email)
Check whether a signup email is verified.
account.beginVerification(params?)
Send a signup verification code by email or SMS.
account.userRecommendations(params?)
Get onboarding user recommendations from v2 onboarding/fetch_user_recommendations_urt.
account.viewerContext(body?)
Post to v1.1 graphql/viewer_context. X answered 400 to an empty body, so this is untested.
Updating Your Profile
Profile updates like changing your display name, bio, location, website, and profile images are available through the Users namespace. See the Users documentation for details.
// Update display name, bio, location, and website
await client.users.updateProfile({
name: "New Display Name",
description: "My updated bio ✨",
location: "San Francisco, CA",
url: "https://example.com",
});
// Update profile picture (base64 image data)
await client.users.updateProfileImage(base64ImageData);
// Update banner image
await client.users.updateProfileBanner(base64BannerData);
// Remove banner
await client.users.removeProfileBanner();Full example
// Get your full profile
const me = await client.account.viewer();
console.log(`Logged in as @${me.username}`);
console.log(`Name: ${me.name}`);
console.log(`Followers: ${me.stats.followers.count}`);
console.log(`Following: ${me.stats.following}`);
console.log(`Tweets: ${me.stats.posts}`);
// Check your account label
const label = await client.account.accountLabel();
console.log(`Account label: ${JSON.stringify(label)}`);
// Check phone verification state
const phoneState = await client.account.phoneState();
console.log(`Phone state: ${JSON.stringify(phoneState)}`);
// Get claims (verification info)
const claims = await client.account.claims();
// Check availability before changing your username
const available = await client.account.usernameAvailable("new_handle");
console.log(`Username available: ${JSON.stringify(available)}`);
// Check email availability
const emailCheck = await client.account.emailAvailable("newemail@example.com");
// Get email and phone info on file
const contactInfo = await client.account.emailPhoneInfo();
// Manage labels
await client.account.enableVerifiedPhoneLabel();
// or
await client.account.disableVerifiedPhoneLabel();
// Update your profile via the users namespace
await client.users.updateProfile({
name: "Updated Name",
description: "Building cool things 🚀",
location: "Earth",
});