Skip to main content

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

FieldValue
Platform slugtwitter
Auth typeOAuth 2.0 (BYOK)
APIX API v2
Best forReal-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

FeatureSupportedNotes
List postsYesReturns user tweets
CommentsYesReplies to a specific tweet
Reply to commentYes
Comment replies (thread)Yes
Moderate comment (hide/delete)YesHide a reply, or delete your own reply
Like commentYesLike/unlike a tweet or reply
Private replyNoNot applicable
DMsYesDirect Messages via X API v2
Send DMYes
ReviewsNoNot applicable
MentionsYesTweets mentioning the authenticated user
Create postYesText tweets, with optional media
Update postNoX does not expose a public edit endpoint
Delete postYes

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"

List comments on a post

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.
FieldTypeDefaultDescription
reply_settingsstring"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.