Social Media Publishing API

June 14, 2026

Social Media Publishing API

Use the Social Media Publishing API to connect social media accounts, schedule posts, and publish WayinVideo clips directly to supported platforms including YouTube, TikTok, Instagram, Facebook, X / Twitter, and LinkedIn.

This API is designed for exported clips generated by AI Clipping and Find Moments. Create clips with either API first, make sure the original project was submitted with enable_export = true, and then use the resulting project_id and clip idx when creating a publishing task.

It is useful for apps and automations that need to move from long-form video to short-form distribution without manually downloading and re-uploading every clip. Common use cases include YouTube Shorts upload workflows, TikTok publishing pipelines, Instagram Reels distribution, social scheduling tools, and creator content dashboards.

Typical flow:

  1. Create an OAuth authorization URL for the platform you want to connect.
  2. Open the returned auth_url in a browser and complete authorization.
  3. Call the accounts endpoint to confirm the connected account and copy its id.
  4. Create a publishing task with the target clip and account-specific publish settings.

All endpoints require:

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
x-wayinvideo-api-version: v2

Billing: Successfully connecting one social media account currently costs 10 API Units during the limited-time promotional period. If authorization is not completed successfully, no API Units are deducted.


What This API Is Best For

  • Publishing AI-generated clips from long videos to one or more connected social accounts.
  • Building a YouTube Shorts, TikTok, or Instagram Reels publishing workflow after clip generation.
  • You can connect social accounts with OAuth instead of sharing platform credentials.
  • Scheduling clip posts up to 30 days in advance.
  • Powering creator dashboards, social media automation tools, CMS integrations, and internal editorial queues.

For the full creation-to-publishing workflow, start with AI Clipping or Find Moments, enable clip export, then publish the generated clip with this API.


Endpoints

MethodPathDescription
POST/api/v2/social-media/oauth/{platform}Create a one-time OAuth authorization URL for a social media platform
GET/api/v2/social-media/accountsList connected social media accounts
POST/api/v2/social-media/publishCreate a task to publish a clip to one or more connected accounts

Connect a Social Media Account

Create an OAuth authorization URL for the platform you want to connect.

POST https://wayinvideo-api.wayin.ai/api/v2/social-media/oauth/{platform}

Path Parameters

ParameterTypeRequiredDescription
platformstringYesSocial media platform. Allowed values: youtube, tiktok, twitter, instagram, facebook, linkedin.

Request Body

No request body is required.

Example Request

curl -X POST https://wayinvideo-api.wayin.ai/api/v2/social-media/oauth/youtube \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "x-wayinvideo-api-version: v2" \
  --data ''

Example Response

{
  "data": {
    "auth_url": "https://example.com/oauth2/auth?xxxxxx",
    "state": "a49bc736-xxxxx"
  }
}

Response Fields

FieldTypeDescription
auth_urlstringThe third-party OAuth authorization page URL. Open this URL in a browser to authorize the account.
statestringAuthorization state identifier.

Notes

  • Each auth_url can be used only once. If authorization fails or the URL expires, call this endpoint again to create a new URL.
  • After authorization succeeds, call List Social Media Accounts to confirm that the account is available for publishing.
  • You can connect multiple accounts on the same platform. For example, call the YouTube OAuth endpoint multiple times to connect multiple YouTube channels.
  • If the account is not connected successfully, no API Units are deducted.

List Social Media Accounts

Get all connected social media accounts for the current API key owner. Use this endpoint before publishing to find the account id values used by publish_configs.

GET https://wayinvideo-api.wayin.ai/api/v2/social-media/accounts?active_only={active_only}

Query Parameters

ParameterTypeRequiredDefaultDescription
active_onlybooleanNofalseWhen true, only accounts with valid tokens are returned.

Example Request

curl -X GET "https://wayinvideo-api.wayin.ai/api/v2/social-media/accounts?active_only=true" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "x-wayinvideo-api-version: v2"

Response When No Account Is Connected

{
  "data": []
}

If data is empty, call Connect a Social Media Account first.

Response When Accounts Are Connected

{
  "data": [
    {
      "id": "smaccxxx",
      "platform": "youtube",
      "platform_username": "MyChannel",
      "platform_avatar": "https://example.com/avatar.jpg",
      "token_valid": true,
      "token_expiring_soon": false
    }
  ]
}

Response Fields

FieldTypeDescription
idstringUnique social account ID. Use this as the key in publish_configs when calling /publish. Do not use the platform name as the key.
platformstringPlatform identifier. See Platform values.
platform_usernamestringUsername, channel name, or account name on the platform.
platform_avatarstring | nullAvatar image URL for the account.
token_validbooleantrue means the authorization token is valid and the account can be used for publishing.
token_expiring_soonbooleantrue means the authorization token will expire soon. Reconnect the account before publishing again.
  • Before creating a publish task, confirm that the target account has token_valid: true.

Create a Publishing Task

Publish one clip to one or more connected social media accounts. Identify the clip by passing the project ID and clip index.

Required: The project_id must come from an AI Clipping or Find Moments task submitted with enable_export = true. Social publishing requires an exported clip video; projects created without export enabled cannot be published with this endpoint.

POST https://wayinvideo-api.wayin.ai/api/v2/social-media/publish

Request Fields

FieldTypeRequiredDescription
project_idstringYesProject ID.
idxintegerYesClip index within the project.
resolutionstringNoExport resolution used by the exported clip, such as 1080p or 720p.
publish_configsobjectYesPublish settings keyed by social account ID from the accounts endpoint.
scheduled_atinteger | nullNoMillisecond timestamp for scheduled publishing. Use null or omit this field to publish immediately.

How to generate a scheduled_at value

