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.readtweet.writeusers.readoffline.access(recommended for refresh tokens)
X app registration (Developer Portal)
Before connecting accounts, create and configure your X app:
- Sign in at developer.x.com, then open console.x.com.
- Create a Project and an App.
- In User authentication settings, enable OAuth 2.0.
- Set app permissions to Read and write.
- Add callback URLs:
http://localhost:3000/api/connect/twitter/callbackhttps://YOUR_DOMAIN/api/connect/twitter/callback
- 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.accessContent guidelines
| Feature | Limit |
|---|---|
| Text length | 280 characters |
| Media attachments | Up to 4 |
| Supported media | JPEG, 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:
| Error | Cause | Solution |
|---|---|---|
Token expired | Access token expired | Re-connect account (or use refresh flow) |
Text too long | More than 280 chars | Shorten post content |
Rate limit | API limits reached | Retry later |
Media upload failed | Upload processing or format issue | Re-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.