Twitter (X) API keys

Twitter API credentials belong in configuration, not in a commit. This page covers where to create one, what it looks like, and how APIKeyConnect stores it without ever being able to read it.

The facts

Category
Social Media
API host
api.twitter.com
Key format
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Env variable
TWITTER
Sensitivity
High
Create a key
https://console.x.comOpen your app → "Keys and tokens". Keys are shown only at creation, so regenerate if you no longer have them.
Documentation
https://developer.twitter.com/en/docs/twitter-api

A leaked key here bills you and can read or write account data. Treat it like a password: server-side only, rotated on staff changes.

Kinds of Twitter (X) key

API Key

API Secret

Bearer Token

Access Token

Access Token Secret

How APIKeyConnect stores it

The key is encrypted in your browser with AES-256-GCM, under a key derived from your master password with PBKDF2-SHA-256 at 600,000 iterations. The password never leaves your device, and the server holds ciphertext it has no way to open.

What the server can see — and what this design does not protect against — is written out in full on the security page. That section exists because a page with no limits section is marketing.

Questions

Where do I get a Twitter (X) API key?

Twitter (X) issues keys from https://console.x.com. Open your app → "Keys and tokens". Keys are shown only at creation, so regenerate if you no longer have them. Once you have it, store it in APIKeyConnect rather than in a .env file you might commit — the key is encrypted on your device with a master password we never receive.

What does a Twitter (X) API key look like?

Twitter (X) keys follow the pattern xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. Knowing the shape is useful for spotting one that has been pasted into a commit, a log line, or a support ticket — the places keys leak from most often.

What environment variable should I use for Twitter (X)?

Most projects use TWITTER. APIKeyConnect recognises these names, so importing an existing .env maps the value onto Twitter (X) automatically instead of leaving it as an unlabelled string, and generating a .env writes it back under the same name.

How dangerous is a leaked Twitter (X) key?

High sensitivity. A leaked key here bills you and can read or write account data. Treat it like a password: server-side only, rotated on staff changes.

Does Twitter (X) have more than one kind of key?

Yes — API Key, API Secret, Bearer Token, Access Token, Access Token Secret. They differ in scope, so keeping them as separate entries rather than one "the Twitter (X) key" is what lets you rotate the risky one without touching the others.

Can APIKeyConnect see my Twitter (X) key?

No. The key is encrypted in your browser with AES-256-GCM under a key derived from your master password (PBKDF2-SHA-256, 600,000 iterations). The password never leaves your device and the server stores ciphertext it cannot open. What the server can see is documented in full on the security page, including what this design does not protect against.

Other Social Media services