SuperAPI AI Directory

x2c-publish

Coding & development

View repository

Updated 10-15 21:52

About this skill

X2c-Publish - X2C Distribution API

Publish video content to X2C platform using the Distribution API.


🔐 Account Binding Process

Before publishing a video, the user must first bind an X2C account.

Binding steps:

  1. Open https://www.x2creel.ai to register/log in to your account
  2. Go to Personal Center → API Management
  3. Create and copy API Key
  4. Send the API Key to me

Example conversation:

用户:我想发布视频
助手:好的,需要先绑定X2C账号。请打开 https://www.x2creel.ai 登录,然后在个人中心获取API Key发给我。
用户:x2c_sk_xxx...
助手:验证通过!你的账号已绑定,现在可以发布视频了~

Automatic Agent Verification

After the Agent receives the API Key, it directly calls the X2C API to verify:

  • Verification successful → Save to credentials/{USER_ID}.json
  • Verification failed → Prompt the user to check whether the Key is correct

⚠️ Important Rules

Before the user provides a valid X2C API Key, performing any publishing operation is prohibited!


⚠️ Interaction Process When the User Publishes a Video

When the user says "publish video" or expresses a similar intent,the following process must be followed:

Step 1: Immediately retrieve and display the supported categories

Call the distribution/categories API to retrieve the supported categories,and display them directly to the user for selection。

Step 2: Display the complete parameter list

Tell the user the information they need to prepare:

Parameter Description Example
Video Link URL of the video (mp4) https://v.arkfs.co/.../video.mp4
Cover Image Video cover URL (jpg/png/webp) Required https://.../cover.jpg
Title Work name (maximum 10 characters) "Reborn Heiress"
Synopsis Plot summary (maximum 200 characters) The female lead returns after rebirth to take revenge...
Category Select from the categories retrieved in Step 1 Urban Revenge

Step 3: Execute publishing after collection is complete

After the user confirms all parameters, call distribution/publish to execute publishing.


⚠️ CRITICAL RULES - MUST FOLLOW THIS WORKFLOW

You MUST complete ALL steps in order. Never skip steps!

ALWAYS add timeout to curl commands: Use -m 60 (60 seconds max)

Step 1: distribution/categories → Get categories
Step 2: distribution/upload-url → Get S3 upload URLs (for cover + videos)
Step 3: Upload files to S3 via HTTP PUT (cover + videos)
Step 4: distribution/publish → Submit with the public_url from Step 3

Two ways to provide videos:

  1. S3 Upload - Use upload-url workflow (for local files)
  2. External URL - Use existing video URLs directly in publish (e.g., from AI Director)

NEVER retry failed requests! If a request fails, report the error to user and ask what to do. Do NOT automatically retry.

⚠️ Publishing Restrictions

  1. No Duplicate Publishing

    • Before publishing, you must first query the project status to confirm that it has not been published before
    • Use distribution/query to check whether the project has already been published
    • If it has already been published, do not call distribution/publish
  2. Cover Image Requirements

    • cover_url must be an image link (jpg/png/webp)
    • A video link cannot be used as the cover
    • You must first obtain the video thumbnail or upload a cover image
  3. API Timeout Handling

    • Add the timeout parameter -m 60 to the curl command
    • After a timeout, do not automatically retry; ask the user how to proceed
  4. Adding Episodes to an Already Published Project

    • If the project has already been published and new episodes need to be added
    • Use distribution/add-episodes instead of republishing the entire project

API Endpoint

POST https://ukbyfmmerxhlghlhbxtz.supabase.co/functions/v1/open-api

Headers:

  • Content-Type: application/json
  • X-API-Key: x2c_sk_xxx...

Workflow

1. distribution/categories → Get available categories
2. distribution/upload-url → Get S3 presigned upload URLs
3. Upload files to S3 via HTTP PUT
4. distribution/publish → Submit project with metadata
5. distribution/query → Check review status
6. distribution/add-episodes → Add more episodes
7. distribution/list → List all projects

Commands

1. Get Categories

curl -X POST https://ukbyfmmerxhlghlhbxtz.supabase.co/functions/v1/open-api \
  -H "Content-Type: application/json" \
  -H "X-API-Key: x2c_sk_xxx" \
  -d '{
    "action": "distribution/categories",
    "lang": "zh-CN"
  }'

⚠️ You must use the categories returned by the API! Before publishing, you must first call this API to retrieve the list of supported categories; users can only select from the returned categories.

2. Get Upload URLs

curl -X POST https://ukbyfmmerxhlghlhbxtz.supabase.co/functions/v1/open-api \
  -H "Content-Type: application/json" \
  -H "X-API-Key: x2c_sk_xxx" \
  -d '{
    "action": "distribution/upload-url",
    "files": [
      {"file_type": "cover", "file_name": "cover.jpg", "content_type": "image/jpeg"},
      {"file_type": "video", "file_name": "ep1.mp4", "content_type": "video/mp4"}
    ]
  }'

Response includes:

  • upload_url - S3 URL to upload to
  • upload_headers - Headers for PUT request
  • public_url - URL after upload completes

3. Upload to S3

curl -X PUT "<upload_url>" \
  -H "Content-Type: image/jpeg" \
  -H "Host: s3api.arkfs.co" \
  -H "x-amz-content-sha256: UNSIGNED-PAYLOAD" \
  -H "x-amz-date: 20260214T120000Z" \
  -H "Authorization: AWS4-HMAC-SHA256 ..." \
  --data-binary @cover.jpg

