Send an iMessage, SMS, or email to a contact — the core automation endpoint
Documentation Index
Fetch the complete documentation index at: https://docs.tuco.ai/llms.txt
Use this file to discover all available pages before exploring further.
attachmentUrls is provided (you can send attachments only, or message + attachments). Personalization placeholders like {{firstName}} are resolved from the lead at send time.message can be empty. Supported formats: images (PNG, JPG, GIF, WebP, HEIC), video (MP4, MOV), audio (CAF), and PDF. Supported sources: any public URL, UploadThing/Blob URLs that belong to your workspace."+12025551234").
Required unless recipientEmail or leadId is provided.recipientPhone or leadId is provided."imessage".| Value | Channel | Addresses tried (from lead) |
|---|---|---|
"imessage" | iMessage via device relay | phone → altPhone1-3 → email → altEmail1-3 |
"sms" | SMS via Twilio | phone → altPhone1-3 only |
"email" | email → altEmail1-3 only |
recipientPhone/recipientEmail, the body recipient is used
as the send-to address while the lead is used for linking.Alternate contact fields
Scheduling & time window
"2025-10-15T14:30:00Z")."America/New_York"). Required
if using sendWindowStart/sendWindowEnd.HH:mm format (e.g. "09:00").HH:mm format (e.g. "17:00").0 = Sunday, 6 = Saturday.
Example: [1,2,3,4,5] for weekdays only.Fallback & advanced
true, if the message ends in failed status (technical error after
retries), Tuco sends a fallback SMS via your configured Twilio number.
Returns 400 with code: "FALLBACK_NOT_CONFIGURED" if enabled but no
fallback is set up on your workspace.POST /api/leads, then send using leadId as shown below.
201 when the message is successfully created.
The status field tells you what happens next.
201 Created or 200 OK when duplicate lead used)200 with duplicateOnly: true, existingLeadIds, and leadIds so your automation can continue without treating it as an error.
true when the message was created.| Status | Meaning | Is it an error? |
|---|---|---|
"sent" | Message sent immediately (sync path) | No |
"pending" | Created, worker will process. Line limits / time window / device gap may delay it. | No — it will send when checks pass |
"scheduled" | Will send at scheduledDate, or rescheduled due to device gap | No |
"fallback" | Recipient has no iMessage; fallback SMS sent if configured | No (business rule) |
"failed" | All retries exhausted or availability API error | Yes (technical) |
"pending" and "scheduled" mean the message is accepted and queued. The worker sends it when:sendWindowStart–sendWindowEnd)allowedDaysOfWeek)| Status | When | Example |
|---|---|---|
400 | Message and attachments both empty | { "error": "Message and attachmentUrls cannot both be empty" } |
400 | Invalid messageType | { "error": "Invalid messageType. Must be email, sms, or imessage" } |
400 | No active lines + no fromLineId | { "error": "No active lines in workspace..." } |
400 | No recipient anywhere | { "error": "Either recipientEmail or recipientPhone is required..." } |
400 | sendFallbackSmsOnFailed: true but fallback not configured | { "error": "...", "code": "FALLBACK_NOT_CONFIGURED" } |
401 | Invalid or missing API key | { "error": "Unauthorized" } |
402 | Subscription past due (workspace read-only) | { "error": "READ_ONLY", "code": "READ_ONLY", "reason": "past_due" } |
404 | leadId provided but not found | { "error": "Lead not found or access denied" } |
Message created
messages collection with status pending
(or scheduled if scheduledDate is provided).Pre-send checks (worker)
Availability check
fallback and
fallback SMS fires (when configured).Send
leadId, Tuco resolves the recipient automatically:
Lead found by phone/email
recipientPhone or
recipientEmail, the message is linked to that lead. Any altPhone/altEmail
fields you pass will update the lead (merge, not overwrite).New lead created (Quick Sends)
leadId provided
recipientPhone/recipientEmail from the body override the lead’s stored
contact for this specific send.altPhone1–altPhone3 or altEmail1–altEmail3, they are
stored on the lead (not the message). The worker uses them as fallback
addresses when the primary address fails the iMessage availability check.
Priority order for messageType: "imessage":
GET /api/workspace/fallback-config).sendFallbackSmsOnFailed: true in the request body (per-message) or
on the workspace (applies to all messages).| Scenario | Fallback SMS fires? |
|---|---|
Status = fallback (no iMessage), Twilio configured | Yes — always |
Status = failed, sendFallbackSmsOnFailed: true, Twilio configured | Yes |
Status = failed, sendFallbackSmsOnFailed: false (default) | No |
Status = failed, flag is true but no Twilio | 400 error at API call time |
recipientPhone on the message. Email-only messages
will not trigger fallback SMS.