Update function
Update function metadata or code. Supports partial updates - only include fields you want to change.
Common updates:
- Update function code (requires redeployment to take effect)
- Change function name or description
- Update runtime configuration
- Modify function slug
Important: Code updates are saved immediately but do NOT automatically deploy. After updating code, you must call POST /functions//deploy for changes to take effect in production.
curl --request PATCH \
--url https://api.kapso.ai/platform/v1/functions/{function_id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"function": {
"name": "<string>",
"slug": "<string>",
"lock_version": 123,
"description": "<string>",
"code": "<string>",
"runtime_config": {},
"public_endpoint": true
}
}
'import requests
url = "https://api.kapso.ai/platform/v1/functions/{function_id}"
payload = { "function": {
"name": "<string>",
"slug": "<string>",
"lock_version": 123,
"description": "<string>",
"code": "<string>",
"runtime_config": {},
"public_endpoint": True
} }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
function: {
name: '<string>',
slug: '<string>',
lock_version: 123,
description: '<string>',
code: '<string>',
runtime_config: {},
public_endpoint: true
}
})
};
fetch('https://api.kapso.ai/platform/v1/functions/{function_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kapso.ai/platform/v1/functions/{function_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'function' => [
'name' => '<string>',
'slug' => '<string>',
'lock_version' => 123,
'description' => '<string>',
'code' => '<string>',
'runtime_config' => [
],
'public_endpoint' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kapso.ai/platform/v1/functions/{function_id}"
payload := strings.NewReader("{\n \"function\": {\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"lock_version\": 123,\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"runtime_config\": {},\n \"public_endpoint\": true\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.kapso.ai/platform/v1/functions/{function_id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"function\": {\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"lock_version\": 123,\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"runtime_config\": {},\n \"public_endpoint\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kapso.ai/platform/v1/functions/{function_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"function\": {\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"lock_version\": 123,\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"runtime_config\": {},\n \"public_endpoint\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"slug": "calculate-shipping-cost",
"status": "draft",
"function_type": "cloudflare_worker",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"lock_version": 0,
"description": "<string>",
"code": "<string>",
"version": 123,
"last_deployed_at": "2023-11-07T05:31:56Z",
"invoke_response_mode": "passthrough",
"public_endpoint": false,
"runtime_config": {},
"endpoint_url": "https://api.kapso.ai/platform/v1/functions/{function_id}/invoke",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_by_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Path Parameters
Function identifier
Body
Request to update an existing function. Supports partial updates - only include fields you want to change. Important: Code updates are saved but not automatically deployed. You must call POST /functions/{id}/deploy to deploy changes to production.
Show child attributes
Show child attributes
Response
Function updated successfully
Single function response
Serverless function configuration. Functions are custom JavaScript code that runs on-demand in response to API invocations. Deploy functions to either Cloudflare Workers (global edge network) or Supabase Edge Functions (Deno runtime).
Show child attributes
Show child attributes
Was this page helpful?
curl --request PATCH \
--url https://api.kapso.ai/platform/v1/functions/{function_id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"function": {
"name": "<string>",
"slug": "<string>",
"lock_version": 123,
"description": "<string>",
"code": "<string>",
"runtime_config": {},
"public_endpoint": true
}
}
'import requests
url = "https://api.kapso.ai/platform/v1/functions/{function_id}"
payload = { "function": {
"name": "<string>",
"slug": "<string>",
"lock_version": 123,
"description": "<string>",
"code": "<string>",
"runtime_config": {},
"public_endpoint": True
} }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
function: {
name: '<string>',
slug: '<string>',
lock_version: 123,
description: '<string>',
code: '<string>',
runtime_config: {},
public_endpoint: true
}
})
};
fetch('https://api.kapso.ai/platform/v1/functions/{function_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kapso.ai/platform/v1/functions/{function_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'function' => [
'name' => '<string>',
'slug' => '<string>',
'lock_version' => 123,
'description' => '<string>',
'code' => '<string>',
'runtime_config' => [
],
'public_endpoint' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kapso.ai/platform/v1/functions/{function_id}"
payload := strings.NewReader("{\n \"function\": {\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"lock_version\": 123,\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"runtime_config\": {},\n \"public_endpoint\": true\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.kapso.ai/platform/v1/functions/{function_id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"function\": {\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"lock_version\": 123,\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"runtime_config\": {},\n \"public_endpoint\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kapso.ai/platform/v1/functions/{function_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"function\": {\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"lock_version\": 123,\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"runtime_config\": {},\n \"public_endpoint\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"slug": "calculate-shipping-cost",
"status": "draft",
"function_type": "cloudflare_worker",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"lock_version": 0,
"description": "<string>",
"code": "<string>",
"version": 123,
"last_deployed_at": "2023-11-07T05:31:56Z",
"invoke_response_mode": "passthrough",
"public_endpoint": false,
"runtime_config": {},
"endpoint_url": "https://api.kapso.ai/platform/v1/functions/{function_id}/invoke",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_by_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}
