Getting Started
Get your first Twitter/X API call working in under two minutes.
1. Get your API key
Sign up for a FetchLayer account and generate an API key from the dashboard. Free tier included — no credit card required.
2. Make your first request
Call any endpoint with curl, or use the TypeScript SDK.
curl
curl -X POST https://api.fetchlayer.dev/twitter/search \
-H "Authorization: Bearer ss-your-key" \
-H "Content-Type: application/json" \
-d '{"query":"openai","product":"Latest","count":5}'TypeScript SDK
npm install @fetchlayer/twitter
import { FetchLayer } from '@fetchlayer/twitter';
const client = new FetchLayer({ apiKey: 'ss-your-key' });
const { results } = await client.search({
query: 'openai',
product: 'Latest',
count: 5,
});Tip
"product": "Top" instead of "Latest" to bias results toward high-engagement tweets rather than strictly reverse-chronological ones.
3. Understand the response
Every endpoint returns structured JSON. The response shape varies by endpoint, but request and authentication patterns stay consistent across the Twitter surface.
{
"results": [
{
"id": "2095595741528125780",
"text": "This is GPT-6 Astra. Anything you can do on a computer, Astra can do for you. Fast.",
"author": "OpenAI",
"createdAt": "Thu Sep 03 19:32:13 +0000 2026",
"url": "https://x.com/OpenAI/status/2095595741528125780"
}
]
}