Skip to content

API Reference

All endpoints require an authenticated session. Collection-level endpoints scope results to the session’s organization automatically.

POST /api/text-agents

Permission: 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


GET /api/text-agents

Response: Vec<TextAgent>


GET /api/text-agents/{id}

Permission: TextAgent:Instance:View

Response: TextAgent


PUT /api/text-agents/{id}

Permission: TextAgent:Instance:Update

Request: TextAgentData (same as create)

Response: TextAgent


DELETE /api/text-agents/{id}

Permission: TextAgent:Instance:Delete

Cascades to: contact_text_agent, text_agent_default_channel, text_agent_suggestion.


GET /api/contacts/{contact_id}/text-agents

Response: Vec<ContactTextAgent>


POST /api/contacts/{contact_id}/text-agents

Permission: 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


DELETE /api/contacts/{contact_id}/text-agents/{channel}

Permission: TextAgent:Instance:Update


GET /api/text-agents/defaults

Response: Vec<TextAgentDefaultChannel>


POST /api/text-agents/defaults

Permission: 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


DELETE /api/text-agents/defaults/{channel}

Permission: TextAgent:Instance:Update


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 /api/text-agents/suggestions/{message_id}

Permission: TextAgent:Collection:List

Returns existing suggestions without re-generating.

Response: TextAgentSuggestion


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,
}

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,
}

pub struct TextAgentDefaultChannel {
pub id: Uuid,
pub organization_id: Uuid,
pub channel: MessageChannel,
pub text_agent_id: Uuid,
pub created_at: String,
}

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
}

EndpointPermission
POST /api/text-agentsTextAgent: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-agentsTextAgent: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/defaultsTextAgent:Collection:Create
DELETE /api/text-agents/defaults/{ch}TextAgent:Instance:Update
POST /api/text-agents/generate-suggestionsTextAgent:Collection:List
GET /api/text-agents/suggestions/{id}TextAgent:Collection:List
Enum VariantAPI identifierProvider
Gpt41gpt-4.1OpenAI
Gpt41Minigpt-4.1-miniOpenAI
Gpt52gpt-5.2-chat-latestOpenAI
Gemini3Flashgemini-3-flash-previewGemini
Gemini3Progemini-3-pro-previewGemini
Gemini25Flashgemini-2.5-flashGemini