scheduled_at is a Unix timestamp in milliseconds. It must be at least 5 minutes in the future and no more than 30 days in the future.

To schedule publishing 10 minutes from now in JavaScript:

const scheduledAt = Date.now() + 10 * 60 * 1000;

To schedule for a specific time:

const scheduledAt = new Date('2026-06-15T10:00:00Z').getTime();

Platform Publish Config

Each value in publish_configs is a platform-specific publish config object.

FieldTypeRequiredDescription
titlestringConditionally requiredVideo title. Required for YouTube.
descriptionstringConditionally requiredVideo description or post text. Required for TikTok.
tagsstring[]NoTag list.
visibilitystringNoVisibility: public, private, or unlisted. Platform support varies.
thumbnail_urlstringNoCustom thumbnail image URL.
categorystringNoPlatform-specific video category.
allow_commentbooleanNoWhether comments are allowed.
allow_duetbooleanNoWhether duets are allowed. TikTok only.
allow_stitchbooleanNoWhether stitches are allowed. TikTok only.
disclose_contentbooleanNoWhether to disclose promotional or advertising content. TikTok only.

Important: The keys inside publish_configs must be account IDs returned by /api/v2/social-media/accounts, such as smacct06ixxxxxxx. Do not use youtube, tiktok, or other platform names as keys.

Example Request

curl -sS -X POST https://wayinvideo-api.wayin.ai/api/v2/social-media/publish \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "x-wayinvideo-api-version: v2" \
  -d '{
    "project_id": "prj06ixxxxxxx",
    "idx": 0,
    "resolution": "1080p",
    "publish_configs": {
      "smacct06ixxxxxxx": {
        "title": "API Test Video",
        "description": "Posted by curl test",
        "tags": ["api", "test"],
        "visibility": "public"
      }
    },
    "scheduled_at": null
  }'

Example Response

{
  "data": {
    "task_id": "pubtask06ixxxxxxx",
    "status": "PENDING",
    "created_at": 1781251687210
  }
}

Response Fields

FieldTypeDescription
task_idstringUnique publishing task ID.
statusstringPublishing task status. See Publish status values.
created_atintegerTask creation timestamp in milliseconds.
schedule_idstring | nullSchedule ID. Returned when scheduled_at is provided.
scheduled_atinteger | nullScheduled publish timestamp in milliseconds.

You can view publishing schedules and live task results on the WayinVideo calendar.


Platform Values

ValuePlatformWebsite
youtubeYouTubehttps://youtube.com
tiktokTikTokhttps://tiktok.com
twitterTwitter / Xhttps://twitter.com
instagramInstagramhttps://instagram.com
facebookFacebookhttps://facebook.com
linkedinLinkedInhttps://linkedin.com

Publish Status Values

ValueDescription
PENDINGThe task has been created and is waiting to be scheduled.
SCHEDULEDThe task has been scheduled and is waiting for the scheduled time.
PROCESSINGPublishing is in progress, including video upload and platform-side processing.
DONEPublishing succeeded.
PARTIAL_DONESome accounts succeeded and some failed. Only possible when publishing to multiple accounts.
ERRORPublishing failed.
CANCELLEDPublishing was cancelled.

Complete Flow Example

Step 1: Create a YouTube OAuth URL

curl -X POST https://wayinvideo-api.wayin.ai/api/v2/social-media/oauth/youtube \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "x-wayinvideo-api-version: v2" \
  --data ''

Open the returned auth_url in a browser and complete authorization.

Step 2: List Available Accounts

curl -X GET "https://wayinvideo-api.wayin.ai/api/v2/social-media/accounts?active_only=true" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "x-wayinvideo-api-version: v2"

Copy the id of the account you want to publish to.

Step 3: Publish a Clip

curl -sS -X POST https://wayinvideo-api.wayin.ai/api/v2/social-media/publish \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "x-wayinvideo-api-version: v2" \
  -d '{
    "project_id": "prj06ixxxxxxx",
    "idx": 0,
    "resolution": "1080p",
    "publish_configs": {
      "smacct06ixxxxxxx": {
        "title": "API Test Video",
        "description": "Posted by curl test",
        "tags": ["api", "test"],
        "visibility": "public"
      }
    },
    "scheduled_at": null
  }'

Notes

  1. The publish_configs key is the connected account ID, not the platform name.
  2. To schedule publishing, pass a future millisecond timestamp in scheduled_at. Use null or omit the field for immediate publishing.
  3. Scheduled publishing must be at least 5 minutes in the future and no more than 30 days in the future.
  4. Social publishing requires an exported clip video. Use a project_id from an AI Clipping or Find Moments task created with enable_export = true.
  5. If publishing returns an account token error, reconnect the social media account and try again.
  6. The same clip can be published multiple times. Publishing the same clip to the same account again creates a separate publishing task.

FAQ

Can I publish clips to multiple social accounts in one request?

Yes. Add one entry per connected social account ID in publish_configs. The keys must be account IDs returned by /api/v2/social-media/accounts, not platform names such as youtube or tiktok.

Can I schedule a social media post instead of publishing immediately?

Yes. Pass scheduled_at as a Unix timestamp in milliseconds. The scheduled time must be at least 5 minutes in the future and no more than 30 days in the future.

Do I need to export a clip before publishing it?

Yes. Social publishing requires an exported clip video. Create the clip with AI Clipping or Find Moments and submit the original task with enable_export = true.

Which platforms are supported?

The API currently supports YouTube, TikTok, Instagram, Facebook, X / Twitter, and LinkedIn. Use Connect a Social Media Account with the platform value you want to authorize.

Where can I monitor scheduled publishing tasks?

You can view publishing schedules and live task results on the WayinVideo calendar.