x2c-publish

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

X2c-Publish - X2C Distribution API

X2c-Publish - X2C Distribution API

Publish video content to X2C platform using the Distribution API.

使用分发API将视频内容发布到X2C平台。

🔐 账号绑定流程

🔐 账号绑定流程

在发布视频之前,用户必须先绑定X2C账号。
在发布视频之前,用户必须先绑定X2C账号。

绑定步骤:

绑定步骤:

  1. 打开 https://www.x2creel.ai 注册/登录账号
  2. 进入 个人中心 → API管理
  3. 创建并复制 API Key
  4. 将 API Key 发送给我
示例对话:
用户:我想发布视频
助手:好的,需要先绑定X2C账号。请打开 https://www.x2creel.ai 登录,然后在个人中心获取API Key发给我。
用户:x2c_sk_xxx...
助手:验证通过!你的账号已绑定,现在可以发布视频了~
  1. 打开 https://www.x2creel.ai 注册/登录账号
  2. 进入 个人中心 → API管理
  3. 创建并复制 API Key
  4. 将 API Key 发送给我
示例对话:
用户:我想发布视频
助手:好的,需要先绑定X2C账号。请打开 https://www.x2creel.ai 登录,然后在个人中心获取API Key发给我。
用户:x2c_sk_xxx...
助手:验证通过!你的账号已绑定,现在可以发布视频了~

Agent 自动验证

Agent 自动验证

Agent 收到 API Key 后,直接调用 X2C API 验证:
  • 验证成功 → 保存到
    credentials/{USER_ID}.json
  • 验证失败 → 提示用户检查Key是否正确

Agent 收到 API Key 后,直接调用 X2C API 验证:
  • 验证成功 → 保存到
    credentials/{USER_ID}.json
  • 验证失败 → 提示用户检查Key是否正确

⚠️ 重要规则

⚠️ 重要规则

在用户提供有效的 X2C API Key 之前,禁止执行任何发布操作!

在用户提供有效的 X2C API Key 之前,禁止执行任何发布操作!

⚠️ 用户发布视频时的交互流程

⚠️ 用户发布视频时的交互流程

当用户说"发布视频"或类似意图时,必须按以下流程执行
当用户说"发布视频"或类似意图时,必须按以下流程执行

Step 1: 立即获取并展示支持的分类

Step 1: 立即获取并展示支持的分类

调用
distribution/categories
API 获取支持的分类,直接展示给用户选择
调用
distribution/categories
API 获取支持的分类,直接展示给用户选择

Step 2: 展示完整参数列表

Step 2: 展示完整参数列表

告诉用户需要准备的信息:
参数说明示例
视频链接视频的URL (mp4)https://v.arkfs.co/.../video.mp4
封面图视频封面URL (jpg/png/webp) 必填https://.../cover.jpg
标题作品名称 (最长10字)《重生千金》
简介剧情简介 (最长200字)女主重生归来复仇...
分类从Step 1获取的分类中选择都市复仇
告诉用户需要准备的信息:
参数说明示例
视频链接视频的URL (mp4)https://v.arkfs.co/.../video.mp4
封面图视频封面URL (jpg/png/webp) 必填https://.../cover.jpg
标题作品名称 (最长10字)《重生千金》
简介剧情简介 (最长200字)女主重生归来复仇...
分类从Step 1获取的分类中选择都市复仇

Step 3: 收集完成后执行发布

Step 3: 收集完成后执行发布

用户确认所有参数后,调用
distribution/publish
执行发布。

用户确认所有参数后,调用
distribution/publish
执行发布。

⚠️ 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.
你必须按顺序完成所有步骤,严禁跳过任何步骤!
所有curl命令必须添加超时参数:使用
-m 60
(最长超时60秒)
步骤1:调用 distribution/categories → 获取分类列表
步骤2:调用 distribution/upload-url → 获取S3上传地址(用于封面+视频文件)
步骤3:通过HTTP PUT请求将文件上传到S3(封面+视频文件)
步骤4:调用 distribution/publish → 提交步骤3返回的public_url完成发布
提供视频的两种方式:
  1. S3上传 - 使用上传地址工作流(适用于本地文件)
  2. 外部链接 - 直接使用已有视频URL发布(例如来自AI Director的视频)
严禁重试失败的请求! 如果请求失败,向用户反馈错误并询问后续操作,不要自动重试。

⚠️ 发布限制规则 (Publishing Restrictions)

