---
search:
  tags:
    - Functions
    - POST
seo:
  description: >-
    Publish source code as the function's new current version. A version…
    Reference for the POST /api/v2/functions/{name}/versions endpoint in the
    Anlyon API.
sidebar:
  label: Publish a function version
  badge: POST
title: Publish a function version
type: openapi-operation
---
Publish source code as the function's new current version. A version never changes: publishing again appends one. `allowedActions` lists the actions the function may call, by name; each must exist in this environment and be enabled (`400 ALLOWED_ACTION_UNAVAILABLE`). A call to any other action is refused in the runner and again by the API. Budgets default to 50 action calls, 1,000 ms of CPU, 100 binding calls and 30,000 ms per run. `straightThrough` lets a run skip the plan for writes to some of those actions, up to a number of writes per run; without it a straight-through run reads and does not write.

JavaScript: an ES module whose default export is `async function run(input, anlyon)`. Python: a module that defines `run(input, anlyon)`. `anlyon.invoke(action, input)` and `anlyon.read(action, input)` call actions; `anlyon.log(message)` adds a line to the run. The function has no network, no environment variables and no secrets. A call answers `{ ok: true, result }` or `{ ok: false, error }`. `result` is the action invocation: the provider's reply as text in `result.body`, and parsed in `result.json` (null when it is not JSON).

`POST /api/v2/functions/{name}/versions`
