Twitter consumer key and secret: where to find them
Where to find your Twitter consumer key and secret, how they map to API key, access token and bearer token today, and a way to skip them for read-only data.
Piyushh · November 13, 2026 · 3 min read

Your Twitter consumer key is the API Key of your X app, and the consumer secret is the API Key Secret. X generates both when you create an app in its Developer Console at console.x.com, and it shows them only once. If you lost them, you have to regenerate them. Below, the old names are matched to the current ones, with where each credential lives. The last section covers how to skip them if all you need is to read data.
The details come from X's getting access page and its authentication overview, both checked 2026-11-13.
The Twitter API credentials, in plain words
Several names refer to the same thing, which is why this gets confusing. Here is what each one means.
| Name you will see | Also called | What it is for |
|---|---|---|
| API Key | consumer key, twitter api key, consumer api key | Identifies your app |
| API Key Secret | consumer secret, twitter api secret, twitter secret key | Proves the app is yours, and signs OAuth 1.0a |
| Access Token | user token, twitter access key | Identifies an account that authorized your app, or your own account |
| Access Token Secret | access token secret | Pairs with the access token to sign requests |
| Bearer Token | app-only token | Read public data as the app |
| Client ID and Client Secret | OAuth 2.0 credentials | OAuth 2.0 user-context requests |
X's access page says creating an app gives you an API Key and Secret, a Bearer Token, an Access Token and Secret, and a Client ID and Secret. "Twitter api key and secret" and "consumer key and secret" are therefore the same pair.
Where to find the Twitter API consumer key and secret
- Go to console.x.com and sign in with your X account.
- Accept the Developer Agreement and Policy. According to the page, you also fill in your profile with basic details about how you will use the API.
- Click New App and give it a name, a description and your use case.
- X generates the credentials. Its page says they are shown only once, so copy them into a password manager before you close the window.
There is no approval step in this list because X's page, as checked today, does not mention one. Rules change, so walk through the steps yourself and read what the console tells you. Our guide on how to get a Twitter API key covers the same flow. For Twitter developer access in general, access to the Twitter API explains the options.
Which credential goes where
The consumer key and secret only identify your app. What else you need depends on the call:
- To read public data, the Bearer Token is enough, and the consumer key doesn't go in the request itself.
- To act as your own account with OAuth 1.0a, you need all four: consumer key, consumer secret, access token and access token secret.
- To act for other people, use OAuth 2.0 with PKCE and the Client ID, or OAuth 1.0a with their tokens after they authorize.
Twitter API authentication covers which method fits which job. Getting an access token for a user works through the OAuth flow in that guide: the user approves your app, and X returns tokens for that user.
Using the keys in code
In Python, a library signs the OAuth 1.0a request for you. This example uses requests-oauthlib:
import os
from requests_oauthlib import OAuth1Session
x = OAuth1Session(
os.environ["X_CONSUMER_KEY"],
client_secret=os.environ["X_CONSUMER_SECRET"],
resource_owner_key=os.environ["X_ACCESS_TOKEN"],
resource_owner_secret=os.environ["X_ACCESS_TOKEN_SECRET"],
)
print(x.get("https://api.x.com/2/users/me").json())
Store all four values in environment variables, not in the file. If a secret leaks, regenerate it in the console and replace it everywhere you use it.
What to do if you lost them
X shows the credentials only once, and you can't read the secret back later. If you lose it, regenerate the keys in the console and update every script and server that used the old ones, because the old keys stop working.
Skip the keys: one key for reads
If you only need to read public data from X, you don't need the consumer key, the secret, the access token or the OAuth flow. ChatterAPI is an independent read API for Reddit and X, not affiliated with X Corp, and it takes one key:
curl -s "https://api.chatterapi.com/v1/x/users/levelsio/tweets" \
-H "Authorization: Bearer $CHATTERAPI_KEY"
That call returns the account's recent tweets as JSON, at 2 credits per page of about 20. To try an X lookup without any key, use the free X user lookup tool.
ChatterAPI is built for reading. If you need to post as your own brand account under first-party terms, use X's keys.
To make a call with one key instead, the quickstart takes a few minutes, and the pricing page lists the plans.