Start the OAuth flow that links an X/Twitter account to your AIsa API key. Call once per source user before using any Twitter write endpoint (follow, like, post, DM).
POST /apis/v1/twitter/auth_twitter is the first step for any X/Twitter write action routed through AIsa. It returns a short-lived X OAuth authorization URL — the source user opens it in a browser, approves the requested scopes, and X redirects back to AIsa’s fixed callback. AIsa stores the resulting session against your API key, and every subsequent write call (e.g., POST /twitter/follow_twitter) uses that session automatically.
Start the flow
POST /apis/v1/twitter/auth_twitter with your AIsa API key. Optionally include a scopes array in the body to request a narrower set than the default.Open the auth URL
auth_url and a state token. Open auth_url in the source user’s browser. X shows its standard “Authorize AIsa to access your account” screen.User approves
https://api.aisa.one/apis/v1/twitter/oauth_callback). AIsa validates the state token, exchanges the authorization code for tokens, and stores the session against your API key.scopes field, AIsa requests the full set needed for every Twitter write endpoint we expose:
follows.write — follow / unfollowtweet.read — read tweets (required by most write actions)users.read — resolve users, read profile infotweet.write — post, reply, quotelike.write — like / unlikedm.read — read DM threadsdm.write — send DMs["follows.write", "tweet.read", "users.read"]) if you only need a subset. Write calls that require a missing scope return 403.
auth_url returned by this endpoint is short-lived (typically 10 minutes). If the user doesn’t complete the flow before expires_at, call POST /apis/v1/twitter/auth_twitter again to generate a fresh URL.
The stored OAuth session itself lives longer (subject to X’s token rotation rules) and is refreshed automatically as long as the user doesn’t revoke access from X’s app settings.
Your AIsa API key. The authenticated source user (the account doing the follow) is determined by the OAuth session attached to your key.
Optional list of X OAuth 2.0 scopes to request. Defaults to the set required by AIsa's Twitter write endpoints: follows.write, tweet.read, users.read, tweet.write, like.write, dm.read, dm.write.
["follows.write", "tweet.read", "users.read"]Authorization URL generated.
Short-lived X OAuth authorization URL. Open it in a browser so the source user can approve the requested scopes.
Opaque CSRF state token that AIsa will validate when X redirects back to its callback. Store it client-side if you need to correlate the flow.
When the auth_url expires. Request a new one if the user hasn't completed the flow before this time.