People who search for an "X API key" or a "Twitter API key" usually want one of two things. One is X's own developer credentials, for a bot, an app that posts, or anything that acts on an account. The other is a way to pull public profiles, posts and search results into a script. Both are covered here, with X's process and prices as of November 2026.
The short answer: sign in to the X Developer Console with your X account, accept the developer agreement, describe your use case and click New App. The console generates your keys and tokens. Using them costs money per request. A Social Fetch key is a separate credential for Social Fetch's own X routes.
Two different things called an X API key
| X API (v2) | Social Fetch X routes | |
|---|---|---|
| What you get | API key and secret, bearer token, access token and secret, OAuth 2.0 client ID and secret | One sfk_… key |
| How you get it | Create an app in the X Developer Console | Create it on the API Keys page |
| Posting, likes, follows, DMs | Yes, within X's terms | No |
| Public profiles, posts, replies, search | Yes | Yes |
| Billing | X credits, per resource returned | Social Fetch credits, per lookup |
| Limits | Per-endpoint windows, plus a monthly read cap | Credits and available service capacity |
Background reading: Does Twitter have an API?, Social Fetch vs the X API and the X platform page.
How to get an official X API key
"Twitter API key" and "X API key" are the same thing: the developer platform now lives at docs.x.com and console.x.com. X's getting access guide sets out these steps as of November 2026:
- Sign in to the Developer Console at console.x.com with your X account.
- Accept the Developer Agreement and Policy.
- Complete your profile by describing how you'll use the API. Be specific; X's policy applies to the use you describe.
- Create an app. Click New App on the dashboard and enter the app's name, description and use case.
- Save your credentials. The console generates your keys and tokens. X warns they are only displayed once; if you lose one you have to regenerate it, which invalidates the old one.
Before a request goes through you also need credits on the account; see Is the X API free? below. With a bearer token set in X_BEARER_TOKEN, an app-only lookup of a public user looks like this:
Treat the API key secret, access token secret and client secret like passwords. Keep them on your server and out of source control. Regenerating a leaked credential breaks every integration that uses it.
X API key vs bearer token
The console hands you several credentials, and each X tutorial calls a different one "the API key". From X's getting access guide:
- API key and secret identify your app. You use them to generate tokens and to sign OAuth 1.0a requests. Older Twitter docs called these the consumer key and secret.
- Bearer token is app-only authentication for reading public data. Most read-only scripts only need this one.
- Access token and secret make OAuth 1.0a requests as the account that owns the app, for example posting from your own bot.
- Client ID and secret are for OAuth 2.0, when your app acts for other X users who sign in and consent.
A 401 Unauthorized usually means the wrong credential for the endpoint (a bearer token on a call that needs a user context, for example) or a regenerated key. A 403 can mean the endpoint isn't available to your app or account.
Is the X API free?
Not in the sense most people mean. X's pricing page describes pay-per-usage with no subscriptions: you buy credits in the Developer Console and requests deduct from your balance. As of November 2026 X lists, per resource returned:
- $0.005 to read a post (also lists, Spaces, communities and notes);
- $0.010 to read a user, or a follower or following entry;
- $0.001 to read likes, mutes and blocks;
- $0.001 per resource for "owned reads", your own app owner's data.
Creating a post costs $0.015, or $0.200 if it contains a URL. Pay-per-usage is capped at 3 million post reads per monthly billing cycle; above that X points to an Enterprise plan with no published price. You can set a spending limit per billing cycle. X also advertises $20 in free API credits for new users after saving a payment card and making a first credit purchase. X says prices are subject to change, so check the console's current rates before you budget. For worked cost comparisons, see X API pricing.
X API rate limits
X's rate limits page sets a limit per endpoint, mostly per 15-minute window, with some per 24 hours or per second. Limits are counted per app when you use the bearer token and per user when you use OAuth user tokens. Two examples as of November 2026:
| Endpoint | Per app | Per user |
|---|---|---|
GET /2/tweets/search/recent | 450 per 15 min | 300 per 15 min |
GET /2/users/by/username/:username | 300 per 15 min | 900 per 15 min |
Each response carries x-rate-limit-limit, x-rate-limit-remaining and x-rate-limit-reset (a Unix timestamp). Going over returns HTTP 429 with error code 88. Back off until the reset time rather than retrying in a loop. Rate limits sit on top of billing: a request within the limit still spends credits.
Social Fetch's paid X routes have no per-window request quota; requests spend credits. When capacity is full, a request may return 503 temporarily_unavailable with a Retry-After header, which isn't charged. See Credits and Errors.
Get a Social Fetch key for public X data
Social Fetch's X routes accept a Social Fetch key, so you don't need an X developer account, bearer token or X credits. They return public data as JSON. The key does not grant any permission under X's terms; check those for your use.
- Create a free account or sign in.
- Open API Keys, type a name for the key and click Create key.
- Copy the key from the Save your API key window. It starts with
sfk_and is shown only once. - Try a search in the Playground: the link fills in
from:nasafor the latest posts. Click Send. The Playground uses your signed-in workspace and spends its credits; you do not paste a key. - Store the key in an environment variable named
SOCIALFETCH_API_KEYand call the routes from your own code. Keep it on your server, out of public repositories and browser code.
Each endpoint page shows what a lookup costs, and successful responses say what they cost in meta.creditsCharged. Lookups that fail (502 lookup_failed, 503 temporarily_unavailable) are free. Plans and credit packs are on Pricing.
The X routes most people start with:
- Profile lookup: a public profile by handle or user ID.
- Profile posts: a profile's recent posts, paged.
- Search: public posts or people matching a query.
- Replies: the public replies to a post.
The full list is on the X platform page and in the X API reference. These routes read public data only; protected accounts, DMs and anything that needs an X login are out of reach.
Which key do you need?
Get an X developer app when you're building something that acts on X: a bot that posts, an app people sign in to with their X account, or anything that likes, follows, reads DMs or manages lists. Those need X's OAuth flows, and X bills them per request.
Use a Social Fetch key when the job is reading public profiles, posts and search results, for example monitoring a list of accounts or keywords, or enriching a CRM with X profiles alongside LinkedIn and Instagram. The same split applies on other networks; the Reddit API key guide walks through it for Reddit, and monitoring webhooks covers pushing new posts to your own endpoint.
FAQ
How do I get an X (Twitter) API key?
Sign in to the X Developer Console at console.x.com with your X account, accept the Developer Agreement and Policy, describe how you'll use the API, then click New App and fill in its name, description and use case. The console then shows your API key and secret, bearer token, access token and secret, and OAuth 2.0 client ID and secret. Save them straight away: they are only displayed once.
Is a Twitter API key the same as an X API key?
Yes. Twitter renamed itself X, and the developer platform moved to docs.x.com and console.x.com. Older tutorials call the API key and secret the consumer key and secret; they are the same credentials.
Is the X API free?
As of November 2026 X's pricing page describes pay-per-usage with no subscriptions: you buy credits in the Developer Console and each request deducts from them. Reading a post costs $0.005 and reading a user costs $0.010 per resource returned. X advertises $20 in free credits for new users after a first credit purchase, but no free tier.
What are the X API rate limits?
Each endpoint has its own limits, mostly per 15-minute window, counted separately per app (bearer token) and per user (user tokens). As of November 2026 X lists recent search at 450 requests per 15 minutes per app and user lookup by username at 300 per 15 minutes per app. Going over returns HTTP 429.
Do I need an X developer account to use Social Fetch?
No. Social Fetch's X routes take a Social Fetch key (it starts with sfk_) in the x-api-key header. They return public profiles, posts, replies and search results, spend Social Fetch credits rather than X credits, and cannot post, like, follow or read DMs.