Skip to main content

AI Functions API

List All Functions

tenant_id
string
required
The ID of the tenant
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

id
string
required
The ID of the function
tenant_id
string
required
The ID of the tenant
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

tenant_id
string
required
The ID of the tenant
ai_function[name]
string
required
Name of the function
ai_function[description]
string
Description of the function
ai_function[parameters]
object
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

id
string
required
The ID of the function
tenant_id
string
required
The ID of the tenant
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

id
string
required
The ID of the function
tenant_id
string
required
The ID of the tenant
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