Get OAuth connect URL
Initiate an OAuth connection flow. Returns an authUrl to redirect the user to. Standard flow: Zernio hosts the selection UI, then redirects to your redirect_url. Headless mode (headless=true): user is redirected to your redirect_url with OAuth data for custom UI. Use the platform-specific selection endpoints to complete.
API key authentication - use your Zernio API key as a Bearer token
In: header
Path Parameters
Social media platform to connect
"facebook" | "instagram" | "linkedin" | "twitter" | "tiktok" | "youtube" | "threads" | "reddit" | "pinterest" | "bluesky" | "googlebusiness" | "telegram" | "snapchat" | "discord" | "slack" | "whatsapp"Query Parameters
Your Zernio profile ID (get from /v1/profiles). For WhatsApp, a Zernio-provisioned number can only be connected on the profile it was provisioned to; connecting from any other profile is rejected with a 409.
Your custom redirect URL after connection completes. Accepts an http(s) URL, a custom app scheme for mobile deeplinks (e.g. myapp://callback), or a relative path. Result params are appended with the URL API, so an existing query string is preserved. Standard mode appends connected={platform}&profileId=X&accountId=Y&username=Z. Headless mode appends OAuth data params for platforms requiring selection (e.g. LinkedIn orgs, Facebook pages). If no selection is needed, the account is created directly and the redirect includes accountId.
uriWhen true, the user is redirected to your redirect_url with raw OAuth data (code, state) instead of Zernio's default account selection UI. Use this to build a custom connect experience.
falseInstagram only. Which of the two Instagram connection methods to use. Ignored for every other platform.
instagram_login (the default, and what you get if you omit this): the Instagram Login dialog. The user authorizes their Instagram professional account directly, no Facebook Page required.
facebook_login: the Facebook Login dialog, i.e. "Instagram API with Facebook Login". The user authorizes a Facebook Page that has a linked Instagram professional account, and every API call for that account then runs through the Page. Use this when the customer manages Instagram through a Page and expects the Facebook consent screen. Because the user has to pick which Page to connect, the callback continues at the account-selection step, /v1/connect/instagram/select-account.
facebook_login supports headless=true like the other selection platforms: the callback redirects to your redirect_url with profileId, tempToken, platform=instagram, step=select_account and connect_token, which you pass into the select-account endpoints to finish. The default instagram_login has no selection step, so it connects the account directly.
"instagram_login""instagram_login" | "facebook_login"WhatsApp only. Ignored for every other platform. Controls which screen Meta's Embedded Signup popup shows.
If omitted, the connection defaults to coexistence (same as business_app below), preserving existing behavior for numbers already on the WhatsApp Business app.
api: standard Embedded Signup, showing Meta's WABA/number picker. Use this to connect a phone number already on Cloud API elsewhere.
business_app: coexistence, i.e. 'Connect existing WhatsApp Business app' (a number shared between Cloud API and the consumer WhatsApp Business app).
"api" | "business_app"Response Body
application/json
application/json
application/json
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.connect.getConnectUrl({ path: { platform: 'facebook', }, query: { profileId: 'profile_abc123', },});console.log(data);{
"authUrl": "https://www.facebook.com/v21.0/dialog/oauth?client_id=...",
"state": "user123-profile456-1234567890-https://yourdomain.com/callback"
}{
"error": "Unauthorized"
}{
"error": "Add a payment method to connect more than 2 accounts.",
"code": "PAYMENT_REQUIRED",
"reason": "free_tier_exceeded",
"documentation_url": "https://docs.zernio.com/billing/payment-method-required",
"dashboard_url": "https://zernio.com/dashboard?tab=billing",
"details": {
"free_tier_account_limit": 2,
"current_account_count": 3,
"has_payment_method": false
}
}Move account to another profile PATCH
Moves a connected social account to a different profile owned by the same user. The target profile must belong to the same user as the account. For API keys restricted to specific profiles, BOTH the source account's current profile AND the target profile must be in the key's allowed set. Calls with a target profile outside the key's scope return 403.
Complete OAuth callback POST
Exchange the OAuth authorization code for tokens and connect the account to the specified profile.