Galadri

Communications API

Server-side endpoints for email, SMS, and AI phone calls.

Use the Communications API when your application already knows it wants to send an email, text someone, or place a phone call. These endpoints are useful for server-side orchestration, background jobs, and workflows that do not need the full Chat API.

Keep API keys server-side

Call these endpoints from your backend. Do not expose Galadri API keys in browser or mobile clients.

Provider setup still matters

These endpoints use the selected agent's communication credentials and channel permissions. Your organization must have working SendGrid and Twilio setup before direct sends can succeed, and the selected agent must have the matching email, SMS, or phone capability enabled.

Endpoints

POST/v1/emails
POST/v1/sms
POST/v1/calls

Shared Context

FieldTypeDescription
agent_idstringRequired. Agent slug or UUID used for credential resolution, policy, and billing.
end_user_idUUIDGaladri's internal end-user UUID from the Users API. Optional for email. Required for SMS and calls unless session_id already resolves to an end user.
session_idUUIDOptional. Useful for continuity, audit linkage, and resolving end-user context from an existing session.

End-user IDs

The Chat API accepts your application's user ID and creates the Galadri user if needed. These direct communications endpoints expect the Galadri end-user UUID when you provide end_user_id. You can also pass a session_id returned by the Chat API, and Galadri will resolve the end user from that session.

POST /v1/emails

Send direct emails and calendar invites through the selected agent's email credential. Plain emails are sent immediately. Calendar invites can create, update, or cancel saved schedule records. Provider click tracking is disabled for these operational emails so authored links stay direct.

Supported actions

FieldTypeDescription
send_emailactionSend a plain email. Requires to, subject, and body_html or body_text.
send_inviteactionSend a calendar invite email. Requires to, title, and start_datetime.
cancel_inviteactionCancel a previously sent invite by schedule_id.

Email request fields

ParameterTypeDescription
agent_idrequiredstringAgent slug or ID.
actionrequired"send_email" | "send_invite" | "cancel_invite"Email action to execute.
tostringRecipient email address.
subjectstringSubject line for send_email.
body_htmlstringHTML body for send_email.
body_textstringPlain-text body for send_email.
titlestringEvent title for send_invite.
start_datetimestringISO 8601 with timezone offset for send_invite.
duration_minutesintegerOptional duration for send_invite.
locationstringOptional location for send_invite.
descriptionstringOptional event description for send_invite.
schedule_idstringRequired for cancel_invite. Optional for send_invite when updating an existing schedule.
vehicle_idsstring[]Optional vehicle IDs to attach to a new calendar invite schedule.
end_user_idUUIDOptional internal Galadri end-user UUID for email workflows.
session_idUUIDOptional session context.
Direct email send
curl -X POST https://api.galadri.com/v1/emails \
  -H "Authorization: Bearer gld_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "main-agent",
    "action": "send_email",
    "to": "rob@example.com",
    "subject": "Service update",
    "body_text": "Your appointment is confirmed for tomorrow at 10:00 AM."
  }'
Email response
{
  "status": "success",
  "data": {
    "sent": true,
    "to": "rob@example.com",
    "subject": "Service update",
    "thread_id": null
  }
}

Email responses include a thread ID when the request includes end_user_id or a session_id that resolves to an end user. Agent-authored outbound emails include unsubscribe content and one-click unsubscribe headers. One-click unsubscribe mutates preference state only on POST, while normal link opens show a confirmation page. Galadri blocks future sends after a recipient opts out of email from that sender.

POST /v1/sms

Queue SMS or MMS through the selected agent's Twilio credential. Galadri checks sender-recipient SMS preferences before queueing, so opted-out recipients return an error instead of a queued callback workflow. Successful responses mean Galadri accepted the message and stored it for delivery. Carrier delivery can still fail later. On the first outbound text from a sender number to a recipient, Galadri adds a short disclosure that identifies the message type and explains how to opt out.

SMS request fields

ParameterTypeDescription
agent_idrequiredstringAgent slug or ID.
torequiredstringRecipient phone number. E.164 format preferred (for example "+15551234567").
messagerequiredstringMessage text.
media_urlstringOptional image URL for MMS.
thread_idstringOptional existing SMS thread ID.
end_user_idUUIDInternal Galadri end-user UUID. Required unless session_id resolves to an end user.
session_idUUIDOptional session context.
Direct SMS send
curl -X POST https://api.galadri.com/v1/sms \
  -H "Authorization: Bearer gld_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "main-agent",
    "end_user_id": "5361a22a-d4a9-4c57-b98b-c70c72f5865f",
    "to": "+15551234567",
    "message": "Your vehicle is ready for pickup."
  }'
SMS accepted response
{
  "status": "success",
  "data": {
    "sent": true,
    "thread_id": "550e8400-e29b-41d4-a716-446655440000",
    "segments": 1,
    "has_media": false
  }
}

SMS and call context

Direct SMS and call requests require end-user context. Provide end_user_id as the Galadri end-user UUID, or provide a session_id that already belongs to the end user.

POST /v1/calls

Initiate an outbound AI phone call through the selected agent's Twilio credential. Successful responses mean Galadri created the call session and started call initiation. The live call and post-call summary continue asynchronously. The JSON request body is capped at 256 KB.

If the recipient or another outside contact calls back, Galadri first matches the callback by destination credential and outside contact. Generic inbound calls use the credential default agent, but a matched callback resumes with the agent that initiated the outreach. During the live call, that agent can use its enabled communication tools to call, text, email, or notify another contact when that is the right next step.

When the request includes a chat session_id and the follow-up route is chat, Galadri records the call result in that same session and can run a new assistant turn so the user receives the update in the original thread. Follow-up delivery is idempotent for the same callback result, so provider retries do not duplicate the same chat, SMS, or email follow-up. Push follow-up webhooks include a stable delivery id when one is available so your backend can apply the same dedupe rule.

Call request fields

ParameterTypeDescription
agent_idrequiredstringAgent slug or ID.
torequiredstringRecipient phone number. E.164 format preferred (for example "+15551234567").
purposerequiredstringWhat the AI should discuss or accomplish on the call.
promptstringOptional extra instructions for this call.
follow_up_channelstringOptional post-call delivery preference for external-contact callbacks. Use auto, chat, sms, email, push, or none. Explicit email or SMS values record the matching end-user opt-in when the profile contact exists. When chat is selected or auto resolves to an originating chat session, Galadri can continue that same session with a follow-up assistant message after the call completes.
end_user_idUUIDInternal Galadri end-user UUID. Required unless session_id resolves to an end user.
session_idUUIDOptional session context.
Direct call initiation
curl -X POST https://api.galadri.com/v1/calls \
  -H "Authorization: Bearer gld_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "main-agent",
    "end_user_id": "5361a22a-d4a9-4c57-b98b-c70c72f5865f",
    "to": "+15551234567",
    "purpose": "Confirm tomorrow's appointment",
    "prompt": "Your mission is to confirm the appointment and answer any follow-up questions briefly.",
    "follow_up_channel": "email"
  }'
Call initiated response
{
  "status": "success",
  "data": {
    "initiated": true,
    "call_id": "550e8400-e29b-41d4-a716-446655440000"
  }
}

Errors

Validation, unavailable capability, provider, and internal errors use the standard structured error envelope when possible. A 402 insufficient-credit response may return a plain string error for compatibility with other Galadri endpoints.

Error response
{
  "error": {
    "code": "validation_error",
    "message": "end_user_id or session_id is required for SMS"
  }
}

For channel behavior, inbound setup, and credential ownership, see Communications. For the main conversational entry point, see Chat API.