Get pending OAuth data
Fetch pending OAuth data for headless mode using the pendingDataToken from the redirect URL.
Scope: This endpoint is used for LinkedIn organizations, Snapchat profiles, and Pinterest boards, where the selection list is too large to fit in URL params. The redirect carries a pendingDataToken instead of the full payload; the response includes the corresponding selection array (e.g. boards for Pinterest). WhatsApp, Facebook, Google Business and other platforms pass selection state directly via URL query params on the redirect (profileId, tempToken, step), no pending record is created, so this endpoint will return 404 for those flows. Use the platform-specific selection endpoint instead (e.g. /v1/connect/whatsapp/select-phone-number).
Token is one-time use and expires after 10 minutes. No authentication required.
API key authentication - use your Zernio API key as a Bearer token
In: header
Query Parameters
The pending data token from the OAuth redirect URL (pendingDataToken parameter)
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.getPendingOAuthData({ query: { token: 'tok_abc123', },});console.log(data);{
"platform": "linkedin",
"profileId": "abc123",
"tempToken": "AQV...",
"refreshToken": "AQW...",
"expiresIn": 5183999,
"userProfile": {
"id": "ABC123",
"username": "John Doe",
"displayName": "John Doe",
"profilePicture": "https://..."
},
"selectionType": "organizations",
"organizations": [
{
"id": "12345",
"urn": "urn:li:organization:12345",
"name": "Acme Corp",
"vanityName": "acme-corp"
},
{
"id": "67890",
"urn": "urn:li:organization:67890",
"name": "Example Inc",
"vanityName": "example-inc"
}
]
}{
"error": "string",
"type": "invalid_request_error",
"code": "string",
"param": "string",
"platform": "string",
"platformError": {},
"details": {}
}{
"error": "string",
"type": "invalid_request_error",
"code": "string",
"param": "string",
"platform": "string",
"platformError": {},
"details": {}
}Complete OAuth callback POST
Exchange the OAuth authorization code for tokens and connect the account to the specified profile.
Connect ads for a platform GET
Unified ads connection endpoint. Creates a dedicated ads SocialAccount for the specified platform. Same-token platforms (facebook, instagram, linkedin, pinterest): Creates an ads SocialAccount (metaads, linkedinads, pinterestads) with a copied OAuth token from the parent posting account. If the ads account already exists, returns alreadyConnected: true. No extra OAuth needed. Separate-token platforms (tiktok, twitter): Starts the platform-specific marketing API OAuth flow and creates an ads SocialAccount (tiktokads, xads) with its own token. If the ads account already exists, returns alreadyConnected: true. - tiktok: accountId is OPTIONAL. With accountId, the new tiktokads account links to that posting account (parentAccountId set) — Spark Ads + standalone ads using the posting TT_USER identity become available. Without accountId, ads-only mode kicks in: the new tiktokads account has parentAccountId=null and standalone ads use a synthetic CUSTOMIZED_USER ("Brand Identity"); Spark Ads are unavailable because TikTok requires a posting account for them. The Brand Identity is configured separately via PATCH /v1/connect/tiktok-ads (or inline on POST /v1/ads/create via the brandIdentity field). - twitter (X Ads): accountId is REQUIRED. There's no ads-only mode — tweets need to be authored by a real X user. Standalone platforms (googleads): Starts the Google Ads OAuth flow and creates a standalone ads SocialAccount (googleads) with no parent. If the account already exists, returns alreadyConnected: true. Ads accounts appear as regular SocialAccount documents with ads platform values (e.g., metaads, tiktokads) in GET /v1/accounts.