Square Post Skill
Overview
Post text content to Binance Square.
API: Add Content
Method: POST
URL:
CODEBLOCK0
Request Headers:
| Header | Required | Description |
|---|
| X-Square-OpenAPI-Key | Yes | Square OpenAPI Key |
| Content-Type |
Yes |
application/json |
| clienttype | Yes |
binanceSkill |
Request Body:
| Field | Type | Required | Description |
|---|
| bodyTextOnly | string | Yes | Post content text (supports #hashtags) |
Example Request
CODEBLOCK1
Response Example
CODEBLOCK2
Response Fields
| Field | Type | Description |
|---|
| code | string | INLINECODE2 = success |
| message |
string | Error message (null on success) |
| data.id | string | Created content ID |
Post URL Format
On success, construct the post URL:
CODEBLOCK3
Example: If data.id is 298177291743282, the post URL is:
https://www.binance.com/square/post/298177291743282
Error Handling
| Code | Description |
|---|
| 000000 | Success |
| 10004 |
Network error. Please try again |
| 10005 | Only allowed for users who have completed identity verification |
| 10007 | Feature unavailable |
| 20002 | Detected sensitive words |
| 20013 | Content length is limited |
| 20020 | Publishing empty content is not supported |
| 20022 | Detected sensitive words (with risk segments) |
| 20041 | Potential security risk with the URL |
| 30004 | User not found |
| 30008 | Banned for violating platform guidelines |
| 220003 | API Key not found |
| 220004 | API Key expired |
| 220009 | Daily post limit exceeded for OpenAPI |
| 220010 | Unsupported content type |
| 220011 | Content body must not be empty |
| 2000001 | Account permanently blocked from posting |
| 2000002 | Device permanently blocked from posting |
Authentication
Required Header
| Header | Required | Description |
|---|
| X-Square-OpenAPI-Key | Yes | API key for Square posting |
Security
Never Display Full Keys
When showing credentials to users:
- - X-Square-OpenAPI-Key: Show first 5 + last 4 characters: INLINECODE5
Listing Accounts
When listing accounts, show names and description only — never full keys:
Accounts:
* default (Default account for Square posting)
Agent Behavior
- 1. Check key before API calls: Verify that X-Square-OpenAPI-Key is configured and not the placeholder INLINECODE6
- Prompt for key if missing: If key is not configured, ask user to provide their API Key first
- Prompt for content if missing: If user triggers posting but doesn't provide specific content, ask what they want to post
- Never display full keys: Only show first 5 + last 4 characters (e.g.,
abc12...xyz9) - Store provided keys: When user provides a new key, update the Accounts section in this file
- Optimize content before posting:
- Polish user's raw input for better readability
- Show optimized content and ask user to choose: use optimized version or post original text
- 7. Return post URL on success: After successful post, return the URL INLINECODE8
- Handle missing id: If code is
000000 but data.id is empty or missing, inform user that post may have succeeded but URL is unavailable, suggest checking Square page manually
Notes
- 1. Only pure text posts are supported currently
- Check daily post limit to avoid 220009 error
Square 发帖技能
概述
将文本内容发布到币安广场。
API:添加内容
方法:POST
URL:
https://www.binance.com/bapi/composite/v1/public/pgc/openApi/content/add
请求头:
| 请求头 | 是否必需 | 描述 |
|---|
| X-Square-OpenAPI-Key | 是 | Square OpenAPI 密钥 |
| Content-Type |
是 | application/json |
| clienttype | 是 | binanceSkill |
请求体:
| 字段 | 类型 | 是否必需 | 描述 |
|---|
| bodyTextOnly | string | 是 | 发帖文本内容(支持#话题标签) |
示例请求
bash
curl -X POST https://www.binance.com/bapi/composite/v1/public/pgc/openApi/content/add \
-H X-Square-OpenAPI-Key: yourapikey \
-H Content-Type: application/json \
-H clienttype: binanceSkill \
-d {
bodyTextOnly: BTC今天看涨!
}
响应示例
json
{
code: 000000,
message: null,
data: {
id: contentidhere
}
}
响应字段
| 字段 | 类型 | 描述 |
|---|
| code | string | 000000 = 成功 |
| message |
string | 错误信息(成功时为null) |
| data.id | string | 创建的内容ID |
帖子URL格式
成功时,构建帖子URL:
https://www.binance.com/square/post/{id}
示例:如果 data.id 为 298177291743282,则帖子URL为:
https://www.binance.com/square/post/298177291743282
错误处理
网络错误,请重试 |
| 10005 | 仅限已完成身份验证的用户使用 |
| 10007 | 功能不可用 |
| 20002 | 检测到敏感词 |
| 20013 | 内容长度受限 |
| 20020 | 不支持发布空内容 |
| 20022 | 检测到敏感词(含风险片段) |
| 20041 | URL存在潜在安全风险 |
| 30004 | 用户未找到 |
| 30008 | 因违反平台规则被禁言 |
| 220003 | API密钥未找到 |
| 220004 | API密钥已过期 |
| 220009 | OpenAPI每日发帖次数超限 |
| 220010 | 不支持的内容类型 |
| 220011 | 内容主体不能为空 |
| 2000001 | 账户已被永久禁止发帖 |
| 2000002 | 设备已被永久禁止发帖 |
身份验证
必需请求头
| 请求头 | 是否必需 | 描述 |
|---|
| X-Square-OpenAPI-Key | 是 | 用于Square发帖的API密钥 |
安全
切勿显示完整密钥
向用户展示凭证时:
- - X-Square-OpenAPI-Key:显示前5位+后4位字符:abc12...xyz9
列出账户
列出账户时,仅显示名称和描述——切勿显示完整密钥:
账户:
代理行为
- 1. 在API调用前检查密钥:确认X-Square-OpenAPI-Key已配置且不是占位符yourapikey
- 密钥缺失时提示:如果密钥未配置,请用户先提供其API密钥
- 内容缺失时提示:如果用户触发发帖但未提供具体内容,询问他们想要发布什么
- 切勿显示完整密钥:仅显示前5位+后4位字符(例如abc12...xyz9)
- 存储提供的密钥:当用户提供新密钥时,更新此文件中的账户部分
- 发帖前优化内容:
- 润色用户的原始输入以提高可读性
- 展示优化后的内容并让用户选择:使用优化版本或发布原文
- 7. 成功时返回帖子URL:成功发帖后,返回URL https://www.binance.com/square/post/{id}
- 处理缺失ID:如果code为000000但data.id为空或缺失,告知用户帖子可能已成功但URL不可用,建议手动检查Square页面
注意事项
- 1. 目前仅支持纯文本帖子
- 检查每日发帖限制以避免220009错误