Skip to main content
Social Accounts

Connect

Initiate an OAuth flow to connect a social media account.

Endpoint

GET https://api.postpeer.dev/v1/connect/{platform}

Path Parameters

ParameterTypeDescription
platformstringPlatform to connect: "twitter", "youtube", "pinterest", or "linkedin"
*More coming soon

Query Parameters

ParameterTypeRequiredDescription
redirectUristringNoURL to redirect the user to after successful connection

Example

curl "https://api.postpeer.dev/v1/connect/twitter" \
  -H "x-access-key: YOUR_API_KEY"

With redirect:

curl "https://api.postpeer.dev/v1/connect/twitter?redirectUri=https://yourapp.com/connected" \
  -H "x-access-key: YOUR_API_KEY"

Response

{
  "url": "https://twitter.com/i/oauth2/authorize?response_type=code&client_id=..."
}

Redirect the user to the returned url. After they authorize on the platform, PostPeer's callback handles the token exchange and stores the connection. If redirectUri was provided, the user is redirected there after a successful connection.

How It Works

  1. Your app calls GET /v1/connect/{platform} to get an OAuth URL
  2. Redirect the user to that URL (or open it in a new tab)
  3. The user authorizes on the platform (Twitter, YouTube, etc.)
  4. The platform redirects to PostPeer's callback
  5. PostPeer exchanges the code for tokens and stores them encrypted
  6. If redirectUri was set, the user is redirected back to your app

Status Codes

CodeMeaning
200OAuth URL generated
403Platform not available
500Platform credentials not configured

On this page