Connect
Create Connect Session
Starts connecting an account. Send the account owner's browser to url, where they sign in on the platform.
BearerAuthorizationBearer <op_>Workspace API key, sent as Authorization: Bearer op_... Keys are created in the dashboard.
Idempotency-Key?stringA 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.
1 <= length <= 255application/json- body
platform*stringPlatform to connect. Bluesky connects with an App Password through Create Account instead.
"x""instagram""facebook""threads""linkedin""youtube""tiktok""pinterest"redirectUrl?stringWhere the browser returns when the connect finishes. Required with an API key. The connected account id arrives as the accountId query parameter.
uriprofile?stringProfile to file the new account under. It is created if it does not exist. Defaults to the workspace's Default profile.
1 <= length <= 60metadata?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?booleanFacebook, 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?stringInstagram 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.
"instagram_login""facebook_login"Connect session
application/json- response
url*stringWhere the account owner signs in.
uriexpiresAt*stringWhen 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.
date-timeimport { 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);{ "url": "https://x.com/i/oauth2/authorize?response_type=code&state=eyJhbGciOiJIUzI1NiJ9", "expiresAt": "2027-03-15T09:10:00.000Z"}