Skip to Content
API access is available to organizations with a signed BAA. Request API access →
API referenceSend messages to patients in a batch

Send messages to patients in a batch

POST/messages:batch

Sends up to 60 messages in one request. Each item is the body of a single send and is checked the same way: recipient, channel, phone number, and opt-out. The batch counts as one request toward the per-second and per-minute request limits, and each message counts toward the per-minute message limit. All of an organization’s API keys share these limits. One Idempotency-Key covers the whole batch: retry with the same key and the same body to get the same results without sending anything twice.

Scope
messages.write
Idempotent
With Idempotency-Key

Headers

Idempotency-KeyUUIDRequired

A UUID you generate for each write. Retrying with the same key returns the original result for 24 hours. Reusing a key with a different method, path, or body returns 409.

Body parameters

Messages to send in one request.

messagesarray of MessageSendRequired

Up to 60 messages, each the body of a single send.

Show child attributes
toRecipientRequired

Who to message. Provide exactly one of patient_id or phone.

Show child attributes
patient_idUUID

The patient to message.

phonestring

A mobile number. BloomText finds the patient with this number, or creates one.

patientPatientDetails

Details for a patient BloomText creates while sending. Ignored when the phone number matches an existing patient.

bodystringRequired

Message text: up to 1,600 characters for sms, or 40,000 for secure. A longer one returns 422 too_long.

channelsecure, smsRequired

Required; there’s no default. sms sends the text itself as a regular SMS from the clinic’s number. secure sends a text or email with a secure link, and the message stays in BloomText.

fromstring

The clinic phone number to send from, in E.164 format, like +15125550100. Defaults to the default number: the one set on the API key, or the admin’s own. See List phone numbers.

Any other field returns 422 unknown_field. See Unknown fields are rejected.

Returns

Returns 207 Multi-Status with one result per message, in the order you sent them: an id and status: queued, or an error with a problem details object. One message’s error never fails the others.

Errors

Failed requests return application/problem+json problem details. The errors specific to this endpoint:

StatusCodeMeaning
400invalid_requestThe request is malformed, such as invalid JSON.
401invalid_tokenThe API key or access token is missing or malformed, or the access token has expired or been revoked.
401key_revokedAn org admin revoked the API key.
401key_expiredThe API key’s expiry has passed.
403insufficient_scopeThe credential doesn’t have the scope this endpoint needs.
403plan_requiredThe organization’s plan doesn’t include patient messaging. The whole batch is refused and nothing is sent.
409idempotency_key_reusedThe Idempotency-Key was already used with a different request.
409idempotency_request_in_progressA request with this Idempotency-Key is still running. Retry shortly.
422validation_failedmessages is empty or holds more than 60 messages. Errors in individual messages come back in their results instead.
422unknown_fieldA message has a field the API doesn’t take. The whole batch is refused, naming the message (/messages/3/...), and nothing is sent.
429rate_limitedThe batch’s messages don’t fit in what’s left of the organization’s per-minute message limit. Nothing was sent; retry with the same Idempotency-Key after Retry-After.
429rate_limitedToo many requests. Retry after Retry-After seconds.
Last updated on