Skip to main content
POST
/
oauth
/
exchange
Complete OAuth2 account connection
curl --request POST \
  --url https://api.social-api.ai/v1/oauth/exchange \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "code": "AQDtbPB9X...",
  "metadata": {},
  "platform": "instagram"
}
'
{
  "account_id": "acc_01HZ9X3Q4R5M6N7P8V2K0W1J",
  "display_name": "Acme Corp",
  "platform": "instagram",
  "username": "acmecorp"
}

Authorizations

Authorization
string
header
required

Prefix your API key with "Bearer ". Example: Authorization: Bearer sapi_key_...

Body

application/json

Platform, code, and metadata (redirect_uri + state)

code
string

Code is the authorization code received from the platform callback.

Example:

"AQDtbPB9X..."

metadata
object

Metadata must include redirect_uri and state for CSRF validation.

platform
string

Platform identifies the social platform (must match the connect call).

Example:

"instagram"

Response

Account connected

account_id
string
Example:

"acc_01HZ9X3Q4R5M6N7P8V2K0W1J"

display_name
string
Example:

"Acme Corp"

platform
string
Example:

"instagram"

username
string
Example:

"acmecorp"