FeedHorizon API
Platforms

Twitter/X API

Post to X (Twitter), including tweets, media, and threads.

Overview

FeedHorizon supports publishing to X (Twitter) through OAuth 2.0 Authorization Code flow with PKCE.

You can connect an X account from Dashboard -> Connections and publish posts with text and media.

Authentication

X uses OAuth 2.0 for user authorization. FeedHorizon requests:

  • tweet.read
  • tweet.write
  • users.read
  • offline.access (recommended for refresh tokens)

X app registration (Developer Portal)

Before connecting accounts, create and configure your X app:

  1. Sign in at developer.x.com, then open console.x.com.
  2. Create a Project and an App.
  3. In User authentication settings, enable OAuth 2.0.
  4. Set app permissions to Read and write.
  5. Add callback URLs:
    • http://localhost:3000/api/connect/twitter/callback
    • https://YOUR_DOMAIN/api/connect/twitter/callback
  6. Copy your OAuth 2.0 Client ID and Client Secret.

Environment variables

Add the following variables:

X_CLIENT_ID=...
X_CLIENT_SECRET=...
X_REDIRECT_URI=http://localhost:3000/api/connect/twitter/callback
# Optional override
X_SCOPE=tweet.read tweet.write users.read offline.access

Content guidelines

FeatureLimit
Text length280 characters
Media attachmentsUp to 4
Supported mediaJPEG, PNG, GIF, MP4

Publish behavior

  • Text-only posts are supported.
  • Media posts upload assets first, then create a post with attached media IDs.
  • The API response includes the X post ID in platformPostIds.twitter.

Error handling

Common X-specific errors:

ErrorCauseSolution
Token expiredAccess token expiredRe-connect account (or use refresh flow)
Text too longMore than 280 charsShorten post content
Rate limitAPI limits reachedRetry later
Media upload failedUpload processing or format issueRe-upload media in supported format

Notes on limits and pricing

X API access tiers and limits can change by plan. Verify your project's rate limits and write limits in the X Developer Portal before production rollout.

View changelog updates
View platform overview