Skip to main content

AI Prompts API

List All Prompts

tenant_id
string
The ID of the tenant. If you leave it blank, it will use the tenant id of the user you are logged in as.
curl -X GET \
  'https://a.messageflow.ai/api/v1/ai_prompts?tenant_id=123' \
  -H 'Authorization: Bearer YOUR_AUTH_TOKEN'
[
  {
    "name": "Example Prompt",
    "id": 1,
    "description": "A sample prompt",
    "prompt_type": 1,
    "group": "General",
    "mode": 1
  }
]

Get Prompt Details

id
string
required
The ID of the prompt
tenant_id
string
required
The ID of the tenant
curl -X GET \
  'https://a.messageflow.ai/api/v1/ai_prompts/1?tenant_id=123' \
  -H 'Authorization: Bearer YOUR_AUTH_TOKEN'
{
  "name": "Example Prompt",
  "id": 1,
  "description": "A sample prompt",
  "prompt_type": 1,
  "group": "General",
  "mode": 1,
  "user_prompt": "Your prompt text here",
  "system": "System instructions",
  "assistant": "Assistant response template",
  "user_name": "User name",
  "temparature": 0.7,
  "max_tokens": 1000,
  "ai_model": "gpt-4o",
  "settings": "{}",
  "function_defs": "[]",
  "next_prompt_id": null,
  "exit_prompt_id": null,
  "prompt_mode": 1,
  "voice": "echo",
  "initial_announcement": null,
  "initial_response": "Initial response text"
}

Create New Prompt

tenant_id
string
required
The ID of the tenant
prompt[name]
string
required
Name of the prompt
prompt[description]
string
Description of the prompt
prompt[prompt_type]
number
Type of prompt (default: 1)
prompt[group]
string
Group name
prompt[mode]
number
Mode (default: 1)
prompt[user_prompt]
string
User prompt text
prompt[system]
string
System instructions
prompt[assistant]
string
Assistant response template
prompt[temparature]
number
Temperature setting
prompt[max_tokens]
number
Maximum tokens
prompt[ai_model]
string
AI model name
curl -X POST \
  'https://a.messageflow.ai/api/v1/ai_prompts?tenant_id=123' \
  -H 'Authorization: Bearer YOUR_AUTH_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "prompt": {
      "name": "New Prompt",
      "description": "A new prompt",
      "prompt_type": 1,
      "group": "General",
      "mode": 1,
      "user_prompt": "Your prompt text",
      "system": "System instructions",
      "assistant": "Assistant template",
      "temparature": 0.7,
      "max_tokens": 1000,
      "ai_model": "gpt-4o"
    }
  }'
{
  "id": 2,
  "name": "New Prompt",
  "status": "created"
}

Update Prompt

id
string
required
The ID of the prompt
tenant_id
string
required
The ID of the tenant
curl -X PUT \
  'https://a.messageflow.ai/api/v1/ai_prompts/1?tenant_id=123' \
  -H 'Authorization: Bearer YOUR_AUTH_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "prompt": {
      "name": "Updated Prompt",
      "description": "Updated description",
      "temparature": 0.8
    }
  }'
{
  "name": "Updated Prompt",
  "id": 1,
  "description": "Updated description",
  "prompt_type": 1,
  "group": "General",
  "mode": 1,
  "user_prompt": "Your prompt text here",
  "system": "System instructions",
  "assistant": "Assistant response template",
  "user_name": "User name",
  "temparature": 0.8,
  "max_tokens": 1000,
  "ai_model": "gpt-4o",
  "settings": "{}",
  "function_defs": "[]",
  "next_prompt_id": null,
  "exit_prompt_id": null,
  "prompt_mode": 1,
  "voice": "echo",
  "initial_announcement": null,
  "initial_response": "Initial response text"
}

Delete Prompt

id
string
required
The ID of the prompt
tenant_id
string
required
The ID of the tenant
curl -X DELETE \
  'https://a.messageflow.ai/api/v1/ai_prompts/1?tenant_id=123' \
  -H 'Authorization: Bearer YOUR_AUTH_TOKEN'
{
  "status": "Prompt deleted successfully"
}

Test Prompt

id
string
required
The ID of the prompt
tenant_id
string
required
The ID of the tenant
prompt_text
string
required
The text to test with the prompt
prompt_params
object
Additional parameters for the prompt
curl -X POST \
  'https://a.messageflow.ai/api/v1/ai_prompts/1/test_prompt?tenant_id=123' \
  -H 'Authorization: Bearer YOUR_AUTH_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "prompt_text": "Your test question here",
    "prompt_params": {
      "param1": "value1",
      "param2": "value2"
    }
  }'
{
  "response": "AI response text",
  "altered_prompt": "Modified prompt text",
  "next_prompt_id": 2,
  "next_prompt_params": {
    "param1": "value1",
    "param2": "value2"
  }
}

HTTP Status Codes

  • 200: Success
  • 201: Created
  • 400: Bad Request
  • 401: Unauthorized
  • 404: Not Found
  • 422: Unprocessable Entity

Prompt Types

  • 1: Standard prompt (PROMPT_TYPE_PROMPT)
  • 2: Group prompt (PROMPT_TYPE_GROUP)
  • 3: API prompt (PROMPT_TYPE_API)
  • 4: Data analysis prompt (PROMPT_TYPE_DATA)
  • 5: Data summary analysis prompt (PROMPT_TYPE_DATA_SUMMARY)

Prompt Modes

  • 1: Activated (PROMPT_MODE_ACTIVATED)
  • 2: Deactivated (PROMPT_MODE_DEACTIVATED)
  • 3: Simulated (PROMPT_MODE_SIMULATED)

Voice Options

  • alloy
  • ash
  • ballad
  • coral
  • echo
  • sage
  • shimmer
  • verse