At a glance
Capabilities
An unsupported call returns501 resource.not_supported.
The cross-platform matrix is on Platforms.
Connect an account
Save your X app’s OAuth 2.0 Client ID and Client Secret in the SocialAPI dashboard first: Use your own X app. Then connect withPOST /v1/accounts/connect and "platform": "twitter". The shared flow, request fields, and result are in Connect accounts, and the redirect parameters are in Redirect parameters.
- Saved app credentials. Without them,
POST /v1/accounts/connectreturns412 byok.credentials_missing. When X rejects the saved credentials, or refuses your app access to its API, the connection ends on your redirect URI with theerrorparameter set tobyok.credentials_invalidorbyok.app_access_denied. - One app per brand. A brand can use a different X app from your default one: see Use your own X app.
- Reconnect. X access tokens last 2 hours and SocialAPI renews them. If renewal fails, for example because the person revoked access, the first call that fails returns
401 platform.twitter.authand the account is markedtoken_expired. Every later call that acts on the account returns403 account.reconnection_requireduntil you reconnect it. See Reconnect an account. - Media scope. Uploading media needs the
media.writescope. An account connected without it fails an upload with403 platform.twitter.insufficient_scopeuntil the person reconnects.
Comments
List replies to a post withGET /v1/inbox/comments/{postId}, where postId is the post’s platform ID (targets[].platform_post_id). Reply, hide, unhide, and delete work as described in Comments. X-specific rules:
- 7-day window. X returns replies posted in the last 7 days. A reply to a post older than that does not appear.
- Hide. Hide and unhide work on replies to the connected account’s own posts.
- Delete. Deleting works only on a reply the connected account wrote.
- Like. X removed like writes for self-serve apps. Read
can_likeon each comment rather than assuming.
Direct messages
List conversations withGET /v1/inbox/conversations, read one with its messages, and send with the DM endpoints in Direct messages. X-specific rules:
- Text only. A DM sends text. An attachment is rejected before anything is sent.
- Recipient. A send goes to the other person in the conversation. A group conversation has no single recipient, so a send to it is refused.
- X’s own limit. X allows 15 DM read requests per 15 minutes for each connected account. Past it, calls return
429 platform.twitter.rate_limit.
Limits
Scopes
You choose the app permissions (Read and write, and Direct message) on your own X app, as described in Use your own X app. SocialAPI requests these scopes when the person connects the account. Each scope belongs to the account permissions in the last column, and the consent screen asks for the scopes of the permissions you selected.Related
- X publishing: fields, media rules, threads, and quirks for publishing
- Use your own X app: create the X app and save its credentials
- Platform apps: which platforms use SocialAPI’s app and which use yours
- Platforms: the capability matrix
- Errors: every error code