⚠️ 发布限制规则 (Publishing Restrictions)

  1. 不重复发布 (No Duplicate Publishing)
    • 发布前必须先查询项目状态,确认未发布过
    • 使用
      distribution/query
      检查项目是否已发布
    • 如果已发布,不要再次调用
      distribution/publish
  2. 封面图片要求 (Cover Image Requirements)
    • cover_url
      必须是图片链接 (jpg/png/webp)
    • 不能使用视频链接作为封面
    • 必须先获取视频的缩略图或上传封面图片
  3. API 超时处理 (Timeout Handling)
    • 添加超时参数
      -m 60
      到 curl 命令
    • 超时后不要自动重试,询问用户如何处理
  4. 已发布项目的后续集数 (Adding Episodes)
    • 如果项目已发布,需要添加新集数
    • 使用
      distribution/add-episodes
      而不是重新发布整个项目
  1. 不重复发布 (No Duplicate Publishing)
    • 发布前必须先查询项目状态,确认未发布过
    • 使用
      distribution/query
      检查项目是否已发布
    • 如果已发布,不要再次调用
      distribution/publish
  2. 封面图片要求 (Cover Image Requirements)
    • cover_url
      必须是图片链接 (jpg/png/webp)
    • 不能使用视频链接作为封面
    • 必须先获取视频的缩略图或上传封面图片
  3. API 超时处理 (Timeout Handling)
    • 添加超时参数
      -m 60
      到 curl 命令
    • 超时后不要自动重试,询问用户如何处理
  4. 已发布项目的后续集数 (Adding Episodes)
    • 如果项目已发布,需要添加新集数
    • 使用
      distribution/add-episodes
      而不是重新发布整个项目

API Endpoint

API Endpoint

POST https://eumfmgwxwjyagsvqloac.supabase.co/functions/v1/open-api
Headers:
  • Content-Type: application/json
  • X-API-Key: x2c_sk_xxx...
POST https://eumfmgwxwjyagsvqloac.supabase.co/functions/v1/open-api
Headers:
  • Content-Type: application/json
  • X-API-Key: x2c_sk_xxx...

Workflow

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
1. distribution/categories → 获取可用分类
2. distribution/upload-url → 获取S3预签名上传地址
3. 通过HTTP PUT请求将文件上传到S3
4. distribution/publish → 提交项目元数据完成发布
5. distribution/query → 检查审核状态
6. distribution/add-episodes → 添加更多剧集
7. distribution/list → 列出所有项目

Commands

Commands

1. Get Categories

1. 获取分类列表

bash
curl -X POST https://eumfmgwxwjyagsvqloac.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"
  }'
⚠️ 必须使用 API 返回的分类!发布前必须先调用此 API 获取支持的分类列表,用户只能从返回的分类中选择。
bash
curl -X POST https://eumfmgwxwjyagsvqloac.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"
  }'
⚠️ 必须使用 API 返回的分类!发布前必须先调用此 API 获取支持的分类列表,用户只能从返回的分类中选择。

2. Get Upload URLs

2. 获取上传地址

bash
curl -X POST https://eumfmgwxwjyagsvqloac.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
bash
curl -X POST https://eumfmgwxwjyagsvqloac.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"}
    ]
  }'
返回结果包含:
  • upload_url
    - 要上传的S3地址
  • upload_headers
    - PUT请求需要的请求头
  • public_url
    - 上传完成后的公网访问地址

3. Upload to S3

3. 上传到S3

bash
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
bash
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

4. 发布项目

bash
curl -X POST https://eumfmgwxwjyagsvqloac.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:
ParamRequiredDescription
titleYesProject name (max 100 chars)
descriptionYesSynopsis (max 2000 chars)
category_idYesCategory UUID (必须从 distribution/categories API 获取)
cover_urlYesCover image URL
video_urlsYesArray of video URLs (1-10)
enable_predictionNoEnable prediction market
⚠️ 发布前必须先调用
distribution/categories
获取支持的分类,用户只能从中选择。
bash
curl -X POST https://eumfmgwxwjyagsvqloac.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
  }'
参数说明:
参数是否必填说明
title项目名称(最多100字符)
description剧情简介(最多2000字符)
category_id分类UUID(必须从 distribution/categories API 获取
cover_url封面图片URL
video_urls视频URL数组(1-10个)
enable_prediction是否开启预测市场
⚠️ 发布前必须先调用
distribution/categories
获取支持的分类,用户只能从中选择。

5. Query Status

5. 查询发布状态

bash
curl -X POST https://eumfmgwxwjyagsvqloac.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
bash
curl -X POST https://eumfmgwxwjyagsvqloac.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"
  }'
