---
title: "Initialize connection"
method: POST
path: "/api/profile_groups/{id}/initialize_connection"
tags: ["Profile Groups"]
---

# Initialize connection

`POST /api/profile_groups/{id}/initialize_connection`

## Request

- Base URL: `https://api.postproxy.dev`
- URL: `https://api.postproxy.dev/api/profile_groups/{id}/initialize_connection`
- Auth: HTTP bearer

Generates a URL to connect a new social media profile to a profile group via OAuth. Bluesky uses an app-password flow and Telegram uses a bring-your-own-bot flow; both authenticate synchronously and create the profile in one call.

## Path parameters

- `id` string, required

## Query parameters

- `profile_group_id` string

## Headers

- `Idempotency-Key` string

## Request body

- object: Connection payload. OAuth platforms require redirect_url; bluesky requires identifier and app_password instead; telegram requires bot_token instead. instagram and whatsapp accept the optional onboarding parameter.
  - `platform` 'facebook' | 'instagram' | 'tiktok' | 'linkedin' | 'youtube' | 'twitter' | 'threads' | 'pinterest' | 'bluesky' | 'telegram' | 'whatsapp', required: Platform to connect.
  - `redirect_url` string: URL to redirect to after OAuth completes. Required for all platforms except bluesky and telegram.
  - `refresh_connection` boolean: Re-authorize a profile already connected to this group, to renew tokens or re-pick pages. Skips the already-connected check for that platform: the same account is updated in place, a different account is still rejected with account_is_already_connected.
  - `identifier` string: Bluesky handle (e.g. yourname.bsky.social). Required for bluesky. The .bsky.social suffix is added automatically if missing; custom domains are accepted as-is.
  - `app_password` string: Bluesky app password, not the account password. Required for bluesky. Generate at https://bsky.app/settings/app-passwords.
  - `bot_token` string: Telegram bot token from @BotFather. Required for telegram.
  - `onboarding` 'instagram' | 'facebook' | 'business_app' | 'api': Optional, whatsapp and instagram only. instagram: which login to use — "instagram" (default) for Instagram Login, or "facebook" for Facebook Login, for an account linked to a Facebook Page the user manages. whatsapp: where the number lives — "business_app" for coexistence with the WhatsApp Business app, or "api" for a number already on the Cloud API or a fresh API-only number. Omit it and the connect page asks the user.

## Response `200`

Connection URL (OAuth platforms) or the created profile (bluesky, telegram)

- union
  - object: OAuth platforms: URL to redirect the user to.
    - `url` string: URL to redirect the user to for OAuth authentication.
    - `success` boolean: Whether the invitation was created successfully.
  - object: Bluesky and Telegram: the profile is created synchronously in one call.
    - `success` boolean
    - `profile` object
      - `id` string
      - `network` string
      - `name` string
      - `external_username` string
    - `next_step` string: Telegram only: instructions for adding the bot as administrator to channels.

## Other responses

- `401`: Invalid, missing, or insufficient API key permissions.
- `422`: Validation failed.

---

[API](https://skmtc.dev/postproxy/apis/postproxy-social-media-api.md) - [All operations](https://skmtc.dev/postproxy/apis/postproxy-social-media-api/llms.txt) - [OpenAPI document](https://skmtc.dev/postproxy/apis/postproxy-social-media-api/revisions/d54482ac4ce7?raw)
