AI Functions API
List All Functions
curl -X GET \
'https://a.messageflow.ai/api/v1/ai_functions?tenant_id=123' \
-H 'Authorization: Bearer YOUR_AUTH_TOKEN'
[
{
"id": 1,
"name": "Example Function",
"description": "A sample function",
"parameters": {
"type": "object",
"properties": {
"param1": {
"type": "string",
"description": "First parameter"
}
}
}
}
]
Get Function Details
curl -X GET \
'https://a.messageflow.ai/api/v1/ai_functions/1?tenant_id=123' \
-H 'Authorization: Bearer YOUR_AUTH_TOKEN'
{
"id": 1,
"name": "Example Function",
"description": "A sample function",
"parameters": {
"type": "object",
"properties": {
"param1": {
"type": "string",
"description": "First parameter"
}
}
},
"tenant_id": 123
}
Create New Function
Description of the function
JSON schema for function parameters
curl -X POST \
'https://a.messageflow.ai/api/v1/ai_functions?tenant_id=123' \
-H 'Authorization: Bearer YOUR_AUTH_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"ai_function": {
"name": "New Function",
"description": "A new function",
"parameters": {
"type": "object",
"properties": {
"param1": {
"type": "string",
"description": "First parameter"
}
}
}
}
}'
{
"id": 2,
"name": "New Function",
"description": "A new function",
"parameters": {
"type": "object",
"properties": {
"param1": {
"type": "string",
"description": "First parameter"
}
}
},
"tenant_id": 123
}
Update Function
curl -X PUT \
'https://a.messageflow.ai/api/v1/ai_functions/1?tenant_id=123' \
-H 'Authorization: Bearer YOUR_AUTH_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"ai_function": {
"name": "Updated Function",
"description": "Updated description",
"parameters": {
"type": "object",
"properties": {
"param1": {
"type": "string",
"description": "Updated parameter description"
}
}
}
}
}'
{
"id": 1,
"name": "Updated Function",
"description": "Updated description",
"parameters": {
"type": "object",
"properties": {
"param1": {
"type": "string",
"description": "Updated parameter description"
}
}
},
"tenant_id": 123
}
Delete Function
curl -X DELETE \
'https://a.messageflow.ai/api/v1/ai_functions/1?tenant_id=123' \
-H 'Authorization: Bearer YOUR_AUTH_TOKEN'
{
"status": "Function 1 deleted"
}
HTTP Status Codes
- 200: Success
- 201: Created
- 400: Bad Request
- 401: Unauthorized
- 404: Not Found
- 422: Unprocessable Entity
Function Configuration
The function configuration includes:
- Name and description
- Parameters schema (JSON Schema format)
- Required parameters
- Parameter types and descriptions