Skip to main content
PATCH
Save a Cloud Function draft
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.

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.
  • Saving code identical to the published code leaves no draft, and draft_hash comes back null.
  • Keep the draft_hash from the response: Publish requires it.
Sending code to Update still publishes it immediately. Use this endpoint when the change should be tested first.

Next steps

  1. Test the draft.
  2. Review the requests it would have sent and the previewed lead changes.
  3. Publish it with that draft_hash as expected_draft_hash.

Authorizations

X-API-Key
string
header
required

API key for authentication. Keys are prefixed with nxr_live_.

Path Parameters

id
string<uuid>
required

Cloud Function id.

Body

application/json
code
string
required

The complete code of the draft. It replaces the previous draft.

Response

The draft was saved.

success
enum<boolean>
required
Available options:
true
function
object
required
draft_hash
string | null
required

Hash of the draft. Send it as expected_draft_hash to publish. null when the code matches the published code.

Last modified on October 6, 2026