How to Get an X (Twitter) API Key
in 2026
The signup flow changed completely in February 2026: no more free tier, pay-per-use billing by default, and credentials shown exactly once. Here is the current process, step by step, with real prices. And at the end, the honest answer to whether you need an X API key at all.
What Changed Before You Start
Most tutorials for getting a Twitter API key describe a flow that no longer exists. There is no free tier for new signups, no 1,500-free-tweets allowance, and no $200 Basic tier you can subscribe to. On February 6, 2026, X made pay-per-use pricing the default for new developers, and around June 2026 it closed the Basic tier and migrated remaining subscribers over.
The practical consequences: you sign up at console.x.com instead of the old developer portal flow, you buy credits before your first API call, and every request bills against that balance. The one upside is that the days-long application review is gone. If you have an X account and a payment method, you can go from nothing to a working key in about fifteen minutes.
One warning before you invest that time: if your only goal is to post and schedule tweets, you can skip this entire process. We cover that fork at the end, but the short version is that a posting layer like OpenTweet needs no X API key at all.
Step-by-Step: Get Your X API Key
Sign in at console.x.com with your X account
The developer console lives at console.x.com. Sign in with the X account you want to develop under. You do not need a separate developer login, but the X account should have a verified email and, for posting apps, ideally a phone number attached. The older developer.x.com portal routes new signups into the same pay-per-use onboarding.
Accept the developer agreement
You will be asked to accept the X Developer Agreement and Policy before you can create anything. There is no longer a long application essay or a days-long manual review for standard access. Read the automation rules if you plan to post programmatically: original posts from your own account are fine, unsolicited automated replies and mentions are not.
Create an app and copy your credentials immediately
Click New App, give it a name and a short description of what it does. The console then generates your credentials: API key, API key secret, and access tokens. These are shown exactly once. Copy them into a password manager or secrets vault right away. If you lose them you have to regenerate, which invalidates the old set and breaks anything still using it.
Configure user authentication for posting
If your app will post tweets, reading credentials alone are not enough. In your app settings, set the app permissions to Read and Write, choose OAuth 2.0, and add a callback URL. Posting to /2/tweets requires a user-context access token obtained through the OAuth flow, not the app-only bearer token. This is the step most first-time integrations get wrong, and it is what produces 403 errors on the first post attempt.
Add credits under Billing before your first call
Since February 6, 2026, pay-per-use is the default and only option for new developers. There is no free tier for new signups. In the console sidebar, go to Billing, then Credits, add a payment method, and buy a credit pack. Some accounts transitioned from the old free tier received a one-time voucher, but a brand new account should expect to pay before the first request.
Make your first request and watch the meter
With credits loaded and a user-context token in hand, POST to https://api.x.com/2/tweets with a JSON body like {"text": "Hello"}. Each successful call draws down your credit balance: roughly $0.015 per post, $0.20 if the post contains a link, $0.005 per post read. Set up a spend habit early. Costs that look tiny per call compound fast once anything runs on a schedule.
Your first post via the X API (requires a user-context OAuth 2.0 token, not the app-only bearer token)
curl -X POST https://api.x.com/2/tweets \
-H "Authorization: Bearer YOUR_USER_CONTEXT_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"text": "Hello from the X API"}'What Pay-Per-Use Actually Costs
These are the published pay-per-use rates as of July 2026. Duplicate resource requests within a 24-hour UTC window are deduplicated and not billed twice.
Prices change. For the full breakdown with worked examples, read our guide to X API pay-per-use pricing or estimate your bill with the X API cost calculator.
Pro Tips for the Developer Console
Store credentials the moment they appear
The console shows your API key, secret, and tokens once. Paste them into a secrets manager before you click anything else. Regenerating later invalidates the old keys and takes down whatever was using them.
Set permissions before generating tokens
Access tokens inherit the app permissions that existed when they were created. If you generate tokens while the app is read-only and later flip to Read and Write, you must regenerate the tokens or posting will fail with a 403.
Budget for link posts separately
A post with a URL costs $0.20 instead of $0.015, more than 13 times the plain-text price. If your bot shares blog posts or product links, that one line item will dominate your bill. Model it before you ship.
Use owned reads for analytics
Reading your own account data is billed at $0.001 per post instead of $0.005. If you are building a dashboard for your own account, make sure your queries qualify as owned reads. It is a 5x difference at volume.
Common Mistakes to Avoid
Expecting a free tier
The free tier was discontinued for new signups when pay-per-use launched in February 2026. Guides that promise a free X API key are describing the pre-2026 flow. New accounts pay per call from the first request.
Using the app-only bearer token to post
The bearer token from your app dashboard authenticates the app, not a user. Posting requires a user-context OAuth 2.0 token. Sending a post with the app-only token returns 403 Forbidden every time.
Hardcoding keys in your repo
Leaked X API credentials let anyone post as your account and burn your credits. Use environment variables or a secrets manager, and rotate immediately if a key ever touches a commit.
Ignoring token refresh
OAuth 2.0 user tokens expire after two hours. If you do not implement refresh-token handling, your integration works in testing and silently dies in production. This is one of the most common X API support threads.
The Honest Fork: Do You Actually Need One?
Get the X API key if you are building something that needs the full API surface: searching public posts, reading other accounts, streaming, or DM automation. Nothing else gives you that access, and pay-per-use is genuinely fair for low-volume read workloads.
But if you landed here because you want to post and schedule tweets from code, a script, or an AI agent, you do not need an X API key. You would be signing up for OAuth token refresh, per-call billing, and a $0.20 charge on every post that contains a link, to solve a problem that a managed posting API already solves at a flat rate.
X API Key (Direct)
- -Full API surface: search, reads, streams, DMs
- -Pay-per-use: $0.015 per post, $0.20 with a link
- -Credits purchased upfront, payment method required
- -OAuth 2.0 setup and token refresh are on you
- -Credentials shown once, regeneration breaks old keys
- -Best for read-heavy or full-platform apps
OpenTweet ot_ Key
- Generate a key in your dashboard in two minutes
- Flat monthly price, links cost nothing extra
- No X developer account, no credit balance to manage
- OAuth and token refresh handled for you
- Scheduling, threads, articles, and MCP built in
- Best if posting and scheduling is the whole job
The same first post through OpenTweet: one key, no OAuth code, no per-call bill
curl -X POST https://opentweet.io/api/v1/posts \
-H "Authorization: Bearer ot_your_api_key" \
-H "Content-Type: application/json" \
-d '{"text": "Hello from the API!", "publish_now": true}'Full endpoint reference in the developer docs. Plans start at $11.99/mo with a 7-day free trial, see pricing.
Frequently Asked Questions
Is the X API free in 2026?
No, not for new developers. X discontinued the free tier for new signups on February 6, 2026 and made pay-per-use the default. You buy credits upfront and each call draws them down: roughly $0.015 per post, $0.20 per post containing a link, $0.005 per read. Free access survives only for approved public-utility apps on a case-by-case basis.
How much does an X API key cost?
The key itself is free to generate. The usage is not. You must add a payment method and load credits before making calls, and every request bills against that balance. A bot posting 5 plain tweets a day costs about $2.25 a month; the same bot posting links costs about $30 a month.
Do I need a credit card to get an X API key?
You can sign in, accept the agreement, and create an app without paying. But to actually make API calls as a new developer you need to add a payment method and purchase credits under Billing in the console. There is no meaningful trial allowance for new accounts.
Can I still sign up for the Basic or Pro tier?
No. The Basic tier ($200 per month) was closed to new customers and existing subscribers were migrated to pay-per-use around June 2026. Fixed tiers persist only for some grandfathered accounts. New signups get pay-per-use, full stop.
What happens if I lose my API keys?
Credentials are displayed once at creation and cannot be viewed again. If you lose them, regenerate from the app settings in the console. Regeneration invalidates the old keys immediately, so update every environment that uses them at the same time.
Do I need an X API key just to post and schedule tweets?
No. If posting and scheduling is all you need, a managed posting API like OpenTweet skips the developer console entirely. You connect your X account once via OAuth, generate an ot_ API key in the dashboard, and post through a flat-rate REST API or MCP server. No developer account, no per-call billing, no token refresh code.
Just Need to Post and Schedule?
Skip the developer console. Get an ot_ API key in two minutes, post at a flat rate, and never write OAuth refresh code.
Get API Access