Skip to main content
Available BYOK connector - Twitter requires you to bring your own Twitter Developer app. Setup takes about ten minutes. See Platform credentials for why Twitter is the only platform that works this way.

At a glance

Setup

Before you can connect any Twitter account, register a Twitter Developer app and paste your Client ID and Client Secret into your SocialAPI dashboard. See the Twitter BYOK setup guide for the ten-minute walkthrough.

Capabilities

Connecting

Response:
Redirect your user to auth_url. After they authorize, SocialAPI exchanges the code with X and redirects the user to your redirect_uri with the connection result. See OAuth flows for the redirect parameters.

Reading samples

List posts

List comments on a post

List DMs

List mentions

Publishing

Create a tweet with optional X-specific settings:

Platform data fields

Pass these inside the target’s platform_data when creating a post. All fields are optional. Invalid values (a bad reply_settings enum, a wrong field type, an empty or over-length thread entry) are rejected by POST /v1/posts/validate and by create with a validation error, before any tweet is published. Unrecognized platform_data keys are ignored with a warning.

Threads

Set thread to an array of strings to publish a chained thread. The target’s text is the root tweet (tweet 1) and each thread entry is posted as a reply to the one before it. Continuation tweets are text-only: the platform_data settings above apply to the root tweet only.
The published post’s ID is the root tweet’s ID. Continuation tweet IDs are returned in the post metadata under thread_post_ids. If a continuation tweet fails partway through, publishing stops: the tweets posted so far stay live (X has no batch rollback), the metadata records thread_failed_at_index, and the request returns an error. Each tweet in a thread is a separate billable X write. Posts containing a URL cost significantly more per X’s pay-per-use pricing, so keep links minimal.

Limitations and gotchas

  • Text-only posts. Posts carry text plus the platform_data settings above, and can be chained into threads. Media upload is not implemented yet, so image and video attachments are ignored. Polls and quote tweets are also unsupported.
  • No post editing. X’s edit capability (edit_options.previous_post_id) is gated to Enterprise on the pay-per-use tier, so it is not available to self-serve BYOK apps. UpdatePost returns 501. Delete and re-create if needed.
  • No webhook handler. X does not push real-time events via this integration. Posts and comments are fetched on demand.
  • Comment moderation. Hide toggles reply visibility. Delete removes your own replies. Liking is not available: X removed like/unlike writes from all self-serve tiers (April 2026), so can_like is false.
  • Token refresh. X OAuth 2.0 tokens expire after two hours. SocialAPI proactively refreshes the access token when fewer than 5 minutes remain on the current token, so most requests complete without interruption. If you receive 401 with code: "invalid_token", the refresh itself failed (for example, the refresh token was revoked): reconnect the account.
  • Required scopes. Your X Developer App must have the appropriate OAuth 2.0 scopes for reading tweets, posting, DMs, and user lookup.

Permissions

Because Twitter is BYOK, you control the OAuth scopes on your own Twitter Developer app. We recommend enabling these scopes for full functionality: read and write tweets, read and send DMs, user lookup. See the Twitter BYOK setup guide for the exact scope list to select in the X Developer Portal.