X (Twitter)

Configure X (Twitter) in Outstand with your own API credentials (BYOK) for full control over the OAuth flow and white-label connections.

X (formerly Twitter) is fully supported in Outstand only through the Bring Your Own Key (BYOK) model. This allows you to use your own X API credentials, giving you complete control over the OAuth flow and ensuring your customers never see Outstand branding during account connection.

Managed Keys do not cover X (Twitter). Outstand ships no managed X OAuth app, so registering your own X application and adding its credentials is required - not an optional white-labelling step. X accounts cannot be connected until you have done so.

Quick Information

Our application works with the following OAuth scopes:

  • tweet.read - Read user tweets and timeline
  • tweet.write - Create and publish tweets
  • users.read - Read user profile information
  • offline.access - Keep users signed in
  • follows.read - Read user followers and following
  • dm.write - Create and publish direct messages (only requested when DM messaging is on)

These are the OAuth scopes the integration uses. X is BYOK-only - Outstand ships no managed X app, so your own application must request them. dm.read and dm.write are only requested when your organization has the DM messaging setting turned on, see Events.

Our API supports only OAuth2.0 flows.

Prerequisites

Before you begin, ensure you have:

  • An X (Twitter) developer account with approved API access
  • An active access plan on the POST /2/tweets endpoint (see the note below)
  • Understanding of OAuth 2.0 flows

Important: As of February 2026, X closed the legacy Free/Basic/Pro tiers to new sign-ups and moved new developers to a pay-per-usage credit model. A brand-new developer app is not enrolled on POST /2/tweets by default - OAuth consent will succeed, but the first publish returns client-not-enrolled. Make sure your app is enrolled under a project with an active access plan (pay-per-use or a legacy tier if your account still has one) before connecting. Check your developer portal dashboard for the plan and limits that apply to your account, and see X's pricing and tiers for details.

Step 1: Create an X Developer Account

If you don't already have one:

  1. Go to developer.x.com
  2. Click Sign up and follow the authentication flow
  3. Accept the Developer Agreement
  4. Complete your developer profile
  5. Create a new project or join an existing one

Step 2: Create an App

  1. Navigate to your project dashboard at developer.x.com/portal
  2. Click Create App or select your existing app
  3. Fill in the required information:
    • App name: Your application name (e.g., "My Company Social Media Manager")
    • App environment: Production (or Development for testing)
    • App permissions: Select the permissions you need:
    • tweet.read - Read user tweets and timeline
    • tweet.write - Create and publish tweets
    • users.read - Read user profile information
    • offline.access - Keep users signed in
    • follows.read - Read user followers and following
    • dm.write - Create and publish direct messages

Step 3: Configure OAuth 2.0

  1. In your app settings, navigate to User authentication settings

  2. Enable OAuth 2.0 as the authentication method

  3. Configure the following settings:

    • App permissions: Select the appropriate scopes (see above)
    • Type of App: Web App
    • Callback URL / Redirect URL:
      • For production: https://www.outstand.so/app/api/socials/x/callback
    • Website URL: Your application's website
    • Privacy Policy URL: Your privacy policy page
    • Terms of Service URL: Your terms of service page
  4. Click Save to save your OAuth 2.0 settings

Step 4: Obtain Your Credentials

  1. Navigate to your app's Keys and tokens tab

  2. You'll find two crucial values:

    • API Key (Client ID): This is your OAuth 2.0 Client ID
    • API Secret (Client Secret): This is your OAuth 2.0 Client Secret
  3. Click Generate if your keys haven't been generated yet

Security Note: Your API Secret is only shown once when first generated. Save it immediately in a secure location. If you lose it, you'll need to regenerate new keys from the X Developer Portal.

Step 5: Add Credentials to Outstand

Once you have your Client ID and Client Secret, you can add them to Outstand using either method:

