staqlydocs
REST APIAPI referencePosts

Create a post

Create a post (posts:write; scheduling or publishing it right away also needs posts:publish)

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/posts

A draft unless status is scheduled (needs publish_at in the future and at least one target) or publish_now is true (needs a target). collection is an id or an exact name. Media ids come from POST /v1/media. Each target is a channel the post goes to, with optional text of its own and provider settings; a target that breaks its provider's limits is a 422 keyed targets.<channel_id>.content or targets.<channel_id>.settings.<key>.

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

content?string
Lengthlength <= 100000
media?array<string>

Media ids from POST /v1/media

Itemsitems <= 20
targets?array<>
Itemsitems <= 50
publish_at?|

In the future, at most a year ahead

Formatdate-time
status?string

Default draft; scheduled needs publish_at and a target

Value in"draft""scheduled"
publish_now?boolean

Publish right away (needs a target)

tags?array<>
Itemsitems <= 50
metadata?
source?string
Lengthlength <= 100
external_ref?string
Lengthlength <= 200
repeat_every?RepeatEvery

Repeat the post: once it is published, staqly schedules a copy this long after its publish time (every 1 to 6 days, every 1 or 2 weeks, every month); the copy repeats too. Empty: no repeat. To stop, clear repeat_every on the next scheduled copy, or delete it.

Value in"""1d""2d""3d""4d""5d""6d""1w""2w""1mo"
thread?array<>

Follow-up parts published as replies (platforms that take replies; your own automation gets them with the request)

Itemsitems <= 25

Response Body

Created

application/json
  1. response
id*string
collection_id*string
collection_name*string
content*string
media*array<string>

Media ids, in order

media_items*array<>

The same media, resolved

status*PostStatus

draft (being written), scheduled (goes out at publish_at), publishing (a job is at work), published (every target is), failed (a target is; retry it or edit and publish again)

Value in"draft""scheduled""publishing""published""failed"
publish_at*|

When it goes out (scheduled), or the time it kept as a note (draft after cancel)

Formatdate-time
published_at*|
Formatdate-time
tags*array<string>
metadata*

Free JSON for your own use

source*string

Who created it: a client name, an agent, a schedule

external_ref*string

Your own reference

repeat_every*RepeatEvery

Repeat the post: once it is published, staqly schedules a copy this long after its publish time (every 1 to 6 days, every 1 or 2 weeks, every month); the copy repeats too. Empty: no repeat. To stop, clear repeat_every on the next scheduled copy, or delete it.

Value in"""1d""2d""3d""4d""5d""6d""1w""2w""1mo"
thread*array<>

Replies published under the post after it, in order

version*integer

Grows with every edit; see PostPatch.expected_version

targets*array<>
created_at*string
Formatdate-time
updated_at*string
Formatdate-time
created_by*string

Who created the post: a person, or the API key (agent, automation) that did; empty when unknown

open_comments*integer

Reviewers' comment threads not resolved yet

curl -X POST 'https://staqly.example.com/v1/posts' \  -H 'Content-Type: application/json' \  -d '{}'
{  "id": "string",  "collection_id": "string",  "collection_name": "string",  "content": "string",  "media": [    "string"  ],  "media_items": [    {      "id": "string",      "mime_type": "string",      "size_bytes": 0,      "original_name": "string",      "url": "string",      "sha256": "string",      "created_at": "2019-08-24T14:15:22Z",      "alt_text": "string",      "width": 0,      "height": 0,      "duration_ms": 0,      "folder_id": "string",      "tags": [        "string"      ],      "deleted_at": "2019-08-24T14:15:22Z",      "purge_at": "2019-08-24T14:15:22Z",      "duplicate_of": "string"    }  ],  "status": "draft",  "publish_at": "2019-08-24T14:15:22Z",  "published_at": "2019-08-24T14:15:22Z",  "tags": [    "string"  ],  "metadata": {},  "source": "string",  "external_ref": "string",  "repeat_every": "",  "thread": [    {      "content": "string",      "media": [        "string"      ],      "delay_seconds": 0,      "media_items": [        {          "id": "string",          "mime_type": "string",          "size_bytes": 0,          "original_name": "string",          "url": "string",          "sha256": "string",          "created_at": "2019-08-24T14:15:22Z",          "alt_text": "string",          "width": 0,          "height": 0,          "duration_ms": 0,          "folder_id": "string",          "tags": [            "string"          ],          "deleted_at": "2019-08-24T14:15:22Z",          "purge_at": "2019-08-24T14:15:22Z",          "duplicate_of": "string"        }      ]    }  ],  "version": 0,  "targets": [    {      "channel_id": "string",      "channel_name": "string",      "provider": "string",      "avatar_url": "string",      "content": "string",      "settings": {        "property1": "string",        "property2": "string"      },      "status": "pending",      "external_id": "string",      "external_url": "string",      "error": "string",      "attempts": 0,      "published_at": "2019-08-24T14:15:22Z",      "replies": [        {          "index": 0,          "status": "pending",          "external_id": "string",          "external_url": "string",          "error": "string",          "published_at": "2019-08-24T14:15:22Z"        }      ]    }  ],  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z",  "created_by": "string",  "open_comments": 0}