/data-streams/user/{streamSlug}/publishPublish to Stream
Appends one message to a user stream. data is any JSON value; the optional subject is a routing suffix under the stream's subjectPrefix, so a publish never leaves the stream's own namespace.
Answers 202 once the broker has stored the message, with the full subject and the payload size.
Needs PROJECT_ADMIN.
| streamSlug * | path | The stream's slug, unique in the project. |
| projectSlug * | path | The project's slug: the path segment after It is unique within the org. |
| data * | any | The event payload: any JSON value (object, array, string, number, boolean or null). It is stored as JSON and delivered to consumers unchanged. |
| subject | string | An optional routing suffix appended under the stream's Omitted, the message is published on |
| HTTP | K9O Code | Description |
|---|---|---|
| 202 | Accepted | |
| 400 | K9O_STREAM_INVALID | The publish subject is malformed (too many segments, or an invalid segment). |
| 403 | K9O_RBAC_DENY | Publishing to a Pulse Stream requires PROJECT_ADMIN (or org-cascade). |
| 404 | K9O_STREAM_NOT_FOUND | No active Pulse Stream with that slug in this project. |
| 503 | K9O_STREAM_UNAVAILABLE | Pulse Stream messaging is not configured in this deployment, or the project's stream account is not provisioned, so the message was not stored. Retry later. |
| data * | object | The message was stored on the stream. |
| streamSlug * | string | The stream the message was published to. |
| subject * | string | The full subject the message was published on. |
| bytes * | integer | The size of the stored payload: the UTF-8 bytes of |
| accepted * | true | Always true: the broker acknowledged the message. |
| meta * | any |
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.streams.publish('<streamSlug>', {})Showing example in TypeScript
{
"subject": "string"
}{
"data": {
"streamSlug": "string",
"subject": "string",
"bytes": 0,
"accepted": true
}
}