curl -X POST "https://api.magpipe.ai/functions/v1/manage-dynamic-variables" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "123e4567-e89b-12d3-a456-426614174000",
"name": "caller_name",
"description": "The full name of the caller",
"var_type": "text"
}'
{
"id": "789e0123-e89b-12d3-a456-426614174000",
"agent_id": "123e4567-e89b-12d3-a456-426614174000",
"user_id": "456e7890-e89b-12d3-a456-426614174000",
"name": "caller_name",
"description": "The full name of the caller",
"var_type": "text",
"enum_options": null,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
{
"error": "enum_options must be a non-empty array when var_type is enum"
}
{
"error": "A variable with this name already exists for this agent"
}
Dynamic Variables
Create Dynamic Variable
Create a new dynamic variable for an agent
POST
/
manage-dynamic-variables
curl -X POST "https://api.magpipe.ai/functions/v1/manage-dynamic-variables" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "123e4567-e89b-12d3-a456-426614174000",
"name": "caller_name",
"description": "The full name of the caller",
"var_type": "text"
}'
{
"id": "789e0123-e89b-12d3-a456-426614174000",
"agent_id": "123e4567-e89b-12d3-a456-426614174000",
"user_id": "456e7890-e89b-12d3-a456-426614174000",
"name": "caller_name",
"description": "The full name of the caller",
"var_type": "text",
"enum_options": null,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
{
"error": "enum_options must be a non-empty array when var_type is enum"
}
{
"error": "A variable with this name already exists for this agent"
}
Create a dynamic variable that your AI agent will extract from conversations. Dynamic variables let you capture structured data (names, emails, order numbers, etc.) during calls.
Request Body
Response
curl -X POST "https://api.magpipe.ai/functions/v1/manage-dynamic-variables" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "123e4567-e89b-12d3-a456-426614174000",
"name": "caller_name",
"description": "The full name of the caller",
"var_type": "text"
}'
{
"id": "789e0123-e89b-12d3-a456-426614174000",
"agent_id": "123e4567-e89b-12d3-a456-426614174000",
"user_id": "456e7890-e89b-12d3-a456-426614174000",
"name": "caller_name",
"description": "The full name of the caller",
"var_type": "text",
"enum_options": null,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
{
"error": "enum_options must be a non-empty array when var_type is enum"
}
{
"error": "A variable with this name already exists for this agent"
}