curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"schedule": ["13:05Z", "20:14Z"], "title": "Instagram Schedule"}' \
-X POST https://api.ayrshare.com/api/auto-schedule/set
const API_KEY = "API_KEY";
const title = "Instagram Schedule";
fetch("https://api.ayrshare.com/api/auto-schedule/set", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${API_KEY}`
},
body: JSON.stringify({
schedule: ["13:05Z", "20:14Z"], // required
title: title // optional
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
<?php
$API_KEY = "API_KEY";
$data = [
'schedule' => ["13:05Z", "20:14Z"], // required
'title' => "Instagram Schedule" // optional
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => "https://api.ayrshare.com/api/auto-schedule/set",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Authorization: Bearer " . $API_KEY
]
]);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
} else {
$json = json_decode($response, true);
print_r($json);
}
curl_close($ch);
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace AutoSchedulePOSTRequest_csharp
{
class AutoSchedule
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/auto-schedule/set";
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
var payload = new
{
schedule = new[] { "13:05Z", "20:14Z" },
title = "Instagram Schedule"
};
try
{
var content = new StringContent(
System.Text.Json.JsonSerializer.Serialize(payload),
System.Text.Encoding.UTF8,
"application/json"
);
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
package main
import (
"bytes"
"encoding/json"
"log"
"net/http"
)
func main() {
message := map[string]interface{}{
"schedule": []string{"13:05Z", "20:14Z"},
"title": "Instagram Schedule"
}
bytesRepresentation, err := json.Marshal(message)
if err != nil {
log.Fatalln(err)
}
req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/auto-schedule/set",
bytes.NewBuffer(bytesRepresentation))
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
req.Header.Add("Authorization", "Bearer API_KEY")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal("Error:", err)
}
res.Body.Close()
}
{
status: "success",
message: "Auto schedule set.",
title: "Instagram Schedule",
}
Auto Schedule
设置自动排期
提供发送时间以建立自动发布排期
POST
/
auto-schedule
/
set
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"schedule": ["13:05Z", "20:14Z"], "title": "Instagram Schedule"}' \
-X POST https://api.ayrshare.com/api/auto-schedule/set
const API_KEY = "API_KEY";
const title = "Instagram Schedule";
fetch("https://api.ayrshare.com/api/auto-schedule/set", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${API_KEY}`
},
body: JSON.stringify({
schedule: ["13:05Z", "20:14Z"], // required
title: title // optional
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
<?php
$API_KEY = "API_KEY";
$data = [
'schedule' => ["13:05Z", "20:14Z"], // required
'title' => "Instagram Schedule" // optional
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => "https://api.ayrshare.com/api/auto-schedule/set",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Authorization: Bearer " . $API_KEY
]
]);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
} else {
$json = json_decode($response, true);
print_r($json);
}
curl_close($ch);
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace AutoSchedulePOSTRequest_csharp
{
class AutoSchedule
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/auto-schedule/set";
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
var payload = new
{
schedule = new[] { "13:05Z", "20:14Z" },
title = "Instagram Schedule"
};
try
{
var content = new StringContent(
System.Text.Json.JsonSerializer.Serialize(payload),
System.Text.Encoding.UTF8,
"application/json"
);
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
package main
import (
"bytes"
"encoding/json"
"log"
"net/http"
)
func main() {
message := map[string]interface{}{
"schedule": []string{"13:05Z", "20:14Z"},
"title": "Instagram Schedule"
}
bytesRepresentation, err := json.Marshal(message)
if err != nil {
log.Fatalln(err)
}
req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/auto-schedule/set",
bytes.NewBuffer(bytesRepresentation))
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
req.Header.Add("Authorization", "Bearer API_KEY")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal("Error:", err)
}
res.Body.Close()
}
{
status: "success",
message: "Auto schedule set.",
title: "Instagram Schedule",
}
提供发送时间以建立自动发布排期。帖子将自动在下一个可用时间发送。如果当天没有更多可用时间,则将使用第二天的第一个可用时间,以此类推。
要使用自动排期,请在 /post 请求中将 autoSchedule 参数设置为
如果你只是想将某条帖子安排在未来某个日期发布,请查看 /post 的
scheduleDate 参数。true,如果希望使用特定排期,请设置 title。例如,将时间设为 UTC 时间 13:05Z 和 20:14Z,并在帖子中设置 autoSchedule: true。该帖子将在下一个可用时间(13:05Z 或 20:14Z)发布。
请求头参数
请求体参数
自动发布排期时间的字符串数组。数组将视为集合,因此重复项会被去除。格式:ISO-8601 UTC。示例:
["13:05Z", "22:14Z"]。如果提供了 setStartDate,则不必需。通过为每个排期分配唯一标题,你可以创建多个不同的发布排期。标题只能包含字母和数字——不允许包含
*、~、/、[ 或 ] 等特殊字符。如果你在 /post 请求中通过 autoScheduleTitle 指定了 title,将使用该排期。设置开始自动排期的特定起始日期,请提供 ISO-8601 UTC 日期时间。例如
2021-07-08T12:30:00Z。该起始时间将被应用到所提供的”title”上;如果未提供,则应用到默认标题上。新帖子会从起始日期开始发送。此前已排期的帖子不受影响。指定应在星期几发送帖子。取值 0-6(周日 - 周六)。例如
[1, 3] 表示仅在周一和周三发布帖子。从自动排期中排除某些日期。例如
["2026-01-01"] 可排除元旦。请注意,仅在 excludeDates 设置之后进行自动排期的帖子才会被排除。curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"schedule": ["13:05Z", "20:14Z"], "title": "Instagram Schedule"}' \
-X POST https://api.ayrshare.com/api/auto-schedule/set
const API_KEY = "API_KEY";
const title = "Instagram Schedule";
fetch("https://api.ayrshare.com/api/auto-schedule/set", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${API_KEY}`
},
body: JSON.stringify({
schedule: ["13:05Z", "20:14Z"], // required
title: title // optional
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
<?php
$API_KEY = "API_KEY";
$data = [
'schedule' => ["13:05Z", "20:14Z"], // required
'title' => "Instagram Schedule" // optional
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => "https://api.ayrshare.com/api/auto-schedule/set",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Authorization: Bearer " . $API_KEY
]
]);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
} else {
$json = json_decode($response, true);
print_r($json);
}
curl_close($ch);
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace AutoSchedulePOSTRequest_csharp
{
class AutoSchedule
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/auto-schedule/set";
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
var payload = new
{
schedule = new[] { "13:05Z", "20:14Z" },
title = "Instagram Schedule"
};
try
{
var content = new StringContent(
System.Text.Json.JsonSerializer.Serialize(payload),
System.Text.Encoding.UTF8,
"application/json"
);
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
package main
import (
"bytes"
"encoding/json"
"log"
"net/http"
)
func main() {
message := map[string]interface{}{
"schedule": []string{"13:05Z", "20:14Z"},
"title": "Instagram Schedule"
}
bytesRepresentation, err := json.Marshal(message)
if err != nil {
log.Fatalln(err)
}
req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/auto-schedule/set",
bytes.NewBuffer(bytesRepresentation))
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
req.Header.Add("Authorization", "Bearer API_KEY")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal("Error:", err)
}
res.Body.Close()
}
{
status: "success",
message: "Auto schedule set.",
title: "Instagram Schedule",
}
⌘I
