创建推文或跟帖回复
自动化发布推文或回复推文。支持纯文字,或在 media 中传入最多 4 张图片或 1 个 100MB 以内的 MP4 视频。需附带 Twitter Cookie。
返回 API 接口列表
/Tweet Actions Endpoints
POST
/twitter/tweets/createAPI 鉴权
AuthorizationBearer token · header必填TwexAPI 平台的全局身份凭据 (Bearer Token)。所有接口调用均需在 Header 中携带:Authorization: Bearer <YOUR_TWEXAPI_KEY>。可在 TwexAPI 用户控制台获取。
请求体
必填application/jsonmedia_urlstring | any可选:随消息附带的公开图片或媒体附件 URL 地址
展开属性折叠属性
Any of:
string
stringany
anymedia_urlsstring[] | any可选:随推文附带的图片或视频公开 URL 列表(最多 4 张图片或 1 个 100MB 以内的 MP4 视频)
展开属性折叠属性
Any of:
string[]
Array of
stringstringany
anytweet_contentstring必填推文或跟帖回复的完整正文内容
delegated_account_usernamestring | any被委托执行操作的子账号推特用户名
展开属性折叠属性
Any of:
string
stringany
anyschedulestring | any推文定时发布时间(ISO 8601 标准格式)
展开属性折叠属性
Any of:
string
stringany
anyreply_tweet_idstring | any可选:被回复的目标推文 ID(填写则代表发布跟帖回复)
展开属性折叠属性
Any of:
string
stringany
anycookiestring必填用户自有授权的 Twitter 会话凭据或 auth_token(BYOC 自带 Cookie 模式)。无状态受托代理执行,凭据绝不持久化存储。详见 [鉴权与安全说明](/zh/authentication#写操作鉴权与-byoc自带授权-cookie--token) 与 [获取 Cookie 指南](https://youtube-promotion.pages.dev/how-to-get-twitter-cookie)。
community_namestring | any要发推的目标推特社区名称或社区唯一 ID
展开属性折叠属性
Any of:
string
stringany
anyproxystring | any用于执行请求的代理 IP 地址(必填)。请使用高质量住宅静态代理,避免使用免费公共代理。格式示例:http://username:password@ip:port
展开属性折叠属性
Any of:
string
stringany
any响应结果
200新发布推文的唯一 ID 及当前操作用户的推特数字 ID
codeintegerHTTP 响应状态码(200 表示成功)
default: 200
msgstring响应提示信息(例如 'success')
default: "success"
dataPostTweetData | any接口返回的核心业务数据载荷
展开属性折叠属性
Any of:
PostTweetData
tweet_idstring | any推文唯一数字 ID
展开属性折叠属性
Any of:
string
stringany
anyuser_idstring | any目标用户的推特唯一数字 ID
展开属性折叠属性
Any of:
string
stringany
anycodeintegerHTTP 响应状态码(200 表示成功)
default: 200
any
any422请求参数校验错误
detailValidationError[]展开属性折叠属性
Array of
ValidationErrorlocstring | integer[]必填展开属性折叠属性
Array of
string | integerAny of:
string
stringinteger
integermsgstring必填响应提示信息(例如 'success')
typestring必填inputanyctxobject⚡交互式测试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/twitter/tweets/create" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"media_url": "https://example.com/image.jpg",
"media_urls": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
"tweet_content": "Hello, Twitter! 🐦",
"delegated_account_username": "elonmusk",
"schedule": "2024-01-01T12:00:00Z",
"reply_tweet_id": "1234567890123456789",
"cookie": "ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7",
"community_name": "Python Developers or 1234567890123456789",
"proxy": "http://username:password@ip:port"
}'const response = await fetch("https://api.twexapi.io/twitter/tweets/create", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"media_url": "https://example.com/image.jpg",
"media_urls": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
"tweet_content": "Hello, Twitter! 🐦",
"delegated_account_username": "elonmusk",
"schedule": "2024-01-01T12:00:00Z",
"reply_tweet_id": "1234567890123456789",
"cookie": "ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7",
"community_name": "Python Developers or 1234567890123456789",
"proxy": "http://username:password@ip:port"
})
});import requests
response = requests.post(
"https://api.twexapi.io/twitter/tweets/create",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
json={
"media_url": "https://example.com/image.jpg",
"media_urls": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
"tweet_content": "Hello, Twitter! 🐦",
"delegated_account_username": "elonmusk",
"schedule": "2024-01-01T12:00:00Z",
"reply_tweet_id": "1234567890123456789",
"cookie": "ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7",
"community_name": "Python Developers or 1234567890123456789",
"proxy": "http://username:password@ip:port"
},
)响应示例
{
"code": 200,
"msg": "success",
"data": {
"tweet_id": "1234567890123456789",
"user_id": "1234567890",
"code": 200
}
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string",
"input": null,
"ctx": {}
}
]
}