curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100", {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100', headers=headers)
print(r.json())
<?php
$apiUrl = 'https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100';
$apiKey = 'API_KEY'; // Replace 'API_KEY' with your actual API key
$headers = [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey,
];
$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers
]);
$response = curl_exec($curl);
if ($response === false) {
echo 'Curl error: ' . curl_error($curl);
} else {
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}
curl_close($curl);
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace HistoryGETRequest_csharp
{
class History
{
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
try
{
var response = await client.GetStringAsync(url);
Console.WriteLine(response);
}
catch (HttpRequestException ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
}
}
{
"history": [
{
"errors": [],
"post": "This is the post I sent",
"platforms": [
"twitter",
"facebook"
],
"postIds": [
{
"status": "success",
"id": "1288968500063775749", // Twitter Social Post ID
"platform": "twitter"
},
{
"id": "104923907983682_108683297607743", // Facebook Social Post ID
"status": "success",
"platform": "facebook"
}
],
"urls": [],
"type": "now",
"notes": "Approved by John Smith", // Reference notes set via /post
"created": "2022-05-20T17:25:06Z",
"status": "deleted",
"scheduleDate": { // In a future release changed to "scheduleDate": "2020-11-05T12:21:29Z"
"_seconds": 1604578889,
"_nanoseconds": 211000000,
"utc": "2020-11-05T12:21:29Z"
},
"id": "rhn6u7wwz2WxGv6MZGK9" // Ayrshare Top-Level Post ID
},
{
"status": "success",
"platforms": [
"twitter",
"facebook"
],
"created": "2022-05-20T17:25:06Z",
"post": "Sometimes we need to take a break for lunch.",
"scheduleDate": { // In a future release changed to "scheduleDate": "2020-11-05T12:21:29Z"
"_seconds": 1604578889,
"_nanoseconds": 211000000,
"utc": "2020-11-05T12:21:29Z"
},
"type": "now",
"postIds": [
{
"platform": "twitter",
"id": "1288890036000983105", // Twitter Social Post ID
"status": "success"
},
{
"id": "104923907983682_108329970009742", // Facebook Social Post ID
"status": "success",
"platform": "facebook",
"isVideo": true // Video post
}
],
"errors": [],
"urls": [],
"id": "wWIY0OEirdNeYSJYm1Xa" // Ayrshare Post ID
},
{ // Awaiting approval post - Approved by user
"approved": true,
"approvedBy": "9abf1426d6ce9122ef11c7222e1",
"approvedDate": "2025-06-06T12:28:12Z",
"created": "2025-06-06T12:27:56Z",
"errors": [],
"id": "sujQsrXtroJU0NEOlY38",
"mediaUrls": [],
"platforms": [
"twitter"
],
"post": "I failed my way to success. - Thomas Edison",
"postIds": [
{
"status": "success",
"id": "193096515330813",
"postUrl": "https://twitter.com/RetiretyHQ/status/19309651533081",
"platform": "twitter"
}
],
"profileTitle": "Primary Profile",
"refId": "9abf1426d6ce9122ef11c7222e1",
"requiresApproval": true,
"scheduleDate": "2025-06-06T12:27:56Z",
"shortenLinks": false,
"status": "success",
"type": "now"
},
{ // Awaiting approval post - Rejected by user
"approved": false,
"created": "2025-06-06T12:23:48Z",
"id": "XL5xHeNK8HGTg07qxzmd",
"mediaUrls": [],
"platforms": [
"twitter"
],
"post": " Honesty is the first chapter in the book of wisdom. - Thomas Jefferson",
"profileTitle": "Primary Profile",
"refId": "9abf1426d6ce9122ef11c72bd62eddw2",
"rejectedBy": "9abf1426d6ce9122ef11c7222e1",
"rejectedDate": "2025-06-06T12:23:58Z",
"requiresApproval": true,
"scheduleDate": "2025-06-06T12:23:48Z",
"shortenLinks": false,
"status": "awaiting approval",
"type": "now"
}
],
"refId": "9abf1426d6ce9122ef11c72bd62e59807c5cc083",
"count": 100,
"lastUpdated": "2025-04-05T22:44:14.209Z",
"nextUpdate": "2025-04-05T22:45:14.209Z"
}
{
"action": "history",
"status": "error",
"code": 221,
"message": "History not found for the past 30 days. Please see the docs on how to retrieve additional history. .../ayrshare.com/rest-api/endpoints/history#list-history-of-sent-and-scheduled-posts"
}
History
帖子历史
Ayrshare 帖子的历史记录
GET
/
history
curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100", {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100', headers=headers)
print(r.json())
<?php
$apiUrl = 'https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100';
$apiKey = 'API_KEY'; // Replace 'API_KEY' with your actual API key
$headers = [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey,
];
$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers
]);
$response = curl_exec($curl);
if ($response === false) {
echo 'Curl error: ' . curl_error($curl);
} else {
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}
curl_close($curl);
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace HistoryGETRequest_csharp
{
class History
{
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
try
{
var response = await client.GetStringAsync(url);
Console.WriteLine(response);
}
catch (HttpRequestException ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
}
}
{
"history": [
{
"errors": [],
"post": "This is the post I sent",
"platforms": [
"twitter",
"facebook"
],
"postIds": [
{
"status": "success",
"id": "1288968500063775749", // Twitter Social Post ID
"platform": "twitter"
},
{
"id": "104923907983682_108683297607743", // Facebook Social Post ID
"status": "success",
"platform": "facebook"
}
],
"urls": [],
"type": "now",
"notes": "Approved by John Smith", // Reference notes set via /post
"created": "2022-05-20T17:25:06Z",
"status": "deleted",
"scheduleDate": { // In a future release changed to "scheduleDate": "2020-11-05T12:21:29Z"
"_seconds": 1604578889,
"_nanoseconds": 211000000,
"utc": "2020-11-05T12:21:29Z"
},
"id": "rhn6u7wwz2WxGv6MZGK9" // Ayrshare Top-Level Post ID
},
{
"status": "success",
"platforms": [
"twitter",
"facebook"
],
"created": "2022-05-20T17:25:06Z",
"post": "Sometimes we need to take a break for lunch.",
"scheduleDate": { // In a future release changed to "scheduleDate": "2020-11-05T12:21:29Z"
"_seconds": 1604578889,
"_nanoseconds": 211000000,
"utc": "2020-11-05T12:21:29Z"
},
"type": "now",
"postIds": [
{
"platform": "twitter",
"id": "1288890036000983105", // Twitter Social Post ID
"status": "success"
},
{
"id": "104923907983682_108329970009742", // Facebook Social Post ID
"status": "success",
"platform": "facebook",
"isVideo": true // Video post
}
],
"errors": [],
"urls": [],
"id": "wWIY0OEirdNeYSJYm1Xa" // Ayrshare Post ID
},
{ // Awaiting approval post - Approved by user
"approved": true,
"approvedBy": "9abf1426d6ce9122ef11c7222e1",
"approvedDate": "2025-06-06T12:28:12Z",
"created": "2025-06-06T12:27:56Z",
"errors": [],
"id": "sujQsrXtroJU0NEOlY38",
"mediaUrls": [],
"platforms": [
"twitter"
],
"post": "I failed my way to success. - Thomas Edison",
"postIds": [
{
"status": "success",
"id": "193096515330813",
"postUrl": "https://twitter.com/RetiretyHQ/status/19309651533081",
"platform": "twitter"
}
],
"profileTitle": "Primary Profile",
"refId": "9abf1426d6ce9122ef11c7222e1",
"requiresApproval": true,
"scheduleDate": "2025-06-06T12:27:56Z",
"shortenLinks": false,
"status": "success",
"type": "now"
},
{ // Awaiting approval post - Rejected by user
"approved": false,
"created": "2025-06-06T12:23:48Z",
"id": "XL5xHeNK8HGTg07qxzmd",
"mediaUrls": [],
"platforms": [
"twitter"
],
"post": " Honesty is the first chapter in the book of wisdom. - Thomas Jefferson",
"profileTitle": "Primary Profile",
"refId": "9abf1426d6ce9122ef11c72bd62eddw2",
"rejectedBy": "9abf1426d6ce9122ef11c7222e1",
"rejectedDate": "2025-06-06T12:23:58Z",
"requiresApproval": true,
"scheduleDate": "2025-06-06T12:23:48Z",
"shortenLinks": false,
"status": "awaiting approval",
"type": "now"
}
],
"refId": "9abf1426d6ce9122ef11c72bd62e59807c5cc083",
"count": 100,
"lastUpdated": "2025-04-05T22:44:14.209Z",
"nextUpdate": "2025-04-05T22:45:14.209Z"
}
{
"action": "history",
"status": "error",
"code": 221,
"message": "History not found for the past 30 days. Please see the docs on how to retrieve additional history. .../ayrshare.com/rest-api/endpoints/history#list-history-of-sent-and-scheduled-posts"
}
获取通过 Ayrshare 发送的帖子历史,按降序(从最新到最早)排列。
通过此接口,你可以按特定日期范围、状态、社交网络或最近 n 天检索帖子。
历史记录
status 字段的取值:
awaiting approval:帖子等待通过审批流程审核。deleted:帖子已删除。注意:删除的帖子只有在使用 status 查询过滤条件时才会返回。请见下文。error:一个或多个社交网络发生错误。paused:定时帖子已被暂停。pending:帖子尚未处理。通常为定时帖子。success:帖子已成功发送到所有社交网络。
- Ayrshare Post ID 在响应的
id字段中返回。 - 如需检索来自 Ayrshare 之外的帖子(例如直接在社交网络上手动创建的帖子), 请使用 history platform 接口。
- 如果只需要单个帖子的历史,请使用按 id 查询帖子历史接口。
- 当
limit大于默认值 25 时,history 接口的 JSON 结果会缓存 1 分钟。
请求头参数
查询参数
返回最近的 n 条帖子。例如,如果只想获取最新一条帖子,设置
limit=1。
如果不传,则返回 lastDays 范围内的所有记录。默认:25 条。最大值:1000。按社交网络平台筛选。平台取值:
bluesky、facebook、gmb、instagram、
linkedin、pinterest、reddit、snapchat、telegram、threads、tiktok、twitter、
youtube。注意:使用 OR 逻辑,["facebook", "instagram"] 会返回来自任一平台的帖子。返回自该起始日期起(含)之后的帖子。以 ISO 8601 格式表示历史记录的起始日期。
例如,使用
YYYY-MM-DDThh:mm:ssZ 格式发送,如 2026-07-08T12:30:00Z。更多示例请参见
utctime。返回直到该结束日期(含)的帖子。以 ISO 8601 格式表示历史记录的结束日期。
例如,使用
YYYY-MM-DDThh:mm:ssZ 格式发送,如 2026-07-08T12:30:00Z。更多示例请参见
utctime。按发布日期(即
scheduleDate)返回最近 n 天的帖子。默认 30 天。- 如果提供了
startDate和endDate,lastDays将被忽略。 - 如果值为 0,将返回全部历史帖子。
- 如果值大于 0,将返回最近 n 天的帖子。
- 例如,
lastDays=5返回最近 5 天的帖子;lastDays=0则返回受limit限制的所有帖子。
按帖子当前状态筛选。有效取值:
success、error、processing、pending、paused、deleted 和 awaiting approval。
processing 表示帖子正在发送中。pending 表示帖子已定时于未来某个日期发布。删除的帖子默认不会返回。只有在 status 查询过滤条件设置为
status=deleted 时才会返回。要检索的帖子类型,即立即发布的帖子或使用
scheduleDate 字段的定时帖子。取值:immediate 或 scheduled。创建自动转发帖时会分配一个 ID 用于追踪该系列帖子。
通过 auto repost ID 检索帖子,或使用
all 获取所有自动转发帖。curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100", {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100', headers=headers)
print(r.json())
<?php
$apiUrl = 'https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100';
$apiKey = 'API_KEY'; // Replace 'API_KEY' with your actual API key
$headers = [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey,
];
$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers
]);
$response = curl_exec($curl);
if ($response === false) {
echo 'Curl error: ' . curl_error($curl);
} else {
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}
curl_close($curl);
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace HistoryGETRequest_csharp
{
class History
{
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
try
{
var response = await client.GetStringAsync(url);
Console.WriteLine(response);
}
catch (HttpRequestException ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
}
}
{
"history": [
{
"errors": [],
"post": "This is the post I sent",
"platforms": [
"twitter",
"facebook"
],
"postIds": [
{
"status": "success",
"id": "1288968500063775749", // Twitter Social Post ID
"platform": "twitter"
},
{
"id": "104923907983682_108683297607743", // Facebook Social Post ID
"status": "success",
"platform": "facebook"
}
],
"urls": [],
"type": "now",
"notes": "Approved by John Smith", // Reference notes set via /post
"created": "2022-05-20T17:25:06Z",
"status": "deleted",
"scheduleDate": { // In a future release changed to "scheduleDate": "2020-11-05T12:21:29Z"
"_seconds": 1604578889,
"_nanoseconds": 211000000,
"utc": "2020-11-05T12:21:29Z"
},
"id": "rhn6u7wwz2WxGv6MZGK9" // Ayrshare Top-Level Post ID
},
{
"status": "success",
"platforms": [
"twitter",
"facebook"
],
"created": "2022-05-20T17:25:06Z",
"post": "Sometimes we need to take a break for lunch.",
"scheduleDate": { // In a future release changed to "scheduleDate": "2020-11-05T12:21:29Z"
"_seconds": 1604578889,
"_nanoseconds": 211000000,
"utc": "2020-11-05T12:21:29Z"
},
"type": "now",
"postIds": [
{
"platform": "twitter",
"id": "1288890036000983105", // Twitter Social Post ID
"status": "success"
},
{
"id": "104923907983682_108329970009742", // Facebook Social Post ID
"status": "success",
"platform": "facebook",
"isVideo": true // Video post
}
],
"errors": [],
"urls": [],
"id": "wWIY0OEirdNeYSJYm1Xa" // Ayrshare Post ID
},
{ // Awaiting approval post - Approved by user
"approved": true,
"approvedBy": "9abf1426d6ce9122ef11c7222e1",
"approvedDate": "2025-06-06T12:28:12Z",
"created": "2025-06-06T12:27:56Z",
"errors": [],
"id": "sujQsrXtroJU0NEOlY38",
"mediaUrls": [],
"platforms": [
"twitter"
],
"post": "I failed my way to success. - Thomas Edison",
"postIds": [
{
"status": "success",
"id": "193096515330813",
"postUrl": "https://twitter.com/RetiretyHQ/status/19309651533081",
"platform": "twitter"
}
],
"profileTitle": "Primary Profile",
"refId": "9abf1426d6ce9122ef11c7222e1",
"requiresApproval": true,
"scheduleDate": "2025-06-06T12:27:56Z",
"shortenLinks": false,
"status": "success",
"type": "now"
},
{ // Awaiting approval post - Rejected by user
"approved": false,
"created": "2025-06-06T12:23:48Z",
"id": "XL5xHeNK8HGTg07qxzmd",
"mediaUrls": [],
"platforms": [
"twitter"
],
"post": " Honesty is the first chapter in the book of wisdom. - Thomas Jefferson",
"profileTitle": "Primary Profile",
"refId": "9abf1426d6ce9122ef11c72bd62eddw2",
"rejectedBy": "9abf1426d6ce9122ef11c7222e1",
"rejectedDate": "2025-06-06T12:23:58Z",
"requiresApproval": true,
"scheduleDate": "2025-06-06T12:23:48Z",
"shortenLinks": false,
"status": "awaiting approval",
"type": "now"
}
],
"refId": "9abf1426d6ce9122ef11c72bd62e59807c5cc083",
"count": 100,
"lastUpdated": "2025-04-05T22:44:14.209Z",
"nextUpdate": "2025-04-05T22:45:14.209Z"
}
{
"action": "history",
"status": "error",
"code": 221,
"message": "History not found for the past 30 days. Please see the docs on how to retrieve additional history. .../ayrshare.com/rest-api/endpoints/history#list-history-of-sent-and-scheduled-posts"
}
⌘I
