API reference

Messages API

3 endpoints for messages. Send your token as a Bearer header; how tokens, scopes, limits and errors work is on the API reference page.

API reference

Before you start

  • Authentication, scopes, rate limits, errors, retrying safely and paging are explained once, on the API reference.
  • Every request needs a token with the scope shown on its endpoint; without it the answer is 403.

Messages

Send an email

POST/api/v1/messages/emailScope messages:send

Send one plain-text email to one contact, through your email connection. A real message, billed per message.

An address that bounced or complained is never sent to, nor a contact on Do-Not-Call or who withdrew consent, and nothing goes in the quiet hours. It is written on the contact's timeline. Requires an Idempotency-Key header.

This sends a real message to a real customer, billed from your wallet for each one at your plan's price per message. Send an Idempotency-Key header: without one the request is refused (428) and nothing is sent.

Parameters
ParameterTypeWhat it is
Idempotency-Keyrequiredstring, up to 255 characters, in the headersAny unique text up to 255 characters, such as a UUID, chosen by you for this request. Sent again with the same body within 24 hours, the first answer comes back (with Idempotent-Replayed: true) and nothing is done twice. The same key with another body is refused with 422. Required here: without it the request is refused with 428 and nothing is sent.
Request body (application/json)
FieldTypeWhat it is
contact_idstring (uuid), or nullThe contact to send to. Send this or the address.
channel_idstring (uuid), or nullThe connection to send through (Integrations). Left out, the workspace's active connection of this kind is used; with more than one, this is required.
emailstring, up to 254 characters, or nullThe address to send to when you do not send contact_id. It must be a contact's address.
subjectrequiredstring, up to 200 characters—
bodyrequiredstring, up to 20000 charactersThe message, as plain text.
Answer (200): these fields
FieldTypeWhat it is
channelrequiredstringwhatsapp, sms or email.
statusrequiredstringsent, or queued when the channel takes it for later delivery. Delivery and reads arrive as webhooks.
contact_idrequiredstring (uuid)—
message_idstring, or nullThe channel's id for the message, when it gives one.
fee_inrrequirednumberWhat this message cost from your wallet (0 when your plan includes it). The channel's own charge is billed by the channel.
Errors
CodeWhen
401The token is missing, unknown or revoked, or its workspace was deleted.
402The workspace's plan does not include API access. The token is paused, not revoked: it works again as soon as the plan includes API access. The wallet cannot cover this message's fee, or the plan does not include this channel.
403The token does not have this endpoint's scope, it is a sandbox token, the workspace is suspended, or the request came from a network the workspace, or the token's IP allowlist, does not allow.
404The contact or the connection was not found.
409Not sent: Do-Not-Call, no consent, the customer turned off offers, the address is suppressed, quiet hours, or the connection is not active or not set up. detail says which.
422A field is missing or not in the form this endpoint takes. detail says which, and why.
428No Idempotency-Key header. Nothing was sent.
429This token has made more requests this minute than your plan allows. The Retry-After header says how many seconds to wait.
502The channel did not take the message. Nothing was charged.
POST /api/v1/messages/email with curl
curl -X POST "https://aicallstudio.com/api/v1/messages/email" \
  -H "Authorization: Bearer mtc_YOUR_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"contact_id":"YOUR_CONTACT_ID","subject":"Your receipt","body":"Thank you, we received your payment."}'

Send an SMS

POST/api/v1/messages/smsScope messages:send

Send the SMS connection's registered template to one person. A real message, billed per message.

Only the registered template goes (India's DLT rules), never free text. Do-Not-Call, consent and the quiet hours apply. It is written on the contact's timeline. Requires an Idempotency-Key header.

This sends a real message to a real customer, billed from your wallet for each one at your plan's price per message. Send an Idempotency-Key header: without one the request is refused (428) and nothing is sent.

Parameters
ParameterTypeWhat it is
Idempotency-Keyrequiredstring, up to 255 characters, in the headersAny unique text up to 255 characters, such as a UUID, chosen by you for this request. Sent again with the same body within 24 hours, the first answer comes back (with Idempotent-Replayed: true) and nothing is done twice. The same key with another body is refused with 422. Required here: without it the request is refused with 428 and nothing is sent.
Request body (application/json)
FieldTypeWhat it is
contact_idstring (uuid), or nullThe contact to send to. Send this or the address.
channel_idstring (uuid), or nullThe connection to send through (Integrations). Left out, the workspace's active connection of this kind is used; with more than one, this is required.
phonestring, up to 20 characters, or nullThe number to send to when you do not send contact_id. A new number is saved as a contact.
namestring, up to 255 characters, or nullThe person's name, for a new number.
templaterequiredstring, up to 200 charactersThe SMS connection's registered template, by its name or id. Only that template is sent, never free text (India's DLT rules).
valuesobjectThe template's variables by name.
Answer (200): these fields
FieldTypeWhat it is
channelrequiredstringwhatsapp, sms or email.
statusrequiredstringsent, or queued when the channel takes it for later delivery. Delivery and reads arrive as webhooks.
contact_idrequiredstring (uuid)—
message_idstring, or nullThe channel's id for the message, when it gives one.
fee_inrrequirednumberWhat this message cost from your wallet (0 when your plan includes it). The channel's own charge is billed by the channel.
Errors
CodeWhen
401The token is missing, unknown or revoked, or its workspace was deleted.
402The workspace's plan does not include API access. The token is paused, not revoked: it works again as soon as the plan includes API access. The wallet cannot cover this message's fee, or the plan does not include this channel.
403The token does not have this endpoint's scope, it is a sandbox token, the workspace is suspended, or the request came from a network the workspace, or the token's IP allowlist, does not allow.
404The contact or the connection was not found.
409Not sent: Do-Not-Call, no consent, the customer turned off offers, the address is suppressed, quiet hours, or the connection is not active or not set up. detail says which.
422A field is missing or not in the form this endpoint takes. detail says which, and why.
428No Idempotency-Key header. Nothing was sent.
429This token has made more requests this minute than your plan allows. The Retry-After header says how many seconds to wait.
502The channel did not take the message. Nothing was charged.
POST /api/v1/messages/sms with curl
curl -X POST "https://aicallstudio.com/api/v1/messages/sms" \
  -H "Authorization: Bearer mtc_YOUR_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"phone":"9876543210","name":"Asha Verma","template":"YOUR_TEMPLATE_NAME","values":{"amount":"12,500"}}'

