---
title: "Publish a message from inside a workflow"
method: POST
path: "/durable-messages/publish"
tags: ["Durable Functions"]
---

# Publish a message from inside a workflow

`POST /durable-messages/publish`

## Request

- Base URL: `https://api.volcano.dev`
- URL: `https://api.volcano.dev/durable-messages/publish`
- Auth: none required

Publishes a named message from a running workflow. The Volcano SDK
calls this from `ctx.publish`; applications do not call it directly.

The message is stored, listed with the execution's messages, and
delivered live to clients subscribed to the execution. Live delivery
counts against the project's Realtime messages.

The SDK sends an `Idempotency-Key` that a rerun of the publishing step
repeats, so a step that runs again returns the first message with
`200` and stores nothing new. That message is delivered live again,
and counts again, because the first run may have stopped before
subscribers got it. The SDKs deliver it to a subscriber once.

## Headers

- `X-Volcano-Durable-Session` string, required
- `Idempotency-Key` string

## Request body

- PublishDurableMessageRequest
  - `name` string, required: The name a workflow waits on or publishes under: up to 237 printable ASCII characters.
  - `data` unknown

## Response `200`

A message with this `Idempotency-Key` was already published; it is returned

- DurableMessage: A message sent to, or published by, a durable execution.
  - `id` string, uuid, required
  - `execution_id` string, uuid, required
  - `direction` 'in' | 'out', required: `in` is a message sent to the execution. `out` is one the execution published.
  - `seq` integer, required: Orders the execution's messages in both directions. It increases with every message but can skip numbers. Pass the last one you read as `after` to read what came next.
  - `name` string, required
  - `data` unknown, required
  - `sender` DurableMessageSender, required: Who sent the message.
    - `type` 'service_key' | 'user' | 'anon' | 'project' | 'execution', required: The credential the message was sent with. `project` is the project's owner or one of its access tokens, and `execution` is the execution itself publishing.
    - `user_id` string, nullable, required: The auth user who sent it. Null unless `type` is `user`.
  - `status` 'queued' | 'delivering' | 'delivered' | 'dropped' | 'published', required: An `in` message is `queued` until a wait for its name takes it, `delivering` while it is handed over, and `delivered` once the execution has it. It is `dropped` if the execution ended before any wait took it. Every `out` message is `published`.
  - `delivered_at` string, date-time, nullable, required: When the execution received the message. Null until then, and for `out` messages.
  - `sent_at` string, date-time, required

## Other responses

- `201`: Message published
- `400`: The session token header is missing, or the name, data or idempotency key is invalid
- `401`: The session token is not valid
- `409`: The message cannot be published. `code` is `execution_not_running` or `too_many_published_messages`.
- `413`: The request body is larger than 72 KiB

## Changes

- **2026-10-23** `5113707385cc`: 1 breaking
  - added the pattern `^[ -~]+$` to the `header` request parameter `Idempotency-Key`
- **2026-10-16** `7fec2090c1f4`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/kong/apis/volcano-api/changes/durable-messages/publish/post.md)

---

[API](https://skmtc.dev/kong/apis/volcano-api.md) - [All operations](https://skmtc.dev/kong/apis/volcano-api/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/volcano-api/revisions/84c4488f91e9?raw)
