staqlydocs
REST APIAPI referenceSchedules

Create a publishing schedule

Create a publishing schedule (schedules:manage)

Every request sends Authorization: Bearer ...: the access token in local mode, an API key stk_... in cloud mode. Use Send to try it against your cloud instance with your API key.

POST
/v1/schedules

kind once (run_at in the future) or recurring (rule: times with optional weekdays in tz, or every_minutes). At each run the schedule picks posts of its collection (pick: next, the oldest waiting draft; selected, the post_ids; all) and publishes them to its channels (a post's own targets win). When nothing waits, source decides: none, agent (emit schedule.posts_requested and list it on GET /v1/work) or endpoint (POST to endpoint_url, signed like a webhook with endpoint_secret, which answers {posts: [...]}).

Authorization

headerAuthorizationBearer <token>

API key (stk_...), or in the Community Edition the access token (stk_local_...)

Header Parameters

Idempotency-Key?string

Replays the stored response when the same key is repeated with the same method, path, query string and body within 24 hours (422 idempotency_mismatch with a different request, 409 idempotency_in_progress while the first one runs). Not applied to multipart uploads or to responses that carry a secret.

Lengthlength <= 200

Request Body

application/json
  1. body
collection*string

Collection id or exact name (create only)

name?string
Lengthlength <= 100
channels?array<string>
Itemsitems <= 50
kind*string
Value in"once""recurring"
run_at?string

once: in the future

Formatdate-time
rule?

When a recurring schedule runs: times (HH:MM) on weekdays in tz, or every N minutes

pick?string
Value in"next""selected""all"
post_ids?array<string>
Itemsitems <= 200
source?string
Value in"none""agent""endpoint"
endpoint_url?string
Formaturi
endpoint_secret?string

Signs the request like a webhook (X-Staqly-Signature); generated when empty, and returned in full once in this response

enabled?boolean

Response Body

Created

application/json
  1. response
id*string
collection_id*string
collection_name*string
name*string
channels*array<string>

Channel ids the chosen posts go to (a post's own targets win)

channel_names*array<string>
kind*string
Value in"once""recurring"
run_at*|

once only

Formatdate-time
rule*

When a recurring schedule runs: times (HH:MM) on weekdays in tz, or every N minutes

pick*string

next: the oldest waiting draft; selected: post_ids; all: every waiting draft

Value in"next""selected""all"
post_ids*array<string>
source*string

When nothing waits: do nothing, ask an agent (schedule.posts_requested, GET /v1/work) or fetch posts from endpoint_url

Value in"none""agent""endpoint"
endpoint_url*string
endpoint_secret?string

source endpoint only: the HMAC key of X-Staqly-Signature (sha256=hex(HMAC_SHA256(secret, timestamp + '.' + body)), like a webhook). Shown in full only when staqly generated it, in that create or update response (send an empty endpoint_secret to generate one); a secret you chose is never echoed back; elsewhere masked as ****<last 4>.

enabled*boolean
next_run_at*|
Formatdate-time
last_run_at*|
Formatdate-time
last_result*string

What the last run did, or why it failed

created_at*string
Formatdate-time
updated_at*string
Formatdate-time
curl -X POST 'https://staqly.example.com/v1/schedules' \  -H 'Content-Type: application/json' \  -d '{}'
{  "id": "string",  "collection_id": "string",  "collection_name": "string",  "name": "string",  "channels": [    "string"  ],  "channel_names": [    "string"  ],  "kind": "once",  "run_at": "2019-08-24T14:15:22Z",  "rule": {    "times": [      "09:00",      "17:30"    ],    "weekdays": [      0    ],    "tz": "Europe/Warsaw",    "every_minutes": 5  },  "pick": "next",  "post_ids": [    "string"  ],  "source": "none",  "endpoint_url": "string",  "endpoint_secret": "string",  "enabled": true,  "next_run_at": "2019-08-24T14:15:22Z",  "last_run_at": "2019-08-24T14:15:22Z",  "last_result": "string",  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}