状态值说明:
  • draft
    - 草稿(已创建未提交)
  • pending_review
    - 待审核
  • approved
    - 已通过/已上线
  • rejected
    - 已驳回

6. Add Episodes

6. 添加剧集

bash
curl -X POST https://eumfmgwxwjyagsvqloac.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"]
  }'
bash
curl -X POST https://eumfmgwxwjyagsvqloac.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

7. 获取项目列表

bash
curl -X POST https://eumfmgwxwjyagsvqloac.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"
  }'
bash
curl -X POST https://eumfmgwxwjyagsvqloac.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
json
{
  "x2cApiKey": "x2c_sk_xxx"
}
When calling, set
USER_ID
environment variable or pass via TELEGRAM_USER_ID.

API Key:https://storyclaw.com/ 获取(不是alpaca.markets!)
存储路径:
  • credentials/{USER_ID}.json
json
{
  "x2cApiKey": "x2c_sk_xxx"
}
调用时设置
USER_ID
环境变量,或者通过 TELEGRAM_USER_ID 传入。

Wallet API (Asset Management)

钱包API(资产管理)

Query balances, claim X2C, swap to USDC, withdraw, and view transaction history.
可查询余额、领取X2C、兑换为USDC、提现以及查看交易历史。

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
1. wallet/balance → 查询所有余额(积分、X2C、USDC)
2. wallet/claim-x2c → 将已释放的X2C领取到链上钱包
3. wallet/swap-x2c → 将X2C代币兑换为USDC
4. wallet/withdraw-usdc → 将USDC提现到外部地址
5. wallet/transactions → 查看收益与购买记录

Commands

命令

1. Get Wallet Balance

1. 查询钱包余额

bash
curl -X POST https://eumfmgwxwjyagsvqloac.supabase.co/functions/v1/open-api \
  -H "Content-Type: application/json" \
  -H "X-API-Key: x2c_sk_xxx" \
  -d '{"action": "wallet/balance"}'
Response:
FieldTypeDescription
creditsnumberPlatform credit balance
x2c_wallet_balancenumberOn-chain X2C wallet balance
x2c_pending_claimnumberReleased X2C available to claim
x2c_pending_releasenumberLocked X2C not yet released
usdc_balancenumberUSDC balance
wallet_addressstringSolana wallet address
bash
curl -X POST https://eumfmgwxwjyagsvqloac.supabase.co/functions/v1/open-api \
  -H "Content-Type: application/json" \
  -H "X-API-Key: x2c_sk_xxx" \
  -d '{"action": "wallet/balance"}'
返回结果:
字段类型说明
creditsnumber平台积分余额
x2c_wallet_balancenumber链上X2C钱包余额
x2c_pending_claimnumber已释放可领取的X2C数量
x2c_pending_releasenumber锁定中未释放的X2C数量
usdc_balancenumberUSDC余额
wallet_addressstringSolana钱包地址

2. Claim X2C

2. 领取X2C

bash
curl -X POST https://eumfmgwxwjyagsvqloac.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:
ParamRequiredDescription
amountYesAmount of X2C to claim
bash
curl -X POST https://eumfmgwxwjyagsvqloac.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
  }'
参数说明:
参数是否必填说明
amount要领取的X2C数量

3. Swap X2C to USDC

3. X2C兑换为USDC

bash
curl -X POST https://eumfmgwxwjyagsvqloac.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
  }'
bash
curl -X POST https://eumfmgwxwjyagsvqloac.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

4. 提现USDC

bash
curl -X POST https://eumfmgwxwjyagsvqloac.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:
ParamRequiredDescription
amountYesUSDC amount to withdraw
to_addressYesDestination Solana wallet address
bash
curl -X POST https://eumfmgwxwjyagsvqloac.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..."
  }'
参数说明:
参数是否必填说明
amount要提现的USDC数量
to_address目标Solana钱包地址

5. Transaction History

5. 交易历史

bash
curl -X POST https://eumfmgwxwjyagsvqloac.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:
ParamRequiredDescription
pageNoPage number (default: 1)
page_sizeNoItems per page (default: 20, max: 100)
typeNo"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
bash
curl -X POST https://eumfmgwxwjyagsvqloac.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"
  }'
参数说明:
参数是否必填说明
page页码(默认:1)
page_size每页条数(默认:20,最大值:100)
type"earnings"(收益)、"purchases"(消费)或 "all"(全部,默认值)
收益类型: mining, distribution, referral, commission, copyright, x2c_release, x2c_claim
消费类型: consume, ai_clone, drama_purchase, purchase, pre_charge, script_generate, preview_regen, ai_consume, swap, withdrawal