Skip to content

Access the Twitter API

There are two ways to access the Twitter API, now called the X API. You can apply for a developer account and pick a paid tier, or you can use a hosted API that reads public X data with one key. The right one depends on whether you need to read, post, or both.

Try a profile lookup, no signupSee the data before you choose a route.
Access twitter api: a traveller at a fork with two doors.

The job

Official route. Apply for a developer account, create a project and use its keys. Your tier decides what you can call, and the tiers have changed several times. Does Twitter have an API, the X API key guide and Twitter API v2 cover the details and dates.

Hosted route. One key from a hosted API reads public posts, profiles and followers, and runs actions from X accounts you connect. You don't file a developer application. See the comparison with the official API.

How it works

  1. Decide what you need

    Reading public data, or acting as an account (posting, DMs, follows).

  2. Pick a route

    Official access if you need its full write scope. A hosted key if you mostly read.

  3. Make a first call

    Look up a profile with your key. The sample below shows the request in curl, Python and JavaScript.

Endpoints that do it

EndpointWhat it's forCredits
Get a userGET /v1/x/users/{handle}Your first call: a profile by handle.2 credits
Search tweetsGET /v1/x/tweets/searchPosts by keyword.2 credits
List user tweetsGET /v1/x/users/{handle}/tweetsAn account's recent posts.2 credits

Free tools for the same job

Try the job in a browser first. These tools call the same endpoints, and you don't need a key or any code.

A first call

A profile lookup. Switch the tabs for curl, Python or JavaScript.

curl "https://api.chatterapi.com/v1/x/users/levelsio" \
  -H "Authorization: Bearer $CHATTERAPI_KEY"
response, first 2 rows
{
  "data": {
    "id": "1577241403",
    "handle": "levelsio",
    "name": "@levelsio",
    "bio": "馃捀http://levels.vc\n馃摳http://PhotoAI.com $86K/m\n馃幃http://VibeJam.com $44K/m\n馃彙http://InteriorAI.com $23K/m\n馃憴@X $13K/m\n馃實http://Nomads.com $7K/m\n馃彥http://Hotelist.com $5K/m",
    "followers": 974707,
    "following": 3276,
    "tweets": 181450,
    "verified": false,
    "blueVerified": true,
    "canDm": false,
    "protected": false,
    "location": "馃摃My book $5K/m 馃憠",
    "url": "https://readMAKE.com",
    "avatarUrl": "https://pbs.twimg.com/profile_images/2077111020305162240/PwddgOau_400x400.jpg",
    "createdAt": "2013-07-08T09:31:59.000Z",
    "profileUrl": "https://x.com/levelsio",
    "bannerUrl": "https://pbs.twimg.com/profile_banners/1577241403/1665964220",
    "likesGiven": 185852,
    "mediaCount": 19829,
    "pinnedTweetIds": [
      "2109949585737052316"
    ]
  }
}

Recorded from a live call on . Long text is shortened and the cursor is cut. A live key is charged 2 credits for this call. A test key returns this same sample for 0 credits.

What it won't do

  • This is independent of X and is not an official X product.
  • Actions run only from accounts you connect, within safe daily limits.
  • Deleted posts and protected accounts are not returned.

Questions

How do I get Twitter API access?
Apply for a developer account on X and choose a tier, or use a hosted API with one key. See the X API key guide.
Is the Twitter API free?
See is the X API free for the current position with dates.
Do I need a developer account for this one?
No. You use a key from this service.

More ways to use the API

Build it with one API key

Try it free for 7 days with 1,000 credits.