storyclaw-x2c-publish
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseX2C 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}.jsonjson
{
"x2cApiKey": "x2c_sk_xxx"
}Set env var when calling. OpenClaw passes it automatically from chat context.
USER_IDOr set env var, or configure via in .
X2C_API_KEYskills."x2c-publish".env.X2C_API_KEY~/.openclaw/openclaw.json将API密钥存储在中:
credentials/{USER_ID}.jsonjson
{
"x2cApiKey": "x2c_sk_xxx"
}调用时设置环境变量。OpenClaw会从聊天上下文自动传递该变量。
USER_ID或者设置环境变量,或通过中的进行配置。
X2C_API_KEY~/.openclaw/openclaw.jsonskills."x2c-publish".env.X2C_API_KEYDistribution 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 projectsTwo ways to provide videos:
- S3 Upload — use upload-url workflow for local files
- 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 → 列出所有项目提供视频的两种方式:
- S3上传——针对本地文件使用upload-url工作流
- 外部URL——在发布时直接使用现有视频URL
API Endpoint
API端点
All requests go to the X2C Open API. The base URL is configured via env var or defaults to the production endpoint.
X2C_API_BASE_URLHeaders:
Content-Type: application/jsonX-API-Key: <your_x2c_api_key>
所有请求均发送至X2C开放API。基础URL可通过环境变量配置,默认使用生产环境端点。
X2C_API_BASE_URL请求头:
Content-Type: application/jsonX-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 , , and .
upload_urlupload_headerspublic_urlbash
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_urlupload_headerspublic_urlUpload to S3
上传至S3
Use the and from the previous response:
upload_urlupload_headersbash
curl -X PUT "<upload_url>" \
-H "Content-Type: image/jpeg" \
<additional headers from upload_headers> \
--data-binary @cover.jpg使用上一步响应中的和:
upload_urlupload_headersbash
curl -X PUT "<upload_url>" \
-H "Content-Type: image/jpeg" \
<additional headers from upload_headers> \
--data-binary @cover.jpgPublish 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
}'| Param | Required | Description |
|---|---|---|
| title | Yes | Project name (max 100 chars) |
| description | Yes | Synopsis (max 2000 chars) |
| category_id | Yes | Category UUID |
| cover_url | Yes | Cover image URL |
| video_urls | Yes | Array of video URLs (1-10) |
| enable_prediction | No | Enable 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: , , ,
draftpending_reviewapprovedrejectedbash
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"}'状态值:(草稿)、(待审核)、(已通过)、(已拒绝)
draftpending_reviewapprovedrejectedAdd 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: (mining, distribution, referral, etc.), (consume, swap, withdrawal, etc.), or .
earningspurchasesallbash
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"}'类型:(收益,包括挖矿、分发、推荐等)、(支出,包括消费、兑换、提现等)或(全部)。
earningspurchasesall