storyclaw-x2c-publish

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

X2C Publish - Distribution & Wallet API

X2C 发布 - 分发与钱包API

Publish video content to the X2C platform and manage digital assets.
向X2C平台发布视频内容并管理数字资产。

Critical Rules

核心规则

  • Complete ALL workflow steps in order — never skip steps
  • Always add timeout to curl commands:
    -m 60
  • NEVER retry failed requests — report error and ask user
  • Check project status before publishing to avoid duplicates
  • Cover URL must be an image (jpg/png/webp), never a video URL
  • 必须按顺序完成所有工作流步骤——切勿跳过步骤
  • 始终为curl命令添加超时参数:
    -m 60
  • 切勿重试失败的请求——报告错误并询问用户
  • 发布前检查项目状态以避免重复
  • 封面URL必须是图片(jpg/png/webp),绝不能是视频URL

Multi-User Support

多用户支持

Store API key in
credentials/{USER_ID}.json
:
json
{
  "x2cApiKey": "x2c_sk_xxx"
}
Set
USER_ID
env var when calling. OpenClaw passes it automatically from chat context.
Or set
X2C_API_KEY
env var, or configure via
skills."x2c-publish".env.X2C_API_KEY
in
~/.openclaw/openclaw.json
.
将API密钥存储在
credentials/{USER_ID}.json
中:
json
{
  "x2cApiKey": "x2c_sk_xxx"
}
调用时设置
USER_ID
环境变量。OpenClaw会从聊天上下文自动传递该变量。
或者设置
X2C_API_KEY
环境变量,或通过
~/.openclaw/openclaw.json
中的
skills."x2c-publish".env.X2C_API_KEY
进行配置。

Distribution Workflow

分发工作流

1. distribution/categories → Get categories
2. distribution/upload-url → Get S3 presigned upload URLs
3. Upload files to S3 via HTTP PUT
4. distribution/publish → Submit with public_url from Step 3
5. distribution/query → Check review status
6. distribution/add-episodes → Add more episodes
7. distribution/list → List all projects
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
1. distribution/categories → 获取分类
2. distribution/upload-url → 获取S3预签名上传URL
3. 通过HTTP PUT将文件上传至S3
4. distribution/publish → 使用步骤3中的public_url提交
5. distribution/query → 检查审核状态
6. distribution/add-episodes → 添加更多剧集
7. distribution/list → 列出所有项目
提供视频的两种方式:
  1. S3上传——针对本地文件使用upload-url工作流
  2. 外部URL——在发布时直接使用现有视频URL

API Endpoint

API端点

All requests go to the X2C Open API. The base URL is configured via
X2C_API_BASE_URL
env var or defaults to the production endpoint.
Headers:
  • Content-Type: application/json
  • X-API-Key: <your_x2c_api_key>
所有请求均发送至X2C开放API。基础URL可通过
X2C_API_BASE_URL
环境变量配置,默认使用生产环境端点。
请求头:
  • Content-Type: application/json
  • X-API-Key: <your_x2c_api_key>

Get Categories

获取分类

bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "distribution/categories", "lang": "zh-CN"}'
bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "distribution/categories", "lang": "zh-CN"}'

Get Upload URLs

获取上传URL

bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -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
,
upload_headers
, and
public_url
.
bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -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
upload_headers
public_url

Upload to S3

上传至S3

Use the
upload_url
and
upload_headers
from the previous response:
bash
curl -X PUT "<upload_url>" \
  -H "Content-Type: image/jpeg" \
  <additional headers from upload_headers> \
  --data-binary @cover.jpg
使用上一步响应中的
upload_url
upload_headers
bash
curl -X PUT "<upload_url>" \
  -H "Content-Type: image/jpeg" \
  <additional headers from upload_headers> \
  --data-binary @cover.jpg

Publish Project

发布项目

bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{
    "action": "distribution/publish",
    "title": "My Drama",
    "description": "A story about...",
    "category_id": "uuid",
    "cover_url": "https://...",
    "video_urls": ["https://..."],
    "enable_prediction": false
  }'
ParamRequiredDescription
titleYesProject name (max 100 chars)
descriptionYesSynopsis (max 2000 chars)
category_idYesCategory UUID
cover_urlYesCover image URL
video_urlsYesArray of video URLs (1-10)
enable_predictionNoEnable prediction market
bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{
    "action": "distribution/publish",
    "title": "My Drama",
    "description": "A story about...",
    "category_id": "uuid",
    "cover_url": "https://...",
    "video_urls": ["https://..."],
    "enable_prediction": false
  }'
参数是否必填描述
title项目名称(最多100个字符)
description剧情简介(最多2000个字符)
category_id分类UUID
cover_url封面图片URL
video_urls视频URL数组(1-10个)
enable_prediction启用预测市场

Query Status

查询状态

bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "distribution/query", "project_id": "uuid"}'
Status values:
draft
,
pending_review
,
approved
,
rejected
bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "distribution/query", "project_id": "uuid"}'
状态值:
draft
(草稿)、
pending_review
(待审核)、
approved
(已通过)、
rejected
(已拒绝)

Add Episodes

添加剧集

bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{
    "action": "distribution/add-episodes",
    "project_id": "uuid",
    "video_urls": ["https://..."]
  }'
bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{
    "action": "distribution/add-episodes",
    "project_id": "uuid",
    "video_urls": ["https://..."]
  }'

List Projects

列出项目

bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "distribution/list", "page": 1, "page_size": 20, "status": "approved"}'
bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "distribution/list", "page": 1, "page_size": 20, "status": "approved"}'

Wallet API (Asset Management)

钱包API(资产管理)

Get Balance

查询余额

bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "wallet/balance"}'
Returns: credits, x2c_wallet_balance, x2c_pending_claim, x2c_pending_release, usdc_balance, wallet_address.
bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "wallet/balance"}'
返回字段:credits、x2c_wallet_balance、x2c_pending_claim、x2c_pending_release、usdc_balance、wallet_address。

Claim X2C

领取X2C

bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "wallet/claim-x2c", "amount": 50.0}'
bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "wallet/claim-x2c", "amount": 50.0}'

Swap X2C to USDC

将X2C兑换为USDC

bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "wallet/swap-x2c", "amount": 100.0}'
bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "wallet/swap-x2c", "amount": 100.0}'

Withdraw USDC

提取USDC

bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "wallet/withdraw-usdc", "amount": 10.0, "to_address": "SolanaAddress..."}'
bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "wallet/withdraw-usdc", "amount": 10.0, "to_address": "SolanaAddress..."}'

Transaction History

交易记录

bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "wallet/transactions", "page": 1, "page_size": 20, "type": "all"}'
Types:
earnings
(mining, distribution, referral, etc.),
purchases
(consume, swap, withdrawal, etc.), or
all
.
bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "wallet/transactions", "page": 1, "page_size": 20, "type": "all"}'
类型:
earnings
(收益,包括挖矿、分发、推荐等)、
purchases
(支出,包括消费、兑换、提现等)或
all
(全部)。