Skip to content
UGC API

Connect accounts

Before you can post, a social account must be connected. You create a connect link, the account owner approves on the platform, and the account appears in your account list with an ID you post to.

Updated

POST /v1/accounts/connect

FieldTypeDescription
platformstring, requiredtiktok, instagram, facebook or youtube
external_idstring, optionalYour own ID for the owner, such as a user or creator ID. Stored on the account.
redirect_urlstring, optionalWhere the owner lands after approving. Use a page in your app.
bash
curl https://ugcapi.dev/v1/accounts/connect \
  -H "Authorization: Bearer ugc_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "instagram",
    "external_id": "user_123",
    "redirect_url": "https://yourapp.com/settings/accounts"
  }'
json
{ "url": "https://ugcapi.dev/connect/..." }

Redirect the user to url right away: it goes straight to the platform's sign-in and expires in 30 minutes. The owner logs in on the platform's own page, so you never handle passwords.

POST /v1/accounts/invite takes the same fields and returns a link to a page on ugcapi.dev that tells the owner which team is asking for access and what it can do, then sends them to the platform's sign-in. Use it when you email or DM the link: it stays valid for 7 days and works more than once until then. In the dashboard, the arrow next to each Connect button creates the same link.

json
{ "url": "https://ugcapi.dev/connect-account/?t=...", "platform": "tiktok", "expires_at": "2026-11-04T12:00:00.000Z", "expires_in": 604800 }

Platform requirements

PlatformAccount typeNotes
TikTokAny TikTok accountAvailable privacy options come from the account's settings.
InstagramBusiness or CreatorPersonal accounts can't publish via Meta's API.
FacebookFacebook PageThe admin picks which Pages to grant. Each Page becomes its own account.
YouTubeA YouTube channelThe owner picks the channel during Google sign-in.

Creator info before posting

GET /v1/accounts/:id/creator_info returns who a post will go out as and what the platform lets them choose. For TikTok that is the creator's nickname, username, avatar, privacy_level_options, whether comments, duets and stitches are turned off, and max_video_post_duration_sec. TikTok requires apps that post on a creator's behalf to show the nickname and let the creator pick privacy from these options, with no default, before posting. Pass the choice as options.tiktok.privacy, with allow_comment, allow_duet, allow_stitch, your_brand and branded_content; see formats and options.

bash
curl https://ugcapi.dev/v1/accounts/acc_tt_01/creator_info -H "Authorization: Bearer ugc_live_..."

Account videos and stats

GET /v1/accounts/:id/videos reads the account's own posts from the last 90 days live from the platform, newest first, each with views, likes, comments and shares. Accounts also carry stats when the platform shares them, refreshed hourly: followers, likes and videos for TikTok; followers (subscribers, unless the channel hides them), views and videos for YouTube. For TikTok these need the read permissions creators grant when they connect; accounts connected before UGC API asked for them need a new connect link.

List accounts

GET /v1/accounts returns connected accounts. Filter with platform and external_id.

javascript
const res = await fetch(
  "https://ugcapi.dev/v1/accounts?platform=instagram&external_id=user_123",
  { headers: { "Authorization": "Bearer " + process.env.UGCAPI_KEY } }
);
const { data } = await res.json();
// data: [{ id: "acc_...", platform: "instagram", username: "...", external_id: "user_123", status: "connected" }]

Use the id values in accounts when you create a post. An account's status is connected or disconnected.

Disconnect

bash
curl -X DELETE https://ugcapi.dev/v1/accounts/acc_123 -H "Authorization: Bearer ugc_live_..."

Disconnecting removes our access tokens for that account. Scheduled posts to it will fail with account_not_found, so cancel them first if you don't want failures.

When a connection breaks

Owners can revoke access on the platform, and tokens can expire. When that happens, the account's status becomes disconnected and we send an account.disconnected webhook. Create a new connect link with the same external_id. For UX tips, read white-label account connect.

FAQ

Can one user connect several accounts?

Yes. Create one link per account. They can share the same external_id.

Do connected accounts cost anything?

No. There are no per-account fees. You pay only for posts.

Why can't my Instagram account connect?

It is probably a personal account. Switch it to Business or Creator in the Instagram app, then try again.

Related