API Reference
All endpoints require an authenticated session. Collection-level endpoints scope results to the session’s organization automatically.
Text Agent CRUD
Section titled “Text Agent CRUD”Create agent
Section titled “Create agent”POST /api/text-agentsPermission: TextAgent:Collection:Create
Request:
pub struct TextAgentData { pub name: String, pub purpose: String, pub provider: TextAgentProvider, // "OpenAi" | "Gemini" pub model: TextAgentModel, // see model table below pub knowledge_base_ids: Vec<Uuid>, pub confidence_threshold: f64, // 0.0 – 1.0}Response: TextAgent
List agents
Section titled “List agents”GET /api/text-agentsResponse: Vec<TextAgent>
Get agent
Section titled “Get agent”GET /api/text-agents/{id}Permission: TextAgent:Instance:View
Response: TextAgent
Update agent
Section titled “Update agent”PUT /api/text-agents/{id}Permission: TextAgent:Instance:Update
Request: TextAgentData (same as create)
Response: TextAgent
Delete agent
Section titled “Delete agent”DELETE /api/text-agents/{id}Permission: TextAgent:Instance:Delete
Cascades to: contact_text_agent, text_agent_default_channel, text_agent_suggestion.
Contact Assignments
Section titled “Contact Assignments”List assignments for a contact
Section titled “List assignments for a contact”GET /api/contacts/{contact_id}/text-agentsResponse: Vec<ContactTextAgent>
Create or replace assignment
Section titled “Create or replace assignment”POST /api/contacts/{contact_id}/text-agentsPermission: TextAgent:Instance:Update
Request:
pub struct ContactTextAgentData { pub text_agent_id: Uuid, pub channel: MessageChannel, // "sms" | "whatsapp" pub auto_reply: bool,}Upsert semantics: if an assignment for (contact_id, channel) already exists, it is deleted and replaced atomically.
Response: ContactTextAgent
Remove assignment
Section titled “Remove assignment”DELETE /api/contacts/{contact_id}/text-agents/{channel}Permission: TextAgent:Instance:Update
Default Channel Agents
Section titled “Default Channel Agents”List defaults
Section titled “List defaults”GET /api/text-agents/defaultsResponse: Vec<TextAgentDefaultChannel>
Set default for a channel
Section titled “Set default for a channel”POST /api/text-agents/defaultsPermission: TextAgent:Collection:Create
Request:
pub struct TextAgentDefaultChannelData { pub channel: MessageChannel, // "sms" | "whatsapp" pub text_agent_id: Uuid,}Upsert semantics: replaces any existing default for that channel.
Response: TextAgentDefaultChannel
Remove default
Section titled “Remove default”DELETE /api/text-agents/defaults/{channel}Permission: TextAgent:Instance:Update
Suggestions
Section titled “Suggestions”Generate suggestions for a message
Section titled “Generate suggestions for a message”POST /api/text-agents/generate-suggestions?contact_id={uuid}&message_id={uuid}Permission: TextAgent:Collection:List
Resolves the agent (contact assignment → default → error if none), runs the full agentic pipeline, persists, and returns the result.
Response: TextAgentSuggestion
Get saved suggestions for a message
Section titled “Get saved suggestions for a message”GET /api/text-agents/suggestions/{message_id}Permission: TextAgent:Collection:List
Returns existing suggestions without re-generating.
Response: TextAgentSuggestion
Response Types
Section titled “Response Types”TextAgent
Section titled “TextAgent”pub struct TextAgent { pub id: Uuid, pub organization_id: Uuid, pub name: String, pub purpose: String, pub provider: TextAgentProvider, pub model: TextAgentModel, pub knowledge_base_ids: Vec<Uuid>, pub confidence_threshold: f64, pub created_at: String, pub updated_at: String,}ContactTextAgent
Section titled “ContactTextAgent”pub struct ContactTextAgent { pub id: Uuid, pub organization_id: Uuid, pub contact_id: Uuid, pub text_agent_id: Uuid, pub channel: MessageChannel, pub auto_reply: bool, pub created_at: String,}TextAgentDefaultChannel
Section titled “TextAgentDefaultChannel”pub struct TextAgentDefaultChannel { pub id: Uuid, pub organization_id: Uuid, pub channel: MessageChannel, pub text_agent_id: Uuid, pub created_at: String,}TextAgentSuggestion
Section titled “TextAgentSuggestion”pub struct TextAgentSuggestion { pub id: Uuid, pub organization_id: Uuid, pub contact_id: Uuid, pub text_agent_id: Uuid, pub message_id: Uuid, pub suggestions: Vec<TextAgentSuggestionItem>, pub auto_sent_body: Option<String>, pub created_at: String,}
pub struct TextAgentSuggestionItem { pub body: String, // the reply text pub confidence: f64, // 0.0 – 1.0}Permissions Summary
Section titled “Permissions Summary”| Endpoint | Permission |
|---|---|
POST /api/text-agents | TextAgent:Collection:Create |
GET /api/text-agents | (open to org members) |
GET /api/text-agents/{id} | TextAgent:Instance:View |
PUT /api/text-agents/{id} | TextAgent:Instance:Update |
DELETE /api/text-agents/{id} | TextAgent:Instance:Delete |
GET /api/contacts/{id}/text-agents | (open to org members) |
POST /api/contacts/{id}/text-agents | TextAgent:Instance:Update |
DELETE /api/contacts/{id}/text-agents/{ch} | TextAgent:Instance:Update |
GET /api/text-agents/defaults | (open to org members) |
POST /api/text-agents/defaults | TextAgent:Collection:Create |
DELETE /api/text-agents/defaults/{ch} | TextAgent:Instance:Update |
POST /api/text-agents/generate-suggestions | TextAgent:Collection:List |
GET /api/text-agents/suggestions/{id} | TextAgent:Collection:List |
Provider & Model Reference
Section titled “Provider & Model Reference”| Enum Variant | API identifier | Provider |
|---|---|---|
Gpt41 | gpt-4.1 | OpenAI |
Gpt41Mini | gpt-4.1-mini | OpenAI |
Gpt52 | gpt-5.2-chat-latest | OpenAI |
Gemini3Flash | gemini-3-flash-preview | Gemini |
Gemini3Pro | gemini-3-pro-preview | Gemini |
Gemini25Flash | gemini-2.5-flash | Gemini |