Skip to main content
PATCH
/
custom-functions
/
{id}
curl -X PATCH "https://api.magpipe.ai/functions/v1/custom-functions/789e0123-e89b-12d3-a456-426614174000" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Look up order status including tracking info",
    "is_active": true
  }'
{
  "id": "789e0123-e89b-12d3-a456-426614174000",
  "agent_id": "123e4567-e89b-12d3-a456-426614174000",
  "user_id": "456e7890-e89b-12d3-a456-426614174000",
  "name": "check_order_status",
  "description": "Look up order status including tracking info",
  "http_method": "POST",
  "endpoint_url": "https://api.yourstore.com/orders/status",
  "headers": [],
  "body_schema": [
    {
      "name": "order_id",
      "type": "string",
      "description": "The customer order ID",
      "required": true
    }
  ],
  "response_variables": [
    {"name": "status", "json_path": "$.data.status"}
  ],
  "timeout_ms": 120000,
  "max_retries": 2,
  "is_active": true,
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T14:00:00Z"
}
Update a custom function’s configuration. Only include fields you want to change.

Path Parameters

id
string
required
UUID of the custom function to update

Request Body

name
string
Function name in snake_case. Must be unique per agent.
description
string
Description of what the function does
http_method
string
HTTP method: GET, POST, PUT, PATCH, or DELETE
endpoint_url
string
The webhook URL to call
headers
array
Custom headers to include with requests
body_schema
array
Parameters the AI should collect
response_variables
array
Variables to extract from response
timeout_ms
integer
Request timeout in milliseconds
max_retries
integer
Number of retry attempts
is_active
boolean
Whether the function is active

Response

Returns the updated custom function object.
curl -X PATCH "https://api.magpipe.ai/functions/v1/custom-functions/789e0123-e89b-12d3-a456-426614174000" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Look up order status including tracking info",
    "is_active": true
  }'
{
  "id": "789e0123-e89b-12d3-a456-426614174000",
  "agent_id": "123e4567-e89b-12d3-a456-426614174000",
  "user_id": "456e7890-e89b-12d3-a456-426614174000",
  "name": "check_order_status",
  "description": "Look up order status including tracking info",
  "http_method": "POST",
  "endpoint_url": "https://api.yourstore.com/orders/status",
  "headers": [],
  "body_schema": [
    {
      "name": "order_id",
      "type": "string",
      "description": "The customer order ID",
      "required": true
    }
  ],
  "response_variables": [
    {"name": "status", "json_path": "$.data.status"}
  ],
  "timeout_ms": 120000,
  "max_retries": 2,
  "is_active": true,
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T14:00:00Z"
}