4. Publish Project

curl -X POST https://ukbyfmmerxhlghlhbxtz.supabase.co/functions/v1/open-api \
  -H "Content-Type: application/json" \
  -H "X-API-Key: x2c_sk_xxx" \
  -d '{
    "action": "distribution/publish",
    "title": "My Drama",
    "description": "A story about...",
    "category_id": "uuid",
    "cover_url": "https://v.arkfs.co/.../cover.jpg",
    "video_urls": ["https://v.arkfs.co/.../1.mp4"],
    "enable_prediction": false
  }'

Parameters:

Param Required Description
title Yes Project name (max 100 chars)
description Yes Synopsis (max 2000 chars)
category_id Yes Category UUID (Must be obtained from the distribution/categories API)
cover_url Yes Cover image URL
video_urls Yes Array of video URLs (1-10)
enable_prediction No Enable prediction market

⚠️ Before publishing, you must first call distribution/categories to retrieve the supported categories; users can only select from them.

5. Query Status

curl -X POST https://ukbyfmmerxhlghlhbxtz.supabase.co/functions/v1/open-api \
  -H "Content-Type: application/json" \
  -H "X-API-Key: x2c_sk_xxx" \
  -d '{
    "action": "distribution/query",
    "project_id": "uuid"
  }'

Status values:

  • draft - Created but not submitted
  • pending_review - Awaiting review
  • approved - Live
  • rejected - Rejected

6. Add Episodes

curl -X POST https://ukbyfmmerxhlghlhbxtz.supabase.co/functions/v1/open-api \
  -H "Content-Type: application/json" \
  -H "X-API-Key: x2c_sk_xxx" \
  -d '{
    "action": "distribution/add-episodes",
    "project_id": "uuid",
    "video_urls": ["https://v.arkfs.co/.../3.mp4"]
  }'

7. List Projects

curl -X POST https://ukbyfmmerxhlghlhbxtz.supabase.co/functions/v1/open-api \
  -H "Content-Type: application/json" \
  -H "X-API-Key: x2c_sk_xxx" \
  -d '{
    "action": "distribution/list",
    "page": 1,
    "page_size": 20,
    "status": "approved"
  }'

Multi-User Support

API Key: Get from https://storyclaw.com/ (not alpaca.markets!)

Store in:

  • credentials/{USER_ID}.json
{
  "x2cApiKey": "x2c_sk_xxx"
}

When calling, set USER_ID environment variable or pass via TELEGRAM_USER_ID.


Wallet API (Asset Management)

Query balances, claim X2C, swap to USDC, withdraw, and view transaction history.

Workflow

1. wallet/balance → Check all balances (credits, X2C, USDC)
2. wallet/claim-x2c → Claim released X2C to on-chain wallet
3. wallet/swap-x2c → Swap X2C tokens for USDC
4. wallet/withdraw-usdc → Withdraw USDC to external address
5. wallet/transactions → View earnings & purchase history

Commands

1. Get Wallet Balance

curl -X POST https://ukbyfmmerxhlghlhbxtz.supabase.co/functions/v1/open-api \
  -H "Content-Type: application/json" \
  -H "X-API-Key: x2c_sk_xxx" \
  -d '{"action": "wallet/balance"}'

Response:

Field Type Description
credits number Platform credit balance
x2c_wallet_balance number On-chain X2C wallet balance
x2c_pending_claim number Released X2C available to claim
x2c_pending_release number Locked X2C not yet released
usdc_balance number USDC balance
wallet_address string Solana wallet address

2. Claim X2C

curl -X POST https://ukbyfmmerxhlghlhbxtz.supabase.co/functions/v1/open-api \
  -H "Content-Type: application/json" \
  -H "X-API-Key: x2c_sk_xxx" \
  -d '{
    "action": "wallet/claim-x2c",
    "amount": 50.0
  }'

Parameters:

Param Required Description
amount Yes Amount of X2C to claim

3. Swap X2C to USDC

curl -X POST https://ukbyfmmerxhlghlhbxtz.supabase.co/functions/v1/open-api \
  -H "Content-Type: application/json" \
  -H "X-API-Key: x2c_sk_xxx" \
  -d '{
    "action": "wallet/swap-x2c",
    "amount": 100.0
  }'

4. Withdraw USDC

curl -X POST https://ukbyfmmerxhlghlhbxtz.supabase.co/functions/v1/open-api \
  -H "Content-Type: application/json" \
  -H "X-API-Key: x2c_sk_xxx" \
  -d '{
    "action": "wallet/withdraw-usdc",
    "amount": 10.0,
    "to_address": "ExternalSolanaAddress..."
  }'

Parameters:

Param Required Description
amount Yes USDC amount to withdraw
to_address Yes Destination Solana wallet address

5. Transaction History

curl -X POST https://ukbyfmmerxhlghlhbxtz.supabase.co/functions/v1/open-api \
  -H "Content-Type: application/json" \
  -H "X-API-Key: x2c_sk_xxx" \
  -d '{
    "action": "wallet/transactions",
    "page": 1,
    "page_size": 20,
    "type": "all"
  }'

Parameters:

Param Required Description
page No Page number (default: 1)
page_size No Items per page (default: 20, max: 100)
type No "earnings", "purchases", or "all" (default)

Earnings types: mining, distribution, referral, commission, copyright, x2c_release, x2c_claim

Purchase types: consume, ai_clone, drama_purchase, purchase, pre_charge, script_generate, preview_regen, ai_consume, swap, withdrawal