> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getnexor.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Publish a Cloud Function draft

> Make the draft of a Cloud Function the published code and record a new version. Requires the draft_hash you reviewed and returns 409 if the draft changed.

Make the draft of a Cloud Function the published code. Production runs it from its next execution, and it is recorded as a new version that you can restore later.

## Before you publish

1. [Test](/docs/en/api/cloud-functions/post-cloud-functions-by-id-test) the draft and review what would have been sent.
2. Read the `draft_hash` of the draft you tested, from the draft response or from [Get](/docs/en/api/cloud-functions/get-cloud-functions-by-id).
3. Send it as `expected_draft_hash`.

## What can happen

| Response | Meaning |
| - | - |
| `200` | Published. `version.version_number` is the new version. |
| `404` `draft_not_found` | There is no draft. Someone may have published or discarded it. |
| `409` `draft_changed_since_preview` | The draft changed after you read it. Nothing was published. Read it again, test it, and publish its current `draft_hash`, which the response includes. |
| `503` `DEPLOYMENT_NOT_CURRENT` | The new version could not be deployed. Nothing was published and the draft is kept. Retry in a moment. |

## Good to know

* Executions already in progress finish on the previous version.
* Publishing does not turn on a paused function. A paused function is deployed when it is turned on.
* No test is required by the API, but the dashboard warns when the draft was not tested or its last test failed.


## API Specification

The full API specification for this endpoint is available in the [documentation index](https://docs.getnexor.ai/llms.txt).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.