Update a function
patch
/v1/projects/{ref}/functions/{function_slug}Updates a function with the specified slug and project.
OAuth scopes
- edge_functions:write
The fine-grained token must include the following permissions to access this endpoint:
- edge_functions_write
Path parameters
- refRequiredstring
Project ref
- function_slugRequiredstring
Function slug
Query parameters
- slugOptionalstring
- nameOptionalstring
- verify_jwtOptionalstring
- import_mapOptionalstring
- entrypoint_pathOptionalstring
- import_map_pathOptionalstring
- ezbr_sha256Optionalstring
Body
Raw Brotli-compressed ESZIP binary file.
Validation requirements - The file must start with the four magic bytes EZBR (hex: 45 5A 42 52).
- The
ezbr_sha256query parameter must contain the SHA-256 hash of the uploaded ESZIP payload.
Example
import { readFile } from 'node:fs/promises';import { brotliCompress } from 'node:zlib';import { promisify } from 'node:util';import { createHash } from 'node:crypto';const compress = promisify(brotliCompress);const marker = Buffer.from('EZBR', 'ascii');const file = await readFile('./function.eszip');const compressed = await compress(file);const payload = Buffer.concat([marker, compressed]);const ezbr_sha256 = createHash('sha256') .update(payload) .digest('hex');console.log(ezbr_sha256);- nameOptionalstring
- bodyOptionalstring
- verify_jwtOptionalboolean
Response codes
- 200
- 401
- 403
- 429
- 500
Response (200)
{ "id": "lorem", "slug": "lorem", "name": "lorem", "status": "ACTIVE", "version": -9007199254740991, "created_at": -9007199254740991, "updated_at": -9007199254740991, "verify_jwt": true, "import_map": true, "entrypoint_path": "lorem", "import_map_path": "lorem", "ezbr_sha256": "lorem"}