diff --git a/xchat/migrate-from-legacy-dms/faq.mdx b/xchat/migrate-from-legacy-dms/faq.mdx index abb43f474..e5d2bde48 100644 --- a/xchat/migrate-from-legacy-dms/faq.mdx +++ b/xchat/migrate-from-legacy-dms/faq.mdx @@ -1,8 +1,8 @@ --- title: "X Chat migration FAQ" sidebarTitle: Partner FAQ -description: "Answers to the questions partners ask most about moving from legacy Direct Messages to the X Chat API: timeline, sign-in and permissions, keys and PINs, events and endpoints, and common errors." -keywords: ["X Chat FAQ", "X Chat migration FAQ", "X Chat partner FAQ", "legacy DM migration", "Direct Messages to X Chat", "X Chat PIN", "X Chat keys", "OAuth 1.0a X Chat", "chat-xdk"] +description: "Answers to the questions partners ask most about moving from legacy Direct Messages to the X Chat API: timeline, sign-in and permissions, enterprise app-owner keys, events and endpoints, and common errors." +keywords: ["X Chat FAQ", "X Chat migration FAQ", "X Chat partner FAQ", "legacy DM migration", "Direct Messages to X Chat", "X Chat PIN", "X Chat keys", "app-owner key", "enterprise X Chat", "OAuth 1.0a X Chat", "chat-xdk"] --- import { FaqSearch } from '/snippets/faq-search.mdx'; @@ -84,7 +84,9 @@ There is no time limit on how far back you can read — page with `pagination_to
Will my customers notice?
-For most customers this is a small change. At most, a customer may need to enter their X Chat PIN once. Accounts that have never set up X Chat do not need an existing PIN, because you can create encryption keys for them through the API (never replace existing X Chat keys without the customer's explicit approval; storing customer keys on your servers requires X's approval). +For **enterprise apps**, customers will barely notice. They connect your app through the standard OAuth flow with DM access — **no X Chat PIN, private key, or key export is needed**. X Chat automatically rotates their conversation keys to include your app's key. + +For **non-enterprise apps**, customers continue to manage their own X Chat keys and PIN on their own device.
@@ -139,7 +141,9 @@ The same applies when exchanging OAuth 1.0a tokens for OAuth 2.0: scopes come fr
Does Sign in with X change?
-**No.** The move to X Chat only affects DM access. To read or send X Chat for a user, the token needs DM access; if sign-in tokens already have it, nothing changes — otherwise users go through consent once. X Chat also needs the account's encryption keys, which are separate from sign-in. +**No.** The move to X Chat only affects DM access. To read or send X Chat for a user, the token needs DM access; if sign-in tokens already have it, nothing changes — otherwise users go through consent once. + +For **enterprise apps**, OAuth DM access is all the customer needs to grant — they do not share a PIN or encryption keys, because your app uses its own app-owner account's X Chat key pair. For **non-enterprise apps**, each account's encryption keys remain separate from sign-in and stay on the user's device.
@@ -149,29 +153,44 @@ The same applies when exchanging OAuth 1.0a tokens for OAuth 2.0: scopes come fr ## Keys, PINs, and storage -

Encryption keys, PINs, storing keys on your servers, and what happens when a customer leaves.

+

How enterprise app-owner keys work, why customers no longer share PINs, disconnecting apps, and how non-enterprise apps differ.

+ +
+
How do enterprise apps handle encryption keys?
+ +Enterprise apps use an **app-owner key model** instead of collecting customer PINs or private keys: + +- **One-time setup (app owner):** Give the X account that owns your app an X Chat key pair (the same kind any X Chat user has), keep its private key securely on your servers, and load it into `chat-xdk` with `set_identity(, )` (`setIdentity` in JavaScript/TypeScript). That single identity covers every customer your app serves. +- **Onboarding a customer:** The customer connects your app through the standard OAuth flow and grants DM access. **No PIN, private key, or key export is needed.** X Chat rotates the customer's existing conversation keys to include your app's owner key, and includes it on every new conversation key going forward. +- **Day-to-day reading and sending:** Fetch events and messages with the customer's OAuth token using the same API calls as usual. `chat-xdk`, loaded with your app-owner key, opens the conversation key wrapped for your app and decrypts the messages. To reply, encrypt and sign the message with `chat-xdk` and send it with the customer's OAuth token — it appears as coming from the customer. +- **Disconnecting:** When a customer disconnects your app, X Chat rotates the conversation key right away and leaves your app out. You keep access to messages from before the disconnect, but cannot read anything sent after. + +Non-enterprise apps do not use the app-owner key model and must use each user's own keys on-device (or per dedicated bot account). + +
What are keys and what is the PIN?
-Each X Chat account has a set of private encryption keys that unlock and sign the account's messages. Anyone who holds them can read that account's messages and send as that account, so treat them like a master password. The PIN is a short code the account owner sets in the X app to recover those keys from X's secure key backup. +Each X Chat account has a set of private encryption keys that unlock and sign the account's messages. Anyone who holds them can read messages wrapped to that key and sign as that account, so treat them like a master password. The PIN is a short code an account owner sets in the X app to recover their keys from X's secure key backup. + +**Enterprise apps do not need customers' PINs or private keys.** Your backend uses one X Chat key pair belonging to the X account that owns your app, and X Chat wraps your connected customers' conversation keys to that app-owner public key. (Non-enterprise and consumer apps still use each account's own keys and PIN on-device.)
My customers' staff use our web app, but only an admin knows the PIN. Does that work?
-**Yes, with approved server-side key storage.** Your backend can hold the account's encryption keys, decrypt messages as they come in, and display them to the customer's staff in your web app — staff never need the PIN. +**Yes — and for enterprise apps, neither the admin nor their staff ever need to enter a PIN.** Once the customer connects your app through OAuth with DM access, X Chat includes your app-owner public key in the customer's conversation keys. Your backend decrypts incoming messages with your own app-owner private key and displays them to the customer's staff in your web app. -The PIN is used only once, when the admin connects the company's X account. Unlock and export the keys once, save them securely in your KMS/secret manager, and never save the PIN. If the admin later changes their PIN in the X app, the saved keys keep working. They stop working only if the account owner runs **Reset Chat** or resets a forgotten PIN — watch for a change in `public_key_version`, and if it changes, stop sending from that account and ask the admin to reconnect. Key export works in the server and native editions of `chat-xdk`, not in the browser edition. +For **non-enterprise apps**, decryption runs on-device using the account's own keys (never collect end-user PINs on your servers).
What if the account has never set a PIN, or the admin doesn't know it?
-- **Never set up X Chat (`GET /2/users/{id}/public_keys` returns no keys):** You can create a new keypair for the account through the API and save it. Have the admin choose the account's PIN in your connect flow rather than picking one for them, so the business can still use X Chat in the X app later. -- **Already uses X Chat, but the admin doesn't know the PIN:** Do **not** replace existing keys silently. If the customer authorizes it and understands the trade-off, you can create and register a new keypair through the API (have the admin choose a new PIN in your connect flow so they can also use X Chat in the X app), or the admin can reset their PIN in the X app. Either way, registering new keys replaces the account's previous identity and makes messages encrypted under the old keys unreadable. +For **enterprise apps**, customers never need to know or share their PIN to connect your app. Connecting through standard OAuth with DM access is all that is required — no PIN prompt, key export, or key replacement is needed. Never generate or replace X Chat keys on a customer's account. Older unencrypted DMs do not need keys at all. @@ -180,7 +199,7 @@ Older unencrypted DMs do not need keys at all.
How do I check whether an account already has keys or can receive encrypted chats?
-Call `GET /2/users/{id}/public_keys` (or batch `GET /2/users/public_keys?ids=...`). If key backup details are returned, the account already uses X Chat — recover the existing keys with the PIN, or only create new keys with the customer's explicit approval (replacing keys makes messages encrypted under the old keys unreadable). +Call `GET /2/users/{id}/public_keys` (or batch `GET /2/users/public_keys?ids=...`) to check whether an account has registered X Chat public keys and to fetch current public keys for conversation key setup or rotation. To check whether you can start an encrypted chat with someone, request `GET /2/users/{id}?user.fields=receives_your_chat` with the sending account's token: `encrypted` means you can, `unencrypted` means the pair cannot be encrypted yet, and `none` means you cannot message them. @@ -189,39 +208,54 @@ To check whether you can start an encrypted chat with someone, request `GET /2/u
Is there a limit on wrong PIN guesses?
-**Yes.** Secure key backup allows only a small number of wrong guesses, and that budget cannot be reset. If it runs out, the backup is deleted and older encrypted messages become unreadable. Ask the account owner to confirm their PIN in the X app first, and stop after one wrong attempt. +**Yes**, though **enterprise apps using the app-owner key model never ask customers for a PIN**. This limit only applies if you call secure key backup `unlock(pin)` directly (for example, to recover your own app-owner account's keys from backup, or in a non-enterprise client app). -Unlock once per account and reuse the result — do not unlock per message or per request. Unlocks have a separate rate limit (about 30 per minute per IP address), independent of X API rate limits. +Secure key backup allows only a small number of wrong guesses, and that budget cannot be reset. If it runs out, the backup is deleted and older encrypted messages under those keys become unreadable. Stop after one wrong attempt and never auto-retry. Unlocks also have a separate rate limit (about 30 per minute per IP address), independent of X API rate limits — unlock once and reuse the result rather than unlocking per message or per request.
When a recipient changes their PIN or someone is added to a group chat, do we need to do anything?
-**No.** The conversation key updates automatically, and you do not need to redo conversation key setup. +Changing a PIN does not change encryption keys, so no action is needed. When someone is added to a group chat or a participant's keys change, the conversation key rotates. + +If your enterprise app needs to rotate a conversation key in order to send (for example, after a participant's key changes), include **every participant's current key plus the owner keys of any other connected enterprise apps** (on both your customer's account and the other participant's account). Leaving another connected app's owner key out will cut that app off from new messages.
Do I need X's approval to store keys on my servers?
-**Yes.** Storing customers' keys on your servers requires approval from X. All of the following must be true: - -- Your customers are businesses or organizations, not individual consumers. -- You run a business messaging or automation tool on their behalf. -- Your customers knowingly give you their key material. -- Each customer's keys are used only for that customer's own X Chat account. -- You tell customers, in your product or contract, that keys are separate from sign-in access and that revoking your app's access does not revoke keys they already shared. -- Your contract with each customer covers how you store and protect keys, who can access them, breach notice, and deleting or returning keys when the relationship ends. +**Not for customer keys — under the enterprise app-owner key model, you do not store customers' private keys or PINs at all.** You only store the private key for **your own app-owner X account** on your servers (protect it in a KMS, HSM, or secret manager with strict access controls). -To start the review, send your X account representative a Yes or No for each point above along with a short description of how your product uses X DMs. +Non-enterprise apps must not collect or store end users' PINs or private keys on a server — run `chat-xdk` on-device instead.
If a customer revokes my app's access, are the keys revoked too?
-**No.** Revoking access only stops your app's API tokens; keys a customer already shared keep working. When a customer leaves, delete every copy and backup of their keys and instruct them to revoke your app's access and run **Reset Chat** in the X app. Reset Chat is the only way to invalidate previously shared keys — there is no app-level key revocation today. +For **enterprise apps**, **yes for all future messages — automatically.** When a customer disconnects your app (revokes OAuth access), X Chat rotates the customer's conversation keys immediately and excludes your app's owner key. Your app retains access to messages from before the disconnect, but cannot read anything sent after — and the customer does **not** need to run **Reset Chat**. + +(For non-enterprise apps where an account's own private keys were exported or shared directly, revoking OAuth stops API tokens only and does not revoke those keys — **Reset Chat** is still required in that case.) + +
+ +
+
What happens if a customer connects more than one enterprise app?
+ +Multiple enterprise apps can be connected to the same customer account at the same time without conflicting over a shared PIN or overwriting the customer's keys. Each enterprise app has its own app-owner key pair, and conversation keys are wrapped to each participant's current key **plus** the owner keys of every connected enterprise app (on both sides of the conversation). + +When your app rotates a conversation key (for example, when replacing your owner key or sending after a participant's key changes), always include every participant's current key and the owner keys of all other connected enterprise apps so none of them lose access. + +
+ +
+
What happens if we lose or need to replace our app-owner key?
+ +Create a new X Chat key pair for your app-owner account, register it, and rotate your connected customers' conversations so the new conversation keys are encrypted to your new public key (keeping each participant's current key and any other connected enterprise apps' owner keys). + +Messages encrypted to the old app-owner key can no longer be read once that key is lost, so store your app-owner private key in a hardened KMS, HSM, or secret manager with backup and access controls.
@@ -235,21 +269,23 @@ X is reviewing this with its policy team and will update this answer.
If we pause our DM integration for a while, can we read those messages later?
-**Yes**, as long as you still have the keys needed to decrypt them and the account has not run Reset Chat or reset a forgotten PIN in the meantime. You can fetch history later while the account is still in the conversation. If you cannot stay subscribed, store the encrypted events (including the conversation key-change events on each page) and decrypt them later. +**Yes**, as long as the customer remained connected to your app during that period and you still have your app-owner private key. You can fetch history later while the customer is still in the conversation (or store the encrypted events, including the conversation key-change events on each page, and decrypt them later). If the customer disconnected your app during that time, conversation keys were rotated to exclude your app, so messages sent while disconnected cannot be decrypted.
Can we export keys in the browser? Can the PIN stay off our servers?
-The browser edition of `chat-xdk` cannot export keys. Export works in the server and native editions: Node (`@xdevplatform/chat-xdk-server`), Python, Go, .NET, JVM, and Rust. If the PIN must not touch your servers, the business can run a small local tool that unlocks and exports the keys on its own machine and uploads only the exported keys. Without approved key storage, decryption works only in the account owner's own session, so background or scheduled processing is not possible. There is no way to export keys without the PIN. +**Enterprise apps using the app-owner key model never ask customers for a PIN or export customer keys.** Your backend generates and persists only your own app-owner key pair using a server or native edition of `chat-xdk`: Node (`@xdevplatform/chat-xdk-server`), Python, Ruby, Go, .NET, JVM, or Rust. + +The browser edition (`@xdevplatform/chat-xdk` WASM) cannot export keys by design — for non-enterprise web UIs, end users unlock their own keys in the browser session so their PIN and private keys never leave their device.
Can we capture messages now and decrypt them after the customer gives us keys?
-**Yes**, as long as the account keeps the same X Chat keys. Store the encrypted events now, including the conversation key-change events on each page, and decrypt them once the customer provides key access. If the owner runs Reset Chat or resets a forgotten PIN before then, messages encrypted under the old keys cannot be decrypted. Capturing alone does not let you reply; replies must be sent encrypted. +Under the enterprise app-owner key model, customers never give you keys or PINs. Once your app-owner key pair is set up and the customer connects your app with DM access, X Chat rotates their conversations to include your app-owner public key so you can decrypt new messages going forward. Messages that were already encrypted under an earlier conversation key that did not include your app's key cannot be decrypted with your app-owner key; older unencrypted legacy DMs do not need keys and remain readable.
@@ -294,7 +330,7 @@ Existing DM subscriptions do not carry chat events, so create new subscriptions
Our bot only replies to messages. Do we need to do anything to start conversations?
-If you only reply to messages people send you, send your replies encrypted with `chat-xdk` — nothing else is required. To start a new 1:1 conversation yourself, set up the conversation key first with `POST /2/chat/conversations/{recipient_id}/keys`, then send. +If you only reply to messages people send you, send your replies encrypted with `chat-xdk` — nothing else is required. To start a new 1:1 conversation yourself, set up the conversation key first with `POST /2/chat/conversations/{recipient_id}/keys`, then send. For enterprise apps, include your app-owner key along with the participants' keys (and the owner keys of any other connected enterprise apps).