---
title: "Create or update a durable function"
method: POST
path: "/projects/{id}/durable-functions"
tags: ["Durable Functions"]
---

# Create or update a durable function

`POST /projects/{id}/durable-functions`

## Request

- Base URL: `https://api.volcano.dev`
- URL: `https://api.volcano.dev/projects/{id}/durable-functions`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Upload a durable function source bundle. Creates the function on the
first call for a name and redeploys it on every call after that, the
same create-or-update contract `POST /projects/{id}/functions` has.

Volcano builds and deploys asynchronously. A deployment that starts
immediately returns `status: provisioning`, then transitions to `active`
or `failed`; a deployment that has to wait for a running one is exposed
through `pending_deployment_id`. Existing executions keep running
against the runtime they started on.

The `durable` configuration is derived from the project's plan rather
than supplied here, and is fixed once the function exists. A name
already held by a standard function is rejected with 409: a function
cannot change kind.

## Path parameters

- `id` string, uuid, required

## Request body `multipart/form-data`

- object
  - `name` string, required: DNS-safe function name (lowercase letters, numbers, hyphens; cannot start or end with hyphen)
  - `code` string, binary, required: ZIP or tar.gz archive containing function source code plus dependency manifests/lockfiles.
  - `runtime` 'nodejs22.x' | 'nodejs24.x' | 'python3.13' | 'python3.14', required: Runtime environment. Required. Durable execution needs the durable authoring API, which ships for these runtimes only; any other runtime is rejected with 400 and the response names the ones that work. Note that a durable Python function needs a newer runtime than a standard one defaults to. `GET /functions/runtimes` reports `durable_capable` per runtime.
  - `handler` string: The name of the function to invoke. Defaults to "handler" if not specified.
  - `visibility` 'private' | 'authenticated' | 'public': Who may start an execution. Redeploying is the only way to change it, since the collection has no update endpoint; omit it to keep the current visibility, and a new function starts `private`. The standard collection's synchronous invocation fields — `invocation_mode`, `http_auth_mode`, `openapi_spec` — configure a request path no durable route serves, and are rejected with 400 rather than ignored.
  - `is_public` boolean: Deprecated alias for `visibility`: `true` means `public` and `false` means `authenticated`. Sending both with different meanings returns 400.
  - `variable_scope` 'all' | 'scoped': Which project variables this function receives. `all` (the default) gives it every project variable; `scoped` gives it only the variables it selects. Omitting this leaves an existing function's scope unchanged.
  - `variables` string: JSON-encoded array of project variable names this function requires, on top of the ones detected in its source. A declared name the project does not define is rejected with 400; a detected name it does not define is ignored. Only used when `variable_scope` is `scoped`. Omitting this leaves an existing function's declared names unchanged.
  - `commit` string: JSON-encoded commit the uploaded source came from: `{"repository": "acme/app", "sha": "<40-character commit ID>", "dirty": false}`. `repository` is `owner/name` or a github.com remote URL (`https://github.com/acme/app.git`, `git@github.com:acme/app.git`, or `ssh://git@github.com/acme/app.git`); Volcano drops any credentials in the URL and records `owner/name`. `dirty` is `true` when the uploaded files differ from the commit. All three fields are required, and fields Volcano does not know are ignored. An empty value, `null`, or `""` reports no commit. A malformed commit, or a repository not on GitHub, returns 400 before anything is deployed. Volcano records a function's commit with `commit.verified: false`.

## Response `200`

Existing durable function updated; its deployment was started or queued

- DurableFunction: A durable function. Separate from `Function` because a durable function is invoked only through its own execution endpoints, so it has no invocation mode, HTTP auth mode, OpenAPI document or invoke URL, and it carries a `durable` configuration that a standard function has no field for.
  - `id` string, uuid, required
  - `project_id` string, uuid, required
  - `name` string, required
  - `status` 'provisioning' | 'active' | 'failed' | 'deleting', required
  - `provisioning_started_at` string, date-time: Timestamp when the current provisioning phase started
  - `visibility` 'private' | 'authenticated' | 'public', required: Who may start executions of this function through `POST /durable-functions/{functionId}/executions`, and read and stop them through `GET /durable-functions/{functionId}/executions/{executionId}` and its `/stop`: service keys at every level (a scoped key needs `functions.invoke`), signed-in users of the project from `authenticated`, and anon keys holding `functions.invoke` only at `public`. On the read and stop routes a service key holding `*`, the default, reaches every execution. A service key scoped to a list without `*` and an anon key reach the ones whose client token they send, which the start returns, and a signed-in user also the ones they started. The project-scoped routes under `/projects/{id}/durable-functions` take the project owner's token or a project access token, whatever this is set to. Set it when the function is deployed. Durable functions have no update endpoint, so changing visibility later means redeploying. A durable function is startable, never invocable: it is not reachable through `POST /functions/{functionId}/invoke` or a function URL, which answer `404` at every level.
  - `is_public` boolean, required: Deprecated. `true` exactly when `visibility` is `public`.
  - `durable` DurableFunctionConfig, required: Execution limits the function was created with, derived from the project's plan. Fixed for the life of the function: changing them means creating a new one. The memory the function runs at, and the timeout on one attempt within an execution, also come from the plan but are not reported here: they are applied to the deployed function rather than recorded on it. Both are published per plan in the plans and limits guide.
    - `execution_timeout_seconds` integer, required: How long a whole execution may run, including time suspended in a wait. This is not a limit on one attempt: an execution outlives any single attempt by checkpointing and resuming, and the per-attempt timeout is the plan's own, smaller number.
    - `retention_days` integer, required: How long a finished execution's result and history are retained, for as long as the function exists. Deleting the function, or its project, ends retention early and takes the history with it. A result or error Volcano has just read is kept in memory for up to five minutes, so a read can still return it for up to five minutes after retention ends.
  - `deployed_regions` string[], required: Regions where this function is currently deployed
  - `runtime` string
  - `handler` string
  - `current_deployment_id` string, uuid: Identifier of the latest deployment operation
  - `pending_deployment_id` string, uuid: Newest queued deployment that will run after the current operation
  - `last_invoked_at` string, date-time: Most recent successful invocation timestamp
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required

## Other responses

- `201`: Durable function created and deployment workflow started
- `400`: Bad request (invalid archive, unsupported runtime, invalid name, an unknown `visibility`, `visibility` and `is_public` disagree, a malformed `commit`, or a project region that does not offer durable execution — a durable function deploys to every region of its project)
- `403`: Durable function limit exceeded for the project
- `409`: Name is held by a standard function, or a deletion is queued or running. The request is refused before the deploy starts, so nothing is deployed.
- `500`: Internal server error (function deployment failed)
- `503`: Durable deploys are paused platform-wide. The same request succeeds once they are re-enabled; executions already running are unaffected.

## Changes

- **2026-10-30** `84c4488f91e9`: 1 info
  - added the new optional request property `commit`
- **2026-10-26** `4b0676e06128`: 1 info
  - the endpoint scheme security `ProjectAccessToken` was added to the API
- **2026-10-07** `23e7875e7c4c`: 6 info
  - added the new optional request property `visibility`
  - request property `is_public` deprecated
  - response property `is_public` deprecated
  - response property `is_public` deprecated
  - …2 more
- **2026-09-19** `3a6f365f3f35`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/kong/apis/volcano-api/changes/projects/:id/durable-functions/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)
