Update Edge Function

PUT /v1/account/edge-functions/{fn_uuid}

Change an edge function's settings, and optionally its code. This is a partial update: a field you leave out (or send empty / null) keeps its current value.

A settings-only change (name, phase, entry, limits) doesn't touch the build: status, bundle_key and bundle_hash stay as they are. Sending a non-empty source runs the AI security check, saves the code, sets status to building and queues a new build — the same as Upload Edge Function Source. When that build is ready, enabled rules already attached to the function are moved to the new bundle automatically; if it fails, they keep running the previous build. If the build can't be started (the source can't be staged or the build queued), the response carries status: "failed"; save the source again to retry.

Requires the endpoints:write permission on the active account and the edge_functions plan entitlement. A function paused over the plan (disabled_by_plan: true) can't be changed.

Path parameters

fn_uuid string (uuid) Req
The function's uuid, from List Edge Functions.

Request body

name string
New display name: at most 120 characters, no line breaks or NUL, unique in the account (case-insensitive).
phase string
on_http_request or on_http_response.
entry string
Handler export: a JavaScript identifier, at most 64 characters.
timeout_ms integer
1–1000 ms.
memory_mb integer
8–256 MiB.
source string
New JavaScript source, at most 524,288 bytes (512 KiB). Triggers a rebuild. An empty string leaves the code unchanged.

Fields not listed are ignored.

Response (200 OK)

{"edge_function": { … }} — the function after the change (fields: the edge function object).

Deprecated: until the sunset this response also carries the legacy integer id and *_id fields. Don't use them; read uuid and the *_uuid fields.

Errors

400 Bad Request
invalid JSON body, or a field that fails validation (name too long (max 120), phase must be one of: on_http_request, on_http_response, timeout_ms must be 1..1000, memory_mb must be 8..256, …).
401 Unauthorized
Missing or invalid auth.
403 Forbidden
The caller lacks endpoints:write, the plan doesn't include edge_functions (code entitlement_required), or the account is suspended (code account_suspended).
404 Not Found
edge function not found — unknown uuid, another account's function, or an application's function.
409 Conflict
The new name is taken (An edge function named "…" already exists in this account), or the function is paused over the plan (code quota_paused, with quota_paused_key: "edge_functions").
413 Payload Too Large
source too large (max 524288 bytes).
415 Unsupported Media Type
The request has no Content-Type: application/json header.
422 Unprocessable Entity
source failed the AI security check (or the check could not run). Nothing was changed.
500 Internal Server Error
failed to load edge function, failed to check edge function name or failed to update edge function.
Request — rename, raise the time budget
curl -X PUT "https://api.ngris.com/v1/account/edge-functions/019b1f24-1a62-7d27-8411-538ed86e2a62" \ -H "X-API-KEY: <your_api_key>" \ -H "Content-Type: application/json" \ -d '{ "name": "security-headers", "timeout_ms": 100 }'
Response — 200 OK
{ "edge_function": { "uuid": "019b1f24-1a62-7d27-8411-538ed86e2a62", "account_uuid": "019b24b5-135e-7590-888e-e7cfa7e28ff3", "name": "security-headers", "source": "function readRequest() { … }\n…", "bundle_key": "accounts/4821/edgefn/019b1f24-1a62-7d27-8411-538ed86e2a62/bundle.wasm", "bundle_hash": "5f2c8e0b9a7d4c31e6f80a2b4d9c7e15a3f6b8d02c4e9a7f1b3d5c8e0a2f4b6d", "entry": "default", "phase": "on_http_response", "timeout_ms": 100, "memory_mb": 64, "status": "ready", "created_at": "2026-10-12T09:14:03Z", "updated_at": "2026-10-14T16:02:10Z", "disabled_by_plan": false } }
On this page
Update Edge Function