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
Configurar programación automática
Configura una programación automática de publicación proporcionando los horarios de envío
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",
}
Configura una programación automática de publicación proporcionando los horarios de envío. La publicación se enviará automáticamente en el próximo horario disponible. Si hoy no hay más horarios disponibles, se usará el primer horario disponible de mañana, y así sucesivamente.
Usa la programación automática estableciendo el parámetro
Si solo quieres programar una publicación para una fecha futura, consulta el parámetro
scheduleDate
de /post.autoSchedule de /post en true y el title si deseas usar una programación en particular. Por ejemplo, establece los horarios en hora UTC 13:05Z y 20:14Z y autoSchedule: true en la publicación. La publicación se programará en el próximo horario disponible entre 13:05Z o 20:14Z.
Parámetros de encabezado
Parámetros del cuerpo
array
requerido
Arreglo de cadenas con los horarios programados para publicar automáticamente. El arreglo se tratará como un conjunto, por lo que se eliminarán los duplicados.Formato: ISO-8601 UTC. Ejemplo:
["13:05Z", "22:14Z"]. No requerido si se proporciona setStartDate.string
predeterminado:"default"
Puedes crear múltiples programaciones de publicación diferentes asignando un título único a cada una. El título debe contener solo caracteres alfanuméricos: no se permiten caracteres especiales como
*, ~, /, [ o ].Si especificas el title en /post con autoScheduleTitle, se usará esa programación.string
Establece una fecha específica para comenzar la programación automática; proporciona una fecha y hora en formato ISO-8601 UTC. Por ejemplo,
2021-07-08T12:30:00Z. La hora de inicio se aplicará al “title” proporcionado o se usará el título predeterminado si no se proporciona uno.Las nuevas publicaciones saldrán desde la fecha de inicio en adelante. Las publicaciones programadas previamente no se ven afectadas.array
Especifica en qué días de la semana debe enviarse la publicación. Valores 0-6 (domingo - sábado). Por ejemplo,
[1, 3] solo publicará los lunes y miércoles.array
Excluye ciertas fechas para que no se realice la programación automática. Por ejemplo,
["2026-01-01"] para excluir el Año Nuevo.Nota: solo se excluirán las publicaciones programadas automáticamente después de que se haya establecido 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",
}