Connect

Create Connect Session

Starts connecting an account. Send the account owner's browser to url, where they sign in on the platform.

POST
/v1/connect-sessions

Authorization

Bearer
headerAuthorizationBearer <op_>

Workspace API key, sent as Authorization: Bearer op_... Keys are created in the dashboard.

Header Parameters

Idempotency-Key?string

A unique key, such as a UUID, that makes retrying this request safe. A repeat with the same key and body within 24 hours returns the first response instead of acting again. A 429 or 5xx response is not kept, so a retry with the same key runs again.

Length1 <= length <= 255

Request Body

application/json
  1. body
platform*string

Platform to connect. Bluesky connects with an App Password through Create Account instead.

Value in"x""instagram""facebook""threads""linkedin""youtube""tiktok""pinterest"
redirectUrl?string

Where the browser returns when the connect finishes. Required with an API key. The connected account id arrives as the accountId query parameter.

Formaturi
profile?string

Profile to file the new account under. It is created if it does not exist. Defaults to the workspace's Default profile.

Length1 <= length <= 60
metadata?

Your own key-value pairs for the new account, such as the id of your user. The account returns them as metadata, and so does the account.connected webhook. An account that is already connected keeps its metadata.

headless?boolean

Facebook, and Instagram with facebook_login. True skips the hosted account picker: the browser returns to redirectUrl with connectSession, and you finish with List Candidates and Select Candidate. Requires redirectUrl.

loginMethod?string

Instagram only. instagram_login (default) signs in to Instagram directly. facebook_login connects an Instagram account linked to a Facebook Page, which unlocks Page-linked features such as audio search.

Value in"instagram_login""facebook_login"

Response Body

Connect session

application/json
  1. response
url*string

Where the account owner signs in.

Formaturi
expiresAt*string

When url stops working, in ISO 8601. A sign-in that finishes later returns to redirectUrl with error=SESSION_EXPIRED. Create a new connect session then.

Formatdate-time
Example Request
import { Configuration, ConnectApi } from "@onepostly/sdk";const connectApi = new ConnectApi(  new Configuration({ accessToken: process.env.ONEPOSTLY_API_KEY }));const response = await connectApi.createConnectSession({  createConnectSessionBody: {    "platform": "x",    "redirectUrl": "https://yourapp.com/oauth/onepostly",    "profile": "Business",    "metadata": {      "userId": "user_8412"    }  },});console.log(response);
Example Response
{  "url": "https://x.com/i/oauth2/authorize?response_type=code&state=eyJhbGciOiJIUzI1NiJ9",  "expiresAt": "2027-03-15T09:10:00.000Z"}