一站式发布长文章
整合创建草稿、更新正文、设置封面图并立即发布的全流程一站式接口。需附带 Twitter Cookie。
返回 API 接口列表
/Article Endpoints
POST
/x/articles/publishAPI 鉴权
AuthorizationBearer token · header必填TwexAPI 平台的全局身份凭据 (Bearer Token)。所有接口调用均需在 Header 中携带:Authorization: Bearer <YOUR_TWEXAPI_KEY>。可在 TwexAPI 用户控制台获取。
请求体
必填application/jsoncookiestring必填用户自有授权的 Twitter 会话凭据或 auth_token(BYOC 自带 Cookie 模式)。无状态受托代理执行,凭据绝不持久化存储。详见 [鉴权与安全说明](/zh/authentication#写操作鉴权与-byoc自带授权-cookie--token) 与 [获取 Cookie 指南](https://youtube-promotion.pages.dev/how-to-get-twitter-cookie)。
titlestring必填标题文本
markdownstring必填Markdown 格式的长文章正文内容
cover_imagestring | any封面头图的公开 URL 地址
展开属性折叠属性
Any of:
string
stringany
anyvisibilitystring文章可见性设置:Public(公开)/ Followers(仅粉丝)/ Mentioned(仅被提及者)
default: "Public"
响应结果
200请求成功响应
codeinteger必填HTTP 响应状态码(200 表示成功)
msgstring必填响应提示信息(例如 'success')
dataArticlePublishData | any接口返回的核心业务数据载荷
展开属性折叠属性
Any of:
ArticlePublishData
article_idstring必填X 长文章的唯一标识符
tweet_idstring必填推文唯一数字 ID
any
any422请求参数校验错误
detailValidationError[]展开属性折叠属性
Array of
ValidationErrorlocstring | integer[]必填展开属性折叠属性
Array of
string | integerAny of:
string
stringinteger
integermsgstring必填响应提示信息(例如 'success')
typestring必填inputanyctxobject429是否已达到推特官方设定的单日发推数量上限
500服务器内部异常错误响应
⚡交互式测试POST
⚡交互式测试 / Try APIPOSTLive Console
🌐目标服务器:
https://api.twexapi.io● 生产环境就绪
✍️
写入接口凭证指引(TwexAPI 密钥 + 目标推特 Cookie)
1. TwexAPI 平台密钥 (Bearer Token):在下方「API 鉴权」中填入,用于 TwexAPI 计费与接口调用鉴权。
2. 推特账号 Cookie:本接口为代发/点赞/关注等写操作,需在下方请求体 (Request Body) 的 cookie 字段中填入目标 Twitter 账号的 Cookie 凭据(如 auth_token=...; ct0=...)。
🔑API 鉴权
📝请求体application/json
📡
暂无响应数据
请在「请求配置」中确认参数后,点击底部的「发送请求」按钮。
请求示例
curl -X POST "https://api.twexapi.io/x/articles/publish" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"cookie": "string",
"title": "string",
"markdown": "string",
"cover_image": "string",
"visibility": "Public"
}'const response = await fetch("https://api.twexapi.io/x/articles/publish", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"cookie": "string",
"title": "string",
"markdown": "string",
"cover_image": "string",
"visibility": "Public"
})
});import requests
response = requests.post(
"https://api.twexapi.io/x/articles/publish",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
json={
"cookie": "string",
"title": "string",
"markdown": "string",
"cover_image": "string",
"visibility": "Public"
},
)响应示例
{
"code": 0,
"msg": "string",
"data": {
"article_id": "string",
"tweet_id": "string"
}
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string",
"input": null,
"ctx": {}
}
]
}{
"code": 429,
"msg": "Daily tweet limit reached, please try again tomorrow."
}{
"code": 500,
"msg": "Internal server error"
}