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

# Restore a Cloud Function version

> Copy a published version of a Cloud Function into its draft. Production keeps the published code until the draft is tested and published.

Copy a published version of a Cloud Function into its draft. Production keeps running the published code until you [test](/docs/en/api/cloud-functions/post-cloud-functions-by-id-test) and [publish](/docs/en/api/cloud-functions/post-cloud-functions-by-id-publish) the draft, so restoring never changes production by itself.

## Replacing an open draft

When the function already has a draft, the call returns 409 `draft_already_open` and changes nothing. Send `replace_draft: true` only when the unpublished changes can be lost.

## Good to know

* Restoring the published version clears the draft, and `draft_hash` comes back `null`.
* Keep the returned `draft_hash` to publish the restored code.
* A version number that does not exist returns 404 `version_not_found`.


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