auto-schedule

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

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 on Mondays and Wednesdays. The system will automatically will queue the post in 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 /auto-schedule/set endpoint. Default title is "default".

Premium or Business Plan required.

Set Auto Schedule

POST https://app.ayrshare.com/api/auto-schedule/set

Set up an auto-post schedule by providing times to send. Post will automatically be sent at the next available time. If no more times are available today, the first available time tomorrow will be used, and so on.

Note: if you're looking to just schedule a post for a future date, please see the scheduleDate parameter of /post Use the auto-schedule by setting the /post autoSchedule parameter to true and the title if you want to use a particular schedule. Example, set the times to UTC time 13:05Z and 20:14Z and autoSchedule: true in the post. The post will be scheduled at the next available time of 13:05Z or 20:14Z. Premium or Business Plan required.

Headers

NameTypeDescription

Authorization*

string

Format: Authorization: Bearer API_KEY. See Overview for more information.

Profile-Key

string

Profile Key of a user profile.

Request Body

NameTypeDescription

schedule*

array

Array of strings of scheduled times to auto-posts. Format: ISO-8601 UTC. Example: ["13:05Z", "22:14Z"]. Not required if setStartDate provided.

title

string

Multiple schedules can be set by providing a title for each schedule. If you specify the title in /post with autoScheduleTitle, that schedule will be used. Default title is: "default".

setStartDate

string

Set a specific beginning date to start the auto schedule, provide a ISO-8601 UTC date time. E.g. 2021-07-08T12:30:00Z. The start time will be applied to the provided "title" or will use the default title if one isn't provided. New posts will go out from the start date onwards. Previously scheduled posts are not affected.

daysOfWeek

array

Specify which days of the week the post should be sent. Values 0-6 (Sunday - Saturday). For example [1, 3] will only publish posts on Mondays and Wednesdays.

If not set, the default is all days of the week.

excludeDates

array

Exclude certain dates from auto scheduling occurring. For example ["2026-01-01"] to exclude New Years. Note, only posts auto scheduled after the excludeDates has been set will be excluded.

{
    status: "success",
    message: "Auto schedule set.",
    title: "Schedule title",
}

Request Examples

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

Delete Auto Schedule

DELETE https://app.ayrshare.com/api/auto-schedule/delete

Delete a particular auto schedule. Provide the title of the schedule or "default" is used.

Headers

NameTypeDescription

Authorization*

string

Format: Authorization: Bearer API_KEY. See Overview for more information.

Profile-Key

string

Profile Key of a user profile.

Request Body

NameTypeDescription

title

string

Schedule title previously set in /auto-schedule/set endpoint. If a title is not given, "default" title is used.

{
    status: "success"
}

Request Examples

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

List Auto Schedule

GET https://app.ayrshare.com/api/auto-schedule/list

List the active auto schedules. Returns an array of schedules with titles, times, and last scheduled date. The lastScheduleDate timestamp is the next schedule date or the previously scheduled date if no pending posts.

Headers

NameTypeDescription

Authorization*

string

Format: Authorization: Bearer API_KEY. See Overview for more information.

Profile-Key

string

Profile Key of a user profile.

{
    "status": "success",
    "schedules": {
        "Title 1": {
            "lastScheduleDate": "2024-01-05T22:30:00Z",
            "schedule": [
                "20:03Z",
                "22:34Z"
            ]
        },
        "Title 2": {
            "schedule": [
                "13:05Z",
                "22:14Z"
            ],
            "lastScheduleDate": "2024-01-04T22:30:00Z",
            "daysOfWeek": [
                2,
                3,
                4
            ]
        }
    }
}

Request Examples

curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://app.ayrshare.com/api/auto-schedule/list

User Profile Auto Schedule

Auto schedule for a particular user profile by adding the PROFILE_KEY in the header.

Last updated