Links

auto-schedule

Auto-Schedule API Endpoint: Create a schedule for future posts to automatically be sent.

Auto Schedule API Endpoint

Click the in the endpoint to view details.
Auto schedule sets up pre-defined posting schedules. For example, you can create a schedule to only post at 9 AM, 2 PM, and 5 PM, and using this schedule when posting will find the next available time slot. You may create an unlimited number of schedules.
The schedule may be applied with the /post endpoint using the following fields:
"autoSchedule": {
"schedule": true,
"title": "Schedule Title"
}
  • schedule: (required) boolean set to true
  • title: (optional) string. "title" references the schedule set in the /set-auto-schedule endpoint. Default title is "default".
Premium or Business Plan required.
post
https://app.ayrshare.com/api
/auto-schedule/set
Set Auto Schedule

Request Examples

cURL
Node.js
Python
PHP
Go
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"schedule": ["13:05Z", "20:14Z"], "title": "Instagram Schedule"}' \
-X POST https://app.ayrshare.com/api/auto-schedule/set
const fetch = require("node-fetch");
const API_KEY = "API_KEY";
fetch("https://app.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: "Instagram Schedule" // optional
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'schedule': ['13:05Z', '20:14Z'], 'title': 'Instagram Schedule'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://app.ayrshare.com/api/auto-schedule/set',
json=payload,
headers=headers)
print(r.json())
<?php
require 'vendor/autoload.php';// Composer auto-loader using Guzzle. See https://docs.guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'POST',
'https://app.ayrshare.com/api/auto-schedule/set',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'json' => [
'schedule' => ["13:05Z", "20:14Z"], // required
'title' => "Instagram Schedule" // optional
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
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://app.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()
}
delete
https://app.ayrshare.com/api
/auto-schedule/delete
Delete Auto Schedule

Request Examples

cURL
Node.js
Python
PHP
C#
curl \
-H "Authorization: Bearer API Key" \
-H 'Content-Type: application/json' \
-d '{"title": "Schedule Title"}' \
-X DELETE https://app.ayrshare.com/api/auto-schedule/delete
const fetch = require("node-fetch");
const API_KEY = "API_KEY";
const title = "Schedule Title";
fetch("https://app.ayrshare.com/api/delete", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({ title }),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'title': 'Schedule Title'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.delete('https://app.ayrshare.com/api/delete',
json=payload,
headers=headers)
print(r.json())
<?php
require 'vendor/autoload.php';// Composer auto-loader using Guzzle. See https://docs.guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'DELETE',
'https://app.ayrshare.com/api/delete',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'json' => [
'title' => ['Schedule Title']
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
using System;
using System.Net;
using System.IO;
namespace DeletePOSTRequest_charp
{
class Delete
{
static void Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://app.ayrshare.com/api/delete";
var httpWebRequest = WebRequest.CreateHttp(url);
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "DELETE";
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = "{\"title\" : \"Schedule Title\"}";
streamWriter.Write(json);
streamWriter.Flush();
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var response = streamReader.ReadToEnd();
Console.WriteLine(response);
}
}
}
}
get
https://app.ayrshare.com/api
/auto-schedule/list
List Auto Schedule

Request Examples

cURL
Node.js
Python
PHP
C#
curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://app.ayrshare.com/api/auto-schedule/list
const fetch = require("node-fetch");
const API_KEY = "API_KEY";
fetch("https://app.ayrshare.com/api/auto-schedule/list", {
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://app.ayrshare.com/api/auto-schedule/list', headers=headers)
print(r.json())
<?php
require 'vendor/autoload.php';// Composer auto-loader using Guzzle. See https://docs.guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'GET',
'https://app.ayrshare.com/api/auto-schedule/list',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
using System;
using System.Net;
using System.IO;
namespace UserGETRequest_charp
{
class User
{
static void Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://app.ayrshare.com/api/auto-schedule/list";
var httpWebRequest = WebRequest.CreateHttp(url);
httpWebRequest.ContentType = "application/json";
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var response = streamReader.ReadToEnd();
Console.WriteLine(response);
}
}
}
}

User Profile Auto Schedule

Auto schedule for a particular user profile by passing the profileKey parameter as a String in the body.
profileKey: "JLDP-0P2si-djJwd-90nsHJ"
Last modified 6mo ago