Skip to main content
POST
/
oauth
/
exchange
Exchange OAuth code for tokens
curl --request POST \
  --url https://app.autoposting.ai/api-proxy/oauth/exchange \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "platform": "linkedin",
  "code": "AQT...",
  "brandSlug": "acme-corp",
  "redirectUri": "https://app.acme.com/oauth/callback",
  "state": "abc123"
}
'
{
  "success": true,
  "data": {
    "tokenId": "tok_01HXYZ",
    "platform": "linkedin",
    "platformUserId": "lin_abc123",
    "platformUsername": "Jane Doe",
    "brandSlug": "acme-corp",
    "scopes": [
      "r_liteprofile",
      "w_member_social"
    ],
    "expiresAt": "2025-01-01T00:00:00Z"
  }
}

Authorizations

Authorization
string
header
required

API key as Authorization: Bearer sk-social-...

Body

application/json
platform
enum<string>
required
Available options:
x,
linkedin,
instagram,
threads,
youtube
Example:

"linkedin"

code
string
required

Authorization code from the OAuth redirect callback.

Example:

"AQT..."

brandSlug
string
required

Brand to attach the token to.

Example:

"acme-corp"

redirectUri
string
required

Must match the redirectUri used in the authorization step.

Example:

"https://app.acme.com/oauth/callback"

state
string

State parameter from the authorization URL (for CSRF validation).

Example:

"abc123"

Response

Token stored.

success
boolean
Example:

true

data
object

A platform token created from an OAuth code exchange.