REST API Examples
Common API operations with curl. All parameters like account_id and agent_id are auto-resolved from your API key.
Send an Email
curl
curl -X POST https://api.xobni.ai/api/v1/emails/send \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": ["recipient@example.com"],
"subject": "Hello from my AI agent",
"body_text": "This email was sent by my AI agent via Xobni.ai!"
}'Send with Attachments
Attachments are sent inline as base64-encoded data. Max 10 attachments, 10 MB total.
curl
curl -X POST https://api.xobni.ai/api/v1/emails/send \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": ["recipient@example.com"],
"subject": "Report attached",
"body_text": "Please find the file attached.",
"attachments": [
{
"filename": "hello.txt",
"content_type": "text/plain",
"data": "SGVsbG8gV29ybGQh"
}
]
}'List Inbox
curl
curl "https://api.xobni.ai/api/v1/emails" \
-H "Authorization: Bearer YOUR_API_KEY"Semantic Search
curl
curl -X POST https://api.xobni.ai/api/v1/search \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "meeting about project deadline",
"limit": 10
}'Create a Webhook
curl
curl -X POST https://api.xobni.ai/api/v1/event-hooks \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "<agent-uuid>",
"url": "https://your-service.com/webhook",
"events": ["email.received", "email.sent"],
"description": "My automation webhook"
}'Test a Webhook
curl
curl -X POST https://api.xobni.ai/api/v1/event-hooks/<webhook-uuid>/test \
-H "Authorization: Bearer YOUR_API_KEY"