Send a WhatsApp template

POST/api/v1/messages/whatsappScope messages:send

Send one approved WhatsApp template to one person. A real message, billed per message.

The same checks as the inbox: the template must be approved for the connection, a customer on Do-Not-Call or without consent is never messaged, one who turned off offers is not sent a marketing template, and nothing goes in the quiet hours. The message lands in the WhatsApp inbox and the contact's timeline (the inbox.message_sent webhook); delivered and read follow as the channel reports them. Requires an Idempotency-Key header.

This sends a real message to a real customer, billed from your wallet for each one at your plan's price per message. Send an Idempotency-Key header: without one the request is refused (428) and nothing is sent.

Parameters
ParameterTypeWhat it is
Idempotency-Keyrequiredstring, up to 255 characters, in the headersAny unique text up to 255 characters, such as a UUID, chosen by you for this request. Sent again with the same body within 24 hours, the first answer comes back (with Idempotent-Replayed: true) and nothing is done twice. The same key with another body is refused with 422. Required here: without it the request is refused with 428 and nothing is sent.
Request body (application/json)
FieldTypeWhat it is
contact_idstring (uuid), or nullThe contact to send to. Send this or the address.
channel_idstring (uuid), or nullThe connection to send through (Integrations). Left out, the workspace's active connection of this kind is used; with more than one, this is required.
phonestring, up to 20 characters, or nullThe number to send to when you do not send contact_id: 8 to 15 digits, optionally starting with +. A new number is saved as a contact (send name for it).
namestring, up to 255 characters, or nullThe person's name, for a new number.
templaterequiredstring, up to 200 charactersThe name of a WhatsApp template approved for this connection. Only approved templates are sent; free text is not, because the 24-hour window may be closed.
valuesobjectThe template's blanks by their number or name, such as {"1": "Asha", "2": "12,500"}. A blank left out is filled from the contact where it can be.
Answer (200): these fields
FieldTypeWhat it is
channelrequiredstringwhatsapp, sms or email.
statusrequiredstringsent, or queued when the channel takes it for later delivery. Delivery and reads arrive as webhooks.
contact_idrequiredstring (uuid)—
message_idstring, or nullThe channel's id for the message, when it gives one.
fee_inrrequirednumberWhat this message cost from your wallet (0 when your plan includes it). The channel's own charge is billed by the channel.
Errors
CodeWhen
401The token is missing, unknown or revoked, or its workspace was deleted.
402The workspace's plan does not include API access. The token is paused, not revoked: it works again as soon as the plan includes API access. The wallet cannot cover this message's fee, or the plan does not include this channel.
403The token does not have this endpoint's scope, it is a sandbox token, the workspace is suspended, or the request came from a network the workspace, or the token's IP allowlist, does not allow.
404The contact or the connection was not found.
409Not sent: Do-Not-Call, no consent, the customer turned off offers, the address is suppressed, quiet hours, or the connection is not active or not set up. detail says which.
422A field is missing or not in the form this endpoint takes. detail says which, and why.
428No Idempotency-Key header. Nothing was sent.
429This token has made more requests this minute than your plan allows. The Retry-After header says how many seconds to wait.
502The channel did not take the message. Nothing was charged.
POST /api/v1/messages/whatsapp with curl
curl -X POST "https://aicallstudio.com/api/v1/messages/whatsapp" \
  -H "Authorization: Bearer mtc_YOUR_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"contact_id":"YOUR_CONTACT_ID","template":"emi_reminder","values":{"1":"Asha","2":"12,500"}}'

Put AI Call Studio on your phone lines.

Book a 30-minute walkthrough, or call us right now: +91 922 222 1378