API Reference
The Aurex API lets you integrate AI agents into any application, website, or workflow. All endpoints return JSON. Authentication uses API keys passed via the x-api-key header.
Base URL
https://yourdomain.comQuick Start
# 1. Get your API key from Dashboard → API Keys
# 2. Start a conversation
curl -X POST https://yourdomain.com/api/conversations \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"agentId": "YOUR_AGENT_ID",
"contact": "John Doe",
"message": "Hi, I need help booking an appointment"
}'
# 3. Response
{
"conversation": { "id": "clx...", "status": "OPEN" },
"aiMessage": { "role": "assistant", "content": "Hello John! I'd be happy to help you book an appointment..." }
}Aurex uses API keys for programmatic access. Include your key in the x-api-key header on every request.
/api/registerCreate a new user account.
Request Body
namestring — Full nameemailstring — Email addresspasswordstring — Min 6 charactersResponse
{ "id": "clx...", "email": "[email protected]", "name": "Jane Smith" }Create and manage AI agents. Each agent has a type and an optional custom system prompt.
/api/agents🔑 Auth requiredList all agents for the authenticated user.
Response
[
{
"id": "clx...",
"name": "Hotel Support Bot",
"type": "CUSTOMER_SUPPORT",
"systemPrompt": "You are a hotel concierge...",
"isActive": true,
"_count": { "conversations": 42 }
}
]/api/agents🔑 Auth requiredCreate a new agent. Plan limits apply.
Request Body
namestring — Agent display nametypeCUSTOMER_SUPPORT | LEAD_FOLLOWUP | APPOINTMENT_BOOKING | REPORT_GENERATORsystemPromptstring? — Custom instructions (optional)Response
{
"id": "clx...",
"name": "Hotel Support Bot",
"type": "CUSTOMER_SUPPORT",
"isActive": true,
"createdAt": "2025-01-01T00:00:00.000Z"
}/api/agents/:id🔑 Auth requiredUpdate an agent's name, prompt, or active status.
Request Body
namestring? — New namesystemPromptstring? — New promptisActiveboolean? — Enable or pauseResponse
{ "id": "clx...", "name": "Updated Name", "isActive": false }/api/agents/:id🔑 Auth requiredDelete an agent and all its conversations.
Response
{ "success": true }Start and continue AI-powered conversations. Each message triggers a GPT-4o response.
/api/conversations🔑 Auth requiredList conversations. Filter by agent using ?agentId=
Response
[
{
"id": "clx...",
"contact": "John Doe",
"status": "OPEN",
"agent": { "id": "clx...", "name": "Support Bot" },
"messages": [
{ "role": "user", "content": "Hi, I need help" },
{ "role": "assistant", "content": "Hello! How can I help?" }
]
}
]/api/conversations🔑 Auth requiredStart a new conversation. Returns the AI's first reply.
Request Body
agentIdstring — ID of the agent to usecontactstring — Customer name or identifiermessagestring — First message from the customerResponse
{
"conversation": { "id": "clx...", "contact": "John", "status": "OPEN" },
"aiMessage": { "role": "assistant", "content": "Hello John! How can I help?" }
}Example
curl -X POST https://yourdomain.com/api/conversations \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"agentId":"clx...","contact":"John","message":"Hi, I need help"}'/api/conversations/:id🔑 Auth requiredSend a message to an existing conversation.
Request Body
messagestring — Message contentResponse
{ "id": "clx...", "role": "assistant", "content": "Here is my reply..." }/api/conversations/:id🔑 Auth requiredUpdate conversation status.
Request Body
statusOPEN | RESOLVED | ESCALATEDResponse
{ "count": 1 }Embed a chat widget on any website with a single script tag.
/api/widget?agentId=:idReturns the embeddable JavaScript widget for a given agent.
Response
// JavaScript widget bundle
Example
<!-- Add before </body> on your website --> <script src="https://yourdomain.com/api/widget?agentId=YOUR_AGENT_ID" async ></script>
Receive real-time event notifications when conversations are created, updated, or resolved.
/api/webhooks🔑 Auth requiredList all configured webhook endpoints.
Response
[
{
"id": "clx...",
"url": "https://your-system.com/webhook",
"events": ["conversation.created", "message.created"],
"secret": "whsec_..."
}
]/api/webhooks🔑 Auth requiredRegister a new webhook endpoint.
Request Body
urlstring — Your endpoint URLeventsstring[] — Events to subscribe toResponse
{ "id": "clx...", "url": "...", "secret": "whsec_..." }Example
// Webhook payload example
{
"event": "conversation.created",
"timestamp": "2025-01-01T00:00:00.000Z",
"data": {
"id": "clx...",
"contact": "John Doe",
"agentId": "clx...",
"status": "OPEN"
}
}/api/webhooks/:id🔑 Auth requiredRemove a webhook endpoint.
Response
{ "success": true }Connect Aurex to external platforms using these webhook endpoints.
/api/integrations/zapierTrigger an agent from a Zapier workflow.
Request Body
agentIdstring — Agent to usecontactstring — Contact identifiermessagestring — Message to processResponse
{ "reply": "AI response text" }Example
// Required header x-api-key: YOUR_API_KEY
/api/integrations/whatsappTwilio WhatsApp webhook. Set this as your Twilio webhook URL.
Response
// TwiML response with AI reply
Example
// Set in Twilio Console: // Webhook URL: https://yourdomain.com/api/integrations/whatsapp // Required .env: TWILIO_AUTH_TOKEN=your_token WHATSAPP_DEFAULT_AGENT_ID=clx...
/api/integrations/messengerFacebook Messenger webhook for auto-replies.
Response
{ "status": "ok" }Example
// Required .env: MESSENGER_VERIFY_TOKEN=your_token MESSENGER_PAGE_ACCESS_TOKEN=your_token MESSENGER_DEFAULT_AGENT_ID=clx...
/api/integrations/slackSlack slash command handler. Use /Aurex in your workspace.
Request Body
textstring — agentId + messageResponse
{ "text": "AI reply" }Webhook Events
Subscribe to these events when registering a webhook endpoint. Aurex signs each payload with your webhook secret using HMAC-SHA256.
conversation.createdA new conversation was startedconversation.updatedConversation status changedconversation.resolvedConversation marked as resolvedconversation.escalatedConversation escalated to humanmessage.createdA new message was sent or receivedVerifying Webhook Signatures
// Node.js example
import crypto from "crypto";
function verifyWebhook(payload: string, signature: string, secret: string) {
const expected = crypto
.createHmac("sha256", secret)
.update(payload)
.digest("hex");
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}Error Codes
All errors return a JSON object with an error field describing the issue.
Error Response Format
{
"error": "Upgrade your plan to create more agents"
}Rate Limits
Need help? [email protected]
© 2025 Aurex. All rights reserved.