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
Set 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
