Twitter API Quickstart | First Call in 2 Minutes
Get an API key and make your first TwitterAPIs request in under two minutes, with copy-paste curl, JavaScript, and Python.
This guide takes you from zero to your first live response. You need a terminal and an API key. Nothing else.
1. Get an API key
Sign up at twitterapis.com and open your dashboard. Your key is on the API Keys page. New accounts start with $0.50 in free credits, which is enough for hundreds of calls, so you can test before you add a card.
Keep your key secret
Treat the key like a password. Send it only from your backend, never from browser code, and store it in an environment variable rather than in source.
2. Set the base URL and auth
Every request goes to the same base URL and carries your key as a bearer token.
- Base URL:
https://api.twitterapis.com/twitter - Auth header:
Authorization: Bearer <API_KEY>
Export your key once so the examples below pick it up:
export TWITTERAPIS_KEY="your_api_key_here"3. Make your first request
This searches recent tweets from a single author. Pick your language.
curl "https://api.twitterapis.com/twitter/tweet/advanced_search?query=from%3Anaval" \
-H "Authorization: Bearer $TWITTERAPIS_KEY"const url = new URL("https://api.twitterapis.com/twitter/tweet/advanced_search");
url.searchParams.set("query", "from:naval");
const res = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.TWITTERAPIS_KEY}` },
});
if (!res.ok) {
throw new Error(`Request failed: ${res.status}`);
}
const data = await res.json();
console.log(data.tweets);import os
import requests
resp = requests.get(
"https://api.twitterapis.com/twitter/tweet/advanced_search",
headers={"Authorization": f"Bearer {os.environ['TWITTERAPIS_KEY']}"},
params={"query": "from:naval"},
)
resp.raise_for_status()
data = resp.json()
print(data["tweets"])4. Read the response
A successful call returns JSON with your search parameters echoed back, a count, a cursor for the next page, and the matching tweets.
{
"query": "from:naval",
"product": "Latest",
"count": 1,
"next_cursor": "DAABCgABF...",
"tweets": [
{
"id": "1759123456789012345",
"text": "Build the input, the output takes care of itself.",
"created_at": "Tue Feb 20 14:02:11 +0000 2026",
"author": { "id": "745273", "username": "naval", "name": "Naval" },
"favorite_count": 4821
}
]
}That is the whole loop: one URL, one header, JSON back. No OAuth handshake, no developer-account review, no per-endpoint scopes.
Where to go next
Authentication
How the bearer token works and where to find your key.
Errors
Status codes, the JSON error shape, and how to handle each.
Pagination
Walk past the first page with cursor-based pagination.
Advanced Tweet Search
The full query-operator syntax for precise tweet search.
FAQ
What do I need to make my first call?
A terminal and an API key from the dashboard. Set the key as a bearer token, hit the base URL, and you get JSON back. No OAuth handshake.
Is there a free tier to test with?
Yes. New accounts start with $0.50 in free credits, enough for hundreds of calls, so you can test before adding a card.
What is the base URL?
Every request goes to https://api.twitterapis.com/twitter with your key in the Authorization: Bearer header.