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

Workflow · Twitter profile API

Twitter profile API for a profile and recent posts

Turn a public username into one application-ready profile snapshot: account fields and recent posts in the same normalized response.

Open endpoint reference

Copyable request + contract response example

One response keeps identity and recent activity together

The example is generated from the same endpoint documentation manifest as the API reference. The OpenAPI-backed schema remains the contract for field types.

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

Inspect one account without stitching profile and post calls

Use this workflow when an account is the unit of research: qualify a creator, enrich a lead, or give an agent current profile context before it reasons.

  1. 01

    Pass the public username in the profile-by-username path.

  2. 02

    Read the user block for identity, account status, and public profile metrics.

  3. 03

    Use recent_tweets as the account's current activity sample.

Code-derived cost

Profile lookup cost follows the returned recent-post count

The rule and worked charge below come from the shared endpoint-pricing catalog used by billing and the API reference.

Current rule

1 base + 1 per item

The profile is covered by the base lookup. Recent posts returned in the same workflow are the priced items.

Documented response example

2 credits

The example contains 1 primary record. 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 a data object with a user block and a recent_tweets array, plus xfetch request, credit, and pagination metadata where applicable.
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. The primary workflow on this page accepts a public username. A sibling endpoint accepts a numeric user ID.
How is a profile request charged?
The pricing rule has a base lookup component and a returned-item component for recent posts. The current rule and worked example on this page are derived from the shared pricing catalog.

Run the documented workflow on your own key

Google sign-in opens the dashboard playground with this endpoint selected.

Compare API costs