> ## 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.

# Save a Cloud Function draft

> Save new code as the draft of a Cloud Function without changing what production runs. Returns the draft_hash that publishing requires.

Save new code for a Cloud Function without changing what production runs. The published code keeps running on every matching event until you [publish the draft](/docs/en/api/cloud-functions/post-cloud-functions-by-id-publish).

## How the draft works

* Each function has one draft, shared by the dashboard, the API, and the MCP. Each save replaces it.
* Only the code is drafted. The name, description, trigger, and `is_active` change immediately with [Update](/docs/en/api/cloud-functions/patch-cloud-functions-by-id).
* Saving code identical to the published code leaves no draft, and `draft_hash` comes back `null`.
* Keep the `draft_hash` from the response: [Publish](/docs/en/api/cloud-functions/post-cloud-functions-by-id-publish) requires it.

<Note>
  Sending `code` to [Update](/docs/en/api/cloud-functions/patch-cloud-functions-by-id) still publishes it immediately. Use this endpoint when the change should be tested first.
</Note>

## Next steps

1. [Test](/docs/en/api/cloud-functions/post-cloud-functions-by-id-test) the draft.
2. Review the requests it would have sent and the previewed lead changes.
3. [Publish](/docs/en/api/cloud-functions/post-cloud-functions-by-id-publish) it with that `draft_hash` as `expected_draft_hash`.


## 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.