curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: multipart/form-data' \
-F 'file=@"./Ayrshare CSV Template.csv"' \
-X POST https://api.ayrshare.com/api/post/bulk
const API_KEY = "API_KEY";
const FormData = require("form-data");
const fs = require("fs");
const formData = new FormData();
formData.append("file", fs.createReadStream("./Ayrshare CSV Template.csv"));
fetch("https://api.ayrshare.com/api/post/bulk", {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
...formData.getHeaders()
},
body: formData
})
.then((res) => res.json())
.then((data) => {
console.log(JSON.stringify(data));
})
.catch((error) => {
console.log(error);
});
import requests
API_KEY = "API_KEY"
# Open the CSV file in binary read mode
with open('./Ayrshare CSV Template.csv', 'rb') as file:
# Prepare the files dictionary for the multipart/form-data request
files = {'file': file}
# Set up the authorization header
headers = {'Authorization': f'Bearer {API_KEY}'}
try:
# Make the POST request to the API
response = requests.post(
'https://api.ayrshare.com/api/post/bulk',
headers=headers,
files=files
)
# Parse and print the JSON response
data = response.json()
print(data)
except Exception as e:
print(f"Error: {e}")
{
"status": "success",
"posts": [
{
"status": "scheduled",
"scheduleDate": "4/6/21 12:50",
"id": "X3uTExuEJhyM3u8wCRsA",
"post": "A great post"
},
{
"status": "scheduled",
"scheduleDate": "4/6/21 13:00",
"id": "8RGrekuxMnVa7lVnARFm",
"post": "An even better post"
}
]
}
Post
批量发布
使用 CSV 文件批量安排帖子
PUT
/
post
/
bulk
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: multipart/form-data' \
-F 'file=@"./Ayrshare CSV Template.csv"' \
-X POST https://api.ayrshare.com/api/post/bulk
const API_KEY = "API_KEY";
const FormData = require("form-data");
const fs = require("fs");
const formData = new FormData();
formData.append("file", fs.createReadStream("./Ayrshare CSV Template.csv"));
fetch("https://api.ayrshare.com/api/post/bulk", {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
...formData.getHeaders()
},
body: formData
})
.then((res) => res.json())
.then((data) => {
console.log(JSON.stringify(data));
})
.catch((error) => {
console.log(error);
});
import requests
API_KEY = "API_KEY"
# Open the CSV file in binary read mode
with open('./Ayrshare CSV Template.csv', 'rb') as file:
# Prepare the files dictionary for the multipart/form-data request
files = {'file': file}
# Set up the authorization header
headers = {'Authorization': f'Bearer {API_KEY}'}
try:
# Make the POST request to the API
response = requests.post(
'https://api.ayrshare.com/api/post/bulk',
headers=headers,
files=files
)
# Parse and print the JSON response
data = response.json()
print(data)
except Exception as e:
print(f"Error: {e}")
{
"status": "success",
"posts": [
{
"status": "scheduled",
"scheduleDate": "4/6/21 12:50",
"id": "X3uTExuEJhyM3u8wCRsA",
"post": "A great post"
},
{
"status": "scheduled",
"scheduleDate": "4/6/21 13:00",
"id": "8RGrekuxMnVa7lVnARFm",
"post": "An even better post"
}
]
}
使用包含帖子数据的 CSV(逗号分隔值)文件批量安排帖子。
Content-Type 必须为
multipart/form-data。
我们建议直接使用 Post 端点 来安排帖子,而不是此批量方法。
直接端点提供了更全面的功能集和更简单的调试
能力。
Header 参数
用户配置文件的 Profile Key。
Content-Type: multipart/form-dataBody 参数
请求示例
包含帖子 CSV 文件的 multipart form-data 会将它们安排到未来某个日期。 CSV 文件包含以下字段(模板见下方),均为必填:post:帖子文本。platforms:逗号分隔的平台列表,例如 “twitter, facebook, instagram”。mediaUrls:媒体的 URL,例如要包含在帖子中的图片或视频。scheduleDate:以 UTC 格式安排帖子的日期时间。例如,使用格式YYYY-MM-DDThh:mm:ssZ并按2026-07-08T12:30:00Z发送。更多示例请参见 utctime。
不要在两天内发送重复的帖子。如果两个帖子具有完全相同的文本且 scheduleDate 相差不到三天,第二个帖子将在 scheduleDate 发生时被拒绝。
这是为了保护你在社交网络上的账户;这些网络可能会暂停或屏蔽经常发送重复帖子的账户。
CSV 模板
下载模板并保存为 .csv 文件。 Ayrshare CSV 模板curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: multipart/form-data' \
-F 'file=@"./Ayrshare CSV Template.csv"' \
-X POST https://api.ayrshare.com/api/post/bulk
const API_KEY = "API_KEY";
const FormData = require("form-data");
const fs = require("fs");
const formData = new FormData();
formData.append("file", fs.createReadStream("./Ayrshare CSV Template.csv"));
fetch("https://api.ayrshare.com/api/post/bulk", {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
...formData.getHeaders()
},
body: formData
})
.then((res) => res.json())
.then((data) => {
console.log(JSON.stringify(data));
})
.catch((error) => {
console.log(error);
});
import requests
API_KEY = "API_KEY"
# Open the CSV file in binary read mode
with open('./Ayrshare CSV Template.csv', 'rb') as file:
# Prepare the files dictionary for the multipart/form-data request
files = {'file': file}
# Set up the authorization header
headers = {'Authorization': f'Bearer {API_KEY}'}
try:
# Make the POST request to the API
response = requests.post(
'https://api.ayrshare.com/api/post/bulk',
headers=headers,
files=files
)
# Parse and print the JSON response
data = response.json()
print(data)
except Exception as e:
print(f"Error: {e}")
{
"status": "success",
"posts": [
{
"status": "scheduled",
"scheduleDate": "4/6/21 12:50",
"id": "X3uTExuEJhyM3u8wCRsA",
"post": "A great post"
},
{
"status": "scheduled",
"scheduleDate": "4/6/21 13:00",
"id": "8RGrekuxMnVa7lVnARFm",
"post": "An even better post"
}
]
}
⌘I
