Social Publishing
Social Publishing
- Social Publishing lets you push media you generate on MuAPI straight to your social accounts. Connect an account once via OAuth, then call a publish endpoint with the media URL and the connected account's id.
Availability: YouTube, Instagram, and TikTok are live and fully supported.
How it works
Publishing happens in three steps:
- Connect an account (one-time) — authorize MuAPI to post on your behalf from the Integrations page.
- Find the account id — list your connected accounts to get the numeric
account_id. - Publish — submit an async publish job with the
account_idand a publicmedia_url.
Like every other MuAPI job, publishing follows the submit-then-poll pattern: the publish call returns a request_id, and you poll (or receive a webhook) for the final result.
1. Connect an account
Go to Dashboard → Integrations and click Connect on the platform you want. You can give each connection an optional label (e.g. "Brand channel") before being redirected to the platform's OAuth consent screen. After you approve, you're returned to MuAPI and the account appears in your connected list.
- Multiple accounts per platform are supported — connect as many YouTube/TikTok/Instagram accounts as you like; each gets its own
account_id. - You can rename or disconnect any account from the same page.
2. Find your account id
List your connected accounts to get the account_id you'll publish to:
curl --location 'https://muapi.ai/api/social/accounts' \
--header 'x-api-key: YOUR_API_KEY'
Response:
[
{
"id": 42,
"platform": 1,
"platform_name": "youtube",
"account_name": "Brand channel",
"platform_user_id": "...",
"connected_at": "2026-05-29T05:50:00Z"
}
]
Use the id field (42 here) as the account_id in your publish request. platform is 1=YouTube, 2=TikTok, 3=Instagram.
3. Publish a video (YouTube)
curl --location --request POST 'https://api.muapi.ai/api/v1/youtube-publish' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"account_id": 42,
"media_url": "https://cdn.muapi.ai/your-video.mp4",
"title": "My generated video",
"description": "Made with MuAPI",
"tags": ["ai", "muapi"],
"privacy": "public"
}'
Response:
{
"request_id": "abc123xyz",
"status": "processing"
}
YouTube parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
account_id | integer | ✅ | Connected YouTube account id (from GET /api/social/accounts). |
media_url | string (URL) | ✅ | Public URL of the video to upload. |
title | string | ✅ | Video title (max 100 chars). |
description | string | Video description. Default "". | |
tags | string[] | Keyword tags. | |
privacy | enum | public, private, or unlisted. Default public. | |
category_id | enum | YouTube category id (string). Omit to default to "22" (People & Blogs). See the category map below. | |
made_for_kids | boolean | COPPA made-for-kids flag. Default false. |
YouTube category IDs — pass the id as a string in category_id:
| Category | id |
|---|---|
| Film & Animation | "1" |
| Autos & Vehicles | "2" |
| Music | "10" |
| Pets & Animals | "15" |
| Sports | "17" |
| Travel & Events | "19" |
| Gaming | "20" |
| People & Blogs (default) | "22" |
| Comedy | "23" |
| Entertainment | "24" |
| News & Politics | "25" |
| Howto & Style | "26" |
| Education | "27" |
| Science & Technology | "28" |
| Nonprofits & Activism | "29" |
4. Get the result
Poll for the result (or pass a webhook query param to be notified on completion — see Webhooks):
curl --location 'https://api.muapi.ai/api/v1/predictions/abc123xyz/result' \
--header 'x-api-key: YOUR_API_KEY'
Completed response:
{
"id": "abc123xyz",
"status": "completed",
"output": {
"platform": "youtube",
"url": "https://youtube.com/watch?v=..."
}
}
5. Publish to Instagram
Instagram publishing targets a connected Instagram Business account. Videos are posted as Reels; images are posted to the feed.
curl --location --request POST 'https://api.muapi.ai/api/v1/instagram-publish' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"account_id": 57,
"media_url": "https://cdn.muapi.ai/your-video.mp4",
"caption": "Made with MuAPI #ai",
"media_type": "VIDEO"
}'
Instagram — POST /api/v1/instagram-publish
| Parameter | Type | Required | Description |
|---|---|---|---|
account_id | integer | ✅ | Connected Instagram (Business) account id. |
media_url | string (URL) | ✅ | Public URL of the video or image. |
caption | string | Post caption (supports hashtags). | |
media_type | enum | VIDEO or IMAGE. Default VIDEO. |
Output: { "platform": "instagram", "media_id": "..." }
Videos must meet Instagram's Reels requirements (MP4/MOV, supported aspect ratio and duration). The publish job creates a media container, waits for Instagram to finish processing it, then publishes — so it may take longer than a YouTube upload.
6. Publish to TikTok
TikTok publishing posts your generated video directly to your connected TikTok account's feed.
curl --location --request POST 'https://api.muapi.ai/api/v1/tiktok-publish' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"account_id": 88,
"media_url": "https://cdn.muapi.ai/your-video.mp4",
"title": "My generated video #ai"
}'
TikTok — POST /api/v1/tiktok-publish
| Parameter | Type | Required | Description |
|---|---|---|---|
account_id | integer | ✅ | Connected TikTok account id. |
media_url | string (URL) | ✅ | Public URL of the video. |
title | string | Caption/Title for the post (max 150 chars, supports hashtags). | |
privacy_level | enum | PUBLIC_TO_EVERYONE, MUTUAL_FOLLOW_FRIENDS, FOLLOWER_OF_CREATOR, SELF_ONLY. Default PUBLIC_TO_EVERYONE. | |
disable_comment | boolean | Disable comments for the video. Default false. | |
disable_duet | boolean | Disable duets for the video. Default false. | |
disable_stitch | boolean | Disable stitches for the video. Default false. |
Output: { "platform": "tiktok", "publish_id": "..." }
Publishing to your users' YouTube channels
If you're building an app on top of MuAPI, you can connect your end-users' YouTube channels and publish to them — without your users ever needing a MuAPI account. MuAPI handles the OAuth and token storage; you drive everything via your API key.
How it works
- Get a connect URL for your user — MuAPI generates a Google OAuth URL using MuAPI's own app credentials.
- Redirect your user to that URL — they see Google's consent screen and approve access.
- List their connected accounts to get the
account_id. - Publish using the standard
POST /api/v1/youtube-publishendpoint with thataccount_id.
Step 1 — Get a connect URL
curl -X POST 'https://api.muapi.ai/api/v1/social/youtube/connect-url' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"external_user_id": "user_123",
"redirect_to": "https://yourapp.com/youtube-connected"
}'
Response:
{
"url": "https://accounts.google.com/o/oauth2/auth?..."
}
| Parameter | Type | Required | Description |
|---|---|---|---|
external_user_id | string | ✅ | Your identifier for this end-user (any string — a user id, email, etc.). Used to look up their accounts later. |
redirect_to | string (URL) | Where to send the user after they complete the consent screen. |
Step 2 — Redirect your user
Send your user to the url from Step 1. They'll see Google's OAuth consent screen asking to allow YouTube uploads. After they approve, they're redirected to redirect_to.
Step 3 — List their connected accounts
curl 'https://api.muapi.ai/api/v1/social/ext/accounts?external_user_id=user_123' \
--header 'x-api-key: YOUR_API_KEY'
Response:
[
{
"id": 88,
"platform_name": "youtube",
"account_name": "user_123",
"platform_user_id": "UCxxxxxx",
"external_user_id": "user_123",
"connected_at": "2026-06-02T10:00:00Z"
}
]
Use the id field as account_id in your publish calls.
Step 4 — Publish
Same as publishing to your own channel — pass the account_id from Step 3:
curl -X POST 'https://api.muapi.ai/api/v1/youtube-publish' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"account_id": 88,
"media_url": "https://cdn.muapi.ai/your-video.mp4",
"title": "My generated video",
"privacy": "public"
}'
Disconnect an account
curl -X DELETE 'https://api.muapi.ai/api/v1/social/ext/accounts/88' \
--header 'x-api-key: YOUR_API_KEY'
Only accounts connected via your API key can be deleted by you. Attempting to delete another developer's user account returns 404.
Pricing
Each successful publish costs $0.01. See Pricing and Credits for details.