Method 1: Using the Dashboard

  1. Log in to Outstand Dashboard
  2. Navigate to Settings → Social Networks
  3. Select X (Twitter) from the dropdown
  4. Enter your Client ID in the "Client ID / API Key" field
  5. Enter your Client Secret in the "Client Secret / API Secret" field
  6. Click Add Social Network

Method 2: Using the API

curl -X POST https://api.outstand.so/v1/social-networks \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "network": "x",
    "client_key": "YOUR_CLIENT_ID_HERE",
    "client_secret": "YOUR_CLIENT_SECRET_HERE"
  }'

Step 6: Connect Your X Account

After adding your credentials:

  1. Navigate to Accounts in your Outstand dashboard
  2. Click Connect Account
  3. Select X (Twitter)
  4. Complete the X authorization flow
  5. Your X account will appear in your connected accounts list

Troubleshooting

"Invalid client credentials"

  • Verify you copied the Client ID and Client Secret correctly (no extra spaces)
  • Ensure you haven't regenerated the keys without updating Outstand
  • Check that your app has OAuth 2.0 enabled in the developer portal

"Redirect URI mismatch"

  • Verify the callback URL in your X app settings matches the Outstand callback URL
  • Contact support if you're unsure of the correct callback URL

"Insufficient permissions"

  • Ensure your app has the required permissions enabled (tweet.write, users.read, offline.access)
  • You may need to request elevated access for certain operations

Media Requirements

Media is validated by X at publish time. The following limits come from X's official API media documentation - see Media best practices.

Text

  • Post length: 280 characters (standard). Verified/Premium accounts can publish up to 25,000 characters (longform). See Counting characters. Character counting is based on Unicode NFC-normalized code points, and URLs are always counted as 23 characters.

Images

RequirementSpecification
FormatsJPG, PNG, GIF, WEBP
Maximum size5 MB (the exact cap varies by media_category)
Items per postUp to 4 images

Animated GIFs

RequirementSpecification
FormatsGIF
Maximum size15 MB
Items per post1 (a GIF cannot be combined with other media)

Video

RequirementSpecification
FormatsMP4, MOV
Maximum size512 MB
Duration0.5 seconds to 140 seconds
Dimensions32x32 (min) to 1280x1024 (max)
Frame rateUp to 60 FPS (H264 High Profile recommended)
Aspect ratio16:9 or 1:1 recommended
Items per post1

A single post may contain either up to 4 images, or 1 animated GIF, or 1 video - the media types cannot be mixed.

Alt Text

Set containers[].media[].altText on an image or GIF to give it screen-reader alt text:

{
  "containers": [{
    "content": "Check out our launch",
    "media": [{
      "url": "https://media.yoursite.com/images/launch.jpg",
      "filename": "launch.jpg",
      "altText": "Screenshot of the launch dashboard"
    }]
  }]
}

Applied to images and GIFs via X's media metadata endpoint after the upload finishes. Max 1,000 characters. Not supported for video. If setting the alt text fails, the tweet still publishes without it.

Polls

To publish the first tweet as a poll, pass x.poll when you create a post:

"x": {
  "poll": {
    "options": ["Yes", "No", "Not sure"],
    "durationMinutes": 1440
  }
}
FieldRequirement
options2-4 options, each 1-25 characters. Required.
durationMinutesHow long the poll stays open, in minutes. 5 to 10,080 (7 days). Required.

Restrictions:

  • x.poll applies to the first tweet only - reply/thread containers are unaffected.
  • A poll cannot be combined with media on the first container. Including both returns a 400.

Publishing Rate Limits

X enforces posting limits on the POST /2/tweets endpoint that depend on your access tier. These are per user and per app over a rolling 24-hour window. See X API rate limits and the Manage Posts introduction.

