Skip to content

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

A large key and a small matching key on a ring beside a sealed envelope, picturing a key and secret pair.

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 seeAlso calledWhat it is for
API Keyconsumer key, twitter api key, consumer api keyIdentifies your app
API Key Secretconsumer secret, twitter api secret, twitter secret keyProves the app is yours, and signs OAuth 1.0a
Access Tokenuser token, twitter access keyIdentifies an account that authorized your app, or your own account
Access Token Secretaccess token secretPairs with the access token to sign requests
Bearer Tokenapp-only tokenRead public data as the app
Client ID and Client SecretOAuth 2.0 credentialsOAuth 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

  1. Go to console.x.com and sign in with your X account.
  2. 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.
  3. Click New App and give it a name, a description and your use case.
  4. 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.

FAQ

What is the Twitter consumer key?
It is the older name for your app's API Key. Together with the consumer secret (the API Key Secret) it identifies your app to X and is used to sign OAuth 1.0a requests.
Where do I find my Twitter consumer key and secret?
In X's Developer Console at console.x.com, after you create an app. X's docs, checked 2026-11-13, say credentials are generated when the app is created and are shown only once, so save them then.
What is the difference between the consumer key and the access token?
The consumer key identifies your app. The access token and its secret identify an account that has authorized your app, or your own account. You need the pair for requests made as a user.
Can I see my consumer secret again?
X's docs say credentials are displayed once. If you lost it, regenerate the keys in the console and update every place that uses the old ones.
Do I need a consumer key to read tweets?
Not with ChatterAPI. It uses one API key in a Bearer header and no X developer app. With X's own API, public reads need a Bearer Token from an app.

More on X (Twitter) API

Try it free for 7 days.

1,000 credits to make your first calls. One key for Reddit and X, over REST or MCP.