staqlydocs
REST APIAPI referencePosts

Close a target on your own automation that waits for a result

Close a target on your own automation that waits for a result (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/{id}/targets/{channel}/result

Only targets on a channel of provider custom take reported results, and only while they are publishing (409 otherwise). published needs no more; failed takes an error. The post settles when its last target does.

Authorization

headerAuthorizationBearer <token>

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

Path Parameters

id*string
channel*string

The channel id of the target

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
status*string
Value in"published""failed"
url?string

Where the post lives now

external_id?string

The platform's id of the post

error?string

Why it failed

Response Body

OK

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/string/targets/string/result' \  -H 'Content-Type: application/json' \  -d '{  "status": "published"}'
{  "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}