API Documentation

Twitter / X Profile API

Read public X / Twitter profile fields and available account statistics.

Test API

Read public X / Twitter profile fields and available account statistics.

Open product page and API Tester

Endpoint and authentication

POST https://api.goanyapi.com/api/v1/twitter/user/profile

Results return synchronously, without tasks or polling. Authenticate using Authorization: Bearer YOUR_API_KEY and send a JSON request body. There are no Path or Query parameters.

Input parameters

ParameterLocationTypeRequiredDefaultConstraints and meaning
AuthorizationHeaderstringYes—Bearer YOUR_API_KEY
Content-TypeHeaderstringYesapplication/jsonapplication/json
screenNameJSON bodystringYes—Username, @username or full https://x.com/<username> or https://twitter.com/<username> profile URL. URL parsing is local and adds no separate charge. Short links and other resource types are unsupported. maxLength=2048

Use the same resource parameter for a raw identifier or supported full resource URL; no prerequisite ID lookup is needed. URL parsing adds no request or separate charge. Short links and other resource types are unsupported.

Username, @username or full https://x.com/<username> or https://twitter.com/<username> profile URL. URL parsing is local and adds no separate charge. Short links and other resource types are unsupported.

Request example

POST /api/v1/twitter/user/profile
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "screenName": "https://x.com/ChineseWSJ"
}

Output fields

Success returns HTTP 200. Business results are in data.result. Null, empty strings, empty arrays and missing business fields are preserved; zero is a valid statistic. Empty display fields do not invalidate an otherwise successful request.

FieldTypeMeaning
codestringok on success; error code otherwise
messagestringStatus message
data.resultobject / nullBusiness data; null is preserved
data.creditsUsedintegerCredits charged using current configuration
data.remainingCreditsnumberBalance after settlement
data.result.screenNamestringPublic business field; may be null, empty or absent
data.result.descriptionstringPublic business field; may be null, empty or absent
data.result.followingintegerPublic business field; may be null, empty or absent
data.result.avatarstringPublic business field; may be null, empty or absent
data.result.verifiedTypestringPublic business field; may be null, empty or absent
data.result.idstringPublic business field; may be null, empty or absent
data.result.mediaTweetCountintegerPublic business field; may be null, empty or absent
data.result.bannerstringPublic business field; may be null, empty or absent
data.result.locationstringPublic business field; may be null, empty or absent
data.result.verifiedbooleanPublic business field; may be null, empty or absent
data.result.websitestringPublic business field; may be null, empty or absent
data.result.tweetCountintegerPublic business field; may be null, empty or absent
data.result.protectedbooleanPublic business field; may be null, empty or absent
data.result.namestringPublic business field; may be null, empty or absent
data.result.followersintegerPublic business field; may be null, empty or absent
data.result.createdAtstringPublic business field; may be null, empty or absent

This endpoint has no pagination parameters.

Real response example

Saved from a real successful response with public business fields. The example omits live data.creditsUsed and data.remainingCredits, which use current configuration and account balance. No list records are omitted. Media URLs may expire. Displaying the example sends no request or charge.

{
  "code": "ok",
  "message": "ok",
  "data": {
    "result": {
      "id": "46574977",
      "screenName": "ChineseWSJ",
      "name": "华尔街日报中文网",
      "avatar": "https://pbs.twimg.com/profile_images/1037219311130234880/KXlUBc9N_normal.jpg",
      "banner": "https://pbs.twimg.com/profile_banners/46574977/1722989773",
      "description": "感谢您关注华尔街日报中文网。我们有上千位专业记者与资深编辑遍布全球,为读者提供24小时最可靠、即时和深入的市场动向,政商时事,科技趋势和前沿思潮。欢迎阅读并分享见解。\n\n尽管全球局势瞬息万变,可靠的信息来源仍能助您洞悉全局,运筹帷幄。前往https://t.co/Ay39I3A0HH成为会员,尽享赢得全球核心决策者信赖的独到见解和深入分析。",
      "location": "China",
      "website": "https://cn.wsj.com/",
      "createdAt": "2009-06-12T03:55:58.000Z",
      "followers": 3341431,
      "following": 493,
      "tweetCount": 99028,
      "mediaTweetCount": 6229,
      "verified": true,
      "verifiedType": "Blue",
      "protected": false
    }
  }
}

Billing

With the current configuration, each successful request costs 1 credit.

Every successful request, including empty results, is settled at the current database-configured rate. Failures are free. Sufficient balance is required before querying; insufficient balance during concurrent settlement returns 402 without delivering unsettled results. URL parsing adds no separate charge.

Status codes and errors

HTTPMeaning
200Success, including empty results
400Invalid JSON or parameters
401Invalid authentication
402Insufficient credits
429Rate limit; wait for Retry-After
502Data request failed
503API or pricing not configured
{"code":"invalid_params","message":"Invalid parameter"}