Documentation Index
Fetch the complete documentation index at: https://docs.social-api.ai/llms.txt
Use this file to discover all available pages before exploring further.
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
| Field | Value |
|---|
| Platform slug | twitter |
| Auth type | OAuth 2.0 (BYOK) |
| API | X API v2 |
| Best for | Real-time conversation: tweets, replies, DMs, mentions on X. |
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
| Feature | Supported | Notes |
|---|
| List posts | Yes | Returns user tweets |
| Comments | Yes | Replies to a specific tweet |
| Reply to comment | Yes | |
| Comment replies (thread) | Yes | |
| Moderate comment (hide/delete) | Yes | Hide a reply, or delete your own reply |
| Like comment | Yes | Like/unlike a tweet or reply |
| Private reply | No | Not applicable |
| DMs | Yes | Direct Messages via X API v2 |
| Send DM | Yes | |
| Reviews | No | Not applicable |
| Mentions | Yes | Tweets mentioning the authenticated user |
| Create post | Yes | Text tweets, with optional media |
| Update post | No | X does not expose a public edit endpoint |
| Delete post | Yes | |
Connecting
curl -X POST https://api.social-api.ai/v1/accounts/connect \
-H "Authorization: Bearer $SOCAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "twitter",
"metadata": {
"redirect_uri": "https://app.example.com/oauth/callback"
}
}'
Response:
{
"auth_url": "https://twitter.com/i/oauth2/authorize?client_id=...&state=...",
"state": "4a8f2c1e9b3d7f06a5c2e8b4d1f3a7e2"
}
Redirect your user to auth_url. After they authorize, X redirects to your redirect_uri with ?code=...&state=.... Then call:
curl -X POST https://api.social-api.ai/v1/oauth/exchange \
-H "Authorization: Bearer $SOCAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "twitter",
"code": "abc123...",
"metadata": {
"state": "4a8f2c1e9b3d7f06a5c2e8b4d1f3a7e2",
"redirect_uri": "https://app.example.com/oauth/callback"
}
}'
Reading samples
List posts
curl "https://api.social-api.ai/v1/posts?account_ids={id}&limit=10" \
-H "Authorization: Bearer $SOCAPI_KEY"
curl "https://api.social-api.ai/v1/accounts/{id}/posts/{pid}/comments?limit=10" \
-H "Authorization: Bearer $SOCAPI_KEY"
List DMs
curl "https://api.social-api.ai/v1/inbox/conversations?account_id={id}" \
-H "Authorization: Bearer $SOCAPI_KEY"
List mentions
curl "https://api.social-api.ai/v1/accounts/{id}/mentions?limit=10" \
-H "Authorization: Bearer $SOCAPI_KEY"
Publishing
Create a tweet with optional reply settings:
curl -X POST https://api.social-api.ai/v1/posts \
-H "Authorization: Bearer $SOCAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"account_ids": ["acc_01HZ9X3Q4R5M6N7P8V2K0W1J"],
"text": "Hello from SocialAPI!",
"platform_data": {
"twitter": {
"reply_settings": "everyone"
}
}
}'
PlatformData fields. Pass these inside platform_data.twitter when creating a post.
| Field | Type | Default | Description |
|---|
reply_settings | string | "everyone" | Who can reply to this tweet. Options: "everyone", "following" (only people you follow), "verified" (only verified accounts). |
See Twitter posts reference for full publishing details.
Limitations and gotchas
- No post editing. X does not expose a public edit API.
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. Like/unlike is supported.
- Token refresh. X OAuth 2.0 tokens expire. SocialAPI handles refresh automatically. If you receive
401 with code: "invalid_token", 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.