Skip to main content
PATCH
/
v1
/
custom_functions
/
{function_id}
Update Custom Function
curl --request PATCH \
  --url https://api.example.com/v1/custom_functions/{function_id} \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "source_code": "<string>",
  "limits": {
    "max_run_time": 15
  }
}
'
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>",
      "input": "<unknown>",
      "ctx": {}
    }
  ]
}
Update an existing custom function. You can update the name, description, source code, and limits. If source code changes, the function is re-analyzed automatically.

Path Parameters

function_id
string
required
Unique identifier of the custom function

Request Body

All fields are optional. Only provided fields will be updated.
name
string
Updated display name
description
string
Updated description
source_code
string
Updated Python source code (triggers re-analysis)
limits
object
Updated execution limits

Response

Returns the updated CustomFunctionItem.

Example Request

curl -X PATCH -H "x-api-key: <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{"description": "Updated description", "source_code": "def xpander_run_action(city: str) -> str:\n    return f\"Weather in {city}: Sunny\""}' \
  "https://api.xpander.ai/v1/custom_functions/<function-id>"

Notes

  • Changing source_code triggers automatic re-analysis — status resets to analysing
  • Non-code fields (name, description, limits) can be updated without triggering re-analysis

Authorizations

x-api-key
string
header
required

API Key for authentication

Path Parameters

function_id
string
required

Body

application/json

Request model for updating an existing custom function.

All fields are optional. If source_code changes, the function will be re-analyzed automatically (status transitions to 'analysing' then 'ready').

name
string | null

Updated function name.

description
string | null

Updated function description.

source_code
string | null

Updated Python source code. If changed, triggers re-analysis.

limits
CustomFunctionLimitsModel · object

Updated resource limits.

Response

Successful Response