All integrations

X

Create, edit, and delete X posts, plus follower and post engagement analytics.

OAuth 11 tools

Overview

Connect X (formerly Twitter) so AI clients can create, edit, and delete posts, and pull follower and post engagement analytics from your account.

You bring your own X developer app. stackgate.ai does not include X API credits — you create an app in the X Developer Console, purchase credits from X, and paste your app's Client ID and Client Secret here before connecting your X account via OAuth.

Prerequisites

  • An X account
  • A stackgate.ai account
  • An X developer account with a pay-per-use app and prepaid API credits
  • Post editing requires X Premium on the connected account (and posts must still be inside the edit window)
  • Quote posts via the API may require a higher X API access tier on your developer app

X API billing (what you pay X for)

X no longer offers a meaningful free tier for new developers. New apps use pay-per-use billing:

  1. No monthly subscription — you buy credits upfront in the Developer Console.
  2. Per-request pricing — reads (posts, users, followers) and writes (create/delete posts) deduct credits at rates shown in the console.
  3. Credits required — without credits, API calls return 402 Payment Required (credits depleted). Only some endpoints (such as GET /2/users/me) may work on a depleted balance during testing.
  4. No referral program — X does not offer affiliate or referral discounts for API access. There is an optional xAI credit rebate when you link an xAI team to your developer account (up to 20% of cumulative X API spend in a billing cycle — see X API pricing).

Legacy Basic ($200/mo) and Pro ($5,000/mo) plans are closed to new signups. High-volume use may require Enterprise (contact X sales).

Getting credentials

1. Create an X developer app

  1. Sign up at developer.x.com and open the Developer Console.

  2. Create a project and app with OAuth 2.0 enabled (confidential client with Client Secret).

  3. Under app settings, add this Callback URL / Redirect URI (copy it — do not open it in your browser):

    https://stackgate.ai/oauth/x/callback

    stackgate.ai shows the same URL on the X integration setup page.

  4. Enable OAuth 2.0 scopes your app needs: tweet.read, tweet.write, users.read, follows.read, and offline.access (for refresh tokens).

2. Purchase API credits

In the Developer Console, open Billing or Credits and add a payment method. Purchase credits before testing MCP tools — most read/write endpoints fail until credits are available.

3. Connect in stackgate.ai

  1. Sign in to stackgate.ai.
  2. Go to My Integrations and open X.
  3. Click Activate, paste your app's Client ID and Client Secret, and click Save app credentials.
  4. Click Connect X account and approve the OAuth prompt — stackgate.ai stores your tokens securely alongside your app credentials.

Using with AI clients

  • Dedicated endpoint: POST /mcp/x with a Sanctum bearer token
  • Private gateway: one config for all integrations — use x__* namespaced tools

See Documentation for HTTP authentication and private gateway setup.

Troubleshooting

  • 422 integration not configured — save app credentials and complete the OAuth connect flow in My Integrations.
  • 402 credits depleted — purchase more credits in the X Developer Console.
  • Connect blocked before OAuth — save Client ID and Client Secret first, then use Connect X account.
  • Authorization expired — disconnect and reconnect X from the integration page.
  • 429 rate limited — X enforces per-user and per-app limits; wait for the window to reset and retry.
  • Edit fails — editing requires X Premium and a post still within the edit window; confirm with get_post (edit_controls).
  • Organic / non-public metrics missing — those fields are only available for your own posts from the last 30 days.
  • Quote post rejected — quote creation may not be enabled on your X API plan.

Available tools

  • get_me

    Get the authenticated X user profile, including public follower and post metrics.

  • get_account_analytics

    Get account-level analytics for the authenticated user: followers, following, tweet, and listed counts via public_metrics.

  • create_post

    Create a new post for the authenticated user. Optionally reply to a post or quote another post (quote may require a higher X API tier).

  • edit_post

    Edit a recent post you own. Requires X Premium and a post still within the edit window. Provide edit_options.previous_post_id.

  • delete_post

    Delete a post authored by the authenticated user.

  • get_post

    Look up a post by ID, including public metrics and edit metadata. Organic/non-public metrics require owning the post and a post age under 30 days.

  • get_post_analytics

    Get engagement analytics for a post (likes, reposts, replies, impressions, and when available organic/non-public metrics for your own posts from the last 30 days).

  • list_posts

    List recent posts for a user. Defaults to the connected account (credential x_user_id).

  • list_followers

    List followers for a user. Defaults to the connected account.

  • list_following

    List accounts the user follows. Defaults to the connected account.

  • get_user

    Look up a user by ID or username, including public metrics.

MCP endpoint: https://stackgate.ai/mcp/x (HTTP) or via the private gateway.