Skip to main content
POST
Send a message
  • Credential: an API key, or a trial key, which sends text only, from the trial’s line to the trial’s paired number: see Send with the trial key and With a trial key. See The send request.
  • Line-scoped keys: a line-scoped key gets 403 forbidden unless line_id is in its list.
  • Test keys: a send with an isnap_test_ account key reaches a real recipient and counts against the same sending limits: see Test keys.
  • Idempotency-Key: honored. The key belongs to the line, and a repeat returns the message already created, as it is now. The checks on the line, and on the trial with a trial key, run before the key is read: a refusal of a repeat does not mean that the first request was refused. See Retrying a send.
  • Events: message.queued, or message.scheduled for a held message, then the events of Following a message.
  • Personal data: the message carries the handles in to and from, the text in body, the attachment file names and your metadata. Request it only when needed, do not copy it into logs, tickets or other tools, and refer to a contact by an id of your own.
  • Quiet hours: ignore_quiet_hours: true lets the message leave during the quiet hours of the line. Use it for a recipient of your own, such as your own phone number: the API does not check the recipient. The sending limits, the spacing and the order per recipient still apply, and a shared line ignores it. See Sending during quiet hours.
  • Response: 202 means that iSnap accepted the message, never that it was sent. status is queued, or scheduled when iSnap holds the message: see The response and Held messages. queue_info is filled only in this response.
  • Headers: with an account API key, the 202 carries X-iSnap-Quota-Remaining and X-iSnap-Quota-Resets-At: see Headers on a send.
  • Rate limit: this operation and GET /v1/messages share the message-operations limit, 60 requests per rolling 60 seconds per network address, in addition to the request-rate limit: see Rate limits.

Errors

With a trial key

A send with a trial key can also return these refusals: The errors that every operation shares are in Errors.

Authorizations

Authorization
string
header
required

An API key created in the iSnap dashboard, or a trial key, sent as Authorization: Bearer <key>. An API key starts with isnap_live_ or isnap_test_; both act on the same account, lines and billing. A trial key acts on its trial only.

Body

application/json

The message to send. It needs a non-empty body or at least one attachment.

line_id
string
required

The line that sends the message: line_ followed by 25 letters or digits. It must be a line of your account whose status is active.

Pattern: ^line_[0-9A-Za-z]{25}$
to
string
required

Recipient phone number, 1 to 30 characters. E.164 is preferred; a number without a country code is read as a US number. iSnap normalizes it to E.164 and returns the normalized value in to of the message. An email address or an Apple ID returns 400 bad_request, even when POST /v1/lookup reports that it can receive iMessage. One request has one recipient: there is no group send.

Required string length: 1 - 30
body
string

Message text, at most 5,000 characters. Required unless attachments is not empty. With a trial key, iSnap appends the footer of the trial to the text, after a blank line: the body of the message returned and the message the recipient receives both carry it.

Maximum string length: 5000
channel
enum<string>
default:auto

Only auto is accepted, and it is the default: the line's device chooses the service.

Available options:
auto
attachments
string[]

Ordered list of at most 10 attachment ids (att_ followed by 25 letters or digits). On an iMessage line, the line's device sends only the first attachment and still reports the message sent: send one attachment per message. Create each attachment with POST /v1/attachments, upload the file, and wait until GET /v1/attachments/{id} shows status: ready: an attachment that is not ready when the line's device takes the message is left out of the message, without an error. An id that does not exist, that belongs to another account, or that names a file received on an inbound message returns 404 not_found. Do not repeat an id: a request that lists the same id twice returns 500 internal_error, and nothing is sent. A request with no body and exactly one attachment whose content type starts with audio/ is sent as a voice note, with kind: voice.

Maximum array length: 10

Attachment id: att_ followed by 25 letters or digits.

Pattern: ^att_[0-9A-Za-z]{25}$
effect
object

iMessage effect of the message: a bubble effect or a screen effect. iSnap passes it to the line's device and does not report whether the recipient saw it.

reply_to_message_id
string

Id of the message this message replies to (msg_ followed by 25 letters or digits): a message on the same line, received or sent. An id that does not exist returns 404 not_found, including the id of a message iSnap has deleted. A message on another line, of your account or of another account, returns 422 reply_to_cross_line.

Pattern: ^msg_[0-9A-Za-z]{25}$
use_typing_indicator
boolean

Whether the line's device shows the typing indicator to the recipient before it sends this message. When omitted, the line's default_use_typing_indicator applies, which is true unless you changed it. Always false on a line that is not an iMessage line. The response returns the value in effect.

ignore_quiet_hours
boolean

true to let this message leave during the quiet hours of the line: the hours whose weight is 0 in the line's activity_curve, counted in the recipient's local time. Use it for a recipient of your own, such as an alert to your own phone number. The default is false. The message still waits for the sending limits of the line, for the spacing between messages and behind an earlier message to the same recipient that iSnap holds. No effect on a shared line. The response returns the value in effect.

metadata
object

Your own keys and values for this message: at most 20 keys and 8,192 bytes once serialized as JSON, otherwise the API returns 400 validation_failed. iSnap stores the object as sent and returns it in metadata of the message, in every response and in the events of the message.

Example:

Response

The message, accepted as queued or scheduled. iSnap holds a message when a sending limit of the line is reached and quota_overflow_behavior of the line is queue, the default. A message is also held by the spacing between messages of the line, by quiet hours, and behind an earlier message to the same recipient that has not left. A 202 returned to an API key carries two headers: X-iSnap-Quota-Remaining, the number of new contacts the line can still message in the rolling 24 hours, and X-iSnap-Quota-Resets-At, the next midnight UTC. The limits are rolling, so that second header is not the time a full limit frees: read GET /v1/lines/{id}/quota.

success
enum<boolean>
required

Always true on a success response.

Available options:
true
data
object
required

A message sent or received by a line. The response of POST /v1/messages, the reads, the list items, the cancel response and the message field of the message.* events all carry this object. It has no chat id: the chat id is given by GET /v1/chats and by events. It carries personal data: the handles in to and from, the text in body, the file names of attachments, and what you put in metadata. Timestamps are ISO 8601 in UTC.

trace_id
string
required

Trace id of the request that produced this response: 32 lowercase hexadecimal characters. Quote it when you report a problem to iSnap.

request_id
string
required

Id of the request that produced this response: req_ followed by 25 letters or digits.