Access tierCreate post limit
Free17 posts per 24 hours (per user and per app)
Basic100 posts per 24 hours per user (commonly documented)
Pro / EnterpriseHigher limits - see your developer portal
  • The endpoint also enforces a technical limit of 200 requests / 15 minutes per user and a combined 300 requests / 3 hours across Manage Posts and Manage Retweets.
  • Important: As of February 2026 X moved new developers to a pay-per-usage credit model, and the legacy Free/Basic/Pro tiers are closed to new sign-ups. The per-tier figures above apply to legacy-tier accounts. Check your developer portal dashboard for the limits that apply to your account.

Posting Threads

A thread is a post with multiple containers: the first container is the root tweet, and each container after it is published as a reply. Each reply is chained onto the previous reply, not onto the root tweet - so the third tweet in a thread replies to the second, not the first. An empty-text reply container is skipped. If a reply fails to publish, it is recorded as failed and the next reply still goes out, chained onto the last reply that succeeded (leaving a gap in the thread rather than stopping it).

Important Notes

  • Premium Access: For high-volume use cases, you may need to apply for premium access tiers or Twitter API Enterprise.

  • Credential Security: Never commit your Client ID or Client Secret to version control. Use environment variables or secure credential management tools.

Comment Webhooks and Direct Messages

X delivers replies and Direct Messages through the X Activity API to a webhook on your own X app. Register Outstand's URL on the app once, and Outstand subscribes each account to its events when it connects.

Register the webhook

Register https://webhooks.outstand.so/x/YOUR_CLIENT_ID, where YOUR_CLIENT_ID is the OAuth 2.0 Client ID you added to Outstand, using your X app's App-Only Bearer Token:

curl -X POST https://api.x.com/2/webhooks \
  -H "Authorization: Bearer YOUR_X_APP_BEARER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://webhooks.outstand.so/x/YOUR_CLIENT_ID"}'

X checks the URL with a CRC challenge during the call, which Outstand answers with the Client Secret you added. Register it before connecting accounts: Outstand subscribes an account only when it connects, so an account connected earlier receives nothing until it is reconnected.

Events

X eventScopeRequested by defaultOutstand sends
post.reply.createtweet.readYescomment.received
dm.received, dm.sentdm.readOnly with DM messaging onconversation.started, message.received, message.sent
  • Replies - comment.received fires for direct replies to the account's posts, including posts published outside Outstand. X does not send replies to replies, replies from protected accounts, or the account's own replies. See the comment.received payload.

  • Direct Messages - dm.read and dm.write are only requested when your organization has DM messaging turned on: an org owner or admin turns it on in the Outstand dashboard under Settings > Security. With it on, they are part of the default scopes, so an authentication URL without scopes enables DMs. With it off, a scopes list that includes either is refused with 403 and "code": "dm_messaging_disabled". A scopes list replaces the defaults, so if you pass one, include them too:

    curl -X POST https://api.outstand.so/v1/social-networks/x/auth-url \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "redirect_uri": "https://your-app.example.com/social/callback",
        "scopes": "tweet.read,tweet.write,users.read,follows.read,dm.read,dm.write,media.write,offline.access"
      }'
  • Reply in a direct message - answer a reply with POST /v1/conversations, passing commentId from the event as x.comment_id. See Comment-to-DM.

  • Subscription limit - each event type for each account is one subscription on your app, and a self-serve X app allows 1,500. An account uses one, or three with Direct Messages.

What X bills to your app

X bills these reads to your app's credits, not to Outstand:

WhenWhat Outstand callsBilled as
A reply is deliveredThe post.reply.create event itself1 Post read
comment.received is sentA lookup of the reply's author for author: follow status, follower count and verification1 User read for each connected account the reply is sent for
You start a conversation with x.usernameA lookup of the user's ID1 User read
You start a conversation with x.comment_idA lookup of the reply and its author1 Post read

Publishing, sending DMs and other calls are billed at X's own rates. See X's pricing.

Next Steps

Once your X credentials are configured and accounts connected, you can:

  1. Create posts for X using the Posts API
  2. Upload media for your tweets via the Media API
  3. Schedule posts for optimal engagement using the scheduling features