READ API LIVEBuild on /v1 for search, profiles, timelines, audience graph, and tweet context.READ DOCS

X/Twitter data · Profile API

Twitter profile API for user lookup by username

Turn an X/Twitter handle into a public profile and recent posts in one request. Get the bio, follower counts and activity your account research or enrichment workflow needs.

Open endpoint reference

Collect account profiles and activity into a report with JSON/CSV exports →

Account research and enrichment

What can you build with public profile data?

Qualify a creator or partner

Read the public bio and recent posts together to assess topic fit. Follower counts add audience context to your review.

Enrich a known account

Add the account's public name, bio, avatar and metrics to an existing handle in your CRM or research dataset.

Give an AI agent account context

Provide the profile and recent post text as inputs for a summary. Keep post IDs and timestamps so your application can trace the inputs.

What profile fields do you get?

These fields are inside data. Check account availability first; some profile fields or post metrics may be absent.

Account identity and bio

Connect a handle to a user ID, display name, public bio and avatar. These fields help you display and enrich an account record.

  • user.id
  • user.username
  • user.name
  • user.description
  • user.profile_image_url
Public account metrics

Read follower, following and post counts alongside account creation time. Counts describe the returned snapshot, not a historical trend.

  • user.follower_count
  • user.following_count
  • user.tweet_count
  • user.created_at
Account availability

Check status before using the other fields. An unavailable or missing account can return only an identifier and its status.

  • user.status
  • user.verified
  • user.protected
Recent activity

Use post text, timestamps and available engagement metrics as an activity sample. Use the Timeline API when you need more pages.

  • recent_tweets[].id
  • recent_tweets[].text
  • recent_tweets[].created_at
  • recent_tweets[].like_count

Try a known username

Get a Twitter user profile and recent posts in one request

Set XFETCH_API_KEY in your environment, then replace the username in this cURL request. The saved JSON example illustrates the response shape; its account metrics and posts are not live values.

GET/v1/profiles/by-username/{username}
Workflow APIs
cURL
curl 'https://api.xfetch.io/v1/profiles/by-username/elonmusk' \
  -H "Authorization: Bearer $XFETCH_API_KEY"
Response example
{
  "data": {
    "user": {
      "id": "44196397",
      "username": "elonmusk",
      "name": "Elon Musk",
      "description": "https://t.co/dDtDyVssfm",
      "created_at": "2009-06-02T20:12:29.000Z",
      "verified": true,
      "protected": false,
      "profile_image_url": "https://pbs.twimg.com/profile_images/2053244804520427520/m8mdWZCG_normal.jpg",
      "follower_count": 239956432,
      "following_count": 1332,
      "tweet_count": 102633,
      "media_count": 4489,
      "status": "active"
    },
    "recent_tweets": [
      {
        "id": "2055734812669865997",
        "text": "These come from court transcripts",
        "author_id": "44196397",
        "created_at": "2026-05-16T19:39:07.000Z",
        "lang": "en",
        "conversation_id": "2055734812669865997",
        "possibly_sensitive": false,
        "like_count": 45028,
        "retweet_count": 9207,
        "reply_count": 2190,
        "quote_count": 236,
        "bookmark_count": 3116,
        "is_quote_status": true,
        "entities": {
          "hashtags": [],
          "urls": [],
          "mentions": []
        },
        "display_text_range": [
          0,
          33
        ],
        "quoted_tweet_id": "2055714457343471890"
      }
    ]
  },
  "meta": {
    "request_id": "req_01HXFETCHEXAMPLE",
    "credits": {
      "charged": 2,
      "remaining": 998
    }
  }
}

One workflow

From a Twitter username to a usable account snapshot

Start with a known handle, such as elonmusk, without the @ sign. The response keeps the account and its recent posts together so your application can read both.

  1. 01

    Create an xfetch API key and send it in the Authorization: Bearer header. X developer credentials are not required.

  2. 02

    Pass the username in the request path. Check data.user.status before using profile fields; unavailable accounts return a smaller user object.

  3. 03

    Read data.user for account context and data.recent_tweets for an activity sample. Save user.id for later account or timeline lookups.

Choose the right lookup

Profile API, user lookup or timeline?

User fields only

Use the user lookup endpoint when you need an ID, bio or follower count without fetching recent posts.

User fields only

More posts from the account

Use the Timeline API to page through posts. The profile snapshot does not accept limit or next_token.

More posts from the account

Know the cost before you call

Twitter Profile API pricing

Pay for the account snapshot and the recent posts it returns. Use the pricing calculator to convert your expected usage into a credit budget.

Current rule

1 base + 1 per item

The base charge covers the profile lookup. Each recent post returned adds the per-item charge. The post count can vary between accounts and requests.

Documented response example

2 credits

The example contains 1 recent post. Failed validation, authentication, insufficient-credit, rate-limit, service-side, and internal failures are not charged.

FAQ

Twitter Profile API questions

What does the Twitter Profile API return?
It returns data.user with the account's public profile and data.recent_tweets with an activity sample. Successful responses include meta.request_id and meta.credits.charged. Available fields depend on the account's status and public data.
Should I use the profile endpoint or the user lookup endpoint?
Use the profile workflow when you need account fields and recent activity together. Use a user lookup when the account object alone is enough.
Can I look up a profile by username?
Yes. Pass a known username without @ in /v1/profiles/by-username/:username. Use the handle rather than the display name or a full profile URL. If you already have the numeric user ID, use /v1/profiles/:id.
How is a profile request charged?
A successful response uses the base lookup charge plus the charge for recent posts actually returned. An empty activity sample still uses the base charge. Failed requests are not charged; check meta.credits.charged for the amount used.
What happens if the account is suspended or does not exist?
A completed lookup can return HTTP 200 with user.status set to suspended, deactivated, unavailable or not_found and an empty recent_tweets array. This is a billed lookup result with the base charge, so do not treat every HTTP 200 as an active account.
Does this return all tweets or let me search for people?
This workflow starts from a known username or ID and returns a recent activity sample. It does not search for profiles by name or bio, and it does not paginate the account's complete history. Use the Timeline API for additional post pages.
Can I try the Twitter Profile API for free?
New xfetch accounts receive starting API credits. Sign in with Google, create an API key and run the selected profile request in the playground. Your requests use those credits according to the pricing rule shown on this page.

Try a profile lookup for the account you have in mind

New accounts receive 1,000 starting credits. Google sign-in opens the dashboard playground with this endpoint selected.

Compare API costs

Maintained by xfetch. Last updated .