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.

Credentials
API key, or an OAuth access token
Scope
messages.write
Idempotent
With Idempotency-Key

Run in Postman: import the collection, set api_key, and find this request in its folder.

Query parameters

org_idUUID

The organization the call acts on, from List organizations. Required when an account API key reaches more than one organization; an organization key or a key limited to one organization can leave it out.

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 API key’s default number, else the organization’s only number; an organization with several numbers and no default answers 422 from_required. 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 a status (queued, or consent_requested when the message waits for the patient’s consent), 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.
400org_id_requiredThe key reaches more than one organization: pass org_id.
401invalid_tokenThe API key is missing or malformed, or isn’t a BloomText key.
401key_revokedThe API key was revoked.
401key_expiredThe API key’s expiry has passed.
403insufficient_scopeThe key doesn’t have the scope this endpoint needs.
403org_not_reachableThe key can’t reach the organization in org_id.
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