Skip to content

Twitter API for beginners

Your first X API call can be a profile lookup with one line of curl. There is no developer access application. Get a key, copy a snippet, and read the JSON that comes back.

Look up a profile, no signupSee the fields before you write code.
Twitter api for beginners: a child at a kitchen table writing a first letter, a mailbox on the windowsill, a friendly path of footprints to the door.

The job

An API is a web address that returns data when you ask for it. In this case you ask for an X profile or a list of posts, send a key in a header, and get JSON back. If that is new to you, read what an API key is.

Start with the free profile lookup in your browser. When you want to script it, copy the curl, Python or JavaScript sample below and run it with a free test key.

How it works

  1. Look up a profile in the browser

    Open the free X user lookup, type a handle, and see the fields the API will give you.

  2. Get a key

    Start the 7-day free trial. Your key goes in the Authorization header.

  3. Run the sample

    Copy the snippet below, replace the handle, and run it.

Endpoints that do it

EndpointWhat it's forCredits
Get a userGET /v1/x/users/{handle}Your first call: a profile by handle.2 credits
List user tweetsGET /v1/x/users/{handle}/tweetsA user's recent posts.2 credits
Search tweetsGET /v1/x/tweets/searchPosts by keyword.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.

Your first call

This is a profile lookup. Switch tabs to see it in curl, Python and 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

  • Test keys return recorded sample data. Use a live key for real results.
  • The free trial is available once per account.
  • Deleted posts and protected accounts are not returned.

Questions

Do I need to be a developer?
No. The free tools need no code, and for scripts you can copy the snippets.
Where do I put the key?
In an Authorization: Bearer header, as the samples show.
What language should I use?
Any language that can make an HTTP request. See the Python guide or the JavaScript guide.

Other solutions

Build it with one API key

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