Send your users through the (sandbox) consent flow to connect an X, LinkedIn, Instagram or Facebook account.
Connecting works like an OAuth redirect: your server asks BetterPost for a URL, your user opens it, approves access,
and is sent back to your app. Each connection becomes an integration whose id you use as accountId when
posting.
curl -s "https://api.betterpost.dev/v1/connect/linkedin?profileId=prof_1b7r4a9n2d5c8l0e3k6s9m2x&redirectUri=https%3A%2F%2Fapp.example.com%2Fsocial%2Fdone" \
-H "x-access-key: $BETTERPOST_API_KEY"{ "url": "https://betterpost.dev/sandbox/authorize?state=Qm3x9TzK2pV8wLr4nB6yHc1dF7gJ0sAeUoXiZtNq" }{platform} is twitter, linkedin, instagram or facebook.profileId (optional) puts the new account in that profile.redirectUri (optional) is an absolute http(s) URL to return to. URL-encode it.In the sandbox the URL opens BetterPost's simulated consent screen (see Sandbox mode). The link is single-use and expires after 15 minutes.
| Outcome | Redirect |
|---|---|
| Authorized | redirectUri?connected=acc_...&platform=linkedin |
| Cancelled | redirectUri?error=access_denied |
Read connected to get the new integration's id, or call list accounts.
When an account's authStatus becomes reconnect_required (you also get an account.reauthorization_required
webhook), run the same flow again with the same profile and authorize the same handle. The
existing integration is reactivated with the same id, so stored accountIds keep working.
Reference: GET /v1/connect/{platform}.