API endpointsPublish requestsSubmit one or more publish requests POST

Submit one or more publish requests

POST
/v1/publish-requests

Submit one or more publish requests. Each item creates platform content — a post, a comment, a reply, a message — through a Profile. Every item's args is validated against its collection's publish input first and the submission is rejected whole if any item fails; each item then runs independently with its own pub_* ledger entry. Requires an Idempotency-Key. Answers 202 with each item as it stands. Sent with Prefer: wait=<seconds>, it waits up to that long (at most 10 seconds) for every item's outcome, and answers 200 if every item then has one.

Authorization

bearerAuth
AuthorizationBearer <token>

An API key from the Koil admin console, sent as Authorization: Bearer <key>. A live key starts koil_live_ and a sandbox key koil_sandbox_; the key alone selects the Organization and mode. See https://docs.koil.co/concepts/authentication.

In: header

Header Parameters

Koil-Version*string

The dated API version the request is written against; it fixes the request and response shapes. Every response echoes the version it is rendered in.

Value in"2026-12-08"
Idempotency-Key*string

A unique key for this request, scoped to the Organization and operation. Retrying with the same key and payload returns the first result instead of repeating the work, or runs a request that failed again; the same key with a different payload is refused with 409 conflict. Keys expire 24 hours after first use, and a request still in flight after 15 minutes releases its key to a retry with the same payload.

Match\S
Length1 <= length <= 255
Prefer?string

RFC 7240 preferences. wait=<seconds> holds the answer until every item has its outcome or is scheduled, for at most that long and never more than 10 seconds. Any other preference, or one Koil cannot read, is ignored.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

publishRequests*array<|||||||||||||||||||||||||>
Items1 <= items <= 100

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/publish-requests" \  -H "Koil-Version: 2026-12-08" \  -H "Idempotency-Key: string" \  -H "Content-Type: application/json" \  -d '{    "publishRequests": [      {        "collection": "youtube.videos.comments",        "profileId": "sandbox_prof_4T2cgH9gnSqEb9DrntKA",        "args": {          "target": {            "kind": "youtube.videos.posts",            "externalId": "sandbox_video_1"          },          "text": "Hello from Koil"        }      }    ]  }'
{  "publishRequests": [    {      "kind": "publish_request",      "mode": "live",      "id": "string",      "status": "created",      "collection": "string",      "variant": "string",      "profileId": "string",      "scheduledAt": "2019-08-24T14:15:22Z",      "externalId": "string",      "error": {        "code": "validation_error",        "message": "string",        "meta": {          "violations": [            {              "code": "string",              "path": "string",              "message": "string"            }          ],          "budgets": [            "string"          ],          "profileIds": [            "string"          ],          "required": [            "string"          ],          "limit": 0,          "resourceType": "string",          "resourceId": "string",          "reason": "string",          "refusalReason": "messaging_window_closed",          "property1": null,          "property2": null        }      },      "metadata": {        "property1": "string",        "property2": "string"      },      "createdAt": "2019-08-24T14:15:22Z",      "updatedAt": "2019-08-24T14:15:22Z",      "startedAt": "2019-08-24T14:15:22Z",      "succeededAt": "2019-08-24T14:15:22Z",      "failedAt": "2019-08-24T14:15:22Z",      "cancelledAt": "2019-08-24T14:15:22Z"    }  ]}
{  "publishRequests": [    {      "kind": "publish_request",      "mode": "live",      "id": "string",      "status": "created",      "collection": "string",      "variant": "string",      "profileId": "string",      "scheduledAt": "2019-08-24T14:15:22Z",      "externalId": "string",      "error": {        "code": "validation_error",        "message": "string",        "meta": {          "violations": [            {              "code": "string",              "path": "string",              "message": "string"            }          ],          "budgets": [            "string"          ],          "profileIds": [            "string"          ],          "required": [            "string"          ],          "limit": 0,          "resourceType": "string",          "resourceId": "string",          "reason": "string",          "refusalReason": "messaging_window_closed",          "property1": null,          "property2": null        }      },      "metadata": {        "property1": "string",        "property2": "string"      },      "createdAt": "2019-08-24T14:15:22Z",      "updatedAt": "2019-08-24T14:15:22Z",      "startedAt": "2019-08-24T14:15:22Z",      "succeededAt": "2019-08-24T14:15:22Z",      "failedAt": "2019-08-24T14:15:22Z",      "cancelledAt": "2019-08-24T14:15:22Z"    }  ]}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}
{  "error": {    "code": "validation_error",    "message": "string",    "meta": {      "violations": [        {          "code": "string",          "path": "string",          "message": "string"        }      ],      "budgets": [        "string"      ],      "profileIds": [        "string"      ],      "required": [        "string"      ],      "limit": 0,      "resourceType": "string",      "resourceId": "string",      "reason": "string",      "refusalReason": "messaging_window_closed",      "property1": null,      "property2": null    },    "requestId": "string"  }}